linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	LKML <linux-kernel@vger.kernel.org>
Cc: Marc Zyngier <maz@kernel.org>, Jon Mason <jdmason@kudzu.us>,
	Allen Hubbe <allenbh@gmail.com>,
	ntb@lists.linux.dev, Nishanth Menon <nm@ti.com>,
	Tero Kristo <kristo@kernel.org>,
	Santosh Shilimkar <ssantosh@kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org, Haiyang Zhang <haiyangz@microsoft.com>,
	Wei Liu <wei.liu@kernel.org>,
	linux-hyperv@vger.kernel.org, Wei Huang <wei.huang2@amd.com>,
	Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org
Subject: Re: [patch 04/10] NTB/msi: Switch MSI descriptor locking to lock guard()
Date: Mon, 10 Mar 2025 08:18:03 -0700	[thread overview]
Message-ID: <1fe5dc6e-3fa9-41a0-a38e-367fa2cc9475@intel.com> (raw)
In-Reply-To: <20250309084110.394142327@linutronix.de>



On 3/9/25 1:41 AM, Thomas Gleixner wrote:
> Convert the code to use the new guard(msi_descs_lock).
> 
> No functional change intended.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: Jon Mason <jdmason@kudzu.us>
> Cc: Dave Jiang <dave.jiang@intel.com>
> Cc: Allen Hubbe <allenbh@gmail.com>
> Cc: ntb@lists.linux.dev

Acked-by: Dave Jiang <dave.jiang@intel.com>

> ---
>  drivers/ntb/msi.c |   22 ++++++++--------------
>  1 file changed, 8 insertions(+), 14 deletions(-)
> 
> --- a/drivers/ntb/msi.c
> +++ b/drivers/ntb/msi.c
> @@ -106,10 +106,10 @@ int ntb_msi_setup_mws(struct ntb_dev *nt
>  	if (!ntb->msi)
>  		return -EINVAL;
>  
> -	msi_lock_descs(&ntb->pdev->dev);
> -	desc = msi_first_desc(&ntb->pdev->dev, MSI_DESC_ASSOCIATED);
> -	addr = desc->msg.address_lo + ((uint64_t)desc->msg.address_hi << 32);
> -	msi_unlock_descs(&ntb->pdev->dev);
> +	scoped_guard (msi_descs_lock, &ntb->pdev->dev) {
> +		desc = msi_first_desc(&ntb->pdev->dev, MSI_DESC_ASSOCIATED);
> +		addr = desc->msg.address_lo + ((uint64_t)desc->msg.address_hi << 32);
> +	}
>  
>  	for (peer = 0; peer < ntb_peer_port_count(ntb); peer++) {
>  		peer_widx = ntb_peer_highest_mw_idx(ntb, peer);
> @@ -289,7 +289,7 @@ int ntbm_msi_request_threaded_irq(struct
>  	if (!ntb->msi)
>  		return -EINVAL;
>  
> -	msi_lock_descs(dev);
> +	guard(msi_descs_lock)(dev);
>  	msi_for_each_desc(entry, dev, MSI_DESC_ASSOCIATED) {
>  		if (irq_has_action(entry->irq))
>  			continue;
> @@ -307,17 +307,11 @@ int ntbm_msi_request_threaded_irq(struct
>  		ret = ntbm_msi_setup_callback(ntb, entry, msi_desc);
>  		if (ret) {
>  			devm_free_irq(&ntb->dev, entry->irq, dev_id);
> -			goto unlock;
> +			return ret;
>  		}
> -
> -		ret = entry->irq;
> -		goto unlock;
> +		return entry->irq;
>  	}
> -	ret = -ENODEV;
> -
> -unlock:
> -	msi_unlock_descs(dev);
> -	return ret;
> +	return -ENODEV;
>  }
>  EXPORT_SYMBOL(ntbm_msi_request_threaded_irq);
>  
> 


  reply	other threads:[~2025-03-10 15:18 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-09  8:41 [patch 00/10] genirq/msi: Spring cleaning Thomas Gleixner
2025-03-09  8:41 ` [patch 01/10] genirq/msi: Make a few functions static Thomas Gleixner
2025-03-11 17:45   ` Jonathan Cameron
2025-03-09  8:41 ` [patch 02/10] genirq/msi: Use lock guards for MSI descriptor locking Thomas Gleixner
2025-03-11 18:00   ` Jonathan Cameron
2025-03-11 21:26     ` Thomas Gleixner
2025-03-12 15:08       ` Jonathan Cameron
2025-03-12 17:46         ` Thomas Gleixner
2025-03-09  8:41 ` [patch 03/10] soc: ti: ti_sci_inta_msi: Switch MSI descriptor locking to guard() Thomas Gleixner
2025-03-11 18:01   ` Jonathan Cameron
2025-03-12 17:59   ` Nishanth Menon
2025-03-13 12:07   ` Dhruva Gole
2025-03-09  8:41 ` [patch 04/10] NTB/msi: Switch MSI descriptor locking to lock guard() Thomas Gleixner
2025-03-10 15:18   ` Dave Jiang [this message]
2025-03-10 16:34   ` Logan Gunthorpe
2025-03-11 18:02   ` Jonathan Cameron
2025-03-09  8:41 ` [patch 05/10] PCI/MSI: Switch to MSI descriptor locking to guard() Thomas Gleixner
2025-03-11 18:10   ` Jonathan Cameron
2025-03-11 21:45     ` Thomas Gleixner
2025-03-12 15:10       ` Jonathan Cameron
2025-03-09  8:41 ` [patch 06/10] PCI: hv: Switch " Thomas Gleixner
2025-03-10 16:52   ` Wei Liu
2025-03-10 20:33   ` Michael Kelley
2025-03-11 18:10   ` Jonathan Cameron
2025-03-09  8:41 ` [patch 07/10] PCI/MSI: Provide a sane mechanism for TPH Thomas Gleixner
2025-03-09  8:41 ` [patch 08/10] PCI/TPH: Replace the broken MSI-X control word update Thomas Gleixner
2025-03-09  8:41 ` [patch 09/10] scsi: ufs: qcom: Remove the MSI descriptor abuse Thomas Gleixner
2025-03-09  8:41 ` [patch 10/10] genirq/msi: Rename msi_[un]lock_descs() Thomas Gleixner
2025-03-09  8:48   ` Xin Li
2025-03-11 18:14   ` Jonathan Cameron
2025-03-10 16:51 ` [patch 00/10] genirq/msi: Spring cleaning Bjorn Helgaas
2025-03-10 17:31   ` Thomas Gleixner

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=1fe5dc6e-3fa9-41a0-a38e-367fa2cc9475@intel.com \
    --to=dave.jiang@intel.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=allenbh@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=haiyangz@microsoft.com \
    --cc=jdmason@kudzu.us \
    --cc=kristo@kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=martin.petersen@oracle.com \
    --cc=maz@kernel.org \
    --cc=nm@ti.com \
    --cc=ntb@lists.linux.dev \
    --cc=ssantosh@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=wei.huang2@amd.com \
    --cc=wei.liu@kernel.org \
    /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).