iio: mma8452: Fix 'mma8452_dt_ids' defined but not used compiler warning
PATCH 1/1 iio: mma8452: Fix 'mma8452_dt_ids' defined but not used compiler warning
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.
---
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(-)
drivers/iio/accel/mma8452.c +1 -1
@@ -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] },
Signature · 1 line
2.33.1
Quoted 8 lines · On Mon, 14 Feb 2022 10:18:50 +0100 Hans de Goede <[email protected]> wrote:
Commit
90adc57bd55a("iio: mma8452: Fix probe failing when ani2c_device_idis 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) todevice_get_match_data(), combined with the use ofof_match_ptr()when settingof_match_table.
Quoted 6 lines
We actually want
mma8452_dt_idsto get optmized away whenCONFIG_OFis not set, so mark it as__maybe_unusedto silence the warning.Fixes 90adc57bd55a ("iio: mma8452: Fix probe failing when an i2c_device_id is used")Reported-by kernel test robot <[email protected]>Signed-off-by Hans de Goede <[email protected]>
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
Quoted 21 lines
---
Note the90adc57bd55ahash 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(-)drivers/iio/accel/mma8452.c +1
-1@@ -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] },
Hi,
Quoted 11 lines · Jonathan Cameron
Quoted 8 lines · On Mon, 14 Feb 2022 10:18:50 +0100 Hans de Goede <[email protected]> wrote:
Commit
90adc57bd55a("iio: mma8452: Fix probe failing when ani2c_device_idis 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) todevice_get_match_data(), combined with the use ofof_match_ptr()when settingof_match_table.
Quoted 8 lines
Quoted 6 lines
We actually want
mma8452_dt_idsto get optmized away whenCONFIG_OFis not set, so mark it as__maybe_unusedto silence the warning.Fixes 90adc57bd55a ("iio: mma8452: Fix probe failing when an i2c_device_id is used")Reported-by kernel test robot <[email protected]>Signed-off-by Hans de Goede <[email protected]>For this I'd rather drop the
of_match_ptr()protection.
Ok, that is fine with me.
Quoted 9 lines
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_tablefrom 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=ca0acb511c21738b32386ce0f85c284b351d919eAnyhow, I can just fix it up on the original patch once I'm on the right computer.
Great thank you.
Quoted 3 lines
I might also post patches to get rid
of the of dependency completely if no one else gets there before me.
Regards,
Hans
Quoted 22 lines
Quoted 21 lines
---
Note the90adc57bd55ahash 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(-)drivers/iio/accel/mma8452.c +1
-1@@ -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] },
Quoted 29 lines · On Mon, 14 Feb 2022 11:59:52 +0100 Hans de Goede <[email protected]> wrote:
Hi,
Quoted 11 lines · Jonathan Cameron
Quoted 8 lines · On Mon, 14 Feb 2022 10:18:50 +0100 Hans de Goede <[email protected]> wrote:
Commit
90adc57bd55a("iio: mma8452: Fix probe failing when ani2c_device_idis 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) todevice_get_match_data(), combined with the use ofof_match_ptr()when settingof_match_table.Quoted 8 lines
Quoted 6 lines
We actually want
mma8452_dt_idsto get optmized away whenCONFIG_OFis not set, so mark it as__maybe_unusedto silence the warning.Fixes 90adc57bd55a ("iio: mma8452: Fix probe failing when an i2c_device_id is used")Reported-by kernel test robot <[email protected]>Signed-off-by Hans de Goede <[email protected]>For this I'd rather drop the
of_match_ptr()protection.Ok, that is fine with me.
Quoted 4 lines
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_tablefrom ACPI.
Quoted 7 lines
Quoted 5 lines
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=ca0acb511c21738b32386ce0f85c284b351d919eAnyhow, I can just fix it up on the original patch once I'm on the right computer.
Great thank you.
Done.
Thanks,
Jonathan
Quoted 33 lines
Quoted 4 lines
I might also post patches to get rid
of the of dependency completely if no one else gets there before me.Regards,
Hans
Quoted 22 lines
Quoted 21 lines
---
Note the90adc57bd55ahash 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(-)drivers/iio/accel/mma8452.c +1
-1@@ -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] },