diff mbox series

[2/3] iio: adc: ltc2309: switch to new .probe()

Message ID 20230824-ltc2309-v1-2-b87b4eb8030c@gmail.com (mailing list archive)
State Changes Requested
Headers show
Series iio: adc: add LTC2309 support | expand

Commit Message

Liam Beguin Aug. 24, 2023, 4:55 p.m. UTC
Recent changes to the I2C subsystem removed the id parameter of the
probe function. Update driver to use the new prototype, and keep this as
an independent commit to facilitate backporting.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
---
 drivers/iio/adc/ltc2309.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Krzysztof Kozlowski Aug. 24, 2023, 6:01 p.m. UTC | #1
On 24/08/2023 18:55, Liam Beguin wrote:
> Recent changes to the I2C subsystem removed the id parameter of the
> probe function. Update driver to use the new prototype, and keep this as
> an independent commit to facilitate backporting.
> 
> Signed-off-by: Liam Beguin <liambeguin@gmail.com>
> ---
>  drivers/iio/adc/ltc2309.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/ltc2309.c b/drivers/iio/adc/ltc2309.c
> index ee1fd9b82e2a..d26bbd70b0ff 100644
> --- a/drivers/iio/adc/ltc2309.c
> +++ b/drivers/iio/adc/ltc2309.c
> @@ -158,8 +158,7 @@ static const struct iio_info ltc2309_info = {
>  	.read_raw = ltc2309_read_raw,
>  };
>  
> -static int ltc2309_probe(struct i2c_client *client,
> -			 const struct i2c_device_id *id)
> +static int ltc2309_probe(struct i2c_client *client)

This patch does not make sense. Do not send patch (1/3) which does not
compile and is buggy, just to immediately fix it. We do not add known
wrong code.

Best regards,
Krzysztof
Liam Beguin Aug. 24, 2023, 7:38 p.m. UTC | #2
On Thu, Aug 24, 2023 at 08:01:01PM +0200, Krzysztof Kozlowski wrote:
> On 24/08/2023 18:55, Liam Beguin wrote:
> > Recent changes to the I2C subsystem removed the id parameter of the
> > probe function. Update driver to use the new prototype, and keep this as
> > an independent commit to facilitate backporting.
> > 
> > Signed-off-by: Liam Beguin <liambeguin@gmail.com>
> > ---
> >  drivers/iio/adc/ltc2309.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iio/adc/ltc2309.c b/drivers/iio/adc/ltc2309.c
> > index ee1fd9b82e2a..d26bbd70b0ff 100644
> > --- a/drivers/iio/adc/ltc2309.c
> > +++ b/drivers/iio/adc/ltc2309.c
> > @@ -158,8 +158,7 @@ static const struct iio_info ltc2309_info = {
> >  	.read_raw = ltc2309_read_raw,
> >  };
> >  
> > -static int ltc2309_probe(struct i2c_client *client,
> > -			 const struct i2c_device_id *id)
> > +static int ltc2309_probe(struct i2c_client *client)
> 
> This patch does not make sense. Do not send patch (1/3) which does not
> compile and is buggy, just to immediately fix it. We do not add known
> wrong code.

Sorry about that! You're right, I missed that 1/3 doesn't build without
this change. I might've pressed send too quickly here..

> Best regards,
> Krzysztof
> 

Thanks,
Liam
kernel test robot Sept. 5, 2023, 8:44 p.m. UTC | #3
Hi Liam,

kernel test robot noticed the following build warnings:

[auto build test WARNING on a5e505a99ca748583dbe558b691be1b26f05d678]

