linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] PCI: Make use of PCI_DEVICE_XXX() helper function
@ 2021-07-22 11:19 Cai Huoqing
  2021-07-22 11:19 ` [PATCH 1/2] PCI: Make use of PCI_DEVICE_SUB/_CLASS() " Cai Huoqing
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Cai Huoqing @ 2021-07-22 11:19 UTC (permalink / raw)
  To: bhelgaas, jonathan.derrick, kw, onathan.derrick, lorenzo.pieralisi, robh
  Cc: linux-pci, linux-kernel, Cai Huoqing

Could make use of PCI_DEVICE_XXX() helper function

Cai Huoqing (2):
  PCI: Make use of PCI_DEVICE_SUB/_CLASS() helper function
  PCI: vmd: Make use of PCI_DEVICE_DATA() helper function

 drivers/pci/controller/vmd.c      | 38 +++++++++++++++----------------
 drivers/pci/hotplug/cpqphp_core.c | 13 ++---------
 drivers/pci/search.c              | 14 ++----------
 include/linux/pci_ids.h           |  2 ++
 4 files changed, 25 insertions(+), 42 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] PCI: Make use of PCI_DEVICE_SUB/_CLASS() helper function
  2021-07-22 11:19 [PATCH 0/2] PCI: Make use of PCI_DEVICE_XXX() helper function Cai Huoqing
@ 2021-07-22 11:19 ` Cai Huoqing
  2021-07-22 11:19 ` [PATCH 2/2] PCI: vmd: Make use of PCI_DEVICE_DATA() " Cai Huoqing
  2021-07-22 16:52 ` [PATCH 0/2] PCI: Make use of PCI_DEVICE_XXX() " Bjorn Helgaas
  2 siblings, 0 replies; 6+ messages in thread
From: Cai Huoqing @ 2021-07-22 11:19 UTC (permalink / raw)
  To: bhelgaas, jonathan.derrick, kw, onathan.derrick, lorenzo.pieralisi, robh
  Cc: linux-pci, linux-kernel, Cai Huoqing

We could make use of PCI_DEVICE_SUB/CLASS() helper function

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/pci/hotplug/cpqphp_core.c | 13 ++-----------
 drivers/pci/search.c              | 14 ++------------
 2 files changed, 4 insertions(+), 23 deletions(-)

diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c
index f99a7927e5a8..407206a233c8 100644
--- a/drivers/pci/hotplug/cpqphp_core.c
+++ b/drivers/pci/hotplug/cpqphp_core.c
@@ -1357,18 +1357,9 @@ static void __exit unload_cpqphpd(void)
 }
 
 static const struct pci_device_id hpcd_pci_tbl[] = {
-       {
        /* handle any PCI Hotplug controller */
-       .class =        ((PCI_CLASS_SYSTEM_PCI_HOTPLUG << 8) | 0x00),
-       .class_mask =   ~0,
-
-       /* no matter who makes it */
-       .vendor =       PCI_ANY_ID,
-       .device =       PCI_ANY_ID,
-       .subvendor =    PCI_ANY_ID,
-       .subdevice =    PCI_ANY_ID,
-
-       }, { /* end: all zeroes */ }
+       { PCI_DEVICE_CLASS(((PCI_CLASS_SYSTEM_PCI_HOTPLUG << 8) | 0x00), ~0) },
+       { /* end: all zeroes */ },
 };
 
 MODULE_DEVICE_TABLE(pci, hpcd_pci_tbl);
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index b4c138a6ec02..528c4fe33171 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -303,11 +303,7 @@ struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,
                               struct pci_dev *from)
 {
        struct pci_device_id id = {
-               .vendor = vendor,
-               .device = device,
-               .subvendor = ss_vendor,
-               .subdevice = ss_device,
-       };
+               PCI_DEVICE_SUB(vendor, device, ss_vendor, ss_device) };
 
        return pci_get_dev_by_id(&id, from);
 }
