]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PNP: Fix ISAPNP to generate uevents to auto-load modules
authorRené Rebe <rene@exactco.de>
Tue, 18 Nov 2025 13:59:42 +0000 (14:59 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 18 Nov 2025 16:35:36 +0000 (17:35 +0100)
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>
drivers/pnp/driver.c

index 7de7aabb275e69ec0025082032bf80a0181585f2..05e9840bc3d4bae950a3112b28c5b6c62e7232ff 100644 (file)
@@ -150,6 +150,24 @@ static void pnp_device_shutdown(struct device *dev)
                drv->shutdown(pnp_dev);
 }
 
+static int pnp_uevent(const struct device *dev, struct kobj_uevent_env *env)
+{
+       struct pnp_id *pos;
+       const struct pnp_dev *pnp_dev = to_pnp_dev(dev);
+
+       if (!dev)
+               return -ENODEV;
+
+       pos = pnp_dev->id;
+       while (pos) {
+               if (add_uevent_var(env, "MODALIAS=pnp:d%s", pos->id))
+                       return -ENOMEM;
+               pos = pos->next;
+       }
+
+       return 0;
+}
+
 static int pnp_bus_match(struct device *dev, const struct device_driver *drv)
 {
        struct pnp_dev *pnp_dev = to_pnp_dev(dev);
@@ -259,6 +277,7 @@ static const struct dev_pm_ops pnp_bus_dev_pm_ops = {
 const struct bus_type pnp_bus_type = {
        .name    = "pnp",
        .match   = pnp_bus_match,
+       .uevent  = pnp_uevent,
        .probe   = pnp_device_probe,
        .remove  = pnp_device_remove,
        .shutdown = pnp_device_shutdown,