url:    https://github.com/intel-lab-lkp/linux/commits/Liam-Beguin/iio-adc-add-ltc2309-support/20230825-005720
base:   a5e505a99ca748583dbe558b691be1b26f05d678
patch link:    https://lore.kernel.org/r/20230824-ltc2309-v1-2-b87b4eb8030c%40gmail.com
patch subject: [PATCH 2/3] iio: adc: ltc2309: switch to new .probe()
config: i386-randconfig-061-20230906 (https://download.01.org/0day-ci/archive/20230906/202309060456.UYGqTIBd-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230906/202309060456.UYGqTIBd-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309060456.UYGqTIBd-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/iio/adc/ltc2309.c:138:24: sparse: sparse: cast to restricted __be16

vim +138 drivers/iio/adc/ltc2309.c

a967828958b014 Liam Beguin 2023-08-24  106  
a967828958b014 Liam Beguin 2023-08-24  107  static int ltc2309_read_raw(struct iio_dev *indio_dev,
a967828958b014 Liam Beguin 2023-08-24  108  			    struct iio_chan_spec const *chan, int *val,
a967828958b014 Liam Beguin 2023-08-24  109  			    int *val2, long mask)
a967828958b014 Liam Beguin 2023-08-24  110  {
a967828958b014 Liam Beguin 2023-08-24  111  	struct ltc2309 *ltc2309 = iio_priv(indio_dev);
a967828958b014 Liam Beguin 2023-08-24  112  	u16 buf;
a967828958b014 Liam Beguin 2023-08-24  113  	int ret;
a967828958b014 Liam Beguin 2023-08-24  114  	u8 din;
a967828958b014 Liam Beguin 2023-08-24  115  
a967828958b014 Liam Beguin 2023-08-24  116  	mutex_lock(&ltc2309->lock);
a967828958b014 Liam Beguin 2023-08-24  117  
a967828958b014 Liam Beguin 2023-08-24  118  	switch (mask) {
a967828958b014 Liam Beguin 2023-08-24  119  	case IIO_CHAN_INFO_RAW:
a967828958b014 Liam Beguin 2023-08-24  120  		din = FIELD_PREP(LTC2309_DIN_CH_MASK, chan->address & 0x0f) |
a967828958b014 Liam Beguin 2023-08-24  121  			FIELD_PREP(LTC2309_DIN_UNI, 1) |
a967828958b014 Liam Beguin 2023-08-24  122  			FIELD_PREP(LTC2309_DIN_SLEEP, 0);
a967828958b014 Liam Beguin 2023-08-24  123  
a967828958b014 Liam Beguin 2023-08-24  124  		ret = i2c_smbus_write_byte(ltc2309->client, din);
a967828958b014 Liam Beguin 2023-08-24  125  		if (ret < 0) {
a967828958b014 Liam Beguin 2023-08-24  126  			dev_err(ltc2309->dev, "i2c command failed: %pe\n",
a967828958b014 Liam Beguin 2023-08-24  127  				ERR_PTR(ret));
a967828958b014 Liam Beguin 2023-08-24  128  			goto out;
a967828958b014 Liam Beguin 2023-08-24  129  		}
a967828958b014 Liam Beguin 2023-08-24  130  
a967828958b014 Liam Beguin 2023-08-24  131  		ret = i2c_master_recv(ltc2309->client, (char *)&buf, 2);
a967828958b014 Liam Beguin 2023-08-24  132  		if (ret < 0) {
a967828958b014 Liam Beguin 2023-08-24  133  			dev_err(ltc2309->dev, "i2c read failed: %pe\n",
a967828958b014 Liam Beguin 2023-08-24  134  				ERR_PTR(ret));
a967828958b014 Liam Beguin 2023-08-24  135  			goto out;
a967828958b014 Liam Beguin 2023-08-24  136  		}
a967828958b014 Liam Beguin 2023-08-24  137  
a967828958b014 Liam Beguin 2023-08-24 @138  		*val = be16_to_cpu(buf) >> 4;
a967828958b014 Liam Beguin 2023-08-24  139  
a967828958b014 Liam Beguin 2023-08-24  140  		ret = IIO_VAL_INT;
a967828958b014 Liam Beguin 2023-08-24  141  		break;
a967828958b014 Liam Beguin 2023-08-24  142  	case IIO_CHAN_INFO_SCALE:
a967828958b014 Liam Beguin 2023-08-24  143  		*val = ltc2309->vref_mv;
a967828958b014 Liam Beguin 2023-08-24  144  		*val2 = LTC2309_ADC_RESOLUTION;
a967828958b014 Liam Beguin 2023-08-24  145  		ret = IIO_VAL_FRACTIONAL_LOG2;
a967828958b014 Liam Beguin 2023-08-24  146  		break;
a967828958b014 Liam Beguin 2023-08-24  147  	default:
a967828958b014 Liam Beguin 2023-08-24  148  		ret = -EINVAL;
a967828958b014 Liam Beguin 2023-08-24  149  		break;
a967828958b014 Liam Beguin 2023-08-24  150  	}
a967828958b014 Liam Beguin 2023-08-24  151  
a967828958b014 Liam Beguin 2023-08-24  152  out:
a967828958b014 Liam Beguin 2023-08-24  153  	mutex_unlock(&ltc2309->lock);
a967828958b014 Liam Beguin 2023-08-24  154  	return ret;
a967828958b014 Liam Beguin 2023-08-24  155  }
a967828958b014 Liam Beguin 2023-08-24  156
diff mbox series

Patch

diff --git a/drivers/iio/adc/ltc2309.c b/drivers/iio/adc/ltc2309.c
index ee1fd9b82e2a..d26bbd70b0ff 100644
--- a/drivers/iio/adc/ltc2309.c
+++ b/drivers/iio/adc/ltc2309.c
@@ -158,8 +158,7 @@  static const struct iio_info ltc2309_info = {
 	.read_raw = ltc2309_read_raw,
 };
 
-static int ltc2309_probe(struct i2c_client *client,
-			 const struct i2c_device_id *id)
+static int ltc2309_probe(struct i2c_client *client)
 {
 	struct iio_dev *indio_dev;
 	struct ltc2309 *ltc2309;