@@ -351,13 +347,7 @@ EXPORT_SYMBOL(pci_get_device);
 struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from)
 {
        struct pci_device_id id = {
-               .vendor = PCI_ANY_ID,
-               .device = PCI_ANY_ID,
-               .subvendor = PCI_ANY_ID,
-               .subdevice = PCI_ANY_ID,
-               .class_mask = PCI_ANY_ID,
-               .class = class,
-       };
+               PCI_DEVICE_CLASS(PCI_ANY_ID, class) };
 
        return pci_get_dev_by_id(&id, from);
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] PCI: vmd: Make use of PCI_DEVICE_DATA() helper function
  2021-07-22 11:19 [PATCH 0/2] PCI: Make use of PCI_DEVICE_XXX() helper function Cai Huoqing
  2021-07-22 11:19 ` [PATCH 1/2] PCI: Make use of PCI_DEVICE_SUB/_CLASS() " Cai Huoqing
@ 2021-07-22 11:19 ` Cai Huoqing
  2021-07-22 16:52 ` [PATCH 0/2] PCI: Make use of PCI_DEVICE_XXX() " Bjorn Helgaas
  2 siblings, 0 replies; 6+ messages in thread
From: Cai Huoqing @ 2021-07-22 11:19 UTC (permalink / raw)
  To: bhelgaas, jonathan.derrick, kw, onathan.derrick, lorenzo.pieralisi, robh
  Cc: linux-pci, linux-kernel, Cai Huoqing

We could make use of PCI_DEVICE_DATA() helper function

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/pci/controller/vmd.c | 38 ++++++++++++++++++------------------
 include/linux/pci_ids.h      |  2 ++
 2 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
index e3fcdfec58b3..565681ed00a1 100644
--- a/drivers/pci/controller/vmd.c
+++ b/drivers/pci/controller/vmd.c
@@ -859,25 +859,25 @@ static int vmd_resume(struct device *dev)
 static SIMPLE_DEV_PM_OPS(vmd_dev_pm_ops, vmd_suspend, vmd_resume);
 
 static const struct pci_device_id vmd_ids[] = {
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_VMD_201D),
-               .driver_data = VMD_FEAT_HAS_MEMBAR_SHADOW_VSCAP,},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_VMD_28C0),
-               .driver_data = VMD_FEAT_HAS_MEMBAR_SHADOW |
-                               VMD_FEAT_HAS_BUS_RESTRICTIONS |
-                               VMD_FEAT_CAN_BYPASS_MSI_REMAP,},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x467f),
-               .driver_data = VMD_FEAT_HAS_MEMBAR_SHADOW_VSCAP |
-                               VMD_FEAT_HAS_BUS_RESTRICTIONS |
-                               VMD_FEAT_OFFSET_FIRST_VECTOR,},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4c3d),
-               .driver_data = VMD_FEAT_HAS_MEMBAR_SHADOW_VSCAP |
-                               VMD_FEAT_HAS_BUS_RESTRICTIONS |
-                               VMD_FEAT_OFFSET_FIRST_VECTOR,},
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_VMD_9A0B),
-               .driver_data = VMD_FEAT_HAS_MEMBAR_SHADOW_VSCAP |
-                               VMD_FEAT_HAS_BUS_RESTRICTIONS |
-                               VMD_FEAT_OFFSET_FIRST_VECTOR,},
-       {0,}
+       { PCI_DEVICE_DATA(INTEL, VMD_201D,
+                         VMD_FEAT_HAS_MEMBAR_SHADOW_VSCAP) },
+       { PCI_DEVICE_DATA(INTEL, VMD_28C0,
+                         VMD_FEAT_HAS_MEMBAR_SHADOW |
+                         VMD_FEAT_HAS_BUS_RESTRICTIONS |
+                         VMD_FEAT_CAN_BYPASS_MSI_REMAP) },
+       { PCI_DEVICE_DATA(INTEL, VMD_467F,
+                         VMD_FEAT_HAS_MEMBAR_SHADOW_VSCAP |
+                         VMD_FEAT_HAS_BUS_RESTRICTIONS |
+                         VMD_FEAT_OFFSET_FIRST_VECTOR) },
+       { PCI_DEVICE_DATA(INTEL, VMD_4C3D,
+                         VMD_FEAT_HAS_MEMBAR_SHADOW_VSCAP |
+                         VMD_FEAT_HAS_BUS_RESTRICTIONS |
+                         VMD_FEAT_OFFSET_FIRST_VECTOR) },
+       { PCI_DEVICE_DATA(INTEL, VMD_9A0B,
+                         VMD_FEAT_HAS_MEMBAR_SHADOW_VSCAP |
+                         VMD_FEAT_HAS_BUS_RESTRICTIONS |
+                         VMD_FEAT_OFFSET_FIRST_VECTOR) },
+       { },
 };
 MODULE_DEVICE_TABLE(pci, vmd_ids);
 
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 4bac1831de80..d25552b5ae3e 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2954,6 +2954,8 @@
 #define PCI_DEVICE_ID_INTEL_SBRIDGE_BR         0x3cf5  /* 13.6 */
 #define PCI_DEVICE_ID_INTEL_SBRIDGE_SAD1       0x3cf6  /* 12.7 */
 #define PCI_DEVICE_ID_INTEL_IOAT_SNB   0x402f
+#define PCI_DEVICE_ID_INTEL_VMD_467F   0x467f
+#define PCI_DEVICE_ID_INTEL_VMD_4C3D   0x4c3d
 #define PCI_DEVICE_ID_INTEL_5100_16    0x65f0
 #define PCI_DEVICE_ID_INTEL_5100_19    0x65f3
 #define PCI_DEVICE_ID_INTEL_5100_21    0x65f5
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] PCI: Make use of PCI_DEVICE_XXX() helper function
  2021-07-22 11:19 [PATCH 0/2] PCI: Make use of PCI_DEVICE_XXX() helper function Cai Huoqing
  2021-07-22 11:19 ` [PATCH 1/2] PCI: Make use of PCI_DEVICE_SUB/_CLASS() " Cai Huoqing
  2021-07-22 11:19 ` [PATCH 2/2] PCI: vmd: Make use of PCI_DEVICE_DATA() " Cai Huoqing
@ 2021-07-22 16:52 ` Bjorn Helgaas
  2021-07-23  1:30   ` Cai,Huoqing
  2 siblings, 1 reply; 6+ messages in thread
From: Bjorn Helgaas @ 2021-07-22 16:52 UTC (permalink / raw)
  To: Cai Huoqing
  Cc: bhelgaas, jonathan.derrick, kw, onathan.derrick,
	lorenzo.pieralisi, robh, linux-pci, linux-kernel

On Thu, Jul 22, 2021 at 07:19:01PM +0800, Cai Huoqing wrote:
> Could make use of PCI_DEVICE_XXX() helper function
> 
> Cai Huoqing (2):
>   PCI: Make use of PCI_DEVICE_SUB/_CLASS() helper function
>   PCI: vmd: Make use of PCI_DEVICE_DATA() helper function
> 
>  drivers/pci/controller/vmd.c      | 38 +++++++++++++++----------------
>  drivers/pci/hotplug/cpqphp_core.c | 13 ++---------
>  drivers/pci/search.c              | 14 ++----------
>  include/linux/pci_ids.h           |  2 ++
>  4 files changed, 25 insertions(+), 42 deletions(-)

When you fix the problem below, also:

s/Make use of/Use/

Update commit log to say what the patch does.  See
https://chris.beams.io/posts/git-commit/ for hints.
Add period at end of sentences.

I don't see exactly what's wrong, but this series doesn't apply
cleanly.  I'm using b4 to fetch the series.  b4 is from
https://git.kernel.org/pub/scm/utils/b4/b4.git

  11:47:04 ~/linux (main)$ git checkout -b wip/cai v5.14-rc1
  Switched to a new branch 'wip/cai'
  11:47:17 ~/linux (wip/cai)$ b4 am -om/ 20210722111903.432-1-caihuoqing@baidu.com
  Looking up https://lore.kernel.org/r/20210722111903.432-1-caihuoqing%40baidu.com
  Grabbing thread from lore.kernel.org/linux-pci
  Analyzing 3 messages in the thread
  ---
  Writing m/20210722_caihuoqing_pci_make_use_of_pci_device_xxx_helper_function.mbx
    [PATCH 1/2] PCI: Make use of PCI_DEVICE_SUB/_CLASS() helper function
    [PATCH 2/2] PCI: vmd: Make use of PCI_DEVICE_DATA() helper function
  ---
  Total patches: 2
  ---
  Cover: m/20210722_caihuoqing_pci_make_use_of_pci_device_xxx_helper_function.cover
   Link: https://lore.kernel.org/r/20210722111903.432-1-caihuoqing@baidu.com
   Base: not found (applies clean to current tree)
	 git am m/20210722_caihuoqing_pci_make_use_of_pci_device_xxx_helper_function.mbx
  11:47:45 ~/linux (wip/cai)$ git am m/20210722_caihuoqing_pci_make_use_of_pci_device_xxx_helper_function.mbx
  Applying: PCI: Make use of PCI_DEVICE_SUB/_CLASS() helper function
  error: patch failed: drivers/pci/hotplug/cpqphp_core.c:1357
  error: drivers/pci/hotplug/cpqphp_core.c: patch does not apply
  error: patch failed: drivers/pci/search.c:303
  error: drivers/pci/search.c: patch does not apply
  Patch failed at 0001 PCI: Make use of PCI_DEVICE_SUB/_CLASS() helper function
  hint: Use 'git am --show-current-patch' to see the failed patch
  When you have resolved this problem, run "git am --continue".
  If you prefer to skip this patch, run "git am --skip" instead.
  To restore the original branch and stop patching, run "git am --abort".


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 0/2] PCI: Make use of PCI_DEVICE_XXX() helper function
  2021-07-22 16:52 ` [PATCH 0/2] PCI: Make use of PCI_DEVICE_XXX() " Bjorn Helgaas
