lkml.org 
[lkml]   [2023]   [Jan]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 2/5] iio: pressure: bmp280: Add preinit callback
From
Date
On Tue, 2022-12-27 at 23:41 +0200, Andy Shevchenko wrote:
> On Mon, Dec 26, 2022 at 03:29:21PM +0100, Angel Iglesias wrote:
> > Adds preinit callback to execute operations on probe before applying
> > initial configuration.
>
> ...
>
> > @@ -935,6 +936,7 @@ static const struct bmp280_chip_info bmp280_chip_info =
> > {
> >         .read_temp = bmp280_read_temp,
> >         .read_press = bmp280_read_press,
> >         .read_calib = bmp280_read_calib,
> > +       .preinit = NULL,
> >  };
> >  
> >  static int bme280_chip_config(struct bmp280_data *data)
> > @@ -979,6 +981,7 @@ static const struct bmp280_chip_info bme280_chip_info =
> > {
> >         .read_press = bmp280_read_press,
> >         .read_humid = bmp280_read_humid,
> >         .read_calib = bme280_read_calib,
> > +       .preinit = NULL,
> >  };
>
> Useless changes.
>
> ...
>
> > @@ -1604,6 +1614,7 @@ static const struct bmp280_chip_info bmp180_chip_info
> > = {
> >         .read_temp = bmp180_read_temp,
> >         .read_press = bmp180_read_press,
> >         .read_calib = bmp180_read_calib,
> > +       .preinit = NULL,
> >  };
>
> Ditto.
>
> ...
>
> > +       /*
> > +        * Some chips like the BMP3xx have preinit tasks to run
> > +        * before applying the initial configuration.
> > +        */
> > +       if (data->chip_info->preinit) {
> > +               ret = data->chip_info->preinit(data);
>
> > +               dev_err(dev, "error running preinit tasks");
>
> Huh?! I guess you wanted

The dangers of copying paste and rushing things etc. Sorry for this brain fart!

Thanks for your time,
Angel

> >                 if (ret < 0)
> >                         return ret;
>
>         if (ret < 0)
>                 return dev_err_probe(...);
>
> >         }
>

\
 
 \ /
  Last update: 2023-03-26 23:24    [W:0.074 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site