Skip to content

Commit e96190d

Browse files
rxrblnrafaeljw
authored andcommitted
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>
1 parent 6a23ae0 commit e96190d

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

drivers/pnp/driver.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,24 @@ static void pnp_device_shutdown(struct device *dev)
150150
drv->shutdown(pnp_dev);
151151
}
152152

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+
153171
static int pnp_bus_match(struct device *dev, const struct device_driver *drv)
154172
{
155173
struct pnp_dev *pnp_dev = to_pnp_dev(dev);
@@ -259,6 +277,7 @@ static const struct dev_pm_ops pnp_bus_dev_pm_ops = {
259277
const struct bus_type pnp_bus_type = {
260278
.name = "pnp",
261279
.match = pnp_bus_match,
280+
.uevent = pnp_uevent,
262281
.probe = pnp_device_probe,
263282
.remove = pnp_device_remove,
264283
.shutdown = pnp_device_shutdown,

0 commit comments

Comments
 (0)