Skip to contentSkip to conversation

PCI: Generate uppercase hex for modalias var in uevent

PATCH In review Ricardo Ribalda Delgado 3 participants 5 messages Dec 2, 2014 – Jan 9, 2015 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: Generate uppercase hex for modalias var in uevent

Some implementations of modprobe fail to load the driver for a PCI device automatically because the "interface" part of the modalias from the kernel is lowercase, and the modalias from file2alias is uppercase.

The "interface" is the low-order byte of the Class Code, defined in PCI r3.0, Appendix D. Most interface types defined in the spec do not use alpha characters, so they won't be affected. For example, 00h, 01h, 10h, 20h, etc. are unaffected.

Print the "interface" byte of the Class Code in uppercase hex, as we already do for the Vendor ID, Device ID, Class, etc.

Commit 89ec3dcf17fd ("PCI: Generate uppercase hex for modalias interface class") fixed only half of the problem. Some udev implementations relays on the uevent file and not in the modalias file.

CC Bjorn Helgaas <[email protected]>
CC Greg Kroah-Hartman <[email protected]>
Fixes d1ded203adf1 ("PCI: add MODALIAS to hotplug event for pci devices")

---

Modified line is >80 char, but I believe that it is better than breaking the string or indent it bad.

 drivers/pci/pci-driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci-driver.c +1 -1
index 2b3c894..b720e78 100644
@@ -1389,7 +1389,7 @@ static int pci_uevent(struct device *dev, struct kobj_uevent_env *env)
 	if (add_uevent_var(env, "PCI_SLOT_NAME=%s", pci_name(pdev)))
 		return -ENOMEM;
 
