[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m1occ0894p.fsf@fess.ebiederm.org>
Date: Tue, 14 Sep 2010 11:36:54 -0700
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Greg Kroah-Hartman <gregkh@...e.de>
Cc: "Hans J. Koch" <hjk@...utronix.de>, <linux-kernel@...r.kernel.org>
Subject: [PATCH 2/5] 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: Eric W. Biederman <ebiederm@...stanetworks.com>
---
drivers/uio/uio.c | 17 +++--------------
1 files changed, 3 insertions(+), 14 deletions(-)
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index bc774cc..8132288 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -229,10 +229,7 @@ static ssize_t show_name(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct uio_device *idev = dev_get_drvdata(dev);
- if (idev)
- return sprintf(buf, "%s\n", idev->info->name);
- else
- return -ENODEV;
+ return sprintf(buf, "%s\n", idev->info->name);
}
static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
@@ -240,10 +237,7 @@ static ssize_t show_version(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct uio_device *idev = dev_get_drvdata(dev);
- if (idev)
- return sprintf(buf, "%s\n", idev->info->version);
- else
- return -ENODEV;
+ return sprintf(buf, "%s\n", idev->info->version);
}
static DEVICE_ATTR(version, S_IRUGO, show_version, NULL);
@@ -251,11 +245,7 @@ static ssize_t show_event(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct uio_device *idev = dev_get_drvdata(dev);
- if (idev)
- return sprintf(buf, "%u\n",
- (unsigned int)atomic_read(&idev->event));
- else
- return -ENODEV;
+ return sprintf(buf, "%u\n", (unsigned int)atomic_read(&idev->event));
}
static DEVICE_ATTR(event, S_IRUGO, show_event, NULL);
@@ -878,7 +868,6 @@ void uio_unregister_device(struct uio_info *info)
uio_dev_del_attributes(idev);
- dev_set_drvdata(idev->dev, NULL);
device_destroy(uio_class, MKDEV(uio_major, idev->minor));
kfree(idev);
--
1.7.2.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists