lkml.org 
[lkml]   [2021]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2 09/20] power: supply: bq25890: Drop dev->platform_data == NULL check
On Sun, Nov 14, 2021 at 7:04 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> Drop the "if (!dev->platform_data)" check, this seems to be an attempt
> for allowing loading the driver on devices without devicetree stemming
> from the initial commit of the driver (with the presumed intention being
> the "return -ENODEV" else branch getting replaced with something else).
>
> With the new "linux,skip-init" and "linux,read-back-settings" properties
> the driver can actually supports devices without devicetree and this
> check no longer makes sense.
>
> While at it also switch to dev_err_probe(), which is already used in

"While at it, also ..."

> various other places in the driver.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> drivers/power/supply/bq25890_charger.c | 13 +++----------
> 1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
> index a69a2173e31a..2bdfb58cda75 100644
> --- a/drivers/power/supply/bq25890_charger.c
> +++ b/drivers/power/supply/bq25890_charger.c
> @@ -1017,16 +1017,9 @@ static int bq25890_probe(struct i2c_client *client,
> return ret;
> }
>
> - if (!dev->platform_data) {
> - ret = bq25890_fw_probe(bq);
> - if (ret < 0) {
> - dev_err(dev, "Cannot read device properties: %d\n",
> - ret);
> - return ret;
> - }
> - } else {
> - return -ENODEV;
> - }
> + ret = bq25890_fw_probe(bq);
> + if (ret < 0)
> + return dev_err_probe(dev, ret, "reading device properties\n");
>
> ret = bq25890_hw_init(bq);
> if (ret < 0) {
> --
> 2.31.1
>


--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2021-11-16 12:05    [W:0.229 / U:5.612 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site