From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Frieder Schrempf <frieder.schrempf@kontron.de>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Robin Gong <yibin.gong@nxp.com>
Cc: linux-kernel@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH] regulator: pca9450: use dev_err_probe on errors requesting resources
Date: Tue, 17 Dec 2024 10:05:34 +0100 [thread overview]
Message-ID: <d796d333-5686-455c-a414-8738f9025b7d@pengutronix.de> (raw)
In-Reply-To: <7b91ef22-2996-4e2e-b791-0cfcd4ce1fdd@kontron.de>
Hello Frieder,
On 17.12.24 10:04, Frieder Schrempf wrote:
> On 17.12.24 9:59 AM, Ahmad Fatoum wrote:
>> Probe functions requesting resources may return -EPROBE_DEFER to
>> the driver core to instruct it to retry probe at a later time.
>> This is not unusual and printing an error message unconditionally
>> is just confusing to users:
>>
>> nxp-pca9450 0-0025: Failed to register regulator(buck1): -517
>>
>> Using dev_err_probe remedies this:
>>
>> The error message will only be shown if the error code is not
>> -EPROBE_DEFER and if it is, the deferral reason is saved for display
>> at a later time.
>>
>> Fixes: 0935ff5f1f0a ("regulator: pca9450: add pca9450 pmic driver")
>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>
> There is a similar change already queued in next:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/regulator/pca9450-regulator.c?id=0f5c601098bd3c9cdfea3e01aacdd9d0c4010ea7
Thanks for pointing this out.
Sorry for the noise!
Ahmad
>
>> ---
>> drivers/regulator/pca9450-regulator.c | 25 +++++++++++--------------
>> 1 file changed, 11 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/regulator/pca9450-regulator.c b/drivers/regulator/pca9450-regulator.c
>> index 9714afe347dcc0205b40243252638dff5f9298ad..8f5ba59f7fe52bee1e467a3e6adf81a6a5476221 100644
>> --- a/drivers/regulator/pca9450-regulator.c
>> +++ b/drivers/regulator/pca9450-regulator.c
>> @@ -953,13 +953,10 @@ static int pca9450_i2c_probe(struct i2c_client *i2c)
>> config.dev = pca9450->dev;
>>
>> rdev = devm_regulator_register(pca9450->dev, desc, &config);
>> - if (IS_ERR(rdev)) {
>> - ret = PTR_ERR(rdev);
>> - dev_err(pca9450->dev,
>> - "Failed to register regulator(%s): %d\n",
>> - desc->name, ret);
>> - return ret;
>> - }
>> + if (IS_ERR(rdev))
>> + return dev_err_probe(pca9450->dev, PTR_ERR(rdev),
>> + "Failed to register regulator(%s)\n",
>> + desc->name);
>> }
>>
>> if (pca9450->irq) {
>> @@ -968,9 +965,9 @@ static int pca9450_i2c_probe(struct i2c_client *i2c)
>> (IRQF_TRIGGER_FALLING | IRQF_ONESHOT),
>> "pca9450-irq", pca9450);
>> if (ret != 0) {
>> - dev_err(pca9450->dev, "Failed to request IRQ: %d\n",
>> - pca9450->irq);
>> - return ret;
>> + return dev_err_probe(pca9450->dev, ret,
>> + "Failed to request IRQ: %d\n",
>> + pca9450->irq);
>> }
>> /* Unmask all interrupt except PWRON/WDOG/RSVD */
>> ret = regmap_update_bits(pca9450->regmap, PCA9450_REG_INT1_MSK,
>> @@ -1022,10 +1019,10 @@ static int pca9450_i2c_probe(struct i2c_client *i2c)
>> */
>> pca9450->sd_vsel_gpio = gpiod_get_optional(pca9450->dev, "sd-vsel", GPIOD_OUT_HIGH);
>>
>> - if (IS_ERR(pca9450->sd_vsel_gpio)) {
>> - dev_err(&i2c->dev, "Failed to get SD_VSEL GPIO\n");
>> - return PTR_ERR(pca9450->sd_vsel_gpio);
>> - }
>> + if (IS_ERR(pca9450->sd_vsel_gpio))
>> + return dev_err_probe(&i2c->dev,
>> + PTR_ERR(pca9450->sd_vsel_gpio),
>> + "Failed to get SD_VSEL GPIO\n");
>>
>> dev_info(&i2c->dev, "%s probed.\n",
>> type == PCA9450_TYPE_PCA9450A ? "pca9450a" :
>>
>> ---
>> base-commit: 78d4f34e2115b517bcbfe7ec0d018bbbb6f9b0b8
>> change-id: 20241217-pca9450-dev_err_probe-778149cae5ee
>>
>> Best regards,
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
prev parent reply other threads:[~2024-12-17 9:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-17 8:59 Ahmad Fatoum
2024-12-17 9:04 ` Frieder Schrempf
2024-12-17 9:05 ` Ahmad Fatoum [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=d796d333-5686-455c-a414-8738f9025b7d@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=broonie@kernel.org \
--cc=frieder.schrempf@kontron.de \
--cc=kernel@pengutronix.de \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=yibin.gong@nxp.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®