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>
This commit is contained in:
@@ -92,7 +92,7 @@ tape_medium_state_show(struct device *dev, struct device_attribute *attr, char *
|
||||
{
|
||||
struct tape_device *tdev;
|
||||
|
||||
tdev = (struct tape_device *) dev->driver_data;
|
||||
tdev = dev_get_drvdata(dev);
|
||||
return scnprintf(buf, PAGE_SIZE, "%i\n", tdev->medium_state);
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ tape_first_minor_show(struct device *dev, struct device_attribute *attr, char *b
|
||||
{
|
||||
struct tape_device *tdev;
|
||||
|
||||
tdev = (struct tape_device *) dev->driver_data;
|
||||
tdev = dev_get_drvdata(dev);
|
||||
return scnprintf(buf, PAGE_SIZE, "%i\n", tdev->first_minor);
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ tape_state_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct tape_device *tdev;
|
||||
|
||||
tdev = (struct tape_device *) dev->driver_data;
|
||||
tdev = dev_get_drvdata(dev);
|
||||
return scnprintf(buf, PAGE_SIZE, "%s\n", (tdev->first_minor < 0) ?
|
||||
"OFFLINE" : tape_state_verbose[tdev->tape_state]);
|
||||
}
|
||||
@@ -130,7 +130,7 @@ tape_operation_show(struct device *dev, struct device_attribute *attr, char *buf
|
||||
struct tape_device *tdev;
|
||||
ssize_t rc;
|
||||
|
||||
tdev = (struct tape_device *) dev->driver_data;
|
||||
tdev = dev_get_drvdata(dev);
|
||||
if (tdev->first_minor < 0)
|
||||
return scnprintf(buf, PAGE_SIZE, "N/A\n");
|
||||
|
||||
@@ -156,7 +156,7 @@ tape_blocksize_show(struct device *dev, struct device_attribute *attr, char *buf
|
||||
{
|
||||
struct tape_device *tdev;
|
||||
|
||||
tdev = (struct tape_device *) dev->driver_data;
|
||||
tdev = dev_get_drvdata(dev);
|
||||
|
||||
return scnprintf(buf, PAGE_SIZE, "%i\n", tdev->char_data.block_size);
|
||||
}
|
||||
@@ -391,7 +391,7 @@ tape_generic_offline(struct ccw_device *cdev)
|
||||
{
|
||||
struct tape_device *device;
|
||||
|
||||
device = cdev->dev.driver_data;
|
||||
device = dev_get_drvdata(&cdev->dev);
|
||||
if (!device) {
|
||||
return -ENODEV;
|
||||
}
|
||||
@@ -534,7 +534,7 @@ tape_generic_probe(struct ccw_device *cdev)
|
||||
tape_put_device(device);
|
||||
return ret;
|
||||
}
|
||||
cdev->dev.driver_data = device;
|
||||
dev_set_drvdata(&cdev->dev, device);
|
||||
cdev->handler = __tape_do_irq;
|
||||
device->cdev = cdev;
|
||||
ccw_device_get_id(cdev, &dev_id);
|
||||
@@ -573,7 +573,7 @@ tape_generic_remove(struct ccw_device *cdev)
|
||||
{
|
||||
struct tape_device * device;
|
||||
|
||||
device = cdev->dev.driver_data;
|
||||
device = dev_get_drvdata(&cdev->dev);
|
||||
if (!device) {
|
||||
return;
|
||||
}
|
||||
@@ -613,9 +613,9 @@ tape_generic_remove(struct ccw_device *cdev)
|
||||
tape_cleanup_device(device);
|
||||
}
|
||||
|
||||
if (cdev->dev.driver_data != NULL) {
|
||||
if (!dev_get_drvdata(&cdev->dev)) {
|
||||
sysfs_remove_group(&cdev->dev.kobj, &tape_attr_group);
|
||||
cdev->dev.driver_data = tape_put_device(cdev->dev.driver_data);
|
||||
dev_set_drvdata(&cdev->dev, tape_put_device(dev_get_drvdata(&cdev->dev)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1011,7 +1011,7 @@ __tape_do_irq (struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
|
||||
struct tape_request *request;
|
||||
int rc;
|
||||
|
||||
device = (struct tape_device *) cdev->dev.driver_data;
|
||||
device = dev_get_drvdata(&cdev->dev);
|
||||
if (device == NULL) {
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user