* [PATCH] iio: mma8452: Fix 'mma8452_dt_ids' defined but not used compiler warning
@ 2022-02-14 9:18 Hans de Goede
2022-02-14 10:54 ` Jonathan Cameron
0 siblings, 1 reply; 4+ messages in thread
From: Hans de Goede @ 2022-02-14 9:18 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Hans de Goede, Lars-Peter Clausen, linux-iio, kernel test robot
Commit 90adc57bd55a ("iio: mma8452: Fix probe failing when an
i2c_device_id is used") introduces a new: "'mma8452_dt_ids' defined
but not used" compiler warning.
This is caused by the switch from of_match_device() (which takes a
pointer to this) to device_get_match_data(), combined with the use of
of_match_ptr() when setting of_match_table.
We actually want mma8452_dt_ids to get optmized away when CONFIG_OF is
not set, so mark it as __maybe_unused to silence the warning.
Fixes: 90adc57bd55a ("iio: mma8452: Fix probe failing when an i2c_device_id is used")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Note the 90adc57bd55a hash is from the jic23/iio.git testing branch, not
sure of it is stable. It is probably best to just squash this into the
original commit.
---
drivers/iio/accel/mma8452.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
index 590d9431e1bd..1324bd515377 100644
--- a/drivers/iio/accel/mma8452.c
+++ b/drivers/iio/accel/mma8452.c
@@ -1529,7 +1529,7 @@ static int mma8452_reset(struct i2c_client *client)
return -ETIMEDOUT;
}
-static const struct of_device_id mma8452_dt_ids[] = {
+static const struct of_device_id __maybe_unused mma8452_dt_ids[] = {
{ .compatible = "fsl,mma8451", .data = &mma_chip_info_table[mma8451] },
{ .compatible = "fsl,mma8452", .data = &mma_chip_info_table[mma8452] },
{ .compatible = "fsl,mma8453", .data = &mma_chip_info_table[mma8453] },
--
2.33.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: mma8452: Fix 'mma8452_dt_ids' defined but not used compiler warning
2022-02-14 9:18 [PATCH] iio: mma8452: Fix 'mma8452_dt_ids' defined but not used compiler warning Hans de Goede
@ 2022-02-14 10:54 ` Jonathan Cameron
2022-02-14 10:59 ` Hans de Goede
0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2022-02-14 10:54 UTC (permalink / raw)
To: Hans de Goede
Cc: Jonathan Cameron, Lars-Peter Clausen, linux-iio,
kernel test robot
On Mon, 14 Feb 2022 10:18:50 +0100
Hans de Goede <hdegoede@redhat.com> wrote:
> Commit 90adc57bd55a ("iio: mma8452: Fix probe failing when an
> i2c_device_id is used") introduces a new: "'mma8452_dt_ids' defined
> but not used" compiler warning.
>
> This is caused by the switch from of_match_device() (which takes a
> pointer to this) to device_get_match_data(), combined with the use of
> of_match_ptr() when setting of_match_table.
>
> We actually want mma8452_dt_ids to get optmized away when CONFIG_OF is
> not set, so mark it as __maybe_unused to silence the warning.
>
> Fixes: 90adc57bd55a ("iio: mma8452: Fix probe failing when an i2c_device_id is used")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
For this I'd rather drop the of_match_ptr() protection.
We will need to do that anyway shortly as part of converting this
to fully device properties and allowing ACPI PRP0001 which uses
the of_match_table from ACPI.
We can now easily make that transition as (via Andy)
https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git/commit/?h=i2c/alert-for-acpi&id=ca0acb511c21738b32386ce0f85c284b351d919e
Anyhow, I can just fix it up on the original patch once I'm on the
right computer. I might also post patches to get rid
of the of dependency completely if no one else gets there
before me.
Thanks,
Jonathan
> ---
> Note the 90adc57bd55a hash is from the jic23/iio.git testing branch, not
> sure of it is stable. It is probably best to just squash this into the
> original commit.
> ---
> drivers/iio/accel/mma8452.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> index 590d9431e1bd..1324bd515377 100644
> --- a/drivers/iio/accel/mma8452.c
> +++ b/drivers/iio/accel/mma8452.c
> @@ -1529,7 +1529,7 @@ static int mma8452_reset(struct i2c_client *client)
> return -ETIMEDOUT;
> }
>
> -static const struct of_device_id mma8452_dt_ids[] = {
> +static const struct of_device_id __maybe_unused mma8452_dt_ids[] = {
> { .compatible = "fsl,mma8451", .data = &mma_chip_info_table[mma8451] },
> { .compatible = "fsl,mma8452", .data = &mma_chip_info_table[mma8452] },
> { .compatible = "fsl,mma8453", .data = &mma_chip_info_table[mma8453] },
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: mma8452: Fix 'mma8452_dt_ids' defined but not used compiler warning
2022-02-14 10:54 ` Jonathan Cameron
@ 2022-02-14 10:59 ` Hans de Goede
2022-02-18 11:30 ` Jonathan Cameron
0 siblings, 1 reply; 4+ messages in thread
From: Hans de Goede @ 2022-02-14 10:59 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Jonathan Cameron, Lars-Peter Clausen, linux-iio,
kernel test robot
Hi,
On 2/14/22 11:54, Jonathan Cameron wrote:
> On Mon, 14 Feb 2022 10:18:50 +0100
> Hans de Goede <hdegoede@redhat.com> wrote:
>
>> Commit 90adc57bd55a ("iio: mma8452: Fix probe failing when an
>> i2c_device_id is used") introduces a new: "'mma8452_dt_ids' defined
>> but not used" compiler warning.
>>
>> This is caused by the switch from of_match_device() (which takes a
>> pointer to this) to device_get_match_data(), combined with the use of
>> of_match_ptr() when setting of_match_table.
>>
>> We actually want mma8452_dt_ids to get optmized away when CONFIG_OF is
>> not set, so mark it as __maybe_unused to silence the warning.
>>
>> Fixes: 90adc57bd55a ("iio: mma8452: Fix probe failing when an i2c_device_id is used")
>> Reported-by: kernel test robot <lkp@intel.com>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>
> For this I'd rather drop the of_match_ptr() protection.
Ok, that is fine with me.
> We will need to do that anyway shortly as part of converting this
> to fully device properties and allowing ACPI PRP0001 which uses
> the of_match_table from ACPI.
>
> We can now easily make that transition as (via Andy)
> https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git/commit/?h=i2c/alert-for-acpi&id=ca0acb511c21738b32386ce0f85c284b351d919e
>
> Anyhow, I can just fix it up on the original patch once I'm on the
> right computer.
Great thank you.
> I might also post patches to get rid
> of the of dependency completely if no one else gets there
> before me.
Regards,
Hans
>> ---
>> Note the 90adc57bd55a hash is from the jic23/iio.git testing branch, not
>> sure of it is stable. It is probably best to just squash this into the
>> original commit.
>> ---
>> drivers/iio/accel/mma8452.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
>> index 590d9431e1bd..1324bd515377 100644
>> --- a/drivers/iio/accel/mma8452.c
>> +++ b/drivers/iio/accel/mma8452.c
>> @@ -1529,7 +1529,7 @@ static int mma8452_reset(struct i2c_client *client)
>> return -ETIMEDOUT;
>> }
>>
>> -static const struct of_device_id mma8452_dt_ids[] = {
>> +static const struct of_device_id __maybe_unused mma8452_dt_ids[] = {
>> { .compatible = "fsl,mma8451", .data = &mma_chip_info_table[mma8451] },
>> { .compatible = "fsl,mma8452", .data = &mma_chip_info_table[mma8452] },
>> { .compatible = "fsl,mma8453", .data = &mma_chip_info_table[mma8453] },
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: mma8452: Fix 'mma8452_dt_ids' defined but not used compiler warning
2022-02-14 10:59 ` Hans de Goede
@ 2022-02-18 11:30 ` Jonathan Cameron
0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2022-02-18 11:30 UTC (permalink / raw)
To: Hans de Goede
Cc: Jonathan Cameron, Lars-Peter Clausen, linux-iio,
kernel test robot
On Mon, 14 Feb 2022 11:59:52 +0100
Hans de Goede <hdegoede@redhat.com> wrote:
> Hi,
>
> On 2/14/22 11:54, Jonathan Cameron wrote:
> > On Mon, 14 Feb 2022 10:18:50 +0100
> > Hans de Goede <hdegoede@redhat.com> wrote:
> >
> >> Commit 90adc57bd55a ("iio: mma8452: Fix probe failing when an
> >> i2c_device_id is used") introduces a new: "'mma8452_dt_ids' defined
> >> but not used" compiler warning.
> >>
> >> This is caused by the switch from of_match_device() (which takes a
> >> pointer to this) to device_get_match_data(), combined with the use of
> >> of_match_ptr() when setting of_match_table.
> >>
> >> We actually want mma8452_dt_ids to get optmized away when CONFIG_OF is
> >> not set, so mark it as __maybe_unused to silence the warning.
> >>
> >> Fixes: 90adc57bd55a ("iio: mma8452: Fix probe failing when an i2c_device_id is used")
> >> Reported-by: kernel test robot <lkp@intel.com>
> >> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> >
> > For this I'd rather drop the of_match_ptr() protection.
>
> Ok, that is fine with me.
>
> > We will need to do that anyway shortly as part of converting this
> > to fully device properties and allowing ACPI PRP0001 which uses
> > the of_match_table from ACPI.
> >
> > We can now easily make that transition as (via Andy)
> > https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git/commit/?h=i2c/alert-for-acpi&id=ca0acb511c21738b32386ce0f85c284b351d919e
> >
> > Anyhow, I can just fix it up on the original patch once I'm on the
> > right computer.
>
> Great thank you.
Done.
Thanks,
Jonathan
>
> > I might also post patches to get rid
> > of the of dependency completely if no one else gets there
> > before me.
>
> Regards,
>
> Hans
>
>
> >> ---
> >> Note the 90adc57bd55a hash is from the jic23/iio.git testing branch, not
> >> sure of it is stable. It is probably best to just squash this into the
> >> original commit.
> >> ---
> >> drivers/iio/accel/mma8452.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> >> index 590d9431e1bd..1324bd515377 100644
> >> --- a/drivers/iio/accel/mma8452.c
> >> +++ b/drivers/iio/accel/mma8452.c
> >> @@ -1529,7 +1529,7 @@ static int mma8452_reset(struct i2c_client *client)
> >> return -ETIMEDOUT;
> >> }
> >>
> >> -static const struct of_device_id mma8452_dt_ids[] = {
> >> +static const struct of_device_id __maybe_unused mma8452_dt_ids[] = {
> >> { .compatible = "fsl,mma8451", .data = &mma_chip_info_table[mma8451] },
> >> { .compatible = "fsl,mma8452", .data = &mma_chip_info_table[mma8452] },
> >> { .compatible = "fsl,mma8453", .data = &mma_chip_info_table[mma8453] },
> >
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-02-18 11:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-14 9:18 [PATCH] iio: mma8452: Fix 'mma8452_dt_ids' defined but not used compiler warning Hans de Goede
2022-02-14 10:54 ` Jonathan Cameron
2022-02-14 10:59 ` Hans de Goede
2022-02-18 11:30 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox