Commit 70a9156b authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Greg Kroah-Hartman

uio: Don't clear driver data

Currently uio sets it's driver data to NULL just as it is unregistering
attributes.  sysfs maks the guaranatee that it will not call attributes
after device_destroy is called so this is unncessary and leads to lots
of unnecessary code in uio.c
Signed-off-by: default avatarEric W. Biederman <ebiederm@aristanetworks.com>
Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarHans J. Koch <hjk@linutronix.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 3d4f9d76
...@@ -229,10 +229,7 @@ static ssize_t show_name(struct device *dev, ...@@ -229,10 +229,7 @@ static ssize_t show_name(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct uio_device *idev = dev_get_drvdata(dev); struct uio_device *idev = dev_get_drvdata(dev);
if (idev)
return sprintf(buf, "%s\n", idev->info->name); return sprintf(buf, "%s\n", idev->info->name);
else
return -ENODEV;
} }
static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
...@@ -240,10 +237,7 @@ static ssize_t show_version(struct device *dev, ...@@ -240,10 +237,7 @@ static ssize_t show_version(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct uio_device *idev = dev_get_drvdata(dev); struct uio_device *idev = dev_get_drvdata(dev);
if (idev)
return sprintf(buf, "%s\n", idev->info->version); return sprintf(buf, "%s\n", idev->info->version);
else
return -ENODEV;
} }
static DEVICE_ATTR(version, S_IRUGO, show_version, NULL); static DEVICE_ATTR(version, S_IRUGO, show_version, NULL);
...@@ -251,11 +245,7 @@ static ssize_t show_event(struct device *dev, ...@@ -251,11 +245,7 @@ static ssize_t show_event(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct uio_device *idev = dev_get_drvdata(dev); struct uio_device *idev = dev_get_drvdata(dev);
if (idev) return sprintf(buf, "%u\n", (unsigned int)atomic_read(&idev->event));
return sprintf(buf, "%u\n",
(unsigned int)atomic_read(&idev->event));
else
return -ENODEV;
} }
static DEVICE_ATTR(event, S_IRUGO, show_event, NULL); static DEVICE_ATTR(event, S_IRUGO, show_event, NULL);
...@@ -878,7 +868,6 @@ void uio_unregister_device(struct uio_info *info) ...@@ -878,7 +868,6 @@ void uio_unregister_device(struct uio_info *info)
uio_dev_del_attributes(idev); uio_dev_del_attributes(idev);
dev_set_drvdata(idev->dev, NULL);
device_destroy(uio_class, MKDEV(uio_major, idev->minor)); device_destroy(uio_class, MKDEV(uio_major, idev->minor));
kfree(idev); kfree(idev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment