Devicetree
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Fabio Estevam <festevam@gmail.com>
Cc: lee@kernel.org, maz@kernel.org, andy@kernel.org,
	dmitry.torokhov@gmail.com, linux-input@vger.kernel.org,
	mfd@lists.linux.dev, linux-iio@vger.kernel.org, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org,
	devicetree@vger.kernel.org, imx@lists.linux.dev,
	stable@vger.kernel.org
Subject: Re: [PATCH v3 2/2] mfd: mxs-lradc: Pass parent IRQs to child drivers
Date: Sat, 14 Nov 2026 02:04:47 +0000	[thread overview]
Message-ID: <20261114020447.7a0b71d5@jic23-hlaptop> (raw)
In-Reply-To: <20261113013212.470981-2-festevam@gmail.com>

On Thu, 12 Nov 2026 22:32:12 -0300
Fabio Estevam <festevam@gmail.com> wrote:

> The MFD driver stores raw DT interrupt indices in IRQ resources but
> registers its child devices without an IRQ domain or IRQ base. The child
> drivers consequently receive the indices as if they were mapped Linux
> IRQ numbers. IRQ index 0 triggers the platform_get_irq_byname() warning:
> 
>   0 is an invalid IRQ number
> 
> The children then try to recover the indices from their resources and
> map them against the parent OF node. Besides duplicating IRQ names in
> the parent and children, this relies on invalid platform IRQ resources
> and fails when IRQ 0 is rejected.
> 
> Resolve the interrupts with platform_get_irq() in the MFD parent and
> store the mapped IRQs in the shared LRADC data. Drop the child IRQ
> resources and duplicated name arrays, and have both child drivers
> request the mapped IRQs directly. Use the MFD memory base support to
> translate a single relative memory resource shared by both cells.
> 
> Tested on an i.MX28 EVK. The mxs-lradc-ts driver probes successfully,
> touch events are reported, and the touch-detect and LRADC channel 7
> interrupt counters increase as expected.
> 
> Cc: stable@vger.kernel.org
> Suggested-by: Lee Jones <lee@kernel.org>
> Closes: https://lore.kernel.org/linux-input/CAOMZO5CgTzo6GuXptD4mFTN=UsJJqpkixDW1Q64gqZGrij8+uQ@mail.gmail.com/
> Fixes: a85a6c86c25b ("driver core: platform: Clarify that IRQ 0 is invalid")
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
For this change
Acked-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
With assumption it'll go through mfd.

However, one of those, whilst you are here comments below....

> diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c
> index 30a66e268169..d16dfea89207 100644
> --- a/drivers/mfd/mxs-lradc.c
> +++ b/drivers/mfd/mxs-lradc.c

>  static int mxs_lradc_probe(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
>  	struct device_node *node = dev->of_node;
> +	const struct mxs_lradc_soc_data *data;
>  	struct mxs_lradc *lradc;
> -	struct mfd_cell *cells = NULL;
>  	struct resource *res;
> +	unsigned int num_cells;
>  	int ret = 0;
>  	u32 ts_wires = 0;
>  
> @@ -137,7 +161,11 @@ static int mxs_lradc_probe(struct platform_device *pdev)
>  	if (!lradc)
>  		return -ENOMEM;
>  
> -	lradc->soc = (kernel_ulong_t)device_get_match_data(&pdev->dev);
> +	data = device_get_match_data(dev);
> +	if (!data)
> +		return -ENODATA;
> +
> +	lradc->soc = data->soc;
>  
>  	lradc->clk = devm_clk_get(&pdev->dev, NULL);

This is what would need changing to fix potential ordering issues with devm / non devm
mixing.

>  	if (IS_ERR(lradc->clk)) {
> @@ -187,38 +215,15 @@ static int mxs_lradc_probe(struct platform_device *pdev)

>  
> -	ret = devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE,
> -				   &cells[TSC_CELL], 1, NULL, 0, NULL);
> +	num_cells = lradc->touchscreen_wire ? ARRAY_SIZE(mxs_lradc_cells) : 1;
> +	ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE,
> +				   mxs_lradc_cells, num_cells, res, 0, NULL);
>  	if (ret) {
> -		dev_err(&pdev->dev,
> -			"Failed to add the touchscreen subdevice\n");
> +		dev_err(dev, "Failed to add subdevices\n");

Not related to what you are changing here, but a devm call with a goto that
follows it is usually an alarm bell...

Can we fix that with a change to devm_clk_get_enabled()?

Jonathan


>  		goto err_clk;
>  	}



      parent reply	other threads:[~2026-11-14  2:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13  1:32 [PATCH v3 1/2] dt-bindings: mfd: mxs-lradc: Fix interrupt order Fabio Estevam
2026-11-13  1:32 ` [PATCH v3 2/2] mfd: mxs-lradc: Pass parent IRQs to child drivers Fabio Estevam
2026-11-13  1:56   ` sashiko-bot
2026-11-13 12:13   ` Andy Shevchenko
2026-11-14  2:04   ` Jonathan Cameron [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=20261114020447.7a0b71d5@jic23-hlaptop \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=stable@vger.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