diff options
| -rw-r--r-- | drivers/base/bus.c | 17 | ||||
| -rw-r--r-- | drivers/base/platform.c | 6 | ||||
| -rw-r--r-- | include/linux/device.h | 4 |
3 files changed, 19 insertions, 8 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 973bf2ad4e0d..63c143e54a57 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
| @@ -689,15 +689,19 @@ int bus_add_driver(struct device_driver *drv) | |||
| 689 | printk(KERN_ERR "%s: driver_add_attrs(%s) failed\n", | 689 | printk(KERN_ERR "%s: driver_add_attrs(%s) failed\n", |
| 690 | __func__, drv->name); | 690 | __func__, drv->name); |
| 691 | } | 691 | } |
| 692 | error = add_bind_files(drv); | 692 | |
| 693 | if (error) { | 693 | if (!drv->suppress_bind_attrs) { |
| 694 | /* Ditto */ | 694 | error = add_bind_files(drv); |
| 695 | printk(KERN_ERR "%s: add_bind_files(%s) failed\n", | 695 | if (error) { |
| 696 | __func__, drv->name); | 696 | /* Ditto */ |
| 697 | printk(KERN_ERR "%s: add_bind_files(%s) failed\n", | ||
| 698 | __func__, drv->name); | ||
| 699 | } | ||
| 697 | } | 700 | } |
| 698 | 701 | ||
| 699 | kobject_uevent(&priv->kobj, KOBJ_ADD); | 702 | kobject_uevent(&priv->kobj, KOBJ_ADD); |
| 700 | return 0; | 703 | return 0; |
| 704 | |||
| 701 | out_unregister: | 705 | out_unregister: |
| 702 | kfree(drv->p); | 706 | kfree(drv->p); |
| 703 | drv->p = NULL; | 707 | drv->p = NULL; |
| @@ -720,7 +724,8 @@ void bus_remove_driver(struct device_driver *drv) | |||
| 720 | if (!drv->bus) | 724 | if (!drv->bus) |
| 721 | return; | 725 | return; |
| 722 | 726 | ||
| 723 | remove_bind_files(drv); | 727 | if (!drv->suppress_bind_attrs) |
| 728 | remove_bind_files(drv); | ||
| 724 | driver_remove_attrs(drv->bus, drv); | 729 | driver_remove_attrs(drv->bus, drv); |
| 725 | driver_remove_file(drv, &driver_attr_uevent); | 730 | driver_remove_file(drv, &driver_attr_uevent); |
| 726 | klist_remove(&drv->p->knode_bus); | 731 | klist_remove(&drv->p->knode_bus); |
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index ed156a13aa40..4fa954b07ac4 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
| @@ -521,11 +521,15 @@ int __init_or_module platform_driver_probe(struct platform_driver *drv, | |||
| 521 | { | 521 | { |
| 522 | int retval, code; | 522 | int retval, code; |
| 523 | 523 | ||
| 524 | /* make sure driver won't have bind/unbind attributes */ | ||
| 525 | drv->driver.suppress_bind_attrs = true; | ||
| 526 | |||
| 524 | /* temporary section violation during probe() */ | 527 | /* temporary section violation during probe() */ |
| 525 | drv->probe = probe; | 528 | drv->probe = probe; |
| 526 | retval = code = platform_driver_register(drv); | 529 | retval = code = platform_driver_register(drv); |
| 527 | 530 | ||
| 528 | /* Fixup that section violation, being paranoid about code scanning | 531 | /* |
| 532 | * Fixup that section violation, being paranoid about code scanning | ||
| 529 | * the list of drivers in order to probe new devices. Check to see | 533 | * the list of drivers in order to probe new devices. Check to see |
| 530 | * if the probe was successful, and make sure any forced probes of | 534 | * if the probe was successful, and make sure any forced probes of |
| 531 | * new devices fail. | 535 | * new devices fail. |
diff --git a/include/linux/device.h b/include/linux/device.h index aca31bf7d8ed..2ea3e4921812 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -124,7 +124,9 @@ struct device_driver { | |||
| 124 | struct bus_type *bus; | 124 | struct bus_type *bus; |
| 125 | 125 | ||
| 126 | struct module *owner; | 126 | struct module *owner; |
| 127 | const char *mod_name; /* used for built-in modules */ | 127 | const char *mod_name; /* used for built-in modules */ |
| 128 | |||
| 129 | bool suppress_bind_attrs; /* disables bind/unbind via sysfs */ | ||
| 128 | 130 | ||
| 129 | int (*probe) (struct device *dev); | 131 | int (*probe) (struct device *dev); |
| 130 | int (*remove) (struct device *dev); | 132 | int (*remove) (struct device *dev); |
