Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp456267pxv; Thu, 22 Jul 2021 04:31:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5rphKXiR6W5OS1HTQhSr6ksuk454+KADLUUBvATZThRVfUH7SkXv5O3Ncp3QJ7vvCfdow X-Received: by 2002:a6b:490d:: with SMTP id u13mr30801888iob.176.1626953461080; Thu, 22 Jul 2021 04:31:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626953461; cv=none; d=google.com; s=arc-20160816; b=xwuNdAL8cf/NcCVODuNtiqgBuKSX7wJE2Qcjd8MeRjs/VDo0G7BcFc59OnpFG+yFu1 J4OonFDsiui5av35/8JH9M7o8MsHufpJbnvdi/BDDSOYQ+huAGTRQcjSUo6+jvZuIhPq 34p44IuZV41fClLJUZH1X/Tee2D2Yz+VoXJgL3ucs9TjidqF4oQPm9dn3ovCVewulC8q 7oGM1waMOPzvS8XOkBDAtyeDjmeZm16faJvQBoNR7N3jqiz8zGq2ocRT05NIs2wglsVI FGSGLll+xCwYIv9gw5V+cxJP2z1x7I1F8OXhaHdE+O4upFncrM3mNEQnjGKMRiqKK03I kKHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=EvznEQG5n6X5AIJWPtk+MBYJKxI/VJebHoAgJR+uytU=; b=Pj5mIlc7E0TzfRWNn4jpKFY+Md68sMvdjfkmpRKlXcHLj8r0l38UJHapMCd4BonWoR m5rZAC6o4nB1mtCKWKwYS6rJ91LJU0Ym2p+BESyH74YNxhvYsqVfqbTsqnepsvpYZo2i EVR4TpD5m+0LprNOkN5QLbKv1qTanRM7Q4tvk8fIMgIwQsWg28bIxoCh3IqEmiHZp962 TN277m9SwU/msKRclNhu2ozopMn5ZJhhhE5SYdzrUhk6c1fHqyXfVAISP6JeYxs1Dl0C JCxwkuuIrreHcBFkq/+X+Y7A3c6rg97piKVW53Tf+eIam4aSTz36XnHyk9IztRTrSghx R1AA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w5si22173225ilu.14.2021.07.22.04.30.48; Thu, 22 Jul 2021 04:31:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231678AbhGVKt2 (ORCPT + 99 others); Thu, 22 Jul 2021 06:49:28 -0400 Received: from mx21.baidu.com ([220.181.3.85]:59642 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231580AbhGVKt2 (ORCPT ); Thu, 22 Jul 2021 06:49:28 -0400 Received: from BC-Mail-Ex16.internal.baidu.com (unknown [172.31.51.56]) by Forcepoint Email with ESMTPS id 137ECB115DAC68B94506; Thu, 22 Jul 2021 19:30:01 +0800 (CST) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-Ex16.internal.baidu.com (172.31.51.56) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.12; Thu, 22 Jul 2021 19:30:00 +0800 Received: from LAPTOP-UKSR4ENP.internal.baidu.com (172.31.63.8) by BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Thu, 22 Jul 2021 19:30:00 +0800 From: Cai Huoqing To: CC: , , Cai Huoqing Subject: [PATCH 1/2] PCI: Make use of PCI_DEVICE_SUB/_CLASS() helper function Date: Thu, 22 Jul 2021 19:29:53 +0800 Message-ID: <20210722112954.477-2-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210722112954.477-1-caihuoqing@baidu.com> References: <20210722112954.477-1-caihuoqing@baidu.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BC-Mail-Ex30.internal.baidu.com (172.31.51.24) To BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We could make use of PCI_DEVICE_SUB/CLASS() helper function Signed-off-by: Cai Huoqing --- 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