From: Dan Williams <dan.j.williams@intel.com>
To: Davidlohr Bueso <dave@stgolabs.net>, <dan.j.williams@intel.com>
Cc: <dave.jiang@intel.com>, <alison.schofield@intel.com>,
<vishal.l.verma@intel.com>, <ira.weiny@intel.com>,
<Jonathan.Cameron@huawei.com>, <fan.ni@samsung.com>,
<a.manzanares@samsung.com>, <dave@stgolabs.net>,
<linux-cxl@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH 3/4] cxl/pci: Introduce cxl_request_irq()
Date: Tue, 23 May 2023 11:43:13 -0700 [thread overview]
Message-ID: <646d0941a2a48_afb77294c@dwillia2-xfh.jf.intel.com.notmuch> (raw)
In-Reply-To: <20230523170927.20685-4-dave@stgolabs.net>
Davidlohr Bueso wrote:
> Factor out common functionality/semantics for cxl shared interrupts
> into a new helper on top of devm_request_irq().
>
> Suggested-by: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
> ---
> drivers/cxl/pci.c | 39 +++++++++++++++++++++++----------------
> 1 file changed, 23 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
> index f2039fe0805d..18b8f3ce680c 100644
> --- a/drivers/cxl/pci.c
> +++ b/drivers/cxl/pci.c
> @@ -84,6 +84,27 @@ static int cxl_pci_mbox_wait_for_doorbell(struct cxl_dev_state *cxlds)
> status & CXLMDEV_DEV_FATAL ? " fatal" : "", \
> status & CXLMDEV_FW_HALT ? " firmware-halt" : "")
>
> +struct cxl_dev_id {
> + struct cxl_dev_state *cxlds;
> +};
> +
> +static int cxl_request_irq(struct cxl_dev_state *cxlds, int irq,
> + irq_handler_t handler, irq_handler_t thread_fn)
> +{
> + struct device *dev = cxlds->dev;
> + struct cxl_dev_id *dev_id;
> +
> + /* dev_id must be globally unique and must contain the cxlds */
> + dev_id = devm_kzalloc(dev, sizeof(*dev_id), GFP_KERNEL);
> + if (!dev_id)
> + return -ENOMEM;
> + dev_id->cxlds = cxlds;
> +
> + return devm_request_threaded_irq(dev, irq, handler, thread_fn,
> + IRQF_SHARED | IRQF_ONESHOT,
> + NULL, dev_id);
I was going to say drop the IRQF_ONESHOT in the case where @thread_fn is
NULL, but I could not convince myself that was safe. I assume that
pci_request_irq() gets away with that because most drivers are not
mixing combinations of @handler and @thread_fn being set to NULL.
So, with that, this looks good to me.
next prev parent reply other threads:[~2023-05-23 18:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-23 17:09 [PATCH v3 0/4] cxl: Handle background commands Davidlohr Bueso
2023-05-23 17:09 ` [PATCH 1/4] rcuwait: Support timeouts Davidlohr Bueso
2023-05-23 17:09 ` [PATCH 2/4] cxl/pci: Allocate irq vectors earlier during probe Davidlohr Bueso
2023-05-23 17:09 ` [PATCH 3/4] cxl/pci: Introduce cxl_request_irq() Davidlohr Bueso
2023-05-23 18:43 ` Dan Williams [this message]
2023-05-23 17:09 ` [PATCH 4/4] cxl/mbox: Add background cmd handling machinery Davidlohr Bueso
2023-05-23 21:03 ` [PATCH v3 0/4] cxl: Handle background commands Dan Williams
2023-05-23 21:59 ` Davidlohr Bueso
2023-05-24 4:19 ` Dan Williams
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=646d0941a2a48_afb77294c@dwillia2-xfh.jf.intel.com.notmuch \
--to=dan.j.williams@intel.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=a.manzanares@samsung.com \
--cc=alison.schofield@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=fan.ni@samsung.com \
--cc=ira.weiny@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vishal.l.verma@intel.com \
/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
all inboxes | Powered by JetHome®