-	if (add_uevent_var(env, "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x",
+	if (add_uevent_var(env, "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02X",
 			   pdev->vendor, pdev->device,
 			   pdev->subsystem_vendor, pdev->subsystem_device,
 			   (u8)(pdev->class >> 16), (u8)(pdev->class >> 8),
Signature · 1 line
2.1.3
Acked-by on v1 1/1
#1 lore raw
Quoted 16 lines · Ricardo Ribalda Delgado

Some implementations of modprobe fail to load the driver for a PCI device automatically because the "interface" part of the modalias from the kernel is lowercase, and the modalias from file2alias is uppercase.

The "interface" is the low-order byte of the Class Code, defined in PCI r3.0, Appendix D. Most interface types defined in the spec do not use alpha characters, so they won't be affected. For example, 00h, 01h, 10h, 20h, etc. are unaffected.

Print the "interface" byte of the Class Code in uppercase hex, as we already do for the Vendor ID, Device ID, Class, etc.

Commit 89ec3dcf17fd ("PCI: Generate uppercase hex for modalias interface class") fixed only half of the problem. Some udev implementations relays on the uevent file and not in the modalias file.

Quoted 8 lines
CC Bjorn Helgaas <[email protected]>
CC Greg Kroah-Hartman <[email protected]>
Fixes d1ded203adf1 ("PCI: add MODALIAS to hotplug event for pci devices")

---

Modified line is >80 char, but I believe that it is better than breaking the string or indent it bad.

maintainer
#2 lore raw
In reply to Ricardo Ribalda Delgado
Quoted 12 lines · Ricardo Ribalda Delgado

Some implementations of modprobe fail to load the driver for a PCI device automatically because the "interface" part of the modalias from the kernel is lowercase, and the modalias from file2alias is uppercase.

The "interface" is the low-order byte of the Class Code, defined in PCI r3.0, Appendix D. Most interface types defined in the spec do not use alpha characters, so they won't be affected. For example, 00h, 01h, 10h, 20h, etc. are unaffected.

Print the "interface" byte of the Class Code in uppercase hex, as we already do for the Vendor ID, Device ID, Class, etc.

Quoted 8 lines

Commit 89ec3dcf17fd ("PCI: Generate uppercase hex for modalias interface class") fixed only half of the problem. Some udev implementations relays on the uevent file and not in the modalias file.

CC Bjorn Helgaas <[email protected]>
CC Greg Kroah-Hartman <[email protected]>
Fixes d1ded203adf1 ("PCI: add MODALIAS to hotplug event for pci devices")

Applied with Greg's ack to pci/enumeration for v3.20, thanks!

Quoted 24 lines

---

Modified line is >80 char, but I believe that it is better than breaking the string or indent it bad.

 drivers/pci/pci-driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci-driver.c +1 -1
index 2b3c894..b720e78 100644
@@ -1389,7 +1389,7 @@ static int pci_uevent(struct device *dev, struct kobj_uevent_env *env)
 	if (add_uevent_var(env, "PCI_SLOT_NAME=%s", pci_name(pdev)))
 		return -ENOMEM;
 
-	if (add_uevent_var(env, "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x",
+	if (add_uevent_var(env, "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02X",
 			   pdev->vendor, pdev->device,
 			   pdev->subsystem_vendor, pdev->subsystem_device,
 			   (u8)(pdev->class >> 16), (u8)(pdev->class >> 8),
Signature · 1 line
2.1.3
#3 lore raw

Shouldnt this also be backported to stable as Commit 89ec3dcf17fd ("PCI: Generate uppercase hex for modalias interface class")?

Regards!

Quoted 48 lines · Bjorn Helgaas
Quoted 12 lines · Ricardo Ribalda Delgado

Some implementations of modprobe fail to load the driver for a PCI device automatically because the "interface" part of the modalias from the kernel is lowercase, and the modalias from file2alias is uppercase.

The "interface" is the low-order byte of the Class Code, defined in PCI r3.0, Appendix D. Most interface types defined in the spec do not use alpha characters, so they won't be affected. For example, 00h, 01h, 10h, 20h, etc. are unaffected.

Print the "interface" byte of the Class Code in uppercase hex, as we already do for the Vendor ID, Device ID, Class, etc.

Quoted 8 lines

Commit 89ec3dcf17fd ("PCI: Generate uppercase hex for modalias interface class") fixed only half of the problem. Some udev implementations relays on the uevent file and not in the modalias file.

CC Bjorn Helgaas <[email protected]>
CC Greg Kroah-Hartman <[email protected]>
Fixes d1ded203adf1 ("PCI: add MODALIAS to hotplug event for pci devices")

Applied with Greg's ack to pci/enumeration for v3.20, thanks!

Quoted 24 lines

---

Modified line is >80 char, but I believe that it is better than breaking the string or indent it bad.

 drivers/pci/pci-driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci-driver.c +1 -2
index 2b3c894..b720e78 100644
@@ -1389,7 +1389,7 @@ static int pci_uevent(struct device *dev, struct kobj_uevent_env *env)
      if (add_uevent_var(env, "PCI_SLOT_NAME=%s", pci_name(pdev)))
              return -ENOMEM;
 
-     if (add_uevent_var(env, "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x",
+     if (add_uevent_var(env, "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02X",
                         pdev->vendor, pdev->device,
                         pdev->subsystem_vendor, pdev->subsystem_device,
                         (u8)(pdev->class >> 16), (u8)(pdev->class >> 8),
--

2.1.3

Signature · 1 line
Ricardo Ribalda
maintainer
#4 lore raw
Quoted 2 lines · Ricardo Ribalda Delgado

Shouldnt this also be backported to stable as Commit 89ec3dcf17fd ("PCI: Generate uppercase hex for modalias interface class")?

Sure, I added that, thanks for noticing. You can always add the stable tag yourself when posting the patch, too :)

Bjorn

Quoted 54 lines · Bjorn Helgaas
Quoted 40 lines · Ricardo Ribalda Delgado
Quoted 12 lines

Some implementations of modprobe fail to load the driver for a PCI device automatically because the "interface" part of the modalias from the kernel is lowercase, and the modalias from file2alias is uppercase.

The "interface" is the low-order byte of the Class Code, defined in PCI r3.0, Appendix D. Most interface types defined in the spec do not use alpha characters, so they won't be affected. For example, 00h, 01h, 10h, 20h, etc. are unaffected.

Print the "interface" byte of the Class Code in uppercase hex, as we already do for the Vendor ID, Device ID, Class, etc.

Quoted 8 lines

Commit 89ec3dcf17fd ("PCI: Generate uppercase hex for modalias interface class") fixed only half of the problem. Some udev implementations relays on the uevent file and not in the modalias file.

CC Bjorn Helgaas <[email protected]>
CC Greg Kroah-Hartman <[email protected]>
Fixes d1ded203adf1 ("PCI: add MODALIAS to hotplug event for pci devices")

Applied with Greg's ack to pci/enumeration for v3.20, thanks!

Quoted 16 lines

---

Modified line is >80 char, but I believe that it is better than breaking the string or indent it bad.

 drivers/pci/pci-driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci-driver.c +0 -0
index 2b3c894..b720e78 100644
@@ -1389,7 +1389,7 @@ static int pci_uevent(struct device *dev, struct kobj_uevent_env *env)
      if (add_uevent_var(env, "PCI_SLOT_NAME=%s", pci_name(pdev)))
              return -ENOMEM;
 
Quoted 8 lines
Quoted 8 lines
drivers/pci/pci-driver.c +1 -2
-     if (add_uevent_var(env, "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x",
+     if (add_uevent_var(env, "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02X",
                         pdev->vendor, pdev->device,
                         pdev->subsystem_vendor, pdev->subsystem_device,
                         (u8)(pdev->class >> 16), (u8)(pdev->class >> 8),
--

2.1.3

--
Ricardo Ribalda