Unverified Commit 132b6512 authored by Zhu Wang's avatar Zhu Wang Committed by Robert Foss
Browse files

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.

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 to save a few bytes of .text if a
driver can be used both with and without it. Hence we remove
all of_match_ptr() used in other places.

Fixes: 0647e7dd ("drm/bridge: Add Analogix anx78xx support")
Signed-off-by: default avatarZhu Wang <wangzhu9@huawei.com>
Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarRobert Foss <rfoss@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230731021345.219588-1-wangzhu9@huawei.com
parent 8b8067fc
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -813,7 +813,7 @@ MODULE_DEVICE_TABLE(of, anx6345_match_table);
static struct i2c_driver anx6345_driver = {
static struct i2c_driver anx6345_driver = {
	.driver = {
	.driver = {
		   .name = "anx6345",
		   .name = "anx6345",
		   .of_match_table = of_match_ptr(anx6345_match_table),
		   .of_match_table = anx6345_match_table,
		  },
		  },
	.probe = anx6345_i2c_probe,
	.probe = anx6345_i2c_probe,
	.remove = anx6345_i2c_remove,
	.remove = anx6345_i2c_remove,
+1 −3
Original line number Original line Diff line number Diff line
@@ -1373,7 +1373,6 @@ static const struct i2c_device_id anx78xx_id[] = {
};
};
MODULE_DEVICE_TABLE(i2c, anx78xx_id);
MODULE_DEVICE_TABLE(i2c, anx78xx_id);


#if IS_ENABLED(CONFIG_OF)
static const struct of_device_id anx78xx_match_table[] = {
static const struct of_device_id anx78xx_match_table[] = {
	{ .compatible = "analogix,anx7808", .data = anx7808_i2c_addresses },
	{ .compatible = "analogix,anx7808", .data = anx7808_i2c_addresses },
	{ .compatible = "analogix,anx7812", .data = anx781x_i2c_addresses },
	{ .compatible = "analogix,anx7812", .data = anx781x_i2c_addresses },
@@ -1382,12 +1381,11 @@ static const struct of_device_id anx78xx_match_table[] = {
	{ /* sentinel */ },
	{ /* sentinel */ },
};
};
MODULE_DEVICE_TABLE(of, anx78xx_match_table);
MODULE_DEVICE_TABLE(of, anx78xx_match_table);
#endif


static struct i2c_driver anx78xx_driver = {
static struct i2c_driver anx78xx_driver = {
	.driver = {
	.driver = {
		   .name = "anx7814",
		   .name = "anx7814",
		   .of_match_table = of_match_ptr(anx78xx_match_table),
		   .of_match_table = anx78xx_match_table,
		  },
		  },
	.probe = anx78xx_i2c_probe,
	.probe = anx78xx_i2c_probe,
	.remove = anx78xx_i2c_remove,
	.remove = anx78xx_i2c_remove,
+1 −1
Original line number Original line Diff line number Diff line
@@ -2655,7 +2655,7 @@ MODULE_DEVICE_TABLE(of, mhdp_ids);
static struct platform_driver mhdp_driver = {
static struct platform_driver mhdp_driver = {
	.driver	= {
	.driver	= {
		.name		= "cdns-mhdp8546",
		.name		= "cdns-mhdp8546",
		.of_match_table	= of_match_ptr(mhdp_ids),
		.of_match_table	= mhdp_ids,
	},
	},
	.probe	= cdns_mhdp_probe,
	.probe	= cdns_mhdp_probe,
	.remove	= cdns_mhdp_remove,
	.remove	= cdns_mhdp_remove,
+1 −1
Original line number Original line Diff line number Diff line
@@ -607,7 +607,7 @@ static struct i2c_driver ch7033_driver = {
	.remove = ch7033_remove,
	.remove = ch7033_remove,
	.driver = {
	.driver = {
		.name = "ch7033",
		.name = "ch7033",
		.of_match_table = of_match_ptr(ch7033_dt_ids),
		.of_match_table = ch7033_dt_ids,
	},
	},
	.id_table = ch7033_ids,
	.id_table = ch7033_ids,
};
};
+1 −1
Original line number Original line Diff line number Diff line
@@ -2376,7 +2376,7 @@ MODULE_DEVICE_TABLE(i2c, sii8620_id);
static struct i2c_driver sii8620_driver = {
static struct i2c_driver sii8620_driver = {
	.driver = {
	.driver = {
		.name	= "sii8620",
		.name	= "sii8620",
		.of_match_table = of_match_ptr(sii8620_dt_match),
		.of_match_table = sii8620_dt_match,
	},
	},
	.probe		= sii8620_probe,
	.probe		= sii8620_probe,
	.remove		= sii8620_remove,
	.remove		= sii8620_remove,
Loading