Re: [PATCH v1 3/3] iio: adc: tsc2046: silent spi_device_id warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 30, 2022 at 02:02:28PM +0100, Jonathan Cameron wrote:
> On Tue, 30 Aug 2022 13:07:09 +0200
> Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx> wrote:
> 
> > Add spi_device_id to silent following warning:
> >  SPI driver tsc2046 has no spi_device_id for ti,tsc2046e-adc
> > 
> > Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
> > ---
> >  drivers/iio/adc/ti-tsc2046.c | 17 ++++++++++++++++-
> >  1 file changed, 16 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/adc/ti-tsc2046.c b/drivers/iio/adc/ti-tsc2046.c
> > index bbc8b4137b0b1..b9a1fac659d46 100644
> > --- a/drivers/iio/adc/ti-tsc2046.c
> > +++ b/drivers/iio/adc/ti-tsc2046.c
> > @@ -761,7 +761,15 @@ static int tsc2046_adc_probe(struct spi_device *spi)
> >  		return -EINVAL;
> >  	}
> >  
> > -	dcfg = device_get_match_data(dev);
> > +	if (!dev_fwnode(dev)) {
> > +		const struct spi_device_id *id;
> > +
> > +		id = spi_get_device_id(spi);
> > +		dcfg = (const struct tsc2046_adc_dcfg *)id->driver_data;
> 
> Driver data not set below.

..facepalm..

> Otherwise this looks good to me.  An alternative more common form (I think...)
> is call device_get_match_data() unconditionally and if that is null follow
> the driver_data path. Either way is fine though.
> 
> Could you add to the patch description where
> the warning is coming from?   Build time / runtime etc and what tool?

ack. It is runtime warning in the kernel log.

Regards,
Oleksij
-- 
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 |



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux