summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzk@kernel.org>2020-08-06 20:20:23 +0200
committerKrzysztof Kozlowski <krzk@kernel.org>2020-08-19 20:58:10 +0200
commitb84e23f5135103c45022b0e4a4ed2459d5398a7e (patch)
treeb41da5da053dc35944de8fec10c83468cbb13aa9 /drivers
parentARM: s3c24xx: make S3C24XX_MISCCR access indirect (diff)
downloadlinux-b84e23f5135103c45022b0e4a4ed2459d5398a7e.tar.xz
linux-b84e23f5135103c45022b0e4a4ed2459d5398a7e.zip
ARM: s3c24xx: pass pointer to clk driver via platform data
Passing pointers directly as platform data is fragile and undocumented. Better to create a platform data structure which explicitly documents what is passed to the driver. Suggested-by: Tomasz Figa <tomasz.figa@gmail.com> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Stephen Boyd <sboyd@kernel.org> Link: https://lore.kernel.org/r/20200806182059.2431-6-krzk@kernel.org
Diffstat (limited to 'drivers')
-rw-r--r--drivers/clk/samsung/clk-s3c2410-dclk.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/clk/samsung/clk-s3c2410-dclk.c b/drivers/clk/samsung/clk-s3c2410-dclk.c
index 3e0f23e8ec21..f5e0a6ba2d12 100644
--- a/drivers/clk/samsung/clk-s3c2410-dclk.c
+++ b/drivers/clk/samsung/clk-s3c2410-dclk.c
@@ -11,6 +11,7 @@
#include <linux/clk-provider.h>
#include <linux/io.h>
#include <linux/platform_device.h>
+#include <linux/platform_data/clk-s3c2410.h>
#include <linux/module.h>
#include "clk.h"
@@ -89,10 +90,14 @@ static struct clk_hw *s3c24xx_register_clkout(struct device *dev,
const char *name, const char **parent_names, u8 num_parents,
u8 shift, u32 mask)
{
+ struct s3c2410_clk_platform_data *pdata = dev_get_platdata(dev);
struct s3c24xx_clkout *clkout;
struct clk_init_data init;
int ret;
+ if (!pdata)
+ return ERR_PTR(-EINVAL);
+
/* allocate the clkout */
clkout = kzalloc(sizeof(*clkout), GFP_KERNEL);
if (!clkout)
@@ -107,7 +112,7 @@ static struct clk_hw *s3c24xx_register_clkout(struct device *dev,
clkout->shift = shift;
clkout->mask = mask;
clkout->hw.init = &init;
- clkout->modify_misccr = dev->platform_data;
+ clkout->modify_misccr = pdata->modify_misccr;
ret = clk_hw_register(dev, &clkout->hw);
if (ret)