Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PNP: Fix ISAPNP to generate uevents to auto-load modules

Currently ISAPNP devices do not generate an uevent for udev to
auto-load the driver modules for Creative SoundBlaster or Gravis
UltraSound to just work.

Signed-off-by: René Rebe <rene@exactco.de>
[ rjw: Subject edits ]
Link: https://patch.msgid.link/20251118.145942.1445519082574147037.rene@exactco.de
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

René Rebe and committed by
Rafael J. Wysocki
e96190da 6a23ae0a

+19
+19
drivers/pnp/driver.c
··· 150 150 drv->shutdown(pnp_dev); 151 151 } 152 152 153 + static int pnp_uevent(const struct device *dev, struct kobj_uevent_env *env) 154 + { 155 + struct pnp_id *pos; 156 + const struct pnp_dev *pnp_dev = to_pnp_dev(dev); 157 + 158 + if (!dev) 159 + return -ENODEV; 160 + 161 + pos = pnp_dev->id; 162 + while (pos) { 163 + if (add_uevent_var(env, "MODALIAS=pnp:d%s", pos->id)) 164 + return -ENOMEM; 165 + pos = pos->next; 166 + } 167 + 168 + return 0; 169 + } 170 + 153 171 static int pnp_bus_match(struct device *dev, const struct device_driver *drv) 154 172 { 155 173 struct pnp_dev *pnp_dev = to_pnp_dev(dev); ··· 277 259 const struct bus_type pnp_bus_type = { 278 260 .name = "pnp", 279 261 .match = pnp_bus_match, 262 + .uevent = pnp_uevent, 280 263 .probe = pnp_device_probe, 281 264 .remove = pnp_device_remove, 282 265 .shutdown = pnp_device_shutdown,