lkml.org 
[lkml]   [2004]   [Jun]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 17/19] serio use bus' default driver/device attributes
Date

===================================================================

ChangeSet@1.1791, 2004-06-27 19:39:04-05:00, dtor_core@ameritech.net
Input: Switch to use bus' default device and driver attributes to
manage serio sysfs attributes

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>


serio.c | 23 +++++++++++++++--------
1 files changed, 15 insertions(+), 8 deletions(-)

===================================================================


diff -Nru a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
--- a/drivers/input/serio/serio.c 2004-06-27 21:23:42 -05:00
+++ b/drivers/input/serio/serio.c 2004-06-27 21:23:42 -05:00
@@ -245,14 +245,12 @@
struct serio *serio = to_serio_port(dev);
return sprintf(buf, "%s\n", serio->name);
}
-static DEVICE_ATTR(description, S_IRUGO, serio_show_description, NULL);

static ssize_t serio_show_legacy_position(struct device *dev, char *buf)
{
struct serio *serio = to_serio_port(dev);
return sprintf(buf, "%s\n", serio->phys);
}
-static DEVICE_ATTR(legacy_position, S_IRUGO, serio_show_legacy_position, NULL);

static ssize_t serio_show_driver(struct device *dev, char *buf)
{
@@ -290,7 +288,14 @@

return retval;
}
-static DEVICE_ATTR(driver, S_IWUSR | S_IRUGO, serio_show_driver, serio_rebind_driver);
+
+static struct device_attribute serio_device_attrs[] = {
+ __ATTR(description, S_IRUGO, serio_show_description, NULL),
+ __ATTR(legacy_position, S_IRUGO, serio_show_legacy_position, NULL),
+ __ATTR(driver, S_IWUSR | S_IRUGO, serio_show_driver, serio_rebind_driver),
+ __ATTR_NULL
+};
+

static void serio_release_port(struct device *dev)
{
@@ -312,9 +317,6 @@
if (serio->parent)
serio->dev.parent = &serio->parent->dev;
device_register(&serio->dev);
- device_create_file(&serio->dev, &dev_attr_description);
- device_create_file(&serio->dev, &dev_attr_legacy_position);
- device_create_file(&serio->dev, &dev_attr_driver);
}

/*
@@ -489,7 +491,11 @@
struct serio_driver *driver = to_serio_driver(drv);
return sprintf(buf, "%s\n", driver->description ? driver->description : "(none)");
}
-static DRIVER_ATTR(description, S_IRUGO, serio_driver_show_description, NULL);
+
+static struct driver_attribute serio_driver_attrs[] = {
+ __ATTR(description, S_IRUGO, serio_driver_show_description, NULL),
+ __ATTR_NULL
+};

void serio_register_driver(struct serio_driver *drv)
{
@@ -501,7 +507,6 @@

drv->driver.bus = &serio_bus;
driver_register(&drv->driver);
- driver_create_file(&drv->driver, &driver_attr_description);

if (drv->manual_bind)
goto out;
@@ -607,6 +612,8 @@
return -1;
}

+ serio_bus.dev_attrs = serio_device_attrs;
+ serio_bus.drv_attrs = serio_driver_attrs;
bus_register(&serio_bus);

return 0;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:04    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site