aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/can/sja1000
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-05-23 06:47:58 -0400
committerMarc Kleine-Budde <mkl@pengutronix.de>2013-06-03 07:13:49 -0400
commit00e4bbc8cd7efac66caa4ce6bcf5f02e944184f6 (patch)
tree57aac83b859b47d0bc4fb444b9b5a39800754b04 /drivers/net/can/sja1000
parent4c4726faed6cf0c7545ac6523de4cc66acd0a61d (diff)
net: can: use platform_{get,set}_drvdata()
Use the wrapper functions for getting and setting the driver data using platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev, so we can directly pass a struct platform_device. Also, unnecessary dev_set_drvdata() is removed, because the driver core clears the driver data to NULL after device_release or on probe failure. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/sja1000')
-rw-r--r--drivers/net/can/sja1000/sja1000_isa.c5
-rw-r--r--drivers/net/can/sja1000/sja1000_of_platform.c6
-rw-r--r--drivers/net/can/sja1000/sja1000_platform.c5
3 files changed, 6 insertions, 10 deletions
diff --git a/drivers/net/can/sja1000/sja1000_isa.c b/drivers/net/can/sja1000/sja1000_isa.c
index 5c8da4661489..06a282397fff 100644
--- a/drivers/net/can/sja1000/sja1000_isa.c
+++ b/drivers/net/can/sja1000/sja1000_isa.c
@@ -197,7 +197,7 @@ static int sja1000_isa_probe(struct platform_device *pdev)
197 else 197 else
198 priv->cdr = CDR_DEFAULT; 198 priv->cdr = CDR_DEFAULT;
199 199
200 dev_set_drvdata(&pdev->dev, dev); 200 platform_set_drvdata(pdev, dev);
201 SET_NETDEV_DEV(dev, &pdev->dev); 201 SET_NETDEV_DEV(dev, &pdev->dev);
202 202
203 err = register_sja1000dev(dev); 203 err = register_sja1000dev(dev);
@@ -225,12 +225,11 @@ static int sja1000_isa_probe(struct platform_device *pdev)
225 225
226static int sja1000_isa_remove(struct platform_device *pdev) 226static int sja1000_isa_remove(struct platform_device *pdev)
227{ 227{
228 struct net_device *dev = dev_get_drvdata(&pdev->dev); 228 struct net_device *dev = platform_get_drvdata(pdev);
229 struct sja1000_priv *priv = netdev_priv(dev); 229 struct sja1000_priv *priv = netdev_priv(dev);
230 int idx = pdev->id; 230 int idx = pdev->id;
231 231
232 unregister_sja1000dev(dev); 232 unregister_sja1000dev(dev);
233 dev_set_drvdata(&pdev->dev, NULL);
234 233
235 if (mem[idx]) { 234 if (mem[idx]) {
236 iounmap(priv->reg_base); 235 iounmap(priv->reg_base);
diff --git a/drivers/net/can/sja1000/sja1000_of_platform.c b/drivers/net/can/sja1000/sja1000_of_platform.c
index 8e0c4a001939..31ad33911167 100644
--- a/drivers/net/can/sja1000/sja1000_of_platform.c
+++ b/drivers/net/can/sja1000/sja1000_of_platform.c
@@ -72,13 +72,11 @@ static void sja1000_ofp_write_reg(const struct sja1000_priv *priv,
72 72
73static int sja1000_ofp_remove(struct platform_device *ofdev) 73static int sja1000_ofp_remove(struct platform_device *ofdev)
74{ 74{
75 struct net_device *dev = dev_get_drvdata(&ofdev->dev); 75 struct net_device *dev = platform_get_drvdata(ofdev);
76 struct sja1000_priv *priv = netdev_priv(dev); 76 struct sja1000_priv *priv = netdev_priv(dev);
77 struct device_node *np = ofdev->dev.of_node; 77 struct device_node *np = ofdev->dev.of_node;
78 struct resource res; 78 struct resource res;
79 79
80 dev_set_drvdata(&ofdev->dev, NULL);
81
82 unregister_sja1000dev(dev); 80 unregister_sja1000dev(dev);
83 free_sja1000dev(dev); 81 free_sja1000dev(dev);
84 iounmap(priv->reg_base); 82 iounmap(priv->reg_base);
@@ -181,7 +179,7 @@ static int sja1000_ofp_probe(struct platform_device *ofdev)
181 priv->reg_base, dev->irq, priv->can.clock.freq, 179 priv->reg_base, dev->irq, priv->can.clock.freq,
182 priv->ocr, priv->cdr); 180 priv->ocr, priv->cdr);
183 181
184 dev_set_drvdata(&ofdev->dev, dev); 182 platform_set_drvdata(ofdev, dev);
185 SET_NETDEV_DEV(dev, &ofdev->dev); 183 SET_NETDEV_DEV(dev, &ofdev->dev);
186 184
187 err = register_sja1000dev(dev); 185 err = register_sja1000dev(dev);
diff --git a/drivers/net/can/sja1000/sja1000_platform.c b/drivers/net/can/sja1000/sja1000_platform.c
index 21619bb5b869..8e259c541036 100644
--- a/drivers/net/can/sja1000/sja1000_platform.c
+++ b/drivers/net/can/sja1000/sja1000_platform.c
@@ -135,7 +135,7 @@ static int sp_probe(struct platform_device *pdev)
135 break; 135 break;
136 } 136 }
137 137
138 dev_set_drvdata(&pdev->dev, dev); 138 platform_set_drvdata(pdev, dev);
139 SET_NETDEV_DEV(dev, &pdev->dev); 139 SET_NETDEV_DEV(dev, &pdev->dev);
140 140
141 err = register_sja1000dev(dev); 141 err = register_sja1000dev(dev);
@@ -161,12 +161,11 @@ static int sp_probe(struct platform_device *pdev)
161 161
162static int sp_remove(struct platform_device *pdev) 162static int sp_remove(struct platform_device *pdev)
163{ 163{
164 struct net_device *dev = dev_get_drvdata(&pdev->dev); 164 struct net_device *dev = platform_get_drvdata(pdev);
165 struct sja1000_priv *priv = netdev_priv(dev); 165 struct sja1000_priv *priv = netdev_priv(dev);
166 struct resource *res; 166 struct resource *res;
167 167
168 unregister_sja1000dev(dev); 168 unregister_sja1000dev(dev);
169 dev_set_drvdata(&pdev->dev, NULL);
170 169
171 if (priv->reg_base) 170 if (priv->reg_base)
172 iounmap(priv->reg_base); 171 iounmap(priv->reg_base);