Re: [PATCH v3 07/23] mailbox: Add RISC-V SBI message proxy (MPXY) based mailbox driver

Thomas Gleixner
2025-05-12T18:54:26Z

On Sun, May 11 2025 at 19:09, Anup Patel wrote:
> +
> +static irqreturn_t mpxy_mbox_irq_event(int irq, void *dev_id)
> +{
> + /* We only have MSI for notification so just wakeup IRQ thread */
> + return IRQ_WAKE_THREAD;

I was idly reading through this because I looked at the irq chip.

This function is competely pointless.

> +}
> +
> +static irqreturn_t mpxy_mbox_irq_thread(int irq, void *dev_id)
> +{
> + mpxy_mbox_peek_data(dev_id);
> + return IRQ_HANDLED;
> +}
> +
> +static int mpxy_mbox_setup_msi(struct mbox_chan *chan,
> + struct mpxy_mbox_channel *mchan)
> +{
> + struct device *dev = mchan->mbox->dev;
> + int rc;
> +
> + /* Do nothing if MSI not supported */
> + if (mchan->msi_irq == U32_MAX)
> + return 0;
> +
> + /* Fail if MSI already enabled */
> + if (mchan->attrs.msi_control)
> + return -EALREADY;
> +
> + /* Request channel MSI handler */
> + rc = request_threaded_irq(mchan->msi_irq,
> + mpxy_mbox_irq_event,
> + mpxy_mbox_irq_thread,
> + 0, dev_name(dev), chan);

Just do:

rc = request_threaded_irq(mchan->msi_irq, NULL, mpxy_mbox_irq_thread,
0, dev_name(dev), chan);

and be done with it. The core code will happily wake up your thread.