Skip to content

Commit 68d4209

Browse files
andy-shevgregkh
authored andcommitted
sub: cdns3: Use predefined PCI vendor ID constant
The PCI vendor ID for Cadence is defined in pci_ids.h. Use it. While at it, move to PCI_DEVICE() macro and usual pattern for PCI class and device IDs. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240913131710.3630560-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent d2a18bb commit 68d4209

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

drivers/usb/cdns3/cdns3-pci-wrap.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ struct cdns3_wrap {
3737
#define PCI_DRIVER_NAME "cdns3-pci-usbss"
3838
#define PLAT_DRIVER_NAME "cdns-usb3"
3939

40-
#define CDNS_VENDOR_ID 0x17cd
41-
#define CDNS_DEVICE_ID 0x0100
40+
#define PCI_DEVICE_ID_CDNS_USB3 0x0100
4241

4342
static struct pci_dev *cdns3_get_second_fun(struct pci_dev *pdev)
4443
{
@@ -190,7 +189,7 @@ static void cdns3_pci_remove(struct pci_dev *pdev)
190189
}
191190

192191
static const struct pci_device_id cdns3_pci_ids[] = {
193-
{ PCI_DEVICE(CDNS_VENDOR_ID, CDNS_DEVICE_ID), },
192+
{ PCI_VDEVICE(CDNS, PCI_DEVICE_ID_CDNS_USB3) },
194193
{ 0, }
195194
};
196195

drivers/usb/cdns3/cdnsp-pci.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@
2828
#define PCI_DRIVER_NAME "cdns-pci-usbssp"
2929
#define PLAT_DRIVER_NAME "cdns-usbssp"
3030

31-
#define CDNS_VENDOR_ID 0x17cd
32-
#define CDNS_DEVICE_ID 0x0200
33-
#define CDNS_DRD_ID 0x0100
34-
#define CDNS_DRD_IF (PCI_CLASS_SERIAL_USB << 8 | 0x80)
31+
#define PCI_DEVICE_ID_CDNS_USB3 0x0100
32+
#define PCI_DEVICE_ID_CDNS_UDC 0x0200
33+
34+
#define PCI_CLASS_SERIAL_USB_CDNS_USB3 (PCI_CLASS_SERIAL_USB << 8 | 0x80)
35+
#define PCI_CLASS_SERIAL_USB_CDNS_UDC PCI_CLASS_SERIAL_USB_DEVICE
3536

3637
static struct pci_dev *cdnsp_get_second_fun(struct pci_dev *pdev)
3738
{
@@ -40,10 +41,10 @@ static struct pci_dev *cdnsp_get_second_fun(struct pci_dev *pdev)
4041
* Platform has two function. The fist keeps resources for
4142
* Host/Device while the secon keeps resources for DRD/OTG.
4243
*/
43-
if (pdev->device == CDNS_DEVICE_ID)
44-
return pci_get_device(pdev->vendor, CDNS_DRD_ID, NULL);
45-
else if (pdev->device == CDNS_DRD_ID)
46-
return pci_get_device(pdev->vendor, CDNS_DEVICE_ID, NULL);
44+
if (pdev->device == PCI_DEVICE_ID_CDNS_UDC)
45+
return pci_get_device(pdev->vendor, PCI_DEVICE_ID_CDNS_USB3, NULL);
46+
if (pdev->device == PCI_DEVICE_ID_CDNS_USB3)
47+
return pci_get_device(pdev->vendor, PCI_DEVICE_ID_CDNS_UDC, NULL);
4748

4849
return NULL;
4950
}
@@ -220,12 +221,12 @@ static const struct dev_pm_ops cdnsp_pci_pm_ops = {
220221
};
221222

222223
static const struct pci_device_id cdnsp_pci_ids[] = {
223-
{ PCI_VENDOR_ID_CDNS, CDNS_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,
224-
PCI_CLASS_SERIAL_USB_DEVICE, PCI_ANY_ID },
225-
{ PCI_VENDOR_ID_CDNS, CDNS_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,
226-
CDNS_DRD_IF, PCI_ANY_ID },
227-
{ PCI_VENDOR_ID_CDNS, CDNS_DRD_ID, PCI_ANY_ID, PCI_ANY_ID,
228-
CDNS_DRD_IF, PCI_ANY_ID },
224+
{ PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_UDC),
225+
.class = PCI_CLASS_SERIAL_USB_CDNS_UDC },
226+
{ PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_UDC),
227+
.class = PCI_CLASS_SERIAL_USB_CDNS_USB3 },
228+
{ PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_USB3),
229+
.class = PCI_CLASS_SERIAL_USB_CDNS_USB3 },
229230
{ 0, }
230231
};
231232

0 commit comments

Comments
 (0)