diff options
author | Alexander Shiyan <shc_work@mail.ru> | 2013-06-29 00:27:50 -0400 |
---|---|---|
committer | Shawn Guo <shawn.guo@linaro.org> | 2013-08-16 00:59:43 -0400 |
commit | 70ac98da780f7085d8c5f0e89bd0438a7f286d20 (patch) | |
tree | 114e189aecface04c16dc3807ec5e6216fc08db5 /drivers/bus/imx-weim.c | |
parent | 5ae90d8e467e625e447000cb4335c4db973b1095 (diff) |
drivers: bus: imx-weim: Remove private driver data
Driver uses only probe function so no reason to keep variables
in private driver data.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Diffstat (limited to 'drivers/bus/imx-weim.c')
-rw-r--r-- | drivers/bus/imx-weim.c | 41 |
1 files changed, 14 insertions, 27 deletions
diff --git a/drivers/bus/imx-weim.c b/drivers/bus/imx-weim.c index 349f14e886b7..0c0e6fea129f 100644 --- a/drivers/bus/imx-weim.c +++ b/drivers/bus/imx-weim.c | |||
@@ -12,11 +12,6 @@ | |||
12 | #include <linux/io.h> | 12 | #include <linux/io.h> |
13 | #include <linux/of_device.h> | 13 | #include <linux/of_device.h> |
14 | 14 | ||
15 | struct imx_weim { | ||
16 | void __iomem *base; | ||
17 | struct clk *clk; | ||
18 | }; | ||
19 | |||
20 | static const struct of_device_id weim_id_table[] = { | 15 | static const struct of_device_id weim_id_table[] = { |
21 | { .compatible = "fsl,imx6q-weim", }, | 16 | { .compatible = "fsl,imx6q-weim", }, |
22 | {} | 17 | {} |
@@ -27,10 +22,8 @@ MODULE_DEVICE_TABLE(of, weim_id_table); | |||
27 | #define CS_REG_RANGE 0x18 | 22 | #define CS_REG_RANGE 0x18 |
28 | 23 | ||
29 | /* Parse and set the timing for this device. */ | 24 | /* Parse and set the timing for this device. */ |
30 | static int | 25 | static int weim_timing_setup(struct device_node *np, void __iomem *base) |
31 | weim_timing_setup(struct platform_device *pdev, struct device_node *np) | ||
32 | { | 26 | { |
33 | struct imx_weim *weim = platform_get_drvdata(pdev); | ||
34 | u32 value[CS_TIMING_LEN]; | 27 | u32 value[CS_TIMING_LEN]; |
35 | u32 cs_idx; | 28 | u32 cs_idx; |
36 | int ret; | 29 | int ret; |
@@ -52,11 +45,11 @@ weim_timing_setup(struct platform_device *pdev, struct device_node *np) | |||
52 | 45 | ||
53 | /* set the timing for WEIM */ | 46 | /* set the timing for WEIM */ |
54 | for (i = 0; i < CS_TIMING_LEN; i++) | 47 | for (i = 0; i < CS_TIMING_LEN; i++) |
55 | writel(value[i], weim->base + cs_idx * CS_REG_RANGE + i * 4); | 48 | writel(value[i], base + cs_idx * CS_REG_RANGE + i * 4); |
56 | return 0; | 49 | return 0; |
57 | } | 50 | } |
58 | 51 | ||
59 | static int weim_parse_dt(struct platform_device *pdev) | 52 | static int weim_parse_dt(struct platform_device *pdev, void __iomem *base) |
60 | { | 53 | { |
61 | struct device_node *child; | 54 | struct device_node *child; |
62 | int ret; | 55 | int ret; |
@@ -65,7 +58,7 @@ static int weim_parse_dt(struct platform_device *pdev) | |||
65 | if (!child->name) | 58 | if (!child->name) |
66 | continue; | 59 | continue; |
67 | 60 | ||
68 | ret = weim_timing_setup(pdev, child); | 61 | ret = weim_timing_setup(child, base); |
69 | if (ret) { | 62 | if (ret) { |
70 | dev_err(&pdev->dev, "%s set timing failed.\n", | 63 | dev_err(&pdev->dev, "%s set timing failed.\n", |
71 | child->full_name); | 64 | child->full_name); |
@@ -82,38 +75,32 @@ static int weim_parse_dt(struct platform_device *pdev) | |||
82 | 75 | ||
83 | static int weim_probe(struct platform_device *pdev) | 76 | static int weim_probe(struct platform_device *pdev) |
84 | { | 77 | { |
85 | struct imx_weim *weim; | ||
86 | struct resource *res; | 78 | struct resource *res; |
79 | struct clk *clk; | ||
80 | void __iomem *base; | ||
87 | int ret = -EINVAL; | 81 | int ret = -EINVAL; |
88 | 82 | ||
89 | weim = devm_kzalloc(&pdev->dev, sizeof(*weim), GFP_KERNEL); | ||
90 | if (!weim) { | ||
91 | ret = -ENOMEM; | ||
92 | goto weim_err; | ||
93 | } | ||
94 | platform_set_drvdata(pdev, weim); | ||
95 | |||
96 | /* get the resource */ | 83 | /* get the resource */ |
97 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 84 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
98 | weim->base = devm_ioremap_resource(&pdev->dev, res); | 85 | base = devm_ioremap_resource(&pdev->dev, res); |
99 | if (IS_ERR(weim->base)) { | 86 | if (IS_ERR(base)) { |
100 | ret = PTR_ERR(weim->base); | 87 | ret = PTR_ERR(base); |
101 | goto weim_err; | 88 | goto weim_err; |
102 | } | 89 | } |
103 | 90 | ||
104 | /* get the clock */ | 91 | /* get the clock */ |
105 | weim->clk = devm_clk_get(&pdev->dev, NULL); | 92 | clk = devm_clk_get(&pdev->dev, NULL); |
106 | if (IS_ERR(weim->clk)) | 93 | if (IS_ERR(clk)) |
107 | goto weim_err; | 94 | goto weim_err; |
108 | 95 | ||
109 | ret = clk_prepare_enable(weim->clk); | 96 | ret = clk_prepare_enable(clk); |
110 | if (ret) | 97 | if (ret) |
111 | goto weim_err; | 98 | goto weim_err; |
112 | 99 | ||
113 | /* parse the device node */ | 100 | /* parse the device node */ |
114 | ret = weim_parse_dt(pdev); | 101 | ret = weim_parse_dt(pdev, base); |
115 | if (ret) { | 102 | if (ret) { |
116 | clk_disable_unprepare(weim->clk); | 103 | clk_disable_unprepare(clk); |
117 | goto weim_err; | 104 | goto weim_err; |
118 | } | 105 | } |
119 | 106 | ||