On Thu, Feb 16, 2017 at 04:05:19AM +0200, Andy Shevchenko wrote:
On Thu, Feb 16, 2017 at 2:56 AM, Stephen Boyd sboyd@codeaurora.org wrote:
and then freeing that lookup with clkdev_drop in the remove of the driver. "mclk" is really generic for a connection name without an associated device id, so you may want to pass some device as the last argument here, but dev_name(&pdev->dev) seems odd because that's the clock controller device, not whatever device would be calling clk_get() with this created lookup in mind.
Here is the problem with CLK framework since it's (was?) too oriented to ARM and clock trees.
That's not really much more of a problem for x86 than it is for ARM, things got easier for ARM with the introduction of device tree but this stuff all predates device tree.
The best option for x86 is to place it in some platform code, which is bad idea per se. For example, GPIO, PWM, etc have static look up tables and glue drivers (like PCI part of the driver, or I2C, or similar) can fill that table based on ID.
Platform code seems fine?
My personal opinion that the best place is not the clock driver for that, rather converting existing drivers to take clock name based on some (platform related) ID.
That doesn't scale so well, you end up needing the platform code anyway and it's one more thing to go wrong when configuring the platform code so you may as well just do something idiomatic with the platform code. Some systems did historically do things like this, that's where the use of the device pointer for namespacing came from.