@ 2021-07-23  1:30   ` Cai,Huoqing
  0 siblings, 0 replies; 6+ messages in thread
From: Cai,Huoqing @ 2021-07-23  1:30 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: bhelgaas, jonathan.derrick, kw, lorenzo.pieralisi, robh,
	linux-pci, linux-kernel

Hello
	I get it and will send patch PATCH again.

THX

-----Original Message-----
From: Bjorn Helgaas <helgaas@kernel.org> 
Sent: 2021年7月23日 0:52
To: Cai,Huoqing <caihuoqing@baidu.com>
Cc: bhelgaas@google.com; jonathan.derrick@intel.com; kw@linux.com; onathan.derrick@intel.com; lorenzo.pieralisi@arm.com; robh@kernel.org; linux-pci@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] PCI: Make use of PCI_DEVICE_XXX() helper function

On Thu, Jul 22, 2021 at 07:19:01PM +0800, Cai Huoqing wrote:
> Could make use of PCI_DEVICE_XXX() helper function
> 
> Cai Huoqing (2):
>   PCI: Make use of PCI_DEVICE_SUB/_CLASS() helper function
>   PCI: vmd: Make use of PCI_DEVICE_DATA() helper function
> 
>  drivers/pci/controller/vmd.c      | 38 +++++++++++++++----------------
>  drivers/pci/hotplug/cpqphp_core.c | 13 ++---------
>  drivers/pci/search.c              | 14 ++----------
>  include/linux/pci_ids.h           |  2 ++
>  4 files changed, 25 insertions(+), 42 deletions(-)

When you fix the problem below, also:

s/Make use of/Use/

Update commit log to say what the patch does.  See https://chris.beams.io/posts/git-commit/ for hints.
Add period at end of sentences.

I don't see exactly what's wrong, but this series doesn't apply cleanly.  I'm using b4 to fetch the series.  b4 is from https://git.kernel.org/pub/scm/utils/b4/b4.git

  11:47:04 ~/linux (main)$ git checkout -b wip/cai v5.14-rc1
  Switched to a new branch 'wip/cai'
  11:47:17 ~/linux (wip/cai)$ b4 am -om/ 20210722111903.432-1-caihuoqing@baidu.com
  Looking up https://lore.kernel.org/r/20210722111903.432-1-caihuoqing%40baidu.com
  Grabbing thread from lore.kernel.org/linux-pci
  Analyzing 3 messages in the thread
  ---
  Writing m/20210722_caihuoqing_pci_make_use_of_pci_device_xxx_helper_function.mbx
    [PATCH 1/2] PCI: Make use of PCI_DEVICE_SUB/_CLASS() helper function
    [PATCH 2/2] PCI: vmd: Make use of PCI_DEVICE_DATA() helper function
  ---
  Total patches: 2
  ---
  Cover: m/20210722_caihuoqing_pci_make_use_of_pci_device_xxx_helper_function.cover
   Link: https://lore.kernel.org/r/20210722111903.432-1-caihuoqing@baidu.com
   Base: not found (applies clean to current tree)
	 git am m/20210722_caihuoqing_pci_make_use_of_pci_device_xxx_helper_function.mbx
  11:47:45 ~/linux (wip/cai)$ git am m/20210722_caihuoqing_pci_make_use_of_pci_device_xxx_helper_function.mbx
  Applying: PCI: Make use of PCI_DEVICE_SUB/_CLASS() helper function
  error: patch failed: drivers/pci/hotplug/cpqphp_core.c:1357
  error: drivers/pci/hotplug/cpqphp_core.c: patch does not apply
  error: patch failed: drivers/pci/search.c:303
  error: drivers/pci/search.c: patch does not apply
  Patch failed at 0001 PCI: Make use of PCI_DEVICE_SUB/_CLASS() helper function
  hint: Use 'git am --show-current-patch' to see the failed patch
  When you have resolved this problem, run "git am --continue".
  If you prefer to skip this patch, run "git am --skip" instead.
  To restore the original branch and stop patching, run "git am --abort".


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 0/2] PCI: Make use of PCI_DEVICE_XXX() helper function
@ 2021-07-22 11:29 Cai Huoqing
  0 siblings, 0 replies; 6+ messages in thread
From: Cai Huoqing @ 2021-07-22 11:29 UTC (permalink / raw)
  To: jonathan.derrick; +Cc: linux-pci, linux-kernel, Cai Huoqing

Could make use of PCI_DEVICE_XXX() helper function

Cai Huoqing (2):
  PCI: Make use of PCI_DEVICE_SUB/_CLASS() helper function
  PCI: vmd: Make use of PCI_DEVICE_DATA() helper function

 drivers/pci/controller/vmd.c      | 38 +++++++++++++++----------------
 drivers/pci/hotplug/cpqphp_core.c | 13 ++---------
 drivers/pci/search.c              | 14 ++----------
 include/linux/pci_ids.h           |  2 ++
 4 files changed, 25 insertions(+), 42 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-07-23  1:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-22 11:19 [PATCH 0/2] PCI: Make use of PCI_DEVICE_XXX() helper function Cai Huoqing
2021-07-22 11:19 ` [PATCH 1/2] PCI: Make use of PCI_DEVICE_SUB/_CLASS() " Cai Huoqing
2021-07-22 11:19 ` [PATCH 2/2] PCI: vmd: Make use of PCI_DEVICE_DATA() " Cai Huoqing
2021-07-22 16:52 ` [PATCH 0/2] PCI: Make use of PCI_DEVICE_XXX() " Bjorn Helgaas
2021-07-23  1:30   ` Cai,Huoqing
2021-07-22 11:29 Cai Huoqing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).