Skip to contentSkip to conversation

regulator: fan53555: Fix W=1 build warning when CONFIG_OF=n

PATCH Superseded Jisheng Zhang 3 participants 15 messages Aug 20, 2020 1 message not in the archive

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/12 regulator: 88pg86x: Fix W=1 build warning when CONFIG_OF=n

Fix below warning when CONFIG_OF=n:

drivers/regulator/88pg86x.c:87:34: warning: ‘pg86x_dt_ids’ defined but not used [-Wunused-const-variable=] 87 | static const struct of_device_id pg86x_dt_ids [] = {
| ^~~~~~~~~~~~

---
 drivers/regulator/88pg86x.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/regulator/88pg86x.c +2 -0
index 71cfa2c5de5e..c47c14d190f5 100644
@@ -84,12 +84,14 @@ static int pg86x_i2c_probe(struct i2c_client *i2c)
 	return 0;
 }
 
+#ifdef CONFIG_OF
 static const struct of_device_id pg86x_dt_ids [] = {
 	{ .compatible = "marvell,88pg867" },
 	{ .compatible = "marvell,88pg868" },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, pg86x_dt_ids);
+#endif
 
 static const struct i2c_device_id pg86x_i2c_id[] = {
 	{ "88pg867", },
Signature · 1 line
2.28.0
#2 lore raw

PATCH 2/12 regulator: da9210: Fix W=1 build warning when CONFIG_OF=n

In reply to a message not in the archive

Fix below warning when CONFIG_OF=n:

drivers/regulator/da9210-regulator.c:128:34: warning: ‘da9210_dt_ids’ defined but not used [-Wunused-const-variable=]

  128 | static const struct of_device_id da9210_dt_ids[] = {
      |                                  ^~~~~~~~~~~~~
---
 drivers/regulator/da9210-regulator.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/regulator/da9210-regulator.c +2 -0
index 0cdeb6186529..219baed89ba5 100644
@@ -125,11 +125,13 @@ static irqreturn_t da9210_irq_handler(int irq, void *data)
  * I2C driver interface functions
  */
 
+#ifdef CONFIG_OF
 static const struct of_device_id da9210_dt_ids[] = {
 	{ .compatible = "dlg,da9210", },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, da9210_dt_ids);
+#endif
 
 static int da9210_i2c_probe(struct i2c_client *i2c)
 {
Signature · 1 line
2.28.0
#3 lore raw

PATCH 3/12 regulator: fan53555: Fix W=1 build warning when CONFIG_OF=n

In reply to a message not in the archive

Fix below warning when CONFIG_OF=n:

drivers/regulator/fan53555.c:439:34: warning: ‘fan53555_dt_ids’ defined but not used [-Wunused-const-variable=]

  439 | static const struct of_device_id fan53555_dt_ids[] = {
      |                                  ^~~~~~~~~~~~~~~
---
 drivers/regulator/fan53555.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/regulator/fan53555.c +2 -0
index 00c83492f774..387c53f387ba 100644
@@ -436,6 +436,7 @@ static struct fan53555_platform_data *fan53555_parse_dt(struct device *dev,
 	return pdata;
 }
 
+#ifdef CONFIG_OF
 static const struct of_device_id fan53555_dt_ids[] = {
 	{
 		.compatible = "fcs,fan53526",
@@ -453,6 +454,7 @@ static const struct of_device_id fan53555_dt_ids[] = {
 	{ }
 };
 MODULE_DEVICE_TABLE(of, fan53555_dt_ids);
+#endif
 
 static int fan53555_regulator_probe(struct i2c_client *client,
 				const struct i2c_device_id *id)
Signature · 1 line
2.28.0
#4 lore raw

PATCH 4/12 regulator: fixed: Fix W=1 build warnings when CONFIG_OF=n

In reply to a message not in the archive

Fix below warnings when CONFIG_OF=n:

drivers/regulator/fixed.c:48:36: warning: ‘fixed_clkenable_data’ defined but not used [-Wunused-const-variable=]

   48 | static const struct fixed_dev_type fixed_clkenable_data = {
      |                                    ^~~~~~~~~~~~~~~~~~~~
drivers/regulator/fixed.c:44:36: warning: ‘fixed_voltage_data’ defined but not used [-Wunused-const-variable=]
   44 | static const struct fixed_dev_type fixed_voltage_data = {
      |                                    ^~~~~~~~~~~~~~~~~~
---
 drivers/regulator/fixed.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/regulator/fixed.c +8 -8
index d54830e48b8d..2d92a471ebc1 100644
@@ -41,14 +41,6 @@ struct fixed_dev_type {
 	bool has_enable_clock;
 };
 
-static const struct fixed_dev_type fixed_voltage_data = {
-	.has_enable_clock = false,
-};
-
-static const struct fixed_dev_type fixed_clkenable_data = {
-	.has_enable_clock = true,
-};
-
 static int reg_clock_enable(struct regulator_dev *rdev)
 {
 	struct fixed_voltage_data *priv = rdev_get_drvdata(rdev);
@@ -260,6 +252,14 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
 }
 
 #if defined(CONFIG_OF)
+static const struct fixed_dev_type fixed_voltage_data = {
+	.has_enable_clock = false,
+};
+
+static const struct fixed_dev_type fixed_clkenable_data = {
+	.has_enable_clock = true,
+};
+
 static const struct of_device_id fixed_of_match[] = {
 	{
 		.compatible = "regulator-fixed",
Signature · 1 line
2.28.0
#5 lore raw

PATCH 5/12 regulator: ltc3589: Fix W=1 build warning when CONFIG_OF=n

In reply to a message not in the archive

Fix below warning when CONFIG_OF=n:

drivers/regulator/ltc3589.c:460:34: warning: ‘ltc3589_of_match’ defined but not used [-Wunused-const-variable=]

  460 | static const struct of_device_id ltc3589_of_match[] = {
      |                                  ^~~~~~~~~~~~~~~~
---
 drivers/regulator/ltc3589.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/regulator/ltc3589.c +2 -0
index 9a037fdc5fc5..c73010bb3b41 100644
@@ -457,6 +457,7 @@ static const struct i2c_device_id ltc3589_i2c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, ltc3589_i2c_id);
 
+#ifdef CONFIG_OF
 static const struct of_device_id ltc3589_of_match[] = {
 	{
 		.compatible = "lltc,ltc3589",
@@ -473,6 +474,7 @@ static const struct of_device_id ltc3589_of_match[] = {
 	{ },
 };
 MODULE_DEVICE_TABLE(of, ltc3589_of_match);
+#endif
 
 static struct i2c_driver ltc3589_driver = {
 	.driver = {
Signature · 1 line
2.28.0
#6 lore raw

PATCH 6/12 regulator: ltc3676: Fix W=1 build warning when CONFIG_OF=n

In reply to a message not in the archive

Fix below warning when CONFIG_OF=n:

drivers/regulator/ltc3676.c:371:34: warning: ‘ltc3676_of_match’ defined but not used [-Wunused-const-variable=]

  371 | static const struct of_device_id ltc3676_of_match[] = {
      |                                  ^~~~~~~~~~~~~~~~
---
 drivers/regulator/ltc3676.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/regulator/ltc3676.c +2 -0
index 093b3e4a6303..0778d5bb7559 100644
@@ -368,11 +368,13 @@ static const struct i2c_device_id ltc3676_i2c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, ltc3676_i2c_id);
 
+#ifdef CONFIG_OF
 static const struct of_device_id ltc3676_of_match[] = {
 	{ .compatible = "lltc,ltc3676" },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, ltc3676_of_match);
+#endif
 
 static struct i2c_driver ltc3676_driver = {
 	.driver = {
Signature · 1 line
2.28.0
#7 lore raw

PATCH 7/12 regulator: max1586: Fix W=1 build warning when CONFIG_OF=n

In reply to a message not in the archive

Fix below warning when CONFIG_OF=n:

drivers/regulator/max1586.c:204:34: warning: ‘max1586_of_match’ defined but not used [-Wunused-const-variable=]

  204 | static const struct of_device_id max1586_of_match[] = {
      |                                  ^~~~~~~~~~~~~~~~
---
 drivers/regulator/max1586.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/regulator/max1586.c +2 -0
index f8941025780b..2ddcdd2908b1 100644
@@ -201,11 +201,13 @@ static int of_get_max1586_platform_data(struct device *dev,
 	return 0;
 }
 
+#ifdef CONFIG_OF
 static const struct of_device_id max1586_of_match[] = {
 	{ .compatible = "maxim,max1586", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, max1586_of_match);
+#endif
 
 static int max1586_pmic_probe(struct i2c_client *client,
 					const struct i2c_device_id *i2c_id)
Signature · 1 line
2.28.0
#8 lore raw

PATCH 8/12 regulator: max77826: Fix W=1 build warning when CONFIG_OF=n

In reply to a message not in the archive

Fix below warning when CONFIG_OF=n:

drivers/regulator/max77826-regulator.c:277:34: warning: ‘max77826_of_match’ defined but not used [-Wunused-const-variable=]

  277 | static const struct of_device_id max77826_of_match[] = {
      |                                  ^~~~~~~~~~~~~~~~~
---
 drivers/regulator/max77826-regulator.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/regulator/max77826-regulator.c +2 -0
index 502ab6afc814..7fbdcd7118a8 100644
@@ -274,11 +274,13 @@ static int max77826_i2c_probe(struct i2c_client *client)
 	return max77826_read_device_id(regmap, dev);
 }
 
+#ifdef CONFIG_OF
 static const struct of_device_id max77826_of_match[] = {
 	{ .compatible = "maxim,max77826" },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, max77826_of_match);
+#endif
 
 static const struct i2c_device_id max77826_id[] = {
 	{ "max77826-regulator" },
Signature · 1 line
2.28.0
#9 lore raw

PATCH 9/12 regulator: pwm: Fix W=1 build warning when CONFIG_OF=n

In reply to a message not in the archive

Fix below warning when CONFIG_OF=n:

drivers/regulator/pwm-regulator.c:393:34: warning: ‘pwm_of_match’ defined but not used [-Wunused-const-variable=]

  393 | static const struct of_device_id pwm_of_match[] = {
      |                                  ^~~~~~~~~~~~
---
 drivers/regulator/pwm-regulator.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/regulator/pwm-regulator.c +2 -0
index 3234b118b53e..c00829bd5d7b 100644
@@ -390,11 +390,13 @@ static int pwm_regulator_probe(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
 static const struct of_device_id pwm_of_match[] = {
 	{ .compatible = "pwm-regulator" },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, pwm_of_match);
+#endif
 
 static struct platform_driver pwm_regulator_driver = {
 	.driver = {
Signature · 1 line
2.28.0
#10 lore raw

PATCH 10/12 regulator: stm32-pwr: Fix W=1 build warning when CONFIG_OF=n

In reply to a message not in the archive

Fix below warning when CONFIG_OF=n:

drivers/regulator/stm32-pwr.c:169:34: warning: ‘stm32_pwr_of_match’ defined but not used [-Wunused-const-variable=]

  169 | static const struct of_device_id stm32_pwr_of_match[] = {
      |                                  ^~~~~~~~~~~~~~~~~~
---
 drivers/regulator/stm32-pwr.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/regulator/stm32-pwr.c +2 -0
index e0e627b0106e..3d5cd954c391 100644
@@ -166,11 +166,13 @@ static int stm32_pwr_regulator_probe(struct platform_device *pdev)
 	return ret;
 }
 
+#ifdef CONFIG_OF
 static const struct of_device_id stm32_pwr_of_match[] = {
 	{ .compatible = "st,stm32mp1,pwr-reg", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, stm32_pwr_of_match);
+#endif
 
 static struct platform_driver stm32_pwr_driver = {
 	.probe = stm32_pwr_regulator_probe,
Signature · 1 line
2.28.0
#11 lore raw

PATCH 11/12 regulator: stm32-vrefbuf: Fix W=1 build warning when CONFIG_OF=n

In reply to a message not in the archive

Fix below warning when CONFIG_OF=n:

drivers/regulator/stm32-vrefbuf.c:287:34: warning: ‘stm32_vrefbuf_of_match’ defined but not used [-Wunused-const-variable=]

  287 | static const struct of_device_id stm32_vrefbuf_of_match[] = {
      |                                  ^~~~~~~~~~~~~~~~~~~~~~
---
 drivers/regulator/stm32-vrefbuf.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/regulator/stm32-vrefbuf.c +2 -0
index 992bc18101ef..5a5c12d9ea22 100644
@@ -284,11 +284,13 @@ static const struct dev_pm_ops stm32_vrefbuf_pm_ops = {
 			   NULL)
 };
 
+#ifdef CONFIG_OF
 static const struct of_device_id stm32_vrefbuf_of_match[] = {
 	{ .compatible = "st,stm32-vrefbuf", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, stm32_vrefbuf_of_match);
+#endif
 
 static struct platform_driver stm32_vrefbuf_driver = {
 	.probe = stm32_vrefbuf_probe,
Signature · 1 line
2.28.0
#12 lore raw

Re: [PATCH 11/12] regulator: stm32-vrefbuf: Fix W=1 build warning when CONFIG_OF=n

Quoted 16 lines · Jisheng Zhang

Fix below warning when CONFIG_OF=n:

drivers/regulator/stm32-vrefbuf.c:287:34: warning: ‘stm32_vrefbuf_of_match’ defined but not used [-Wunused-const-variable=]

  287 | static const struct of_device_id stm32_vrefbuf_of_match[] = {
      |                                  ^~~~~~~~~~~~~~~~~~~~~~
---
 drivers/regulator/stm32-vrefbuf.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/regulator/stm32-vrefbuf.c +0 -0
index 992bc18101ef..5a5c12d9ea22 100644

drivers/regulator/stm32-vrefbuf.c static const struct dev_pm_ops stm32_vrefbuf_pm_ops = { · line 287

Quoted 4 lines
drivers/regulator/stm32-vrefbuf.c +1 -0
@@ -284,11 +284,13 @@ static const struct dev_pm_ops stm32_vrefbuf_pm_ops = {
 			   NULL)
 };
 
+#ifdef CONFIG_OF

Hi Jisheng,

You could probably adopt "__maybe_unused" here ? E.g. like:

static const struct of_device_id __maybe_unused stm32_vrefbuf_of_match[] = {

I can see other drivers use this already for the same.

Thanks,
Best regards,
Fabrice

drivers/regulator/stm32-vrefbuf.c static const struct dev_pm_ops stm32_vrefbuf_pm_ops = { · line 296

Quoted 10 lines
drivers/regulator/stm32-vrefbuf.c +1 -0
 static const struct of_device_id stm32_vrefbuf_of_match[] = {
 	{ .compatible = "st,stm32-vrefbuf", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, stm32_vrefbuf_of_match);
+#endif
 
 static struct platform_driver stm32_vrefbuf_driver = {
 	.probe = stm32_vrefbuf_probe,

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#13 lore raw

Re: [PATCH 11/12] regulator: stm32-vrefbuf: Fix W=1 build warning when CONFIG_OF=n

Quoted 22 lines · On Thu, 20 Aug 2020 10:13:12 +0200 Fabrice Gasnier wrote:
Quoted 19 lines · Jisheng Zhang

Fix below warning when CONFIG_OF=n:

drivers/regulator/stm32-vrefbuf.c:287:34: warning: ‘stm32_vrefbuf_of_match’ defined but not used [-Wunused-const-variable=]

  287 | static const struct of_device_id stm32_vrefbuf_of_match[] = {
      |                                  ^~~~~~~~~~~~~~~~~~~~~~
---
 drivers/regulator/stm32-vrefbuf.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/regulator/stm32-vrefbuf.c +0 -0
index 992bc18101ef..5a5c12d9ea22 100644
@@ -284,11 +284,13 @@ static const struct dev_pm_ops stm32_vrefbuf_pm_ops = {
                         NULL)
 };
 
Quoted 3 lines

drivers/regulator/stm32-vrefbuf.c static const struct dev_pm_ops stm32_vrefbuf_pm_ops = { · line 287

Quoted 1 line
drivers/regulator/stm32-vrefbuf.c +1 -0
+#ifdef CONFIG_OF  

Hi Jisheng,

Hi,

Quoted 2 lines

You could probably adopt "__maybe_unused" here ? E.g. like:

__maybe_unused also fixes the warning. I'm not sure the maintainers' preference.

Hi Mark,

which solution do you prefer?

Thanks in advance

Quoted 19 lines

static const struct of_device_id __maybe_unused stm32_vrefbuf_of_match[] = {

I can see other drivers use this already for the same.

Thanks,
Best regards,
Fabrice

Quoted 10 lines
drivers/regulator/stm32-vrefbuf.c +1 -0
 static const struct of_device_id stm32_vrefbuf_of_match[] = {
      { .compatible = "st,stm32-vrefbuf", },
      {},
 };
 MODULE_DEVICE_TABLE(of, stm32_vrefbuf_of_match);
+#endif
 
 static struct platform_driver stm32_vrefbuf_driver = {
      .probe = stm32_vrefbuf_probe,
maintainer
#14 lore raw

Re: [PATCH 11/12] regulator: stm32-vrefbuf: Fix W=1 build warning when CONFIG_OF=n

Quoted 7 lines · Jisheng Zhang
Quoted 1 line · On Thu, 20 Aug 2020 10:13:12 +0200 Fabrice Gasnier wrote:

You could probably adopt "__maybe_unused" here ? E.g. like:

__maybe_unused also fixes the warning. I'm not sure the maintainers' preference.

which solution do you prefer?

__maybe_unused is a bit nicer.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#15 lore raw

PATCH 12/12 regulator: sy8106a: Fix W=1 build warning when CONFIG_OF=n

In reply to a message not in the archive

Fix below warning when CONFIG_OF=n:

drivers/regulator/sy8106a-regulator.c:126:34: warning: ‘sy8106a_i2c_of_match’ defined but not used [-Wunused-const-variable=]

  126 | static const struct of_device_id sy8106a_i2c_of_match[] = {
      |                                  ^~~~~~~~~~~~~~~~~~~~
---
 drivers/regulator/sy8106a-regulator.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/regulator/sy8106a-regulator.c +2 -0
index 2222e739e62b..1878caf4dd40 100644
@@ -123,11 +123,13 @@ static int sy8106a_i2c_probe(struct i2c_client *i2c)
 	return 0;
 }
 
+#ifdef CONFIG_OF
 static const struct of_device_id sy8106a_i2c_of_match[] = {
 	{ .compatible = "silergy,sy8106a" },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, sy8106a_i2c_of_match);
+#endif
 
 static const struct i2c_device_id sy8106a_i2c_id[] = {
 	{ "sy8106a", 0 },
Signature · 1 line
2.28.0