linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: "Alexander Kurz" <akurz@blala.de>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Dzmitry Sankouski" <dsankouski@gmail.com>,
	"Dr. David Alan Gilbert" <linux@treblig.org>,
	"Heiko Stuebner" <heiko@sntech.de>,
	"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
	devicetree@vger.kernel.org, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 4/8] mfd: mc13xxx: Use devm_mfd_add_devices and devm_regmap_add_irq_chip
Date: Wed, 17 Sep 2025 11:04:22 +0100	[thread overview]
Message-ID: <20250917100422.GH3893363@google.com> (raw)
In-Reply-To: <fqhldiqylcsp6kp4tvhopxekgszabbemnvbseygkqaipgp5mhl@wtz6c7kjloko>

On Tue, 16 Sep 2025, Dmitry Torokhov wrote:

> Hi Alexander,
> 
> On Sun, Sep 14, 2025 at 07:37:19PM +0000, Alexander Kurz wrote:
> > Use devm_mfd_add_devices() for adding MFD child devices and
> > devm_regmap_add_irq_chip() for IRQ chip registration.
> > 
> > This reduces the amount of required cleanup.
> > 
> > Signed-off-by: Alexander Kurz <akurz@blala.de>
> > ---
> >  drivers/mfd/mc13xxx-core.c | 9 ++++-----
> >  1 file changed, 4 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
> > index 920797b806ce..091c9171b2b7 100644
> > --- a/drivers/mfd/mc13xxx-core.c
> > +++ b/drivers/mfd/mc13xxx-core.c
> > @@ -381,7 +381,7 @@ static int mc13xxx_add_subdevice_pdata(struct mc13xxx *mc13xxx,
> >  	if (!cell.name)
> >  		return -ENOMEM;
> >  
> > -	return mfd_add_devices(mc13xxx->dev, -1, &cell, 1, NULL, 0,
> > +	return devm_mfd_add_devices(mc13xxx->dev, -1, &cell, 1, NULL, 0,
> >  			       regmap_irq_get_domain(mc13xxx->irq_data));
> >  }
> >  
> > @@ -455,8 +455,9 @@ int mc13xxx_common_init(struct device *dev)
> >  	mc13xxx->irq_chip.irqs = mc13xxx->irqs;
> >  	mc13xxx->irq_chip.num_irqs = ARRAY_SIZE(mc13xxx->irqs);
> >  
> > -	ret = regmap_add_irq_chip(mc13xxx->regmap, mc13xxx->irq, IRQF_ONESHOT,
> > -				  0, &mc13xxx->irq_chip, &mc13xxx->irq_data);
> > +	ret = devm_regmap_add_irq_chip(dev, mc13xxx->regmap, mc13xxx->irq,
> > +				       IRQF_ONESHOT, 0, &mc13xxx->irq_chip,
> > +				       &mc13xxx->irq_data);
> >  	if (ret)
> >  		return ret;
> >  
> > @@ -502,8 +503,6 @@ void mc13xxx_common_exit(struct device *dev)
> >  {
> >  	struct mc13xxx *mc13xxx = dev_get_drvdata(dev);
> >  
> > -	mfd_remove_devices(dev);
> > -	regmap_del_irq_chip(mc13xxx->irq, mc13xxx->irq_data);
> >  	mutex_destroy(&mc13xxx->lock);
> 
> This causes the mutex be destroyed while the sub-devices are still
> present. The power button will try to call mc13xxx_lock() and
> mc13xxx_unlock() and of mutex debugging is enabled you'll get errors.
> 
> I'd remove mutex_destroy() as well (and transitively get rid of 
> mc13xxx_common_exit()) and then look into getting rid of  mc13xxx_lock()
> and mc13xxx_unlock() because, as I mentioned in another email, they are
> IMO not needed.
> 
> But this version of the patch is broken as far as I can tell.

Thanks for the input Dmitry.

I have removed the patch until this gets resolved.

-- 
Lee Jones [李琼斯]

  reply	other threads:[~2025-09-17 10:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-14 19:37 [PATCH v4 0/8] Fix, extend and support OF to mc13xxx pwrbutton Alexander Kurz
2025-09-14 19:37 ` [PATCH v4 1/8] dt-bindings: mfd: fsl,mc13xxx: convert txt to DT schema Alexander Kurz
2025-09-14 19:37 ` [PATCH v4 2/8] dt-bindings: mfd: fsl,mc13xxx: add buttons node Alexander Kurz
2025-09-14 19:37 ` [PATCH v4 3/8] Input: mc13783-pwrbutton: use managed resources Alexander Kurz
2025-09-14 19:37 ` [PATCH v4 4/8] mfd: mc13xxx: Use devm_mfd_add_devices and devm_regmap_add_irq_chip Alexander Kurz
2025-09-16 14:44   ` (subset) " Lee Jones
2025-09-16 18:09   ` Dmitry Torokhov
2025-09-17 10:04     ` Lee Jones [this message]
2025-09-18  7:25     ` Alexander Kurz
2025-09-14 19:37 ` [PATCH v4 5/8] Input: mc13783-pwrbutton: fix irq mixup and use resources Alexander Kurz
2025-09-14 19:37 ` [PATCH v4 6/8] Input: mc13783-pwrbutton: convert pdata members to array Alexander Kurz
2025-09-14 19:37 ` [PATCH v4 7/8] Input: mc13783-pwrbutton: enable other mc13xxx PMIC Alexander Kurz
2025-09-14 19:37 ` [PATCH v4 8/8] Input: mc13783-pwrbutton: add OF support Alexander Kurz
2025-09-18 15:43   ` Dmitry Torokhov

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=20250917100422.GH3893363@google.com \
    --to=lee@kernel.org \
    --cc=akurz@blala.de \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=dsankouski@gmail.com \
    --cc=heiko@sntech.de \
    --cc=krzk+dt@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@treblig.org \
    --cc=robh@kernel.org \
    --cc=u.kleine-koenig@baylibre.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;
as well as URLs for NNTP newsgroup(s).