drm/bridge: fix -Wunused-const-variable= warning
Subsystems (3)
PATCH v2 1/1 drm/bridge: fix -Wunused-const-variable= warning
When building with W=1, the following warning occurs.
drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c:48:17: warning: ‘anx781x_i2c_addresses’ defined but not used [-Wunused-const-variable=] static const u8 anx781x_i2c_addresses[] = {
^~~~~~~~~~~~~~~~~~~~~drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c:40:17: warning: ‘anx7808_i2c_addresses’ defined but not used [-Wunused-const-variable=] static const u8 anx7808_i2c_addresses[] = {
When CONFIG_IO is disabled, above two variables are not used, since the place where it is used is inclueded in the macro CONFIG_OF.
The drivers under the directory drivers/gpu/drm/bridge depends on the macro CONFIG_OF, it is not necessary to use CONFIG_OF or of_match_ptr in related files in this directory, so we just remove them all.
Changes in v2
- remove CONFIG_OF and of_match_ptr in following files:
drivers/gpu/drm/bridge/analogix/analogix-anx6345.c drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c drivers/gpu/drm/bridge/chrontel-ch7033.c drivers/gpu/drm/bridge/sil-sii8620.c drivers/gpu/drm/bridge/ti-tfp410.c
--- drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 2 +- drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c | 4 +--- drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 2 +- drivers/gpu/drm/bridge/chrontel-ch7033.c | 2 +- drivers/gpu/drm/bridge/sil-sii8620.c | 2 +- drivers/gpu/drm/bridge/ti-tfp410.c | 2 +- 6 files changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/bridge/analogix/analogix-anx6345.c +1 -1
@@ -813,7 +813,7 @@ MODULE_DEVICE_TABLE(of, anx6345_match_table);static struct i2c_driver anx6345_driver = { .driver = { .name ="anx6345" , - .of_match_table =of_match_ptr (anx6345_match_table), + .of_match_table = anx6345_match_table, }, .probe = anx6345_i2c_probe, .remove = anx6345_i2c_remove,
drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c +1 -3
@@ -1373,7 +1373,6 @@ static const struct i2c_device_id anx78xx_id[] = { };MODULE_DEVICE_TABLE (i2c, anx78xx_id); -#if IS_ENABLED (CONFIG_OF )static const struct of_device_id anx78xx_match_table[] = { { .compatible ="analogix,anx7808" , .data = anx7808_i2c_addresses }, { .compatible ="analogix,anx7812" , .data = anx781x_i2c_addresses },
@@ -1382,12 +1381,11 @@ static const struct of_device_id anx78xx_match_table[] = { { /* sentinel */ }, };MODULE_DEVICE_TABLE (of, anx78xx_match_table); -#endif static struct i2c_driver anx78xx_driver = { .driver = { .name ="anx7814" , - .of_match_table =of_match_ptr (anx78xx_match_table), + .of_match_table = anx78xx_match_table, }, .probe = anx78xx_i2c_probe, .remove = anx78xx_i2c_remove,
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +1 -1
@@ -2656,7 +2656,7 @@ MODULE_DEVICE_TABLE(of, mhdp_ids);static struct platform_driver mhdp_driver = { .driver = { .name ="cdns-mhdp8546" , - .of_match_table =of_match_ptr (mhdp_ids), + .of_match_table = mhdp_ids, }, .probe = cdns_mhdp_probe, .remove = cdns_mhdp_remove,
drivers/gpu/drm/bridge/chrontel-ch7033.c +1 -1
@@ -607,7 +607,7 @@ static struct i2c_driver ch7033_driver = { .remove = ch7033_remove, .driver = { .name = "ch7033", - .of_match_table = of_match_ptr(ch7033_dt_ids), + .of_match_table = ch7033_dt_ids, }, .id_table = ch7033_ids, };
drivers/gpu/drm/bridge/sil-sii8620.c +1 -1
@@ -2376,7 +2376,7 @@ MODULE_DEVICE_TABLE(i2c, sii8620_id);static struct i2c_driver sii8620_driver = { .driver = { .name ="sii8620" , - .of_match_table =of_match_ptr (sii8620_dt_match), + .of_match_table = sii8620_dt_match, }, .probe = sii8620_probe, .remove = sii8620_remove,
drivers/gpu/drm/bridge/ti-tfp410.c +1 -1
@@ -448,7 +448,7 @@ MODULE_DEVICE_TABLE(i2c, tfp410_i2c_ids);static struct i2c_driver tfp410_i2c_driver = { .driver = { .name ="tfp410" , - .of_match_table =of_match_ptr (tfp410_match), + .of_match_table = tfp410_match, }, .id_table = tfp410_i2c_ids, .probe = tfp410_i2c_probe,
Signature · 1 line
2.17.1
Quoted 18 lines · Zhu Wang
When building with W=1, the following warning occurs.
drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c:48:17: warning: ‘anx781x_i2c_addresses’ defined but not used [-Wunused-const-variable=] static const u8 anx781x_i2c_addresses[] = { ^~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c:40:17: warning: ‘anx7808_i2c_addresses’ defined but not used [-Wunused-const-variable=] static const u8 anx7808_i2c_addresses[] = {When
CONFIG_IOis disabled, above two variables are not used, since the place where it is used is inclueded in the macroCONFIG_OF.The drivers under the directory
drivers/gpu/drm/bridgedepends on the macroCONFIG_OF, it is not necessary to useCONFIG_OForof_match_ptrin related files in this directory, so we just remove them all.Fixes 0647e7dd3f7a ("drm/bridge: Add Analogix anx78xx support")Signed-off-by Zhu Wang <[email protected]>
Quoted 9 lines
Changes in v2
- removeCONFIG_OFandof_match_ptrin following files:
drivers/gpu/drm/bridge/analogix/analogix-anx6345.cdrivers/gpu/drm/bridge/analogix/analogix-anx78xx.cdrivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.cdrivers/gpu/drm/bridge/chrontel-ch7033.cdrivers/gpu/drm/bridge/sil-sii8620.cdrivers/gpu/drm/bridge/ti-tfp410.c
---
Note that the changelog between patch series version usually goes below the triple-dash.
Otherwise looks good to me,
Thanks
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |
Quoted 10 lines · Zhu Wang
When building with W=1, the following warning occurs.
drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c:48:17: warning:
‘anx781x_i2c_addresses’ defined but not used [-Wunused-const-variable=]static const u8 anx781x_i2c_addresses[] = { ^~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c:40:17: warning:
‘anx7808_i2c_addresses’ defined but not used [-Wunused-const-variable=]
static const u8 anx7808_i2c_addresses[] = {
Quoted 8 lines
When
CONFIG_IOis disabled, above two variables are not used, since the place where it is used is inclueded in the macroCONFIG_OF.The drivers under the directory
drivers/gpu/drm/bridgedepends on the macroCONFIG_OF, it is not necessary to useCONFIG_OForof_match_ptrin related files in this directory, so we just remove them all.
Note that even for drivers that do not depend on CONFIG_OF, it's almost always better to leave out the of_match_ptr(), since the only thing it can possibly do is save a few bytes of .text if a driver can be used both with and without it.
Quoted 2 lines
Fixes 0647e7dd3f7a ("drm/bridge: Add Analogix anx78xx support")Signed-off-by Zhu Wang <[email protected]>