linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Luis Chamberlain <mcgrof@kernel.org>
Cc: bhelgaas@google.com, alex.williamson@redhat.com,
	cohuck@redhat.com, jgg@ziepe.ca, kevin.tian@intel.com,
	eric.auger@redhat.com, giovanni.cabiddu@intel.com,
	mjrosato@linux.ibm.com, jannh@google.com, kvm@vger.kernel.org,
	linux-pci@vger.kernel.org, minchan@kernel.org,
	gregkh@linuxfoundation.org, jeyu@kernel.org, ngupta@vflare.org,
	sergey.senozhatsky.work@gmail.com, axboe@kernel.dk,
	mbenes@suse.com, jpoimboe@redhat.com, tglx@linutronix.de,
	keescook@chromium.org, jikos@kernel.org, rostedt@goodmis.org,
	peterz@infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] pci: export pci_dev_unlock() and the respective unlock
Date: Tue, 22 Jun 2021 09:57:58 -0500	[thread overview]
Message-ID: <20210622145758.GA3336253@bjorn-Precision-5520> (raw)
In-Reply-To: <20210622000310.728294-1-mcgrof@kernel.org>

Please update the subject line to match the convention:

  PCI: Export pci_dev_trylock() and pci_dev_unlock()

On Mon, Jun 21, 2021 at 05:03:09PM -0700, Luis Chamberlain wrote:
> Other places in the kernel use this form, and so just
> provide a common path for it.
> 
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

With tweaks mentioned here:

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

> ---
>  drivers/pci/pci.c   | 6 ++++--
>  include/linux/pci.h | 3 +++
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index f09821af1d2e..b1d9bb3f5ae2 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -5027,7 +5027,7 @@ static void pci_dev_lock(struct pci_dev *dev)
>  }
>  
>  /* Return 1 on successful lock, 0 on contention */
> -static int pci_dev_trylock(struct pci_dev *dev)
> +int pci_dev_trylock(struct pci_dev *dev)
>  {
>  	if (pci_cfg_access_trylock(dev)) {
>  		if (device_trylock(&dev->dev))
> @@ -5037,12 +5037,14 @@ static int pci_dev_trylock(struct pci_dev *dev)
>  
>  	return 0;
>  }
> +EXPORT_SYMBOL_GPL(pci_dev_trylock);
>  
> -static void pci_dev_unlock(struct pci_dev *dev)
> +void pci_dev_unlock(struct pci_dev *dev)
>  {
>  	device_unlock(&dev->dev);
>  	pci_cfg_access_unlock(dev);
>  }
> +EXPORT_SYMBOL_GPL(pci_dev_unlock);
>  
>  static void pci_dev_save_and_disable(struct pci_dev *dev)
>  {
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 6248e044dd29..c55368f58965 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1353,6 +1353,9 @@ int devm_request_pci_bus_resources(struct device *dev,
>  /* Temporary until new and working PCI SBR API in place */
>  int pci_bridge_secondary_bus_reset(struct pci_dev *dev);
>  
> +int pci_dev_trylock(struct pci_dev *dev);
> +void pci_dev_unlock(struct pci_dev *dev);

Move next to pci_cfg_access_lock(), which seems a little more related.

>  #define pci_bus_for_each_resource(bus, res, i)				\
>  	for (i = 0;							\
>  	    (res = pci_bus_resource_n(bus, i)) || i < PCI_BRIDGE_RESOURCE_NUM; \
> -- 
> 2.30.2
> 

      parent reply	other threads:[~2021-06-22 14:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22  0:03 [PATCH 1/2] pci: export pci_dev_unlock() and the respective unlock Luis Chamberlain
2021-06-22  0:03 ` [PATCH 2/2] vfio: use the new pci_dev_trylock() helper to simplify try lock Luis Chamberlain
2021-06-22  7:45 ` [PATCH 1/2] pci: export pci_dev_unlock() and the respective unlock Niklas Schnelle
2021-06-22 14:57 ` Bjorn Helgaas [this message]

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=20210622145758.GA3336253@bjorn-Precision-5520 \
    --to=helgaas@kernel.org \
    --cc=alex.williamson@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=bhelgaas@google.com \
    --cc=cohuck@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=giovanni.cabiddu@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jannh@google.com \
    --cc=jeyu@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=jikos@kernel.org \
    --cc=jpoimboe@redhat.com \
    --cc=keescook@chromium.org \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mbenes@suse.com \
    --cc=mcgrof@kernel.org \
    --cc=minchan@kernel.org \
    --cc=mjrosato@linux.ibm.com \
    --cc=ngupta@vflare.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=tglx@linutronix.de \
    /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 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).