All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cai Huoqing <caihuoqing@baidu.com>
To: <bhelgaas@google.com>, <jonathan.derrick@intel.com>,
	<kw@linux.com>, <onathan.derrick@intel.com>,
	<lorenzo.pieralisi@arm.com>, <robh@kernel.org>
Cc: <linux-pci@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Cai Huoqing <caihuoqing@baidu.com>
Subject: [PATCH 1/2] PCI: Make use of PCI_DEVICE_SUB/_CLASS() helper function
Date: Thu, 22 Jul 2021 19:19:02 +0800	[thread overview]
Message-ID: <20210722111903.432-2-caihuoqing@baidu.com> (raw)
In-Reply-To: <20210722111903.432-1-caihuoqing@baidu.com>

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


  reply	other threads:[~2021-07-22 11:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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
2021-07-22 11:29 ` [PATCH 1/2] PCI: Make use of PCI_DEVICE_SUB/_CLASS() " Cai Huoqing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210722111903.432-2-caihuoqing@baidu.com \
    --to=caihuoqing@baidu.com \
    --cc=bhelgaas@google.com \
    --cc=jonathan.derrick@intel.com \
    --cc=kw@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=onathan.derrick@intel.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.