From patchwork Tue Sep 9 02:21:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ethan zhao X-Patchwork-Id: 387110 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 64894140192 for ; Tue, 9 Sep 2014 12:24:29 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755825AbaIICXW (ORCPT ); Mon, 8 Sep 2014 22:23:22 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:25495 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755773AbaIICXU (ORCPT ); Mon, 8 Sep 2014 22:23:20 -0400 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s892NBU8016620 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 9 Sep 2014 02:23:12 GMT Received: from userz7022.oracle.com (userz7022.oracle.com [156.151.31.86]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s892NBBJ012826 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 9 Sep 2014 02:23:11 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userz7022.oracle.com (8.14.5+Sun/8.14.4) with ESMTP id s892NA7O006725; Tue, 9 Sep 2014 02:23:10 GMT Received: from etnux.cn.oracle.com (/10.182.70.25) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 08 Sep 2014 19:23:09 -0700 From: Ethan Zhao To: bhelgaas@google.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, gleb@kernel.org, pbonzini@redhat.com, kvm@vger.kernel.org, konrad.wilk@oracle.com, boris.ostrovsky@oracle.com, david.vrabel@citrix.com Cc: alex.williamson@redhat.com, alexander.h.duyck@intel.com, ethan.kernel@gmail.com, Ethan Zhao Subject: [PATCH V4 1/4 resend] PCI: introduce helper functions for device flag operation Date: Tue, 9 Sep 2014 10:21:25 +0800 Message-Id: <1410229288-31829-2-git-send-email-ethan.zhao@oracle.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1410229288-31829-1-git-send-email-ethan.zhao@oracle.com> References: <1410229288-31829-1-git-send-email-ethan.zhao@oracle.com> X-Source-IP: ucsinet21.oracle.com [156.151.31.93] Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org This patch introduced three helper functions to hide direct device flag operation. void pci_set_dev_assigned(struct pci_dev *pdev); void pci_clear_dev_assigned(struct pci_dev *pdev); bool pci_is_dev_assigned(struct pci_dev *pdev); Signed-off-by: Ethan Zhao --- v2: simplify unnecessory ternary operation in function pci_is_dev_assigned(); v3: amend helper functions naming. v4: fix incorrect type in return expression warning. --- include/linux/pci.h | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/include/linux/pci.h b/include/linux/pci.h index 466bcd1..b610ab3 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1829,4 +1829,17 @@ int pci_for_each_dma_alias(struct pci_dev *pdev, */ struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev); +/* helper functions for operation of device flag */ +static inline void pci_set_dev_assigned(struct pci_dev *pdev) +{ + pdev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED; +} +static inline void pci_clear_dev_assigned(struct pci_dev *pdev) +{ + pdev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED; +} +static inline bool pci_is_dev_assigned(struct pci_dev *pdev) +{ + return (pdev->dev_flags & PCI_DEV_FLAGS_ASSIGNED) == PCI_DEV_FLAGS_ASSIGNED; +} #endif /* LINUX_PCI_H */