public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Marek Vasut <marex@denx.de>, Sebastian Reichel <sre@kernel.org>
Cc: linux-pm@vger.kernel.org
Subject: Re: [PATCH v2 2/2] power: supply: bq25890: Add new linux,iinlim-percentage property
Date: Wed, 25 Jan 2023 14:12:52 +0100	[thread overview]
Message-ID: <ef4088fc-e17e-40aa-3446-2f08c51d809b@redhat.com> (raw)
In-Reply-To: <bce44755-9a27-74e4-47ae-ee8051780575@denx.de>

Hi Marek,

On 1/25/23 14:02, Marek Vasut wrote:
> On 1/25/23 11:58, Hans de Goede wrote:
> 
> [...]
> 
>> @@ -1390,6 +1404,17 @@ static int bq25890_fw_probe(struct bq25890_device *bq)
>>       device_property_read_u32(bq->dev, "linux,pump-express-vbus-max",
>>                    &bq->pump_express_vbus_max);
>>   +    ret = device_property_read_u32(bq->dev, "linux,iinlim-percentage", &val);
>> +    if (ret == 0) {
>> +        if (val > 100) {
>> +            dev_err(bq->dev, "Error linux,iinlim-percentage %u > 100\n", val);
>> +            return -EINVAL;
>> +        }
>> +        bq->iinlim_percentage = val;
>> +    } else {
>> +        bq->iinlim_percentage = 100;
>> +    }
> 
> Should we really return -EINVAL if > 100 % or shall we clamp the value instead ?

Either one will work, returning -EINVAL frpm probe() for invalid property
values is something other drivers do to AFAIK.

I don't really have a preference either way.

Regards,

Hans


  reply	other threads:[~2023-01-25 13:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-25 10:58 [PATCH v2 0/2] power: supply: bq25890: Remaining dual-charger support patches Hans de Goede
2023-01-25 10:58 ` [PATCH v2 1/2] power: supply: bq25890: Add support for having a secondary charger IC Hans de Goede
2023-01-25 10:58 ` [PATCH v2 2/2] power: supply: bq25890: Add new linux,iinlim-percentage property Hans de Goede
2023-01-25 13:02   ` Marek Vasut
2023-01-25 13:12     ` Hans de Goede [this message]
2023-01-25 13:44       ` Marek Vasut
2023-01-29 23:48 ` [PATCH v2 0/2] power: supply: bq25890: Remaining dual-charger support patches Sebastian Reichel

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=ef4088fc-e17e-40aa-3446-2f08c51d809b@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=sre@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