Commit e07d4e61 authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Greg Kroah-Hartman

[PATCH] Driver core: add driver symlink to device

Driver core: when binding device to a driver create "driver"
             symlink in device's directory. Rename serio's
             "driver" attribute to "drvctl" (write-only)
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent a6391b5b
...@@ -246,6 +246,7 @@ void device_bind_driver(struct device * dev) ...@@ -246,6 +246,7 @@ void device_bind_driver(struct device * dev)
list_add_tail(&dev->driver_list, &dev->driver->devices); list_add_tail(&dev->driver_list, &dev->driver->devices);
sysfs_create_link(&dev->driver->kobj, &dev->kobj, sysfs_create_link(&dev->driver->kobj, &dev->kobj,
kobject_name(&dev->kobj)); kobject_name(&dev->kobj));
sysfs_create_link(&dev->kobj, &dev->driver->kobj, "driver");
} }
...@@ -370,6 +371,7 @@ void device_release_driver(struct device * dev) ...@@ -370,6 +371,7 @@ void device_release_driver(struct device * dev)
struct device_driver * drv = dev->driver; struct device_driver * drv = dev->driver;
if (drv) { if (drv) {
sysfs_remove_link(&drv->kobj, kobject_name(&dev->kobj)); sysfs_remove_link(&drv->kobj, kobject_name(&dev->kobj));
sysfs_remove_link(&dev->kobj, "driver");
list_del_init(&dev->driver_list); list_del_init(&dev->driver_list);
device_detach_shutdown(dev); device_detach_shutdown(dev);
if (drv->remove) if (drv->remove)
......
...@@ -246,11 +246,6 @@ static ssize_t serio_show_description(struct device *dev, char *buf) ...@@ -246,11 +246,6 @@ static ssize_t serio_show_description(struct device *dev, char *buf)
return sprintf(buf, "%s\n", serio->name); return sprintf(buf, "%s\n", serio->name);
} }
static ssize_t serio_show_driver(struct device *dev, char *buf)
{
return sprintf(buf, "%s\n", dev->driver ? dev->driver->name : "(none)");
}
static ssize_t serio_rebind_driver(struct device *dev, const char *buf, size_t count) static ssize_t serio_rebind_driver(struct device *dev, const char *buf, size_t count)
{ {
struct serio *serio = to_serio_port(dev); struct serio *serio = to_serio_port(dev);
...@@ -307,7 +302,7 @@ static ssize_t serio_set_bind_mode(struct device *dev, const char *buf, size_t c ...@@ -307,7 +302,7 @@ static ssize_t serio_set_bind_mode(struct device *dev, const char *buf, size_t c
static struct device_attribute serio_device_attrs[] = { static struct device_attribute serio_device_attrs[] = {
__ATTR(description, S_IRUGO, serio_show_description, NULL), __ATTR(description, S_IRUGO, serio_show_description, NULL),
__ATTR(driver, S_IWUSR | S_IRUGO, serio_show_driver, serio_rebind_driver), __ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver),
__ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode), __ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode),
__ATTR_NULL __ATTR_NULL
}; };
......
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