* [PATCH v1] PCI: Add PCI_DEVICE_DATA() macro to fully describe device ID entry
@ 2018-07-27 20:39 Andy Shevchenko
2018-07-27 20:41 ` Andy Shevchenko
2018-07-29 0:29 ` Joe Perches
0 siblings, 2 replies; 6+ messages in thread
From: Andy Shevchenko @ 2018-07-27 20:39 UTC (permalink / raw)
To: Stanislaw Gruszka, Helmut Schaa, linux-wireless, Bjorn Helgaas,
linux-pci
Cc: Andy Shevchenko
There are a lot of examples in the kernel where PCI_VDEVICE() is used and still
looks not so convenient due to additional driver_data field attached.
Introduce PCI_DEVICE_DATA() macro to fully describe device ID entry in shortest
possible form. For example,
before:
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MRFLD),
(kernel_ulong_t) &dwc3_pci_mrfld_properties, },
after:
{ PCI_VDEVICE(INTEL, INTEL_MRFLD, &dwc3_pci_mrfld_properties },
Drivers can be converted later on in independent way.
While here, remove the unused macro with the same name
from Ralink wireless driver.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/net/wireless/ralink/rt2x00/rt2x00pci.h | 6 ------
include/linux/pci.h | 15 +++++++++++++++
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00pci.h b/drivers/net/wireless/ralink/rt2x00/rt2x00pci.h
index bc0ca5f58f38..283e2e607bba 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00pci.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00pci.h
@@ -27,12 +27,6 @@
#include <linux/io.h>
#include <linux/pci.h>
-/*
- * This variable should be used with the
- * pci_driver structure initialization.
- */
-#define PCI_DEVICE_DATA(__ops) .driver_data = (kernel_ulong_t)(__ops)
-
/*
* PCI driver handlers.
*/
diff --git a/include/linux/pci.h b/include/linux/pci.h
index d0961aefdbae..af29a32865c5 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -825,6 +825,21 @@ struct pci_driver {
.vendor = PCI_VENDOR_ID_##vend, .device = (dev), \
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0
+/**
+ * PCI_DEVICE_DATA - macro used to describe a specific PCI device in very short form
+ * @vend: the vendor name
+ * @dev: the device name (without PCI_DEVICE_ID_ prefix)
+ * @data: the driver data to be filled
+ *
+ * This macro is used to create a struct pci_device_id that matches a
+ * specific PCI device. The subvendor, and subdevice fields will be set
+ * to PCI_ANY_ID.
+ */
+#define PCI_DEVICE_DATA(vend, dev, data) \
+ .vendor = PCI_VENDOR_ID_##vend, .device = PCI_DEVICE_ID_##dev, \
+ .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0 \
+ .driver_data = (kernel_ulong_t)(data)
+
enum {
PCI_REASSIGN_ALL_RSRC = 0x00000001, /* Ignore firmware setup */
PCI_REASSIGN_ALL_BUS = 0x00000002, /* Reassign all bus numbers */
--
2.18.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v1] PCI: Add PCI_DEVICE_DATA() macro to fully describe device ID entry
2018-07-27 20:39 [PATCH v1] PCI: Add PCI_DEVICE_DATA() macro to fully describe device ID entry Andy Shevchenko
@ 2018-07-27 20:41 ` Andy Shevchenko
2018-07-27 20:42 ` Randy Dunlap
2018-07-29 0:29 ` Joe Perches
1 sibling, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2018-07-27 20:41 UTC (permalink / raw)
To: Stanislaw Gruszka, Helmut Schaa, linux-wireless, Bjorn Helgaas,
linux-pci
On Fri, 2018-07-27 at 23:39 +0300, Andy Shevchenko wrote:
> There are a lot of examples in the kernel where PCI_VDEVICE() is used
> and still
> looks not so convenient due to additional driver_data field attached.
>
> Introduce PCI_DEVICE_DATA() macro to fully describe device ID entry in
> shortest
> possible form. For example,
>
> before:
>
> { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MRFLD),
> (kernel_ulong_t) &dwc3_pci_mrfld_properties, },
>
> after:
>
> { PCI_VDEVICE(INTEL, INTEL_MRFLD, &dwc3_pci_mrfld_properties },
>
> Drivers can be converted later on in independent way.
>
> While here, remove the unused macro with the same name
> from Ralink wireless driver.
Skip this, it missed one comma.
Will send v2 soon.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/net/wireless/ralink/rt2x00/rt2x00pci.h | 6 ------
> include/linux/pci.h | 15 +++++++++++++++
> 2 files changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00pci.h
> b/drivers/net/wireless/ralink/rt2x00/rt2x00pci.h
> index bc0ca5f58f38..283e2e607bba 100644
> --- a/drivers/net/wireless/ralink/rt2x00/rt2x00pci.h
> +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00pci.h
> @@ -27,12 +27,6 @@
> #include <linux/io.h>
> #include <linux/pci.h>
>
> -/*
> - * This variable should be used with the
> - * pci_driver structure initialization.
> - */
> -#define PCI_DEVICE_DATA(__ops) .driver_data =
> (kernel_ulong_t)(__ops)
> -
> /*
> * PCI driver handlers.
> */
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index d0961aefdbae..af29a32865c5 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -825,6 +825,21 @@ struct pci_driver {
> .vendor = PCI_VENDOR_ID_##vend, .device = (dev), \
> .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0
>
> +/**
> + * PCI_DEVICE_DATA - macro used to describe a specific PCI device in
> very short form
> + * @vend: the vendor name
> + * @dev: the device name (without PCI_DEVICE_ID_ prefix)
> + * @data: the driver data to be filled
> + *
> + * This macro is used to create a struct pci_device_id that matches a
> + * specific PCI device. The subvendor, and subdevice fields will be
> set
> + * to PCI_ANY_ID.
> + */
> +#define PCI_DEVICE_DATA(vend, dev, data) \
> + .vendor = PCI_VENDOR_ID_##vend, .device =
> PCI_DEVICE_ID_##dev, \
> + .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0 \
> + .driver_data = (kernel_ulong_t)(data)
> +
> enum {
> PCI_REASSIGN_ALL_RSRC = 0x00000001, /* Ignore
> firmware setup */
> PCI_REASSIGN_ALL_BUS = 0x00000002, /* Reassign
> all bus numbers */
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] PCI: Add PCI_DEVICE_DATA() macro to fully describe device ID entry
2018-07-27 20:41 ` Andy Shevchenko
@ 2018-07-27 20:42 ` Randy Dunlap
2018-07-27 20:46 ` Andy Shevchenko
0 siblings, 1 reply; 6+ messages in thread
From: Randy Dunlap @ 2018-07-27 20:42 UTC (permalink / raw)
To: Andy Shevchenko, Stanislaw Gruszka, Helmut Schaa, linux-wireless,
Bjorn Helgaas, linux-pci
On 07/27/2018 01:41 PM, Andy Shevchenko wrote:
> On Fri, 2018-07-27 at 23:39 +0300, Andy Shevchenko wrote:
>> There are a lot of examples in the kernel where PCI_VDEVICE() is used
>> and still
>> looks not so convenient due to additional driver_data field attached.
>>
>> Introduce PCI_DEVICE_DATA() macro to fully describe device ID entry in
>> shortest
>> possible form. For example,
>>
>> before:
>>
>> { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MRFLD),
>> (kernel_ulong_t) &dwc3_pci_mrfld_properties, },
>>
>> after:
>>
>> { PCI_VDEVICE(INTEL, INTEL_MRFLD, &dwc3_pci_mrfld_properties },
>>
>> Drivers can be converted later on in independent way.
>>
>> While here, remove the unused macro with the same name
>> from Ralink wireless driver.
>
> Skip this, it missed one comma.
s/comma/right paren/ ??
> Will send v2 soon.
>
>>
>> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>> ---
>> drivers/net/wireless/ralink/rt2x00/rt2x00pci.h | 6 ------
>> include/linux/pci.h | 15 +++++++++++++++
>> 2 files changed, 15 insertions(+), 6 deletions(-)
--
~Randy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] PCI: Add PCI_DEVICE_DATA() macro to fully describe device ID entry
2018-07-27 20:42 ` Randy Dunlap
@ 2018-07-27 20:46 ` Andy Shevchenko
0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2018-07-27 20:46 UTC (permalink / raw)
To: Randy Dunlap, Stanislaw Gruszka, Helmut Schaa, linux-wireless,
Bjorn Helgaas, linux-pci
On Fri, 2018-07-27 at 13:42 -0700, Randy Dunlap wrote:
> On 07/27/2018 01:41 PM, Andy Shevchenko wrote:
> > On Fri, 2018-07-27 at 23:39 +0300, Andy Shevchenko wrote:
> > > There are a lot of examples in the kernel where PCI_VDEVICE() is
> > > used
> > > and still
> > > looks not so convenient due to additional driver_data field
> > > attached.
> > >
> > > Introduce PCI_DEVICE_DATA() macro to fully describe device ID
> > > entry in
> > > shortest
> > > possible form. For example,
> > >
> > > before:
> > >
> > > { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MRFLD),
> > > (kernel_ulong_t) &dwc3_pci_mrfld_properties, },
> > >
> > > after:
> > >
> > > { PCI_VDEVICE(INTEL, INTEL_MRFLD, &dwc3_pci_mrfld_properties
> > > },
> > >
> > > Drivers can be converted later on in independent way.
> > >
> > > While here, remove the unused macro with the same name
> > > from Ralink wireless driver.
> >
> > Skip this, it missed one comma.
>
> s/comma/right paren/ ??
comma in the code and you are right about commit message. Btw, it missed
rename as well there.
Thanks for spotting this!
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] PCI: Add PCI_DEVICE_DATA() macro to fully describe device ID entry
2018-07-27 20:39 [PATCH v1] PCI: Add PCI_DEVICE_DATA() macro to fully describe device ID entry Andy Shevchenko
2018-07-27 20:41 ` Andy Shevchenko
@ 2018-07-29 0:29 ` Joe Perches
2018-07-29 1:11 ` Randy Dunlap
1 sibling, 1 reply; 6+ messages in thread
From: Joe Perches @ 2018-07-29 0:29 UTC (permalink / raw)
To: Andy Shevchenko, Stanislaw Gruszka, Helmut Schaa, linux-wireless,
Bjorn Helgaas, linux-pci
On Fri, 2018-07-27 at 23:39 +0300, Andy Shevchenko wrote:
> There are a lot of examples in the kernel where PCI_VDEVICE() is used and still
> looks not so convenient due to additional driver_data field attached.
>
> Introduce PCI_DEVICE_DATA() macro to fully describe device ID entry in shortest
> possible form. For example,
>
> before:
>
> { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MRFLD),
> (kernel_ulong_t) &dwc3_pci_mrfld_properties, },
>
> after:
>
> { PCI_VDEVICE(INTEL, INTEL_MRFLD, &dwc3_pci_mrfld_properties },
PCI_DEVICE_DATA(...)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] PCI: Add PCI_DEVICE_DATA() macro to fully describe device ID entry
2018-07-29 0:29 ` Joe Perches
@ 2018-07-29 1:11 ` Randy Dunlap
0 siblings, 0 replies; 6+ messages in thread
From: Randy Dunlap @ 2018-07-29 1:11 UTC (permalink / raw)
To: Joe Perches, Andy Shevchenko, Stanislaw Gruszka, Helmut Schaa,
linux-wireless, Bjorn Helgaas, linux-pci
On 07/28/2018 05:29 PM, Joe Perches wrote:
> On Fri, 2018-07-27 at 23:39 +0300, Andy Shevchenko wrote:
>> There are a lot of examples in the kernel where PCI_VDEVICE() is used and still
>> looks not so convenient due to additional driver_data field attached.
>>
>> Introduce PCI_DEVICE_DATA() macro to fully describe device ID entry in shortest
>> possible form. For example,
>>
>> before:
>>
>> { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MRFLD),
>> (kernel_ulong_t) &dwc3_pci_mrfld_properties, },
>>
>> after:
>>
>> { PCI_VDEVICE(INTEL, INTEL_MRFLD, &dwc3_pci_mrfld_properties },
>
> PCI_DEVICE_DATA(...)
>
see v2 and v3 :)
--
~Randy
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-07-29 2:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-27 20:39 [PATCH v1] PCI: Add PCI_DEVICE_DATA() macro to fully describe device ID entry Andy Shevchenko
2018-07-27 20:41 ` Andy Shevchenko
2018-07-27 20:42 ` Randy Dunlap
2018-07-27 20:46 ` Andy Shevchenko
2018-07-29 0:29 ` Joe Perches
2018-07-29 1:11 ` Randy Dunlap
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox