Skip to contentSkip to conversation

media: staging: rkisp1: avoid unused variable warning

PATCH In review Arnd Bergmann 3 participants 5 messages Apr 8, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: staging: rkisp1: avoid unused variable warning

When compile-testing with CONFIG_OF disabled, we get a warning about an unused variable, and about inconsistent Kconfig dependencies:

WARNING: unmet direct dependencies detected for PHY_ROCKCHIP_DPHY_RX0
Depends on [n]: STAGING [=y] && STAGING_MEDIA [=y] && MEDIA_SUPPORT [=m] && (ARCH_ROCKCHIP [=n] || COMPILE_TEST [=y]) && OF [=n]
Selected by [m]:
- VIDEO_ROCKCHIP_ISP1 [=m] && STAGING [=y] && STAGING_MEDIA [=y] && MEDIA_SUPPORT [=m] && VIDEO_V4L2 [=m] && VIDEO_V4L2_SUBDEV_API [=y] && (ARCH_ROCKCHIP [=n] || COMPILE_TEST [=y])

drivers/staging/media/rkisp1/rkisp1-dev.c: In function 'rkisp1_probe':
drivers/staging/media/rkisp1/rkisp1-dev.c:457:22: error: unused variable 'node' [-Werror=unused-variable]
457 | struct device_node *node = pdev->dev.of_node;

Simply open-coding the pointer dereference in the only place the variable is used avoids the warning in all configurations, so we can allow compile-testing as well.

Fixes d65dd85281fb ("media: staging: rkisp1: add Rockchip ISP1 base driver")
---
 drivers/staging/media/phy-rockchip-dphy-rx0/Kconfig | 2 +-
 drivers/staging/media/rkisp1/rkisp1-dev.c           | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/staging/media/phy-rockchip-dphy-rx0/Kconfig +1 -1
index bd0147624de1..dd5d4d741bdd 100644
@@ -2,7 +2,7 @@
 
 config PHY_ROCKCHIP_DPHY_RX0
 	tristate "Rockchip MIPI Synopsys DPHY RX0 driver"
-	depends on (ARCH_ROCKCHIP || COMPILE_TEST) && OF
+	depends on (ARCH_ROCKCHIP && OF) || COMPILE_TEST
 	select GENERIC_PHY_MIPI_DPHY
 	select GENERIC_PHY
 	help
drivers/staging/media/rkisp1/rkisp1-dev.c +1 -2
index b1b3c058e957..5e7e797aad71 100644
@@ -454,7 +454,6 @@ static void rkisp1_debug_init(struct rkisp1_device *rkisp1)
 
 static int rkisp1_probe(struct platform_device *pdev)
 {
-	struct device_node *node = pdev->dev.of_node;
 	const struct rkisp1_match_data *clk_data;
 	const struct of_device_id *match;
 	struct device *dev = &pdev->dev;
@@ -463,7 +462,7 @@ static int rkisp1_probe(struct platform_device *pdev)
 	unsigned int i;
 	int ret, irq;
 
-	match = of_match_node(rkisp1_of_match, node);
+	match = of_match_node(rkisp1_of_match, pdev->dev.of_node);
 	rkisp1 = devm_kzalloc(dev, sizeof(*rkisp1), GFP_KERNEL);
 	if (!rkisp1)
 		return -ENOMEM;
Signature · 1 line
2.26.0
Reviewed-by on v1 1/1
#1 lore raw

Hi Arnd,

Thank you for the patch.

Quoted 12 lines · Arnd Bergmann

When compile-testing with CONFIG_OF disabled, we get a warning about an unused variable, and about inconsistent Kconfig dependencies:

WARNING: unmet direct dependencies detected for PHY_ROCKCHIP_DPHY_RX0
Depends on [n]: STAGING [=y] && STAGING_MEDIA [=y] && MEDIA_SUPPORT [=m] && (ARCH_ROCKCHIP [=n] || COMPILE_TEST [=y]) && OF [=n]
Selected by [m]:
- VIDEO_ROCKCHIP_ISP1 [=m] && STAGING [=y] && STAGING_MEDIA [=y] && MEDIA_SUPPORT [=m] && VIDEO_V4L2 [=m] && VIDEO_V4L2_SUBDEV_API [=y] && (ARCH_ROCKCHIP [=n] || COMPILE_TEST [=y])

drivers/staging/media/rkisp1/rkisp1-dev.c: In function 'rkisp1_probe':
drivers/staging/media/rkisp1/rkisp1-dev.c:457:22: error: unused variable 'node' [-Werror=unused-variable]
457 | struct device_node *node = pdev->dev.of_node;

Quoted 6 lines

Simply open-coding the pointer dereference in the only place the variable is used avoids the warning in all configurations, so we can allow compile-testing as well.

Fixes d65dd85281fb ("media: staging: rkisp1: add Rockchip ISP1 base driver")
Quoted 39 lines
---
 drivers/staging/media/phy-rockchip-dphy-rx0/Kconfig | 2 +-
 drivers/staging/media/rkisp1/rkisp1-dev.c           | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/staging/media/phy-rockchip-dphy-rx0/Kconfig +1 -1
index bd0147624de1..dd5d4d741bdd 100644
@@ -2,7 +2,7 @@
 
 config PHY_ROCKCHIP_DPHY_RX0
 	tristate "Rockchip MIPI Synopsys DPHY RX0 driver"
-	depends on (ARCH_ROCKCHIP || COMPILE_TEST) && OF
+	depends on (ARCH_ROCKCHIP && OF) || COMPILE_TEST
 	select GENERIC_PHY_MIPI_DPHY
 	select GENERIC_PHY
 	help
drivers/staging/media/rkisp1/rkisp1-dev.c +1 -2
index b1b3c058e957..5e7e797aad71 100644
@@ -454,7 +454,6 @@ static void rkisp1_debug_init(struct rkisp1_device *rkisp1)
 
 static int rkisp1_probe(struct platform_device *pdev)
 {
-	struct device_node *node = pdev->dev.of_node;
 	const struct rkisp1_match_data *clk_data;
 	const struct of_device_id *match;
 	struct device *dev = &pdev->dev;
@@ -463,7 +462,7 @@ static int rkisp1_probe(struct platform_device *pdev)
 	unsigned int i;
 	int ret, irq;
 
-	match = of_match_node(rkisp1_of_match, node);
+	match = of_match_node(rkisp1_of_match, pdev->dev.of_node);
 	rkisp1 = devm_kzalloc(dev, sizeof(*rkisp1), GFP_KERNEL);
 	if (!rkisp1)
 		return -ENOMEM;
Signature · 3 lines
Regards,

Laurent Pinchart
#2 lore raw
In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

When compile-testing with CONFIG_OF disabled, we get a warning about an unused variable, and about inconsistent Kconfig dependencies:

WARNING: unmet direct dependencies detected for PHY_ROCKCHIP_DPHY_RX0
Depends on [n]: STAGING [=y] && STAGING_MEDIA [=y] && MEDIA_SUPPORT [=m] && (ARCH_ROCKCHIP [=n] || COMPILE_TEST [=y]) && OF [=n] Selected by [m]:
- VIDEO_ROCKCHIP_ISP1 [=m] && STAGING [=y] && STAGING_MEDIA [=y] && MEDIA_SUPPORT [=m] && VIDEO_V4L2 [=m] && VIDEO_V4L2_SUBDEV_API [=y] &&
(ARCH_ROCKCHIP [=n] || COMPILE_TEST [=y])

Quoted 8 lines

drivers/staging/media/rkisp1/rkisp1-dev.c: In function 'rkisp1_probe':
drivers/staging/media/rkisp1/rkisp1-dev.c:457:22: error: unused variable 'node' [-Werror=unused-variable]
457 | struct device_node *node = pdev->dev.of_node;

Simply open-coding the pointer dereference in the only place the variable is used avoids the warning in all configurations, so we can allow compile-testing as well.

Hello Arnd,

Thanks for your patch.

I believe this is already fixed here:

https://patchwork.linuxtv.org/patch/62774/
https://patchwork.linuxtv.org/patch/62775/

Cheers,
Ezequiel

#3 lore raw
Quoted 20 lines · Ezequiel Garcia
Quoted 9 lines · Arnd Bergmann

When compile-testing with CONFIG_OF disabled, we get a warning about an unused variable, and about inconsistent Kconfig dependencies:

WARNING: unmet direct dependencies detected for PHY_ROCKCHIP_DPHY_RX0
Depends on [n]: STAGING [=y] && STAGING_MEDIA [=y] && MEDIA_SUPPORT [=m] && (ARCH_ROCKCHIP [=n] || COMPILE_TEST [=y]) && OF [=n] Selected by [m]:
- VIDEO_ROCKCHIP_ISP1 [=m] && STAGING [=y] && STAGING_MEDIA [=y] && MEDIA_SUPPORT [=m] && VIDEO_V4L2 [=m] && VIDEO_V4L2_SUBDEV_API [=y] &&
(ARCH_ROCKCHIP [=n] || COMPILE_TEST [=y])

Quoted 8 lines

drivers/staging/media/rkisp1/rkisp1-dev.c: In function 'rkisp1_probe':
drivers/staging/media/rkisp1/rkisp1-dev.c:457:22: error: unused variable 'node' [-Werror=unused-variable]
457 | struct device_node *node = pdev->dev.of_node;

Simply open-coding the pointer dereference in the only place the variable is used avoids the warning in all configurations, so we can allow compile-testing as well.

Quoted 8 lines

Hello Arnd,

Thanks for your patch.

I believe this is already fixed here:

https://patchwork.linuxtv.org/patch/62774/
https://patchwork.linuxtv.org/patch/62775/

Ok, sorry for the duplicate. I only tested on mainline from a few days ago, so I must have missed it getting merged in the meantime.

Arnd

#4 lore raw
Quoted 24 lines · Arnd Bergmann
Quoted 23 lines · Ezequiel Garcia
Quoted 9 lines · Arnd Bergmann

When compile-testing with CONFIG_OF disabled, we get a warning about an unused variable, and about inconsistent Kconfig dependencies:

WARNING: unmet direct dependencies detected for PHY_ROCKCHIP_DPHY_RX0
Depends on [n]: STAGING [=y] && STAGING_MEDIA [=y] && MEDIA_SUPPORT [=m] && (ARCH_ROCKCHIP [=n] || COMPILE_TEST [=y]) && OF [=n] Selected by [m]:
- VIDEO_ROCKCHIP_ISP1 [=m] && STAGING [=y] && STAGING_MEDIA [=y] && MEDIA_SUPPORT [=m] && VIDEO_V4L2 [=m] && VIDEO_V4L2_SUBDEV_API [=y] &&
(ARCH_ROCKCHIP [=n] || COMPILE_TEST [=y])

Quoted 8 lines

drivers/staging/media/rkisp1/rkisp1-dev.c: In function 'rkisp1_probe':
drivers/staging/media/rkisp1/rkisp1-dev.c:457:22: error: unused variable 'node' [-Werror=unused-variable]
457 | struct device_node *node = pdev->dev.of_node;

Simply open-coding the pointer dereference in the only place the variable is used avoids the warning in all configurations, so we can allow compile-testing as well.

Hello Arnd,

Thanks for your patch.

Quoted 8 lines
Quoted 4 lines

I believe this is already fixed here:

https://patchwork.linuxtv.org/patch/62774/
https://patchwork.linuxtv.org/patch/62775/

Ok, sorry for the duplicate. I only tested on mainline from a few days ago, so I must have missed it getting merged in the meantime.

No worries!

Those were was sent very recently, and won't be
merged any time soon :-)

Ezequiel