Skip to contentSkip to conversation

ohci-pci: use PCI_DEVICE_SUB()

PATCH In review Sergei Shtylyov 2 participants 3 messages Oct 12, 2015 – Oct 17, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ohci-pci: use PCI_DEVICE_SUB()

Toshiba Portege 4000 quirk entry can be written shorter using the PCI_DEVICE_SUB() macro.

---
The patch is against the 'usb-next' branch of Greg KH's 'usb.git' repo.

 drivers/usb/host/ohci-pci.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/usb/host/ohci-pci.c +2 -4
Index: usb/drivers/usb/host/ohci-pci.c
===================================================================
@@ -192,10 +192,8 @@ static const struct pci_device_id ohci_p
 	},
 	{
 		/* Toshiba portege 4000 */
-		.vendor		= PCI_VENDOR_ID_AL,
-		.device		= 0x5237,
-		.subvendor	= PCI_VENDOR_ID_TOSHIBA,
-		.subdevice	= 0x0004,
+		PCI_DEVICE_SUB(PCI_VENDOR_ID_AL, 0x5237,
+			       PCI_VENDOR_ID_TOSHIBA, 0x0004),
 		.driver_data	= (unsigned long) broken_suspend,
 	},
 	{
maintainer
#1 lore raw
Quoted 16 lines · Sergei Shtylyov

Toshiba Portege 4000 quirk entry can be written shorter using the PCI_DEVICE_SUB() macro.

---
The patch is against the 'usb-next' branch of Greg KH's 'usb.git' repo.

 drivers/usb/host/ohci-pci.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Index: usb/drivers/usb/host/ohci-pci.c
===================================================================

drivers/usb/host/ohci-pci.c static const struct pci_device_id ohci_p · line 196

Quoted 9 lines
drivers/usb/host/ohci-pci.c +2 -4
@@ -192,10 +192,8 @@ static const struct pci_device_id ohci_p
 	},
 	{
 		/* Toshiba portege 4000 */
-		.vendor		= PCI_VENDOR_ID_AL,
-		.device		= 0x5237,
-		.subvendor	= PCI_VENDOR_ID_TOSHIBA,
-		.subdevice	= 0x0004,
+		PCI_DEVICE_SUB(PCI_VENDOR_ID_AL, 0x5237,
+			       PCI_VENDOR_ID_TOSHIBA, 0x0004),

But it's much less readable now, right? Why make this change then?

sorry,

greg k-h

#2 lore raw
Quoted 11 lines · Greg KH
Quoted 11 lines

Toshiba Portege 4000 quirk entry can be written shorter using the PCI_DEVICE_SUB() macro.

---
The patch is against the 'usb-next' branch of Greg KH's 'usb.git' repo.

  drivers/usb/host/ohci-pci.c |    6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
Quoted 16 lines
Quoted 5 lines

Index: usb/drivers/usb/host/ohci-pci.c
===================================================================

drivers/usb/host/ohci-pci.c static const struct pci_device_id ohci_p · line 196

Quoted 9 lines
drivers/usb/host/ohci-pci.c +2 -4
@@ -192,10 +192,8 @@ static const struct pci_device_id ohci_p
  	},
  	{
  		/* Toshiba portege 4000 */
-		.vendor		= PCI_VENDOR_ID_AL,
-		.device		= 0x5237,
-		.subvendor	= PCI_VENDOR_ID_TOSHIBA,
-		.subdevice	= 0x0004,
+		PCI_DEVICE_SUB(PCI_VENDOR_ID_AL, 0x5237,
+			       PCI_VENDOR_ID_TOSHIBA, 0x0004),

But it's much less readable now, right?

To me, the field names like sub{vendor|device} also don't seem very
readable, I'd prefer subsys_{vendor|device}. Does your logic extend to using the mere USB_DEVICE() macro too?

Quoted 1 line

Why make this change then?

For brevity's sake. The same reason they called the fields sub{vendor|device}.

Quoted 3 lines

sorry,

greg k-h

MBR, Sergei