Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: raspberrypi: register platform device for raspberrypi-cpufreq

As 'clk-raspberrypi' depends on RPi's firmware interface, which might be
configured as a module, the cpu clock might not be available for the
cpufreq driver during it's init process. So we register the
'raspberrypi-cpufreq' platform device after the probe sequence succeeds.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by

Nicolas Saenz Julienne and committed by
Stephen Boyd
e2bb1834 91f2cf4a

+15
+15
drivers/clk/bcm/clk-raspberrypi.c
··· 34 34 struct raspberrypi_clk { 35 35 struct device *dev; 36 36 struct rpi_firmware *firmware; 37 + struct platform_device *cpufreq; 37 38 38 39 unsigned long min_rate; 39 40 unsigned long max_rate; ··· 273 272 274 273 rpi->dev = dev; 275 274 rpi->firmware = firmware; 275 + platform_set_drvdata(pdev, rpi); 276 276 277 277 ret = raspberrypi_register_pllb(rpi); 278 278 if (ret) { ··· 285 283 if (ret) 286 284 return ret; 287 285 286 + rpi->cpufreq = platform_device_register_data(dev, "raspberrypi-cpufreq", 287 + -1, NULL, 0); 288 + 289 + return 0; 290 + } 291 + 292 + static int raspberrypi_clk_remove(struct platform_device *pdev) 293 + { 294 + struct raspberrypi_clk *rpi = platform_get_drvdata(pdev); 295 + 296 + platform_device_unregister(rpi->cpufreq); 297 + 288 298 return 0; 289 299 } 290 300 ··· 305 291 .name = "raspberrypi-clk", 306 292 }, 307 293 .probe = raspberrypi_clk_probe, 294 + .remove = raspberrypi_clk_remove, 308 295 }; 309 296 module_platform_driver(raspberrypi_clk_driver); 310 297