···115115At this time, a generic EEH recovery mechanism has been implemented,116116so that individual device drivers do not need to be modified to support117117EEH recovery. This generic mechanism piggy-backs on the PCI hotplug118118-infrastructure, and percolates events up through the hotplug/udev118118+infrastructure, and percolates events up through the userspace/udev119119infrastructure. Followiing is a detailed description of how this is120120accomplished.121121···172172drivers/pci/hotplug/pSeries_pci.c, called handle_eeh_events().173173It saves the device BAR's and then calls rpaphp_unconfig_pci_adapter().174174This last call causes the device driver for the card to be stopped,175175-which causes hotplug events to go out to user space. This triggers175175+which causes uevents to go out to user space. This triggers176176user-space scripts that might issue commands such as "ifdown eth0"177177for ethernet cards, and so on. This handler then sleeps for 5 seconds,178178hoping to give the user-space scripts enough time to complete.···258258 calls259259 pci_destroy_dev (struct pci_dev *) {260260 calls261261- device_unregister (&dev->dev) { // in /drivers/base/core.c261261+ device_unregister (&dev->dev) { // in /drivers/base/core.c262262 calls263263- device_del(struct device * dev) { // in /drivers/base/core.c263263+ device_del(struct device * dev) { // in /drivers/base/core.c264264 calls265265- kobject_del() { //in /libs/kobject.c265265+ kobject_del() { //in /libs/kobject.c266266 calls267267- kobject_hotplug() { // in /libs/kobject.c267267+ kobject_uevent() { // in /libs/kobject.c268268 calls269269- kset_hotplug() { // in /lib/kobject.c269269+ kset_uevent() { // in /lib/kobject.c270270 calls271271- kset->hotplug_ops->hotplug() which is really just271271+ kset->uevent_ops->uevent() // which is really just272272 a call to273273- dev_hotplug() { // in /drivers/base/core.c273273+ dev_uevent() { // in /drivers/base/core.c274274 calls275275- dev->bus->hotplug() which is really just a call to276276- pci_hotplug () { // in drivers/pci/hotplug.c275275+ dev->bus->uevent() which is really just a call to276276+ pci_uevent () { // in drivers/pci/hotplug.c277277 which prints device name, etc....278278 }279279 }280280- then kset_hotplug() calls281281- call_usermodehelper () with282282- argv[0]=hotplug_path[] which is "/sbin/hotplug"283283- --> event to userspace,280280+ then kobject_uevent() sends a netlink uevent to userspace281281+ --> userspace uevent282282+ (during early boot, nobody listens to netlink events and283283+ kobject_uevent() executes uevent_helper[], which runs the284284+ event process /sbin/hotplug)284285 }285286 }286287 kobject_del() then calls sysfs_remove_dir(), which would
-6
MAINTAINERS
···14801480W: http://www.cse.unsw.edu.au/~neilb/patches/linux-devel/14811481S: Maintained1482148214831483-KERNEL EVENT LAYER (KOBJECT_UEVENT)14841484-P: Robert Love14851485-M: rml@novell.com14861486-L: linux-kernel@vger.kernel.org14871487-S: Maintained14881488-14891483KEXEC14901484P: Eric Biederman14911485P: Randy Dunlap
+3-3
arch/arm/common/amba.c
···4545}46464747#ifdef CONFIG_HOTPLUG4848-static int amba_hotplug(struct device *dev, char **envp, int nr_env, char *buf, int bufsz)4848+static int amba_uevent(struct device *dev, char **envp, int nr_env, char *buf, int bufsz)4949{5050 struct amba_device *pcdev = to_amba_device(dev);5151···5858 return 0;5959}6060#else6161-#define amba_hotplug NULL6161+#define amba_uevent NULL6262#endif63636464static int amba_suspend(struct device *dev, pm_message_t state)···8888static struct bus_type amba_bustype = {8989 .name = "amba",9090 .match = amba_match,9191- .hotplug = amba_hotplug,9191+ .uevent = amba_uevent,9292 .suspend = amba_suspend,9393 .resume = amba_resume,9494};
+2-2
arch/ia64/sn/kernel/tiocx.c
···65656666}67676868-static int tiocx_hotplug(struct device *dev, char **envp, int num_envp,6868+static int tiocx_uevent(struct device *dev, char **envp, int num_envp,6969 char *buffer, int buffer_size)7070{7171 return -ENODEV;···7979struct bus_type tiocx_bus_type = {8080 .name = "tiocx",8181 .match = tiocx_match,8282- .hotplug = tiocx_hotplug,8282+ .uevent = tiocx_uevent,8383};84848585/**
···1919 If unsure say Y here.20202121config FW_LOADER2222- tristate "Hotplug firmware loading support"2222+ tristate "Userspace firmware loading support"2323 select HOTPLUG2424 ---help---2525 This option is provided for the case where no in-kernel-tree modules2626- require hotplug firmware loading support, but a module built outside2626+ require userspace firmware loading support, but a module built outside2727 the kernel tree does.28282929config DEBUG_DRIVER
+36-5
drivers/base/bus.c
···152152153153 dev = bus_find_device(bus, NULL, (void *)buf, driver_helper);154154 if (dev && dev->driver == drv) {155155+ if (dev->parent) /* Needed for USB */156156+ down(&dev->parent->sem);155157 device_release_driver(dev);158158+ if (dev->parent)159159+ up(&dev->parent->sem);156160 err = count;157161 }158162 put_device(dev);···179175180176 dev = bus_find_device(bus, NULL, (void *)buf, driver_helper);181177 if (dev && dev->driver == NULL) {178178+ if (dev->parent) /* Needed for USB */179179+ down(&dev->parent->sem);182180 down(&dev->sem);183181 err = driver_probe_device(drv, dev);184182 up(&dev->sem);183183+ if (dev->parent)184184+ up(&dev->parent->sem);185185 }186186 put_device(dev);187187 put_bus(bus);···428420 }429421}430422423423+#ifdef CONFIG_HOTPLUG424424+/*425425+ * Thanks to drivers making their tables __devinit, we can't allow manual426426+ * bind and unbind from userspace unless CONFIG_HOTPLUG is enabled.427427+ */428428+static void add_bind_files(struct device_driver *drv)429429+{430430+ driver_create_file(drv, &driver_attr_unbind);431431+ driver_create_file(drv, &driver_attr_bind);432432+}433433+434434+static void remove_bind_files(struct device_driver *drv)435435+{436436+ driver_remove_file(drv, &driver_attr_bind);437437+ driver_remove_file(drv, &driver_attr_unbind);438438+}439439+#else440440+static inline void add_bind_files(struct device_driver *drv) {}441441+static inline void remove_bind_files(struct device_driver *drv) {}442442+#endif431443432444/**433445 * bus_add_driver - Add a driver to the bus.···477449 module_add_driver(drv->owner, drv);478450479451 driver_add_attrs(bus, drv);480480- driver_create_file(drv, &driver_attr_unbind);481481- driver_create_file(drv, &driver_attr_bind);452452+ add_bind_files(drv);482453 }483454 return error;484455}···495468void bus_remove_driver(struct device_driver * drv)496469{497470 if (drv->bus) {498498- driver_remove_file(drv, &driver_attr_bind);499499- driver_remove_file(drv, &driver_attr_unbind);471471+ remove_bind_files(drv);500472 driver_remove_attrs(drv->bus, drv);501473 klist_remove(&drv->knode_bus);502474 pr_debug("bus %s: remove driver %s\n", drv->bus->name, drv->name);···510484/* Helper for bus_rescan_devices's iter */511485static int bus_rescan_devices_helper(struct device *dev, void *data)512486{513513- if (!dev->driver)487487+ if (!dev->driver) {488488+ if (dev->parent) /* Needed for USB */489489+ down(&dev->parent->sem);514490 device_attach(dev);491491+ if (dev->parent)492492+ up(&dev->parent->sem);493493+ }515494 return 0;516495}517496
+33-33
drivers/base/class.c
···178178}179179180180/* needed to allow these devices to have parent class devices */181181-static int class_device_create_hotplug(struct class_device *class_dev,181181+static int class_device_create_uevent(struct class_device *class_dev,182182 char **envp, int num_envp,183183 char *buffer, int buffer_size)184184{···331331 .release = class_dev_release,332332};333333334334-static int class_hotplug_filter(struct kset *kset, struct kobject *kobj)334334+static int class_uevent_filter(struct kset *kset, struct kobject *kobj)335335{336336 struct kobj_type *ktype = get_ktype(kobj);337337···343343 return 0;344344}345345346346-static const char *class_hotplug_name(struct kset *kset, struct kobject *kobj)346346+static const char *class_uevent_name(struct kset *kset, struct kobject *kobj)347347{348348 struct class_device *class_dev = to_class_dev(kobj);349349350350 return class_dev->class->name;351351}352352353353-static int class_hotplug(struct kset *kset, struct kobject *kobj, char **envp,353353+static int class_uevent(struct kset *kset, struct kobject *kobj, char **envp,354354 int num_envp, char *buffer, int buffer_size)355355{356356 struct class_device *class_dev = to_class_dev(kobj);···365365 struct device *dev = class_dev->dev;366366 char *path = kobject_get_path(&dev->kobj, GFP_KERNEL);367367368368- add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size,369369- &length, "PHYSDEVPATH=%s", path);368368+ add_uevent_var(envp, num_envp, &i, buffer, buffer_size,369369+ &length, "PHYSDEVPATH=%s", path);370370 kfree(path);371371372372 if (dev->bus)373373- add_hotplug_env_var(envp, num_envp, &i,374374- buffer, buffer_size, &length,375375- "PHYSDEVBUS=%s", dev->bus->name);373373+ add_uevent_var(envp, num_envp, &i,374374+ buffer, buffer_size, &length,375375+ "PHYSDEVBUS=%s", dev->bus->name);376376377377 if (dev->driver)378378- add_hotplug_env_var(envp, num_envp, &i,379379- buffer, buffer_size, &length,380380- "PHYSDEVDRIVER=%s", dev->driver->name);378378+ add_uevent_var(envp, num_envp, &i,379379+ buffer, buffer_size, &length,380380+ "PHYSDEVDRIVER=%s", dev->driver->name);381381 }382382383383 if (MAJOR(class_dev->devt)) {384384- add_hotplug_env_var(envp, num_envp, &i,385385- buffer, buffer_size, &length,386386- "MAJOR=%u", MAJOR(class_dev->devt));384384+ add_uevent_var(envp, num_envp, &i,385385+ buffer, buffer_size, &length,386386+ "MAJOR=%u", MAJOR(class_dev->devt));387387388388- add_hotplug_env_var(envp, num_envp, &i,389389- buffer, buffer_size, &length,390390- "MINOR=%u", MINOR(class_dev->devt));388388+ add_uevent_var(envp, num_envp, &i,389389+ buffer, buffer_size, &length,390390+ "MINOR=%u", MINOR(class_dev->devt));391391 }392392393393 /* terminate, set to next free slot, shrink available space */···397397 buffer = &buffer[length];398398 buffer_size -= length;399399400400- if (class_dev->hotplug) {400400+ if (class_dev->uevent) {401401 /* have the class device specific function add its stuff */402402- retval = class_dev->hotplug(class_dev, envp, num_envp,402402+ retval = class_dev->uevent(class_dev, envp, num_envp,403403 buffer, buffer_size);404404 if (retval)405405- pr_debug("class_dev->hotplug() returned %d\n", retval);406406- } else if (class_dev->class->hotplug) {405405+ pr_debug("class_dev->uevent() returned %d\n", retval);406406+ } else if (class_dev->class->uevent) {407407 /* have the class specific function add its stuff */408408- retval = class_dev->class->hotplug(class_dev, envp, num_envp,408408+ retval = class_dev->class->uevent(class_dev, envp, num_envp,409409 buffer, buffer_size);410410 if (retval)411411- pr_debug("class->hotplug() returned %d\n", retval);411411+ pr_debug("class->uevent() returned %d\n", retval);412412 }413413414414 return retval;415415}416416417417-static struct kset_hotplug_ops class_hotplug_ops = {418418- .filter = class_hotplug_filter,419419- .name = class_hotplug_name,420420- .hotplug = class_hotplug,417417+static struct kset_uevent_ops class_uevent_ops = {418418+ .filter = class_uevent_filter,419419+ .name = class_uevent_name,420420+ .uevent = class_uevent,421421};422422423423-static decl_subsys(class_obj, &ktype_class_device, &class_hotplug_ops);423423+static decl_subsys(class_obj, &ktype_class_device, &class_uevent_ops);424424425425426426static int class_device_add_attrs(struct class_device * cd)···464464static ssize_t store_uevent(struct class_device *class_dev,465465 const char *buf, size_t count)466466{467467- kobject_hotplug(&class_dev->kobj, KOBJ_ADD);467467+ kobject_uevent(&class_dev->kobj, KOBJ_ADD);468468 return count;469469}470470···559559 class_name);560560 }561561562562- kobject_hotplug(&class_dev->kobj, KOBJ_ADD);562562+ kobject_uevent(&class_dev->kobj, KOBJ_ADD);563563564564 /* notify any interfaces this device is now here */565565 if (parent_class) {···632632 class_dev->class = cls;633633 class_dev->parent = parent;634634 class_dev->release = class_device_create_release;635635- class_dev->hotplug = class_device_create_hotplug;635635+ class_dev->uevent = class_device_create_uevent;636636637637 va_start(args, fmt);638638 vsnprintf(class_dev->class_id, BUS_ID_SIZE, fmt, args);···674674 class_device_remove_file(class_dev, class_dev->devt_attr);675675 class_device_remove_attrs(class_dev);676676677677- kobject_hotplug(&class_dev->kobj, KOBJ_REMOVE);677677+ kobject_uevent(&class_dev->kobj, KOBJ_REMOVE);678678 kobject_del(&class_dev->kobj);679679680680 class_device_put(parent_device);
+21-21
drivers/base/core.c
···9090};919192929393-static int dev_hotplug_filter(struct kset *kset, struct kobject *kobj)9393+static int dev_uevent_filter(struct kset *kset, struct kobject *kobj)9494{9595 struct kobj_type *ktype = get_ktype(kobj);9696···102102 return 0;103103}104104105105-static const char *dev_hotplug_name(struct kset *kset, struct kobject *kobj)105105+static const char *dev_uevent_name(struct kset *kset, struct kobject *kobj)106106{107107 struct device *dev = to_dev(kobj);108108109109 return dev->bus->name;110110}111111112112-static int dev_hotplug(struct kset *kset, struct kobject *kobj, char **envp,112112+static int dev_uevent(struct kset *kset, struct kobject *kobj, char **envp,113113 int num_envp, char *buffer, int buffer_size)114114{115115 struct device *dev = to_dev(kobj);···119119120120 /* add bus name of physical device */121121 if (dev->bus)122122- add_hotplug_env_var(envp, num_envp, &i,123123- buffer, buffer_size, &length,124124- "PHYSDEVBUS=%s", dev->bus->name);122122+ add_uevent_var(envp, num_envp, &i,123123+ buffer, buffer_size, &length,124124+ "PHYSDEVBUS=%s", dev->bus->name);125125126126 /* add driver name of physical device */127127 if (dev->driver)128128- add_hotplug_env_var(envp, num_envp, &i,129129- buffer, buffer_size, &length,130130- "PHYSDEVDRIVER=%s", dev->driver->name);128128+ add_uevent_var(envp, num_envp, &i,129129+ buffer, buffer_size, &length,130130+ "PHYSDEVDRIVER=%s", dev->driver->name);131131132132 /* terminate, set to next free slot, shrink available space */133133 envp[i] = NULL;···136136 buffer = &buffer[length];137137 buffer_size -= length;138138139139- if (dev->bus && dev->bus->hotplug) {139139+ if (dev->bus && dev->bus->uevent) {140140 /* have the bus specific function add its stuff */141141- retval = dev->bus->hotplug (dev, envp, num_envp, buffer, buffer_size);141141+ retval = dev->bus->uevent(dev, envp, num_envp, buffer, buffer_size);142142 if (retval) {143143- pr_debug ("%s - hotplug() returned %d\n",143143+ pr_debug ("%s - uevent() returned %d\n",144144 __FUNCTION__, retval);145145 }146146 }···148148 return retval;149149}150150151151-static struct kset_hotplug_ops device_hotplug_ops = {152152- .filter = dev_hotplug_filter,153153- .name = dev_hotplug_name,154154- .hotplug = dev_hotplug,151151+static struct kset_uevent_ops device_uevent_ops = {152152+ .filter = dev_uevent_filter,153153+ .name = dev_uevent_name,154154+ .uevent = dev_uevent,155155};156156157157static ssize_t store_uevent(struct device *dev, struct device_attribute *attr,158158 const char *buf, size_t count)159159{160160- kobject_hotplug(&dev->kobj, KOBJ_ADD);160160+ kobject_uevent(&dev->kobj, KOBJ_ADD);161161 return count;162162}163163···165165 * device_subsys - structure to be registered with kobject core.166166 */167167168168-decl_subsys(devices, &ktype_device, &device_hotplug_ops);168168+decl_subsys(devices, &ktype_device, &device_uevent_ops);169169170170171171/**···274274 dev->uevent_attr.store = store_uevent;275275 device_create_file(dev, &dev->uevent_attr);276276277277- kobject_hotplug(&dev->kobj, KOBJ_ADD);277277+ kobject_uevent(&dev->kobj, KOBJ_ADD);278278 if ((error = device_pm_add(dev)))279279 goto PMError;280280 if ((error = bus_add_device(dev)))···291291 BusError:292292 device_pm_remove(dev);293293 PMError:294294- kobject_hotplug(&dev->kobj, KOBJ_REMOVE);294294+ kobject_uevent(&dev->kobj, KOBJ_REMOVE);295295 kobject_del(&dev->kobj);296296 Error:297297 if (parent)···374374 platform_notify_remove(dev);375375 bus_remove_device(dev);376376 device_pm_remove(dev);377377- kobject_hotplug(&dev->kobj, KOBJ_REMOVE);377377+ kobject_uevent(&dev->kobj, KOBJ_REMOVE);378378 kobject_del(&dev->kobj);379379 if (parent)380380 put_device(parent);
+2-2
drivers/base/cpu.c
···4141 case '0':4242 ret = cpu_down(cpu->sysdev.id);4343 if (!ret)4444- kobject_hotplug(&dev->kobj, KOBJ_OFFLINE);4444+ kobject_uevent(&dev->kobj, KOBJ_OFFLINE);4545 break;4646 case '1':4747 ret = smp_prepare_cpu(cpu->sysdev.id);4848 if (!ret)4949 ret = cpu_up(cpu->sysdev.id);5050 if (!ret)5151- kobject_hotplug(&dev->kobj, KOBJ_ONLINE);5151+ kobject_uevent(&dev->kobj, KOBJ_ONLINE);5252 break;5353 default:5454 ret = -EINVAL;
+14-1
drivers/base/dd.c
···6565 * This function returns 1 if a match is found, an error if one6666 * occurs (that is not -ENODEV or -ENXIO), and 0 otherwise.6767 *6868- * This function must be called with @dev->sem held.6868+ * This function must be called with @dev->sem held. When called6969+ * for a USB interface, @dev->parent->sem must be held as well.6970 */7071int driver_probe_device(struct device_driver * drv, struct device * dev)7172{···124123 *125124 * Returns 1 if the device was bound to a driver;126125 * 0 if no matching device was found; error code otherwise.126126+ *127127+ * When called for a USB interface, @dev->parent->sem must be held.127128 */128129int device_attach(struct device * dev)129130{···155152 * is an error.156153 */157154155155+ if (dev->parent) /* Needed for USB */156156+ down(&dev->parent->sem);158157 down(&dev->sem);159158 if (!dev->driver)160159 driver_probe_device(drv, dev);161160 up(&dev->sem);161161+ if (dev->parent)162162+ up(&dev->parent->sem);162163163164 return 0;164165}···188181 * Manually detach device from driver.189182 *190183 * __device_release_driver() must be called with @dev->sem held.184184+ * When called for a USB interface, @dev->parent->sem must be held185185+ * as well.191186 */192187193188static void __device_release_driver(struct device * dev)···242233 get_device(dev);243234 spin_unlock(&drv->klist_devices.k_lock);244235236236+ if (dev->parent) /* Needed for USB */237237+ down(&dev->parent->sem);245238 down(&dev->sem);246239 if (dev->driver == drv)247240 __device_release_driver(dev);248241 up(&dev->sem);242242+ if (dev->parent)243243+ up(&dev->parent->sem);249244 put_device(dev);250245 }251246}
+22-23
drivers/base/firmware_class.c
···8585static CLASS_ATTR(timeout, 0644, firmware_timeout_show, firmware_timeout_store);86868787static void fw_class_dev_release(struct class_device *class_dev);8888-int firmware_class_hotplug(struct class_device *dev, char **envp,8888+int firmware_class_uevent(struct class_device *dev, char **envp,8989 int num_envp, char *buffer, int buffer_size);90909191static struct class firmware_class = {9292 .name = "firmware",9393- .hotplug = firmware_class_hotplug,9393+ .uevent = firmware_class_uevent,9494 .release = fw_class_dev_release,9595};96969797int9898-firmware_class_hotplug(struct class_device *class_dev, char **envp,9898+firmware_class_uevent(struct class_device *class_dev, char **envp,9999 int num_envp, char *buffer, int buffer_size)100100{101101 struct firmware_priv *fw_priv = class_get_devdata(class_dev);···104104 if (!test_bit(FW_STATUS_READY, &fw_priv->status))105105 return -ENODEV;106106107107- if (add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, &len,108108- "FIRMWARE=%s", fw_priv->fw_id))107107+ if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &len,108108+ "FIRMWARE=%s", fw_priv->fw_id))109109 return -ENOMEM;110110- if (add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, &len,111111- "TIMEOUT=%i", loading_timeout))110110+ if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &len,111111+ "TIMEOUT=%i", loading_timeout))112112 return -ENOMEM;113113-114113 envp[i] = NULL;115114116115 return 0;···351352352353static int353354fw_setup_class_device(struct firmware *fw, struct class_device **class_dev_p,354354- const char *fw_name, struct device *device, int hotplug)355355+ const char *fw_name, struct device *device, int uevent)355356{356357 struct class_device *class_dev;357358 struct firmware_priv *fw_priv;···383384 goto error_unreg;384385 }385386386386- if (hotplug)387387+ if (uevent)387388 set_bit(FW_STATUS_READY, &fw_priv->status);388389 else389390 set_bit(FW_STATUS_READY_NOHOTPLUG, &fw_priv->status);···398399399400static int400401_request_firmware(const struct firmware **firmware_p, const char *name,401401- struct device *device, int hotplug)402402+ struct device *device, int uevent)402403{403404 struct class_device *class_dev;404405 struct firmware_priv *fw_priv;···417418 }418419419420 retval = fw_setup_class_device(firmware, &class_dev, name, device,420420- hotplug);421421+ uevent);421422 if (retval)422423 goto error_kfree_fw;423424424425 fw_priv = class_get_devdata(class_dev);425426426426- if (hotplug) {427427+ if (uevent) {427428 if (loading_timeout > 0) {428429 fw_priv->timeout.expires = jiffies + loading_timeout * HZ;429430 add_timer(&fw_priv->timeout);430431 }431432432432- kobject_hotplug(&class_dev->kobj, KOBJ_ADD);433433+ kobject_uevent(&class_dev->kobj, KOBJ_ADD);433434 wait_for_completion(&fw_priv->completion);434435 set_bit(FW_STATUS_DONE, &fw_priv->status);435436 del_timer_sync(&fw_priv->timeout);···455456}456457457458/**458458- * request_firmware: - request firmware to hotplug and wait for it459459+ * request_firmware: - send firmware request and wait for it459460 * @firmware_p: pointer to firmware image460461 * @name: name of firmware file461462 * @device: device for which firmware is being loaded···465466 *466467 * Should be called from user context where sleeping is allowed.467468 *468468- * @name will be used as $FIRMWARE in the hotplug environment and469469+ * @name will be used as $FIRMWARE in the uevent environment and469470 * should be distinctive enough not to be confused with any other470471 * firmware image for this or any other device.471472 **/···473474request_firmware(const struct firmware **firmware_p, const char *name,474475 struct device *device)475476{476476- int hotplug = 1;477477- return _request_firmware(firmware_p, name, device, hotplug);477477+ int uevent = 1;478478+ return _request_firmware(firmware_p, name, device, uevent);478479}479480480481/**···517518 struct device *device;518519 void *context;519520 void (*cont)(const struct firmware *fw, void *context);520520- int hotplug;521521+ int uevent;521522};522523523524static int···532533 }533534 daemonize("%s/%s", "firmware", fw_work->name);534535 ret = _request_firmware(&fw, fw_work->name, fw_work->device,535535- fw_work->hotplug);536536+ fw_work->uevent);536537 if (ret < 0)537538 fw_work->cont(NULL, fw_work->context);538539 else {···547548/**548549 * request_firmware_nowait: asynchronous version of request_firmware549550 * @module: module requesting the firmware550550- * @hotplug: invokes hotplug event to copy the firmware image if this flag551551+ * @uevent: sends uevent to copy the firmware image if this flag551552 * is non-zero else the firmware copy must be done manually.552553 * @name: name of firmware file553554 * @device: device for which firmware is being loaded···561562 **/562563int563564request_firmware_nowait(564564- struct module *module, int hotplug,565565+ struct module *module, int uevent,565566 const char *name, struct device *device, void *context,566567 void (*cont)(const struct firmware *fw, void *context))567568{···582583 .device = device,583584 .context = context,584585 .cont = cont,585585- .hotplug = hotplug,586586+ .uevent = uevent,586587 };587588588589 ret = kernel_thread(request_firmware_work_func, fw_work,
···121121};122122123123static int nodemgr_bus_match(struct device * dev, struct device_driver * drv);124124-static int nodemgr_hotplug(struct class_device *cdev, char **envp, int num_envp,125125- char *buffer, int buffer_size);124124+static int nodemgr_uevent(struct class_device *cdev, char **envp, int num_envp,125125+ char *buffer, int buffer_size);126126static void nodemgr_resume_ne(struct node_entry *ne);127127static void nodemgr_remove_ne(struct node_entry *ne);128128static struct node_entry *find_entry_by_guid(u64 guid);···162162static struct class nodemgr_ud_class = {163163 .name = "ieee1394",164164 .release = ud_cls_release,165165- .hotplug = nodemgr_hotplug,165165+ .uevent = nodemgr_uevent,166166};167167168168static struct hpsb_highlevel nodemgr_highlevel;···966966 if (ud_child == NULL)967967 break;968968969969- /* inherit unspecified values so hotplug picks it up */969969+ /* inherit unspecified values, the driver core picks it up */970970 if ((ud->flags & UNIT_DIRECTORY_MODEL_ID) &&971971 !(ud_child->flags & UNIT_DIRECTORY_MODEL_ID))972972 {···1062106210631063#ifdef CONFIG_HOTPLUG1064106410651065-static int nodemgr_hotplug(struct class_device *cdev, char **envp, int num_envp,10661066- char *buffer, int buffer_size)10651065+static int nodemgr_uevent(struct class_device *cdev, char **envp, int num_envp,10661066+ char *buffer, int buffer_size)10671067{10681068 struct unit_directory *ud;10691069 int i = 0;···1112111211131113#else1114111411151115-static int nodemgr_hotplug(struct class_device *cdev, char **envp, int num_envp,11161116- char *buffer, int buffer_size)11151115+static int nodemgr_uevent(struct class_device *cdev, char **envp, int num_envp,11161116+ char *buffer, int buffer_size)11171117{11181118 return -ENODEV;11191119}···1618161816191619 /* Scan our nodes to get the bus options and create node16201620 * entries. This does not do the sysfs stuff, since that16211621- * would trigger hotplug callbacks and such, which is a16221622- * bad idea at this point. */16211621+ * would trigger uevents and such, which is a bad idea at16221622+ * this point. */16231623 nodemgr_node_scan(hi, generation);1624162416251625 /* This actually does the full probe, with sysfs
+8-8
drivers/infiniband/core/sysfs.c
···434434 kfree(dev);435435}436436437437-static int ib_device_hotplug(struct class_device *cdev, char **envp,438438- int num_envp, char *buf, int size)437437+static int ib_device_uevent(struct class_device *cdev, char **envp,438438+ int num_envp, char *buf, int size)439439{440440 struct ib_device *dev = container_of(cdev, struct ib_device, class_dev);441441 int i = 0, len = 0;442442443443- if (add_hotplug_env_var(envp, num_envp, &i, buf, size, &len,444444- "NAME=%s", dev->name))443443+ if (add_uevent_var(envp, num_envp, &i, buf, size, &len,444444+ "NAME=%s", dev->name))445445 return -ENOMEM;446446447447 /*448448- * It might be nice to pass the node GUID to hotplug, but448448+ * It might be nice to pass the node GUID with the event, but449449 * right now the only way to get it is to query the device450450 * provider, and this can crash during device removal because451451 * we are will be running after driver removal has started.452452 * We could add a node_guid field to struct ib_device, or we453453- * could just let the hotplug script read the node GUID from454454- * sysfs when devices are added.453453+ * could just let userspace read the node GUID from sysfs when454454+ * devices are added.455455 */456456457457 envp[i] = NULL;···653653static struct class ib_class = {654654 .name = "infiniband",655655 .release = ib_device_release,656656- .hotplug = ib_device_hotplug,656656+ .uevent = ib_device_uevent,657657};658658659659int ib_device_register_sysfs(struct ib_device *device)
+46-8
drivers/input/input.c
···1818#include <linux/random.h>1919#include <linux/major.h>2020#include <linux/proc_fs.h>2121-#include <linux/kobject_uevent.h>2221#include <linux/interrupt.h>2322#include <linux/poll.h>2423#include <linux/device.h>···528529INPUT_DEV_STRING_ATTR_SHOW(phys);529530INPUT_DEV_STRING_ATTR_SHOW(uniq);530531532532+static int print_modalias_bits(char *buf, char prefix, unsigned long *arr,533533+ unsigned int min, unsigned int max)534534+{535535+ int len, i;536536+537537+ len = sprintf(buf, "%c", prefix);538538+ for (i = min; i < max; i++)539539+ if (arr[LONG(i)] & BIT(i))540540+ len += sprintf(buf+len, "%X,", i);541541+ return len;542542+}543543+544544+static ssize_t input_dev_show_modalias(struct class_device *dev, char *buf)545545+{546546+ struct input_dev *id = to_input_dev(dev);547547+ ssize_t len = 0;548548+549549+ len += sprintf(buf+len, "input:b%04Xv%04Xp%04Xe%04X-",550550+ id->id.bustype,551551+ id->id.vendor,552552+ id->id.product,553553+ id->id.version);554554+555555+ len += print_modalias_bits(buf+len, 'e', id->evbit, 0, EV_MAX);556556+ len += print_modalias_bits(buf+len, 'k', id->keybit,557557+ KEY_MIN_INTERESTING, KEY_MAX);558558+ len += print_modalias_bits(buf+len, 'r', id->relbit, 0, REL_MAX);559559+ len += print_modalias_bits(buf+len, 'a', id->absbit, 0, ABS_MAX);560560+ len += print_modalias_bits(buf+len, 'm', id->mscbit, 0, MSC_MAX);561561+ len += print_modalias_bits(buf+len, 'l', id->ledbit, 0, LED_MAX);562562+ len += print_modalias_bits(buf+len, 's', id->sndbit, 0, SND_MAX);563563+ len += print_modalias_bits(buf+len, 'f', id->ffbit, 0, FF_MAX);564564+ len += print_modalias_bits(buf+len, 'w', id->swbit, 0, SW_MAX);565565+ len += sprintf(buf+len, "\n");566566+ return len;567567+}568568+static CLASS_DEVICE_ATTR(modalias, S_IRUGO, input_dev_show_modalias, NULL);569569+531570static struct attribute *input_dev_attrs[] = {532571 &class_device_attr_name.attr,533572 &class_device_attr_phys.attr,534573 &class_device_attr_uniq.attr,574574+ &class_device_attr_modalias.attr,535575 NULL536576};537577···649611}650612651613/*652652- * Input hotplugging interface - loading event handlers based on614614+ * Input uevent interface - loading event handlers based on653615 * device bitfields.654616 */655655-static int input_add_hotplug_bm_var(char **envp, int num_envp, int *cur_index,617617+static int input_add_uevent_bm_var(char **envp, int num_envp, int *cur_index,656618 char *buffer, int buffer_size, int *cur_len,657619 const char *name, unsigned long *bitmap, int max)658620{···677639678640#define INPUT_ADD_HOTPLUG_VAR(fmt, val...) \679641 do { \680680- int err = add_hotplug_env_var(envp, num_envp, &i, \642642+ int err = add_uevent_var(envp, num_envp, &i, \681643 buffer, buffer_size, &len, \682644 fmt, val); \683645 if (err) \···686648687649#define INPUT_ADD_HOTPLUG_BM_VAR(name, bm, max) \688650 do { \689689- int err = input_add_hotplug_bm_var(envp, num_envp, &i, \651651+ int err = input_add_uevent_bm_var(envp, num_envp, &i, \690652 buffer, buffer_size, &len, \691653 name, bm, max); \692654 if (err) \693655 return err; \694656 } while (0)695657696696-static int input_dev_hotplug(struct class_device *cdev, char **envp,697697- int num_envp, char *buffer, int buffer_size)658658+static int input_dev_uevent(struct class_device *cdev, char **envp,659659+ int num_envp, char *buffer, int buffer_size)698660{699661 struct input_dev *dev = to_input_dev(cdev);700662 int i = 0;···736698struct class input_class = {737699 .name = "input",738700 .release = input_dev_release,739739- .hotplug = input_dev_hotplug,701701+ .uevent = input_dev_uevent,740702};741703742704struct input_dev *input_allocate_device(void)
+11-11
drivers/input/serio/serio.c
···800800801801#ifdef CONFIG_HOTPLUG802802803803-#define SERIO_ADD_HOTPLUG_VAR(fmt, val...) \803803+#define SERIO_ADD_UEVENT_VAR(fmt, val...) \804804 do { \805805- int err = add_hotplug_env_var(envp, num_envp, &i, \805805+ int err = add_uevent_var(envp, num_envp, &i, \806806 buffer, buffer_size, &len, \807807 fmt, val); \808808 if (err) \809809 return err; \810810 } while (0)811811812812-static int serio_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)812812+static int serio_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)813813{814814 struct serio *serio;815815 int i = 0;···820820821821 serio = to_serio_port(dev);822822823823- SERIO_ADD_HOTPLUG_VAR("SERIO_TYPE=%02x", serio->id.type);824824- SERIO_ADD_HOTPLUG_VAR("SERIO_PROTO=%02x", serio->id.proto);825825- SERIO_ADD_HOTPLUG_VAR("SERIO_ID=%02x", serio->id.id);826826- SERIO_ADD_HOTPLUG_VAR("SERIO_EXTRA=%02x", serio->id.extra);827827- SERIO_ADD_HOTPLUG_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X",823823+ SERIO_ADD_UEVENT_VAR("SERIO_TYPE=%02x", serio->id.type);824824+ SERIO_ADD_UEVENT_VAR("SERIO_PROTO=%02x", serio->id.proto);825825+ SERIO_ADD_UEVENT_VAR("SERIO_ID=%02x", serio->id.id);826826+ SERIO_ADD_UEVENT_VAR("SERIO_EXTRA=%02x", serio->id.extra);827827+ SERIO_ADD_UEVENT_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X",828828 serio->id.type, serio->id.proto, serio->id.id, serio->id.extra);829829 envp[i] = NULL;830830831831 return 0;832832}833833-#undef SERIO_ADD_HOTPLUG_VAR833833+#undef SERIO_ADD_UEVENT_VAR834834835835#else836836837837-static int serio_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)837837+static int serio_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)838838{839839 return -ENODEV;840840}···908908 serio_bus.dev_attrs = serio_device_attrs;909909 serio_bus.drv_attrs = serio_driver_attrs;910910 serio_bus.match = serio_bus_match;911911- serio_bus.hotplug = serio_hotplug;911911+ serio_bus.uevent = serio_uevent;912912 serio_bus.resume = serio_resume;913913 bus_register(&serio_bus);914914
···11/* Functions internal to the PCI core code */2233-extern int pci_hotplug (struct device *dev, char **envp, int num_envp,44- char *buffer, int buffer_size);33+extern int pci_uevent(struct device *dev, char **envp, int num_envp,44+ char *buffer, int buffer_size);55extern int pci_create_sysfs_dev_files(struct pci_dev *pdev);66extern void pci_remove_sysfs_dev_files(struct pci_dev *pdev);77extern void pci_cleanup_rom(struct pci_dev *dev);
+5-5
drivers/pcmcia/cs.c
···901901EXPORT_SYMBOL(pcmcia_insert_card);902902903903904904-static int pcmcia_socket_hotplug(struct class_device *dev, char **envp,905905- int num_envp, char *buffer, int buffer_size)904904+static int pcmcia_socket_uevent(struct class_device *dev, char **envp,905905+ int num_envp, char *buffer, int buffer_size)906906{907907 struct pcmcia_socket *s = container_of(dev, struct pcmcia_socket, dev);908908 int i = 0, length = 0;909909910910- if (add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size,911911- &length, "SOCKET_NO=%u", s->sock))910910+ if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size,911911+ &length, "SOCKET_NO=%u", s->sock))912912 return -ENOMEM;913913914914 envp[i] = NULL;···927927928928struct class pcmcia_socket_class = {929929 .name = "pcmcia_socket",930930- .hotplug = pcmcia_socket_hotplug,930930+ .uevent = pcmcia_socket_uevent,931931 .release = pcmcia_release_socket,932932 .class_release = pcmcia_release_socket_class,933933};
+25-25
drivers/pcmcia/ds.c
···779779780780#ifdef CONFIG_HOTPLUG781781782782-static int pcmcia_bus_hotplug(struct device *dev, char **envp, int num_envp,783783- char *buffer, int buffer_size)782782+static int pcmcia_bus_uevent(struct device *dev, char **envp, int num_envp,783783+ char *buffer, int buffer_size)784784{785785 struct pcmcia_device *p_dev;786786 int i, length = 0;···800800801801 i = 0;802802803803- if (add_hotplug_env_var(envp, num_envp, &i,804804- buffer, buffer_size, &length,805805- "SOCKET_NO=%u",806806- p_dev->socket->sock))803803+ if (add_uevent_var(envp, num_envp, &i,804804+ buffer, buffer_size, &length,805805+ "SOCKET_NO=%u",806806+ p_dev->socket->sock))807807 return -ENOMEM;808808809809- if (add_hotplug_env_var(envp, num_envp, &i,810810- buffer, buffer_size, &length,811811- "DEVICE_NO=%02X",812812- p_dev->device_no))809809+ if (add_uevent_var(envp, num_envp, &i,810810+ buffer, buffer_size, &length,811811+ "DEVICE_NO=%02X",812812+ p_dev->device_no))813813 return -ENOMEM;814814815815- if (add_hotplug_env_var(envp, num_envp, &i,816816- buffer, buffer_size, &length,817817- "MODALIAS=pcmcia:m%04Xc%04Xf%02Xfn%02Xpfn%02X"818818- "pa%08Xpb%08Xpc%08Xpd%08X",819819- p_dev->has_manf_id ? p_dev->manf_id : 0,820820- p_dev->has_card_id ? p_dev->card_id : 0,821821- p_dev->has_func_id ? p_dev->func_id : 0,822822- p_dev->func,823823- p_dev->device_no,824824- hash[0],825825- hash[1],826826- hash[2],827827- hash[3]))815815+ if (add_uevent_var(envp, num_envp, &i,816816+ buffer, buffer_size, &length,817817+ "MODALIAS=pcmcia:m%04Xc%04Xf%02Xfn%02Xpfn%02X"818818+ "pa%08Xpb%08Xpc%08Xpd%08X",819819+ p_dev->has_manf_id ? p_dev->manf_id : 0,820820+ p_dev->has_card_id ? p_dev->card_id : 0,821821+ p_dev->has_func_id ? p_dev->func_id : 0,822822+ p_dev->func,823823+ p_dev->device_no,824824+ hash[0],825825+ hash[1],826826+ hash[2],827827+ hash[3]))828828 return -ENOMEM;829829830830 envp[i] = NULL;···834834835835#else836836837837-static int pcmcia_bus_hotplug(struct device *dev, char **envp, int num_envp,837837+static int pcmcia_bus_uevent(struct device *dev, char **envp, int num_envp,838838 char *buffer, int buffer_size)839839{840840 return -ENODEV;···1223122312241224struct bus_type pcmcia_bus_type = {12251225 .name = "pcmcia",12261226- .hotplug = pcmcia_bus_hotplug,12261226+ .uevent = pcmcia_bus_uevent,12271227 .match = pcmcia_bus_match,12281228 .dev_attrs = pcmcia_dev_attrs,12291229};
+3-5
drivers/pnp/pnpbios/core.c
···5656#include <linux/mm.h>5757#include <linux/smp.h>5858#include <linux/slab.h>5959-#include <linux/kobject_uevent.h>6059#include <linux/completion.h>6160#include <linux/spinlock.h>6261#include <linux/dmi.h>···105106 char *argv [3], **envp, *buf, *scratch;106107 int i = 0, value;107108108108- if (!hotplug_path [0])109109- return -ENOENT;110109 if (!current->fs->root) {111110 return -EAGAIN;112111 }···116119 return -ENOMEM;117120 }118121119119- /* only one standardized param to hotplug command: type */120120- argv [0] = hotplug_path;122122+ /* FIXME: if there are actual users of this, it should be integrated into123123+ * the driver core and use the usual infrastructure like sysfs and uevents */124124+ argv [0] = "/sbin/pnpbios";121125 argv [1] = "dock";122126 argv [2] = NULL;123127
···4747 struct driver_attribute * drv_attrs;48484949 int (*match)(struct device * dev, struct device_driver * drv);5050- int (*hotplug) (struct device *dev, char **envp, 5151- int num_envp, char *buffer, int buffer_size);5050+ int (*uevent)(struct device *dev, char **envp,5151+ int num_envp, char *buffer, int buffer_size);5252 int (*suspend)(struct device * dev, pm_message_t state);5353 int (*resume)(struct device * dev);5454};···151151 struct class_attribute * class_attrs;152152 struct class_device_attribute * class_dev_attrs;153153154154- int (*hotplug)(struct class_device *dev, char **envp, 154154+ int (*uevent)(struct class_device *dev, char **envp,155155 int num_envp, char *buffer, int buffer_size);156156157157 void (*release)(struct class_device *dev);···209209 * set, this will be called instead of the class specific release function.210210 * Only use this if you want to override the default release function, like211211 * when you are nesting class_device structures.212212- * @hotplug: pointer to a hotplug function for this struct class_device. If213213- * set, this will be called instead of the class specific hotplug function.214214- * Only use this if you want to override the default hotplug function, like212212+ * @uevent: pointer to a uevent function for this struct class_device. If213213+ * set, this will be called instead of the class specific uevent function.214214+ * Only use this if you want to override the default uevent function, like215215 * when you are nesting class_device structures.216216 */217217struct class_device {···227227 struct class_device *parent; /* parent of this child device, if there is one */228228229229 void (*release)(struct class_device *dev);230230- int (*hotplug)(struct class_device *dev, char **envp,230230+ int (*uevent)(struct class_device *dev, char **envp,231231 int num_envp, char *buffer, int buffer_size);232232 char class_id[BUS_ID_SIZE]; /* unique to this class */233233};
···1313#include <linux/time.h>1414#include <linux/list.h>1515#include <linux/device.h>1616+#include <linux/mod_devicetable.h>1617#else1718#include <sys/time.h>1819#include <sys/ioctl.h>···512511#define KEY_FN_S 0x1e3513512#define KEY_FN_B 0x1e4514513514514+/* We avoid low common keys in module aliases so they don't get huge. */515515+#define KEY_MIN_INTERESTING KEY_MUTE515516#define KEY_MAX 0x1ff516517517518/*···796793797794#define FF_MAX 0x7f798795796796+struct input_device_id {797797+798798+ kernel_ulong_t flags;799799+800800+ struct input_id id;801801+802802+ kernel_ulong_t evbit[EV_MAX/BITS_PER_LONG+1];803803+ kernel_ulong_t keybit[KEY_MAX/BITS_PER_LONG+1];804804+ kernel_ulong_t relbit[REL_MAX/BITS_PER_LONG+1];805805+ kernel_ulong_t absbit[ABS_MAX/BITS_PER_LONG+1];806806+ kernel_ulong_t mscbit[MSC_MAX/BITS_PER_LONG+1];807807+ kernel_ulong_t ledbit[LED_MAX/BITS_PER_LONG+1];808808+ kernel_ulong_t sndbit[SND_MAX/BITS_PER_LONG+1];809809+ kernel_ulong_t ffbit[FF_MAX/BITS_PER_LONG+1];810810+ kernel_ulong_t swbit[SW_MAX/BITS_PER_LONG+1];811811+812812+ kernel_ulong_t driver_info;813813+};814814+815815+/*816816+ * Structure for hotplug & device<->driver matching.817817+ */818818+819819+#define INPUT_DEVICE_ID_MATCH_BUS 1820820+#define INPUT_DEVICE_ID_MATCH_VENDOR 2821821+#define INPUT_DEVICE_ID_MATCH_PRODUCT 4822822+#define INPUT_DEVICE_ID_MATCH_VERSION 8823823+824824+#define INPUT_DEVICE_ID_MATCH_EVBIT 0x010825825+#define INPUT_DEVICE_ID_MATCH_KEYBIT 0x020826826+#define INPUT_DEVICE_ID_MATCH_RELBIT 0x040827827+#define INPUT_DEVICE_ID_MATCH_ABSBIT 0x080828828+#define INPUT_DEVICE_ID_MATCH_MSCIT 0x100829829+#define INPUT_DEVICE_ID_MATCH_LEDBIT 0x200830830+#define INPUT_DEVICE_ID_MATCH_SNDBIT 0x400831831+#define INPUT_DEVICE_ID_MATCH_FFBIT 0x800832832+#define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000833833+799834#ifdef __KERNEL__800835801836/*···942901};943902#define to_input_dev(d) container_of(d, struct input_dev, cdev)944903945945-/*946946- * Structure for hotplug & device<->driver matching.947947- */948948-949949-#define INPUT_DEVICE_ID_MATCH_BUS 1950950-#define INPUT_DEVICE_ID_MATCH_VENDOR 2951951-#define INPUT_DEVICE_ID_MATCH_PRODUCT 4952952-#define INPUT_DEVICE_ID_MATCH_VERSION 8953953-954954-#define INPUT_DEVICE_ID_MATCH_EVBIT 0x010955955-#define INPUT_DEVICE_ID_MATCH_KEYBIT 0x020956956-#define INPUT_DEVICE_ID_MATCH_RELBIT 0x040957957-#define INPUT_DEVICE_ID_MATCH_ABSBIT 0x080958958-#define INPUT_DEVICE_ID_MATCH_MSCIT 0x100959959-#define INPUT_DEVICE_ID_MATCH_LEDBIT 0x200960960-#define INPUT_DEVICE_ID_MATCH_SNDBIT 0x400961961-#define INPUT_DEVICE_ID_MATCH_FFBIT 0x800962962-#define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000963963-964904#define INPUT_DEVICE_ID_MATCH_DEVICE\965905 (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT)966906#define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION\967907 (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION)968968-969969-struct input_device_id {970970-971971- unsigned long flags;972972-973973- struct input_id id;974974-975975- unsigned long evbit[NBITS(EV_MAX)];976976- unsigned long keybit[NBITS(KEY_MAX)];977977- unsigned long relbit[NBITS(REL_MAX)];978978- unsigned long absbit[NBITS(ABS_MAX)];979979- unsigned long mscbit[NBITS(MSC_MAX)];980980- unsigned long ledbit[NBITS(LED_MAX)];981981- unsigned long sndbit[NBITS(SND_MAX)];982982- unsigned long ffbit[NBITS(FF_MAX)];983983- unsigned long swbit[NBITS(SW_MAX)];984984-985985- unsigned long driver_info;986986-};987908988909struct input_handle;989910
+34-20
include/linux/kobject.h
···2323#include <linux/spinlock.h>2424#include <linux/rwsem.h>2525#include <linux/kref.h>2626-#include <linux/kobject_uevent.h>2726#include <linux/kernel.h>2827#include <asm/atomic.h>29283030-#define KOBJ_NAME_LEN 202929+#define KOBJ_NAME_LEN 203030+#define UEVENT_HELPER_PATH_LEN 25631313232-/* counter to tag the hotplug event, read only except for the kobject core */3333-extern u64 hotplug_seqnum;3232+/* path to the userspace helper executed on an event */3333+extern char uevent_helper[];3434+3535+/* counter to tag the uevent, read only except for the kobject core */3636+extern u64 uevent_seqnum;3737+3838+/* the actions here must match the proper string in lib/kobject_uevent.c */3939+typedef int __bitwise kobject_action_t;4040+enum kobject_action {4141+ KOBJ_ADD = (__force kobject_action_t) 0x01, /* exclusive to core */4242+ KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* exclusive to core */4343+ KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* device state change */4444+ KOBJ_OFFLINE = (__force kobject_action_t) 0x04, /* device offline */4545+ KOBJ_ONLINE = (__force kobject_action_t) 0x05, /* device online */4646+};34473548struct kobject {3649 const char * k_name;···10087 * of object; multiple ksets can belong to one subsystem. All 10188 * ksets of a subsystem share the subsystem's lock.10289 *103103- * Each kset can support hotplugging; if it does, it will be given104104- * the opportunity to filter out specific kobjects from being105105- * reported, as well as to add its own "data" elements to the106106- * environment being passed to the hotplug helper.9090+ * Each kset can support specific event variables; it can9191+ * supress the event generation or add subsystem specific9292+ * variables carried with the event.10793 */108108-struct kset_hotplug_ops {9494+struct kset_uevent_ops {10995 int (*filter)(struct kset *kset, struct kobject *kobj);11096 const char *(*name)(struct kset *kset, struct kobject *kobj);111111- int (*hotplug)(struct kset *kset, struct kobject *kobj, char **envp,9797+ int (*uevent)(struct kset *kset, struct kobject *kobj, char **envp,11298 int num_envp, char *buffer, int buffer_size);11399};114100···117105 struct list_head list;118106 spinlock_t list_lock;119107 struct kobject kobj;120120- struct kset_hotplug_ops * hotplug_ops;108108+ struct kset_uevent_ops * uevent_ops;121109};122110123111···165153 struct rw_semaphore rwsem;166154};167155168168-#define decl_subsys(_name,_type,_hotplug_ops) \156156+#define decl_subsys(_name,_type,_uevent_ops) \169157struct subsystem _name##_subsys = { \170158 .kset = { \171159 .kobj = { .name = __stringify(_name) }, \172160 .ktype = _type, \173173- .hotplug_ops =_hotplug_ops, \161161+ .uevent_ops =_uevent_ops, \174162 } \175163}176176-#define decl_subsys_name(_varname,_name,_type,_hotplug_ops) \164164+#define decl_subsys_name(_varname,_name,_type,_uevent_ops) \177165struct subsystem _varname##_subsys = { \178166 .kset = { \179167 .kobj = { .name = __stringify(_name) }, \180168 .ktype = _type, \181181- .hotplug_ops =_hotplug_ops, \169169+ .uevent_ops =_uevent_ops, \182170 } \183171}184172···253241extern int subsys_create_file(struct subsystem * , struct subsys_attribute *);254242extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *);255243256256-#ifdef CONFIG_HOTPLUG257257-void kobject_hotplug(struct kobject *kobj, enum kobject_action action);258258-int add_hotplug_env_var(char **envp, int num_envp, int *cur_index,244244+#if defined(CONFIG_HOTPLUG) & defined(CONFIG_NET)245245+void kobject_uevent(struct kobject *kobj, enum kobject_action action);246246+247247+int add_uevent_var(char **envp, int num_envp, int *cur_index,259248 char *buffer, int buffer_size, int *cur_len,260249 const char *format, ...)261250 __attribute__((format (printf, 7, 8)));262251#else263263-static inline void kobject_hotplug(struct kobject *kobj, enum kobject_action action) { }264264-static inline int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, 252252+static inline void kobject_uevent(struct kobject *kobj, enum kobject_action action) { }253253+254254+static inline int add_uevent_var(char **envp, int num_envp, int *cur_index,265255 char *buffer, int buffer_size, int *cur_len, 266256 const char *format, ...)267257{ return 0; }
-57
include/linux/kobject_uevent.h
···11-/*22- * kobject_uevent.h - list of kobject user events that can be generated33- *44- * Copyright (C) 2004 IBM Corp.55- * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>66- *77- * This file is released under the GPLv2.88- *99- */1010-1111-#ifndef _KOBJECT_EVENT_H_1212-#define _KOBJECT_EVENT_H_1313-1414-#define HOTPLUG_PATH_LEN 2561515-1616-/* path to the hotplug userspace helper executed on an event */1717-extern char hotplug_path[];1818-1919-/*2020- * If you add an action here, you must also add the proper string to the2121- * lib/kobject_uevent.c file.2222- */2323-typedef int __bitwise kobject_action_t;2424-enum kobject_action {2525- KOBJ_ADD = (__force kobject_action_t) 0x01, /* add event, for hotplug */2626- KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* remove event, for hotplug */2727- KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* a sysfs attribute file has changed */2828- KOBJ_MOUNT = (__force kobject_action_t) 0x04, /* mount event for block devices */2929- KOBJ_UMOUNT = (__force kobject_action_t) 0x05, /* umount event for block devices */3030- KOBJ_OFFLINE = (__force kobject_action_t) 0x06, /* offline event for hotplug devices */3131- KOBJ_ONLINE = (__force kobject_action_t) 0x07, /* online event for hotplug devices */3232-};3333-3434-3535-#ifdef CONFIG_KOBJECT_UEVENT3636-int kobject_uevent(struct kobject *kobj,3737- enum kobject_action action,3838- struct attribute *attr);3939-int kobject_uevent_atomic(struct kobject *kobj,4040- enum kobject_action action,4141- struct attribute *attr);4242-#else4343-static inline int kobject_uevent(struct kobject *kobj,4444- enum kobject_action action,4545- struct attribute *attr)4646-{4747- return 0;4848-}4949-static inline int kobject_uevent_atomic(struct kobject *kobj,5050- enum kobject_action action,5151- struct attribute *attr)5252-{5353- return 0;5454-}5555-#endif5656-5757-#endif
+1
include/linux/platform_device.h
···4141extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num);4242extern int platform_device_add_data(struct platform_device *pdev, void *data, size_t size);4343extern int platform_device_add(struct platform_device *pdev);4444+extern void platform_device_del(struct platform_device *pdev);4445extern void platform_device_put(struct platform_device *pdev);45464647struct platform_driver {
+1-1
include/linux/sysctl.h
···124124 KERN_OVERFLOWUID=46, /* int: overflow UID */125125 KERN_OVERFLOWGID=47, /* int: overflow GID */126126 KERN_SHMPATH=48, /* string: path to shm fs */127127- KERN_HOTPLUG=49, /* string: path to hotplug policy agent */127127+ KERN_HOTPLUG=49, /* string: path to uevent helper (deprecated) */128128 KERN_IEEE_EMULATION_WARNINGS=50, /* int: unimplemented ieee instructions */129129 KERN_S390_USER_DEBUG_LOGGING=51, /* int: dumps of user faults */130130 KERN_CORE_USES_PID=52, /* int: use core or core.%pid */
+1-1
include/linux/usb.h
···225225 * Device drivers should not attempt to activate configurations. The choice226226 * of which configuration to install is a policy decision based on such227227 * considerations as available power, functionality provided, and the user's228228- * desires (expressed through hotplug scripts). However, drivers can call228228+ * desires (expressed through userspace tools). However, drivers can call229229 * usb_reset_configuration() to reinitialize the current configuration and230230 * all its interfaces.231231 */
+9-27
init/Kconfig
···197197 can be used independently or with another kernel subsystem,198198 such as SELinux.199199200200-config HOTPLUG201201- bool "Support for hot-pluggable devices" if !ARCH_S390202202- default ARCH_S390203203- help204204- This option is provided for the case where no in-kernel-tree205205- modules require HOTPLUG functionality, but a module built206206- outside the kernel tree does. Such modules require Y here.207207-208208-config KOBJECT_UEVENT209209- bool "Kernel Userspace Events" if EMBEDDED210210- depends on NET211211- default y212212- help213213- This option enables the kernel userspace event layer, which is a214214- simple mechanism for kernel-to-user communication over a netlink215215- socket.216216- The goal of the kernel userspace events layer is to provide a simple217217- and efficient events system, that notifies userspace about kobject218218- state changes. This will enable applications to just listen for219219- events instead of polling system devices and files.220220- Hotplug events (kobject addition and removal) are also available on221221- the netlink socket in addition to the execution of /sbin/hotplug if222222- CONFIG_HOTPLUG is enabled.223223-224224- Say Y, unless you are building a system requiring minimal memory225225- consumption.226226-227200config IKCONFIG228201 bool "Kernel .config support"229202 ---help---···280307 reported. KALLSYMS_EXTRA_PASS is only a temporary workaround while281308 you wait for kallsyms to be fixed.282309310310+311311+config HOTPLUG312312+ bool "Support for hot-pluggable devices" if EMBEDDED313313+ default y314314+ help315315+ This option is provided for the case where no hotplug or uevent316316+ capabilities is wanted by the kernel. You should only consider317317+ disabling this option for embedded systems that do not use modules, a318318+ dynamic /dev tree, or dynamic device discovery. Just say Y.283319284320config PRINTK285321 default y