Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 16214
b: refs/heads/master
c: 874c624
h: refs/heads/master
v: v3
  • Loading branch information
Greg Kroah-Hartman committed Jan 5, 2006
1 parent 75f43dc commit 04d941f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a96b204208443ab7e23c681f7ddabe807a741d0c
refs/heads/master: 874c6241b2e49e52680d32a50d4909c7768d5cb9
26 changes: 22 additions & 4 deletions trunk/drivers/base/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,26 @@ static void driver_remove_attrs(struct bus_type * bus, struct device_driver * dr
}
}

#ifdef CONFIG_HOTPLUG
/*
* Thanks to drivers making their tables __devinit, we can't allow manual
* bind and unbind from userspace unless CONFIG_HOTPLUG is enabled.
*/
static void add_bind_files(struct device_driver *drv)
{
driver_create_file(drv, &driver_attr_unbind);
driver_create_file(drv, &driver_attr_bind);
}

static void remove_bind_files(struct device_driver *drv)
{
driver_remove_file(drv, &driver_attr_bind);
driver_remove_file(drv, &driver_attr_unbind);
}
#else
static inline void add_bind_files(struct device_driver *drv) {}
static inline void remove_bind_files(struct device_driver *drv) {}
#endif

/**
* bus_add_driver - Add a driver to the bus.
Expand Down Expand Up @@ -457,8 +477,7 @@ int bus_add_driver(struct device_driver * drv)
module_add_driver(drv->owner, drv);

driver_add_attrs(bus, drv);
driver_create_file(drv, &driver_attr_unbind);
driver_create_file(drv, &driver_attr_bind);
add_bind_files(drv);
}
return error;
}
Expand All @@ -476,8 +495,7 @@ int bus_add_driver(struct device_driver * drv)
void bus_remove_driver(struct device_driver * drv)
{
if (drv->bus) {
driver_remove_file(drv, &driver_attr_bind);
driver_remove_file(drv, &driver_attr_unbind);
remove_bind_files(drv);
driver_remove_attrs(drv->bus, drv);
klist_remove(&drv->knode_bus);
pr_debug("bus %s: remove driver %s\n", drv->bus->name, drv->name);
Expand Down

0 comments on commit 04d941f

Please sign in to comment.