aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/net/claw.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2009-05-04 15:40:54 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-06-16 00:30:28 -0400
commitdff59b64af94dc588044d70f3708cb835055c5b6 (patch)
tree5d4069fa0ac280b637b8aa691e71ac3b58a508b5 /drivers/s390/net/claw.c
parent61616115d748e2eb76c43715383e602b09d9bf50 (diff)
s390: remove driver_data direct access of struct device
In the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions. Thanks to Sebastian Ott <sebott@linux.vnet.ibm.com> for fixing a few typos in my original version of this patch. Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Sebastian Ott <sebott@linux.vnet.ibm.com> Cc: linux-s390@vger.kernel.org Cc: linux390@de.ibm.com Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/s390/net/claw.c')
-rw-r--r--drivers/s390/net/claw.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c
index 7b6f46ddf3c3..1b34233cf6d5 100644
--- a/drivers/s390/net/claw.c
+++ b/drivers/s390/net/claw.c
@@ -284,7 +284,7 @@ claw_probe(struct ccwgroup_device *cgdev)
284 if (!get_device(&cgdev->dev)) 284 if (!get_device(&cgdev->dev))
285 return -ENODEV; 285 return -ENODEV;
286 privptr = kzalloc(sizeof(struct claw_privbk), GFP_KERNEL); 286 privptr = kzalloc(sizeof(struct claw_privbk), GFP_KERNEL);
287 cgdev->dev.driver_data = privptr; 287 dev_set_drvdata(&cgdev->dev, privptr);
288 if (privptr == NULL) { 288 if (privptr == NULL) {
289 probe_error(cgdev); 289 probe_error(cgdev);
290 put_device(&cgdev->dev); 290 put_device(&cgdev->dev);
@@ -591,14 +591,14 @@ claw_irq_handler(struct ccw_device *cdev,
591 591
592 CLAW_DBF_TEXT(4, trace, "clawirq"); 592 CLAW_DBF_TEXT(4, trace, "clawirq");
593 /* Bypass all 'unsolicited interrupts' */ 593 /* Bypass all 'unsolicited interrupts' */
594 if (!cdev->dev.driver_data) { 594 privptr = dev_get_drvdata(&cdev->dev);
595 if (!privptr) {
595 dev_warn(&cdev->dev, "An uninitialized CLAW device received an" 596 dev_warn(&cdev->dev, "An uninitialized CLAW device received an"
596 " IRQ, c-%02x d-%02x\n", 597 " IRQ, c-%02x d-%02x\n",
597 irb->scsw.cmd.cstat, irb->scsw.cmd.dstat); 598 irb->scsw.cmd.cstat, irb->scsw.cmd.dstat);
598 CLAW_DBF_TEXT(2, trace, "badirq"); 599 CLAW_DBF_TEXT(2, trace, "badirq");
599 return; 600 return;
600 } 601 }
601 privptr = (struct claw_privbk *)cdev->dev.driver_data;
602 602
603 /* Try to extract channel from driver data. */ 603 /* Try to extract channel from driver data. */
604 if (privptr->channel[READ].cdev == cdev) 604 if (privptr->channel[READ].cdev == cdev)
@@ -1980,9 +1980,9 @@ probe_error( struct ccwgroup_device *cgdev)
1980 struct claw_privbk *privptr; 1980 struct claw_privbk *privptr;
1981 1981
1982 CLAW_DBF_TEXT(4, trace, "proberr"); 1982 CLAW_DBF_TEXT(4, trace, "proberr");
1983 privptr = (struct claw_privbk *) cgdev->dev.driver_data; 1983 privptr = dev_get_drvdata(&cgdev->dev);
1984 if (privptr != NULL) { 1984 if (privptr != NULL) {
1985 cgdev->dev.driver_data = NULL; 1985 dev_set_drvdata(&cgdev->dev, NULL);
1986 kfree(privptr->p_env); 1986 kfree(privptr->p_env);
1987 kfree(privptr->p_mtc_envelope); 1987 kfree(privptr->p_mtc_envelope);
1988 kfree(privptr); 1988 kfree(privptr);
@@ -2911,9 +2911,9 @@ claw_new_device(struct ccwgroup_device *cgdev)
2911 dev_info(&cgdev->dev, "add for %s\n", 2911 dev_info(&cgdev->dev, "add for %s\n",
2912 dev_name(&cgdev->cdev[READ]->dev)); 2912 dev_name(&cgdev->cdev[READ]->dev));
2913 CLAW_DBF_TEXT(2, setup, "new_dev"); 2913 CLAW_DBF_TEXT(2, setup, "new_dev");
2914 privptr = cgdev->dev.driver_data; 2914 privptr = dev_get_drvdata(&cgdev->dev);
2915 cgdev->cdev[READ]->dev.driver_data = privptr; 2915 dev_set_drvdata(&cgdev->cdev[READ]->dev, privptr);
2916 cgdev->cdev[WRITE]->dev.driver_data = privptr; 2916 dev_set_drvdata(&cgdev->cdev[WRITE]->dev, privptr);
2917 if (!privptr) 2917 if (!privptr)
2918 return -ENODEV; 2918 return -ENODEV;
2919 p_env = privptr->p_env; 2919 p_env = privptr->p_env;
@@ -2950,9 +2950,9 @@ claw_new_device(struct ccwgroup_device *cgdev)
2950 goto out; 2950 goto out;
2951 } 2951 }
2952 dev->ml_priv = privptr; 2952 dev->ml_priv = privptr;
2953 cgdev->dev.driver_data = privptr; 2953 dev_set_drvdata(&cgdev->dev, privptr);
2954 cgdev->cdev[READ]->dev.driver_data = privptr; 2954 dev_set_drvdata(&cgdev->cdev[READ]->dev, privptr);
2955 cgdev->cdev[WRITE]->dev.driver_data = privptr; 2955 dev_set_drvdata(&cgdev->cdev[WRITE]->dev, privptr);
2956 /* sysfs magic */ 2956 /* sysfs magic */
2957 SET_NETDEV_DEV(dev, &cgdev->dev); 2957 SET_NETDEV_DEV(dev, &cgdev->dev);
2958 if (register_netdev(dev) != 0) { 2958 if (register_netdev(dev) != 0) {
@@ -3018,7 +3018,7 @@ claw_shutdown_device(struct ccwgroup_device *cgdev)
3018 int ret; 3018 int ret;
3019 3019
3020 CLAW_DBF_TEXT_(2, setup, "%s", dev_name(&cgdev->dev)); 3020 CLAW_DBF_TEXT_(2, setup, "%s", dev_name(&cgdev->dev));
3021 priv = cgdev->dev.driver_data; 3021 priv = dev_get_drvdata(&cgdev->dev);
3022 if (!priv) 3022 if (!priv)
3023 return -ENODEV; 3023 return -ENODEV;
3024 ndev = priv->channel[READ].ndev; 3024 ndev = priv->channel[READ].ndev;
@@ -3048,7 +3048,7 @@ claw_remove_device(struct ccwgroup_device *cgdev)
3048 3048
3049 BUG_ON(!cgdev); 3049 BUG_ON(!cgdev);
3050 CLAW_DBF_TEXT_(2, setup, "%s", dev_name(&cgdev->dev)); 3050 CLAW_DBF_TEXT_(2, setup, "%s", dev_name(&cgdev->dev));
3051 priv = cgdev->dev.driver_data; 3051 priv = dev_get_drvdata(&cgdev->dev);
3052 BUG_ON(!priv); 3052 BUG_ON(!priv);
3053 dev_info(&cgdev->dev, " will be removed.\n"); 3053 dev_info(&cgdev->dev, " will be removed.\n");
3054 if (cgdev->state == CCWGROUP_ONLINE) 3054 if (cgdev->state == CCWGROUP_ONLINE)
@@ -3063,9 +3063,9 @@ claw_remove_device(struct ccwgroup_device *cgdev)
3063 kfree(priv->channel[1].irb); 3063 kfree(priv->channel[1].irb);
3064 priv->channel[1].irb=NULL; 3064 priv->channel[1].irb=NULL;
3065 kfree(priv); 3065 kfree(priv);
3066 cgdev->dev.driver_data=NULL; 3066 dev_set_drvdata(&cgdev->dev, NULL);
3067 cgdev->cdev[READ]->dev.driver_data = NULL; 3067 dev_set_drvdata(&cgdev->cdev[READ]->dev, NULL);
3068 cgdev->cdev[WRITE]->dev.driver_data = NULL; 3068 dev_set_drvdata(&cgdev->cdev[WRITE]->dev, NULL);
3069 put_device(&cgdev->dev); 3069 put_device(&cgdev->dev);
3070 3070
3071 return; 3071 return;
@@ -3081,7 +3081,7 @@ claw_hname_show(struct device *dev, struct device_attribute *attr, char *buf)
3081 struct claw_privbk *priv; 3081 struct claw_privbk *priv;
3082 struct claw_env * p_env; 3082 struct claw_env * p_env;
3083 3083
3084 priv = dev->driver_data; 3084 priv = dev_get_drvdata(dev);
3085 if (!priv) 3085 if (!priv)
3086 return -ENODEV; 3086 return -ENODEV;
3087 p_env = priv->p_env; 3087 p_env = priv->p_env;
@@ -3095,7 +3095,7 @@ claw_hname_write(struct device *dev, struct device_attribute *attr,
3095 struct claw_privbk *priv; 3095 struct claw_privbk *priv;
3096 struct claw_env * p_env; 3096 struct claw_env * p_env;
3097 3097
3098 priv = dev->driver_data; 3098 priv = dev_get_drvdata(dev);
3099 if (!priv) 3099 if (!priv)
3100 return -ENODEV; 3100 return -ENODEV;
3101 p_env = priv->p_env; 3101 p_env = priv->p_env;
@@ -3119,7 +3119,7 @@ claw_adname_show(struct device *dev, struct device_attribute *attr, char *buf)
3119 struct claw_privbk *priv; 3119 struct claw_privbk *priv;
3120 struct claw_env * p_env; 3120 struct claw_env * p_env;
3121 3121
3122 priv = dev->driver_data; 3122 priv = dev_get_drvdata(dev);
3123 if (!priv) 3123 if (!priv)
3124 return -ENODEV; 3124 return -ENODEV;
3125 p_env = priv->p_env; 3125 p_env = priv->p_env;
@@ -3133,7 +3133,7 @@ claw_adname_write(struct device *dev, struct device_attribute *attr,
3133 struct claw_privbk *priv; 3133 struct claw_privbk *priv;
3134 struct claw_env * p_env; 3134 struct claw_env * p_env;
3135 3135
3136 priv = dev->driver_data; 3136 priv = dev_get_drvdata(dev);
3137 if (!priv) 3137 if (!priv)
3138 return -ENODEV; 3138 return -ENODEV;
3139 p_env = priv->p_env; 3139 p_env = priv->p_env;
@@ -3157,7 +3157,7 @@ claw_apname_show(struct device *dev, struct device_attribute *attr, char *buf)
3157 struct claw_privbk *priv; 3157 struct claw_privbk *priv;
3158 struct claw_env * p_env; 3158 struct claw_env * p_env;
3159 3159
3160 priv = dev->driver_data; 3160 priv = dev_get_drvdata(dev);
3161 if (!priv) 3161 if (!priv)
3162 return -ENODEV; 3162 return -ENODEV;
3163 p_env = priv->p_env; 3163 p_env = priv->p_env;
@@ -3172,7 +3172,7 @@ claw_apname_write(struct device *dev, struct device_attribute *attr,
3172 struct claw_privbk *priv; 3172 struct claw_privbk *priv;
3173 struct claw_env * p_env; 3173 struct claw_env * p_env;
3174 3174
3175 priv = dev->driver_data; 3175 priv = dev_get_drvdata(dev);
3176 if (!priv) 3176 if (!priv)
3177 return -ENODEV; 3177 return -ENODEV;
3178 p_env = priv->p_env; 3178 p_env = priv->p_env;
@@ -3206,7 +3206,7 @@ claw_wbuff_show(struct device *dev, struct device_attribute *attr, char *buf)
3206 struct claw_privbk *priv; 3206 struct claw_privbk *priv;
3207 struct claw_env * p_env; 3207 struct claw_env * p_env;
3208 3208
3209 priv = dev->driver_data; 3209 priv = dev_get_drvdata(dev);
3210 if (!priv) 3210 if (!priv)
3211 return -ENODEV; 3211 return -ENODEV;
3212 p_env = priv->p_env; 3212 p_env = priv->p_env;
@@ -3221,7 +3221,7 @@ claw_wbuff_write(struct device *dev, struct device_attribute *attr,
3221 struct claw_env * p_env; 3221 struct claw_env * p_env;
3222 int nnn,max; 3222 int nnn,max;
3223 3223
3224 priv = dev->driver_data; 3224 priv = dev_get_drvdata(dev);
3225 if (!priv) 3225 if (!priv)
3226 return -ENODEV; 3226 return -ENODEV;
3227 p_env = priv->p_env; 3227 p_env = priv->p_env;
@@ -3248,7 +3248,7 @@ claw_rbuff_show(struct device *dev, struct device_attribute *attr, char *buf)
3248 struct claw_privbk *priv; 3248 struct claw_privbk *priv;
3249 struct claw_env * p_env; 3249 struct claw_env * p_env;
3250 3250
3251 priv = dev->driver_data; 3251 priv = dev_get_drvdata(dev);
3252 if (!priv) 3252 if (!priv)
3253 return -ENODEV; 3253 return -ENODEV;
3254 p_env = priv->p_env; 3254 p_env = priv->p_env;
@@ -3263,7 +3263,7 @@ claw_rbuff_write(struct device *dev, struct device_attribute *attr,
3263 struct claw_env *p_env; 3263 struct claw_env *p_env;
3264 int nnn,max; 3264 int nnn,max;
3265 3265
3266 priv = dev->driver_data; 3266 priv = dev_get_drvdata(dev);
3267 if (!priv) 3267 if (!priv)
3268 return -ENODEV; 3268 return -ENODEV;
3269 p_env = priv->p_env; 3269 p_env = priv->p_env;