Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp5132898pxb; Tue, 28 Sep 2021 11:11:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwN0iRaqJtAz0oxhraoHZMKHFYes8kTSYSccCr+7UCA1QtazRcUie2dr+HGmsfzAjbRg0m8 X-Received: by 2002:aa7:953d:0:b0:438:c168:df09 with SMTP id c29-20020aa7953d000000b00438c168df09mr6587315pfp.59.1632852716342; Tue, 28 Sep 2021 11:11:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632852716; cv=none; d=google.com; s=arc-20160816; b=USBvzIphfWDD+x2IKm4rQ8g7WND4M8q4cLn1DYH81vWzJQWoHdRWAPWoTX1+3WmOhU b64I5mGHrssVoTDfGyC1IBDDO4yk4h9kafB35L/w6NJBVcVIzk0Lcqt8mCMMLuRaxivn quikVxmTBrIVluovUuOtGlobc5BddIck9PGvPqbblv867U/FuC4ErzluPnCxkTwB9H/J 0NVLBap9UqEpmrf68ucPsZ7R4fDrP/GGSy3tbrvcxZihlvCFkzYI3xu/vTtt+cQRDQ1z axZ2CNCLQMpcsnCbtf4QOVaiRN2FjS0l+WxUe6OMJdRVYYhp6zpEPeFBNrTUrgW0wP3R 24uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=FzM1xNw7L5pINp8NuMJX3tp61aPgDWateyQRphP4v94=; b=q7o+0lgwGoDf8NNAlc7YycbJnYu1ieyLi9XRX8nwAnDlO6/qKR/TL9DMQOKTsGY1fm ZzkPB71NLKSZTOhXHGqoOyOwPTQowRvOdjZBidUe2s2qBHqCN8hT02L3POOZQ5jqtF6H wJQ3fB0hPk+rFreuxG0FTclkjVHIz85T7zFE1I3VSjZhFI5b6vwFQMG1yRna0kSM46w3 FFxCWBqjvRks/BygwhgDcS7n5P/bGQXt95SpNyRsGmTVL9eUgA5I4bQ3z390ty1zNagL UOv/aCNt2+hcN9yDTMJX6Y5mOfnPLuFJ0I9enEbl7T3kX0DZaU4I2kvMZxC9zNPbvjqo N8dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nG8lgqF5; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x83si26470841pfc.161.2021.09.28.11.11.43; Tue, 28 Sep 2021 11:11:56 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nG8lgqF5; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242064AbhI1SL4 (ORCPT + 99 others); Tue, 28 Sep 2021 14:11:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:51128 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239306AbhI1SLz (ORCPT ); Tue, 28 Sep 2021 14:11:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8FE4061352; Tue, 28 Sep 2021 18:10:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632852615; bh=cT8cQ5HY5tOYrLBIoP7JCa0vC1JePSFeWXunFeRb30U=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=nG8lgqF5GIuVvbIdVUn94n/g0w4MbsgK4azBFTrnPmt2+QCIpE3Cm0URumB0fXGT9 1x2VOnrG1M3AkBpFK3G0P1uq2WP4qOpp22jnxpXjcgg14/OxA8heum5Ij9reQRnW/o O5IkJkgCteYHCy7h5zZNu23QlZQOtHvYQVGEA8MxJ7BQQwfoKoP2AdpfBwxL25KhWG D2vPV+LE51LxW5kGR65Gm202oDAHKlXLtTqVVc2+45CnZ/N2AGaGvC0bVRMgrUtOVT uFjQpQepfCZwSgNMBE6RXEvRJYkg1SOMqY3iVotcQFwLdHsIk0MsOHxWHeVftH65y+ 9j3UJaTZbYLbw== Date: Tue, 28 Sep 2021 13:10:14 -0500 From: Bjorn Helgaas To: Niklas Schnelle Cc: Bjorn Helgaas , Linas Vepstas , Oliver O'Halloran , linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-pci@vger.kernel.org, Matthew Rosato , Pierre Morel Subject: Re: [PATCH v2 3/4] PCI: Export pci_dev_lock() Message-ID: <20210928181014.GA713179@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210916093336.2895602-4-schnelle@linux.ibm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 16, 2021 at 11:33:35AM +0200, Niklas Schnelle wrote: > Commit e3a9b1212b9d ("PCI: Export pci_dev_trylock() and pci_dev_unlock()") > already exported pci_dev_trylock()/pci_dev_unlock() however in some > circumstances such as during error recovery it makes sense to block > waiting to get full access to the device so also export pci_dev_lock(). > > Signed-off-by: Niklas Schnelle Acked-by: Bjorn Helgaas > --- > drivers/pci/pci.c | 3 ++- > include/linux/pci.h | 1 + > 2 files changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > index ce2ab62b64cf..6fe810fdb796 100644 > --- a/drivers/pci/pci.c > +++ b/drivers/pci/pci.c > @@ -5059,12 +5059,13 @@ static int pci_reset_bus_function(struct pci_dev *dev, bool probe) > return pci_parent_bus_reset(dev, probe); > } > > -static void pci_dev_lock(struct pci_dev *dev) > +void pci_dev_lock(struct pci_dev *dev) > { > pci_cfg_access_lock(dev); > /* block PM suspend, driver probe, etc. */ > device_lock(&dev->dev); > } > +EXPORT_SYMBOL_GPL(pci_dev_lock); > > /* Return 1 on successful lock, 0 on contention */ > int pci_dev_trylock(struct pci_dev *dev) > diff --git a/include/linux/pci.h b/include/linux/pci.h > index cd8aa6fce204..c27c8fd1d30c 100644 > --- a/include/linux/pci.h > +++ b/include/linux/pci.h > @@ -1671,6 +1671,7 @@ void pci_cfg_access_lock(struct pci_dev *dev); > bool pci_cfg_access_trylock(struct pci_dev *dev); > void pci_cfg_access_unlock(struct pci_dev *dev); > > +void pci_dev_lock(struct pci_dev *dev); > int pci_dev_trylock(struct pci_dev *dev); > void pci_dev_unlock(struct pci_dev *dev); > > -- > 2.25.1 >