diff mbox series

iio: adc: ti-ads131e08: Silent no spi_device_id warnings

Message ID 20220919150011.823383-1-weiyongjun@huaweicloud.com (mailing list archive)
State Changes Requested
Headers show
Series iio: adc: ti-ads131e08: Silent no spi_device_id warnings | expand

Commit Message

Wei Yongjun Sept. 19, 2022, 3 p.m. UTC
From: Wei Yongjun <weiyongjun1@huawei.com>

Add spi_device_id entries to silent following SPI warnings:

SPI driver ads131e08 has no spi_device_id for ti,ads131e04
SPI driver ads131e08 has no spi_device_id for ti,ads131e06

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/iio/adc/ti-ads131e08.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Andy Shevchenko Sept. 19, 2022, 2:48 p.m. UTC | #1
On Mon, Sep 19, 2022 at 5:43 PM Wei Yongjun <weiyongjun@huaweicloud.com> wrote:
>
> From: Wei Yongjun <weiyongjun1@huawei.com>
>
> Add spi_device_id entries to silent following SPI warnings:
>
> SPI driver ads131e08 has no spi_device_id for ti,ads131e04
> SPI driver ads131e08 has no spi_device_id for ti,ads131e06

...

> +static const struct spi_device_id ads131e08_ids[] = {
> +       { "ads131e04", (kernel_ulong_t)&ads131e08_info_tbl[ads131e04] },
> +       { "ads131e06", (kernel_ulong_t)&ads131e08_info_tbl[ads131e06] },
> +       { "ads131e08", (kernel_ulong_t)&ads131e08_info_tbl[ads131e08] },
> +       { },

Please, no comma for the terminator entry.

> +};
Jonathan Cameron Sept. 19, 2022, 3:50 p.m. UTC | #2
On Mon, 19 Sep 2022 15:00:11 +0000
Wei Yongjun <weiyongjun@huaweicloud.com> wrote:

> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> Add spi_device_id entries to silent following SPI warnings:
> 
> SPI driver ads131e08 has no spi_device_id for ti,ads131e04
> SPI driver ads131e08 has no spi_device_id for ti,ads131e06
> 
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/iio/adc/ti-ads131e08.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/iio/adc/ti-ads131e08.c b/drivers/iio/adc/ti-ads131e08.c
> index 5235a93f28bc..9a6bc1be2877 100644
> --- a/drivers/iio/adc/ti-ads131e08.c
> +++ b/drivers/iio/adc/ti-ads131e08.c
> @@ -926,12 +926,21 @@ static const struct of_device_id ads131e08_of_match[] = {
>  };
>  MODULE_DEVICE_TABLE(of, ads131e08_of_match);
>  
> +static const struct spi_device_id ads131e08_ids[] = {
> +	{ "ads131e04", (kernel_ulong_t)&ads131e08_info_tbl[ads131e04] },

If we are going to provide this, please also modify the getting of the
const struct ads131e08_info to use spi_get_device_id(spi)->driver_data
if device_get_match_data() returned NULL.

 I don't think we have any magic in the SPI core to make that association
(maybe I missed a change there).

This is needed in case we are probing via a route that doesn't provide
firmware info via the interfaces in linux/property.h
and hence uses the spi_device_id table to get this info.


> +	{ "ads131e06", (kernel_ulong_t)&ads131e08_info_tbl[ads131e06] },
> +	{ "ads131e08", (kernel_ulong_t)&ads131e08_info_tbl[ads131e08] },
> +	{ },
> +};
> +MODULE_DEVICE_TABLE(spi, ads131e08_ids);
> +
>  static struct spi_driver ads131e08_driver = {
>  	.driver = {
>  		.name = "ads131e08",
>  		.of_match_table = ads131e08_of_match,
>  	},
>  	.probe = ads131e08_probe,
> +	.id_table = ads131e08_ids,
>  };
>  module_spi_driver(ads131e08_driver);
>
Wei Yongjun Sept. 19, 2022, 3:54 p.m. UTC | #3
On 2022/9/19 23:50, Jonathan Cameron wrote:
> On Mon, 19 Sep 2022 15:00:11 +0000
> Wei Yongjun <weiyongjun@huaweicloud.com> wrote:
> 
>> From: Wei Yongjun <weiyongjun1@huawei.com>
>>
>> Add spi_device_id entries to silent following SPI warnings:
>>
>> SPI driver ads131e08 has no spi_device_id for ti,ads131e04
>> SPI driver ads131e08 has no spi_device_id for ti,ads131e06
>>
>> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
>> ---
>>  drivers/iio/adc/ti-ads131e08.c | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/drivers/iio/adc/ti-ads131e08.c b/drivers/iio/adc/ti-ads131e08.c
>> index 5235a93f28bc..9a6bc1be2877 100644
>> --- a/drivers/iio/adc/ti-ads131e08.c
>> +++ b/drivers/iio/adc/ti-ads131e08.c
>> @@ -926,12 +926,21 @@ static const struct of_device_id ads131e08_of_match[] = {
>>  };
>>  MODULE_DEVICE_TABLE(of, ads131e08_of_match);
>>  
>> +static const struct spi_device_id ads131e08_ids[] = {
>> +	{ "ads131e04", (kernel_ulong_t)&ads131e08_info_tbl[ads131e04] },
> 
> If we are going to provide this, please also modify the getting of the
> const struct ads131e08_info to use spi_get_device_id(spi)->driver_data
> if device_get_match_data() returned NULL.
> 
>  I don't think we have any magic in the SPI core to make that association
> (maybe I missed a change there).
> 
> This is needed in case we are probing via a route that doesn't provide
> firmware info via the interfaces in linux/property.h
> and hence uses the spi_device_id table to get this info.


Will fix it in next version.

Thanks.
Wei Yongjun


> 
> 
>> +	{ "ads131e06", (kernel_ulong_t)&ads131e08_info_tbl[ads131e06] },
>> +	{ "ads131e08", (kernel_ulong_t)&ads131e08_info_tbl[ads131e08] },
>> +	{ },
>> +};
>> +MODULE_DEVICE_TABLE(spi, ads131e08_ids);
>> +
>>  static struct spi_driver ads131e08_driver = {
>>  	.driver = {
>>  		.name = "ads131e08",
>>  		.of_match_table = ads131e08_of_match,
>>  	},
>>  	.probe = ads131e08_probe,
>> +	.id_table = ads131e08_ids,
>>  };
>>  module_spi_driver(ads131e08_driver);
>>  
>
diff mbox series

Patch

diff --git a/drivers/iio/adc/ti-ads131e08.c b/drivers/iio/adc/ti-ads131e08.c
index 5235a93f28bc..9a6bc1be2877 100644
--- a/drivers/iio/adc/ti-ads131e08.c
+++ b/drivers/iio/adc/ti-ads131e08.c
@@ -926,12 +926,21 @@  static const struct of_device_id ads131e08_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, ads131e08_of_match);
 
+static const struct spi_device_id ads131e08_ids[] = {
+	{ "ads131e04", (kernel_ulong_t)&ads131e08_info_tbl[ads131e04] },
+	{ "ads131e06", (kernel_ulong_t)&ads131e08_info_tbl[ads131e06] },
+	{ "ads131e08", (kernel_ulong_t)&ads131e08_info_tbl[ads131e08] },
+	{ },
+};
+MODULE_DEVICE_TABLE(spi, ads131e08_ids);
+
 static struct spi_driver ads131e08_driver = {
 	.driver = {
 		.name = "ads131e08",
 		.of_match_table = ads131e08_of_match,
 	},
 	.probe = ads131e08_probe,
+	.id_table = ads131e08_ids,
 };
 module_spi_driver(ads131e08_driver);