lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210622145758.GA3336253@bjorn-Precision-5520>
Date:   Tue, 22 Jun 2021 09:57:58 -0500
From:   Bjorn Helgaas <helgaas@...nel.org>
To:     Luis Chamberlain <mcgrof@...nel.org>
Cc:     bhelgaas@...gle.com, alex.williamson@...hat.com, cohuck@...hat.com,
        jgg@...pe.ca, kevin.tian@...el.com, eric.auger@...hat.com,
        giovanni.cabiddu@...el.com, mjrosato@...ux.ibm.com,
        jannh@...gle.com, kvm@...r.kernel.org, linux-pci@...r.kernel.org,
        minchan@...nel.org, gregkh@...uxfoundation.org, jeyu@...nel.org,
        ngupta@...are.org, sergey.senozhatsky.work@...il.com,
        axboe@...nel.dk, mbenes@...e.com, jpoimboe@...hat.com,
        tglx@...utronix.de, keescook@...omium.org, jikos@...nel.org,
        rostedt@...dmis.org, peterz@...radead.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] pci: export pci_dev_unlock() and the respective
 unlock

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@...nel.org>

With tweaks mentioned here:

Acked-by: Bjorn Helgaas <bhelgaas@...gle.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
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