diff mbox series

[1/9] regulator: lp872x: Mark OF related data as maybe unused

Message ID 20230310214553.275450-1-krzysztof.kozlowski@linaro.org
State New
Headers show
Series [1/9] regulator: lp872x: Mark OF related data as maybe unused | expand

Commit Message

Krzysztof Kozlowski March 10, 2023, 9:45 p.m. UTC
The driver can be compile tested with !CONFIG_OF making certain data
unused:

  drivers/regulator/lp872x.c:931:34: error: ‘lp872x_dt_ids’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/regulator/lp872x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Laurent Pinchart March 12, 2023, 9:42 a.m. UTC | #1
Hi Krzysztof,

Thank you for the patch.

On Fri, Mar 10, 2023 at 10:45:46PM +0100, Krzysztof Kozlowski wrote:
> The driver can be compile tested with !CONFIG_OF making certain data
> unused:
> 
>   drivers/regulator/max20086-regulator.c:289:34: error: ‘max20086_dt_ids’ defined but not used [-Werror=unused-const-variable=]
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>  drivers/regulator/max20086-regulator.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/regulator/max20086-regulator.c b/drivers/regulator/max20086-regulator.c
> index b8bf76c170fe..c98a72f43935 100644
> --- a/drivers/regulator/max20086-regulator.c
> +++ b/drivers/regulator/max20086-regulator.c
> @@ -286,7 +286,7 @@ static const struct i2c_device_id max20086_i2c_id[] = {
>  
>  MODULE_DEVICE_TABLE(i2c, max20086_i2c_id);
>  
> -static const struct of_device_id max20086_dt_ids[] = {
> +static const struct of_device_id max20086_dt_ids[] __maybe_unused = {

The following change would also work, as the of_match_table field of
struct device_driver isn't conditioned by CONFIG_OF:

diff --git a/drivers/regulator/max20086-regulator.c b/drivers/regulator/max20086-regulator.c
index b8bf76c170fe..ad92f84b4abb 100644
--- a/drivers/regulator/max20086-regulator.c
+++ b/drivers/regulator/max20086-regulator.c
@@ -320,7 +320,7 @@ MODULE_DEVICE_TABLE(of, max20086_dt_ids);
 static struct i2c_driver max20086_regulator_driver = {
 	.driver = {
 		.name = "max20086",
-		.of_match_table = of_match_ptr(max20086_dt_ids),
+		.of_match_table = max20086_dt_ids,
 	},
 	.probe_new = max20086_i2c_probe,
 	.id_table = max20086_i2c_id,

Your patch should reduce the module size without any real drawback as
far as I can see, so that's probably best. I'm fine with either
approach, so

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  	{
>  		.compatible = "maxim,max20086",
>  		.data = &(const struct max20086_chip_info) {
Mark Brown March 13, 2023, 1:58 p.m. UTC | #2
On Fri, Mar 10, 2023 at 10:45:45PM +0100, Krzysztof Kozlowski wrote:
> The driver can be compile tested with !CONFIG_OF making certain data
> unused:
> 
>   drivers/regulator/lp872x.c:931:34: error: ‘lp872x_dt_ids’ defined but not used [-Werror=unused-const-variable=]

Here you're using maybe unused instead of removing the of_match_ptr()
(which does seem like a better approach).  This really feels very
random, there's obviously a usability problem here.
Mark Brown March 13, 2023, 7:07 p.m. UTC | #3
On Fri, 10 Mar 2023 22:45:45 +0100, Krzysztof Kozlowski wrote:
> The driver can be compile tested with !CONFIG_OF making certain data
> unused:
> 
>   drivers/regulator/lp872x.c:931:34: error: ‘lp872x_dt_ids’ defined but not used [-Werror=unused-const-variable=]
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/9] regulator: lp872x: Mark OF related data as maybe unused
      commit: 70b26bb55f719e2900404459128d41c8425c8dde
[2/9] regulator: max20086: Mark OF related data as maybe unused
      commit: 4a5850865641d0b83caaad81ca0bbd722ac514fb
[3/9] regulator: mp8859: Mark OF related data as maybe unused
      commit: 334e6b85a348a79bb018003f09e1cc94accd53a2
[4/9] regulator: mt6397-regulator: Mark OF related data as maybe unused
      commit: 38cc873cb1cf27965dacbbc5957a7a8aee89679c

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/drivers/regulator/lp872x.c b/drivers/regulator/lp872x.c
index c576894c3d52..c3a6e77db4d0 100644
--- a/drivers/regulator/lp872x.c
+++ b/drivers/regulator/lp872x.c
@@ -928,7 +928,7 @@  static int lp872x_probe(struct i2c_client *cl)
 	return lp872x_regulator_register(lp);
 }
 
-static const struct of_device_id lp872x_dt_ids[] = {
+static const struct of_device_id lp872x_dt_ids[] __maybe_unused = {
 	{ .compatible = "ti,lp8720", },
 	{ .compatible = "ti,lp8725", },
 	{ }