Skip to contentSkip to conversation

media: i2c: imx290: fix conditional function defintions

PATCH In review Arnd Bergmann 5 participants 8 messages Feb 7, 2023 – Mar 20, 2023

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

PATCH 1/1 media: i2c: imx290: fix conditional function defintions

From: Arnd Bergmann <[email protected]>

The runtime suspend/resume functions are only referenced from the dev_pm_ops, but they use the old SET_RUNTIME_PM_OPS() helper that requires a __maybe_unused annotation to avoid a warning:

drivers/media/i2c/imx290.c:1082:12: error: unused function 'imx290_runtime_resume' [-Werror,-Wunused-function] static int imx290_runtime_resume(struct device *dev)

           ^
drivers/media/i2c/imx290.c:1090:12: error: unused function 'imx290_runtime_suspend' [-Werror,-Wunused-function]
static int imx290_runtime_suspend(struct device *dev)
           ^

Convert this to the new RUNTIME_PM_OPS() helper that so this is not required. To improve this further, also use the pm_ptr() helper that lets the dev_pm_ops get dropped entirely when CONFIG_PM is disabled.

A related mistake happened in the of_match_ptr() macro here, which like SET_RUNTIME_PM_OPS() requires the match table to be marked as __maybe_unused, though I could not reproduce building this without CONFIG_OF. Remove the of_match_ptr() here as there is no point in dropping the match table in configurations without CONFIG_OF.

Fixes 02852c01f654 ("media: i2c: imx290: Initialize runtime PM before subdev")
---
 drivers/media/i2c/imx290.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/i2c/imx290.c +3 -3
index 49d6c8bdec41..48ae2e0adf9e 100644
@@ -1098,7 +1098,7 @@ static int imx290_runtime_suspend(struct device *dev)
 }
 
 static const struct dev_pm_ops imx290_pm_ops = {
-	SET_RUNTIME_PM_OPS(imx290_runtime_suspend, imx290_runtime_resume, NULL)
+	RUNTIME_PM_OPS(imx290_runtime_suspend, imx290_runtime_resume, NULL)
 };
 
 /* ----------------------------------------------------------------------------
@@ -1362,8 +1362,8 @@ static struct i2c_driver imx290_i2c_driver = {
 	.remove = imx290_remove,
 	.driver = {
 		.name  = "imx290",
-		.pm = &imx290_pm_ops,
-		.of_match_table = of_match_ptr(imx290_of_match),
+		.pm = pm_ptr(&imx290_pm_ops),
+		.of_match_table = imx290_of_match,
 	},
 };
 
Signature · 1 line
2.39.1
Reviewed-by on v1 1/1
#1 lore raw

Hi Arnd,

Thank you for the patch.

Quoted 18 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The runtime suspend/resume functions are only referenced from the dev_pm_ops, but they use the old SET_RUNTIME_PM_OPS() helper that requires a __maybe_unused annotation to avoid a warning:

drivers/media/i2c/imx290.c:1082:12: error: unused function 'imx290_runtime_resume' [-Werror,-Wunused-function] static int imx290_runtime_resume(struct device *dev)

           ^
drivers/media/i2c/imx290.c:1090:12: error: unused function 'imx290_runtime_suspend' [-Werror,-Wunused-function]
static int imx290_runtime_suspend(struct device *dev)
           ^

Convert this to the new RUNTIME_PM_OPS() helper that so this is not required. To improve this further, also use the pm_ptr() helper that lets the dev_pm_ops get dropped entirely when CONFIG_PM is disabled.

Quoted 8 lines

A related mistake happened in the of_match_ptr() macro here, which like SET_RUNTIME_PM_OPS() requires the match table to be marked as __maybe_unused, though I could not reproduce building this without CONFIG_OF. Remove the of_match_ptr() here as there is no point in dropping the match table in configurations without CONFIG_OF.

Fixes 02852c01f654 ("media: i2c: imx290: Initialize runtime PM before subdev")
Quoted 28 lines
---
 drivers/media/i2c/imx290.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/i2c/imx290.c +3 -3
index 49d6c8bdec41..48ae2e0adf9e 100644
@@ -1098,7 +1098,7 @@ static int imx290_runtime_suspend(struct device *dev)
 }
 
 static const struct dev_pm_ops imx290_pm_ops = {
-	SET_RUNTIME_PM_OPS(imx290_runtime_suspend, imx290_runtime_resume, NULL)
+	RUNTIME_PM_OPS(imx290_runtime_suspend, imx290_runtime_resume, NULL)
 };
 
 /* ----------------------------------------------------------------------------
@@ -1362,8 +1362,8 @@ static struct i2c_driver imx290_i2c_driver = {
 	.remove = imx290_remove,
 	.driver = {
 		.name  = "imx290",
-		.pm = &imx290_pm_ops,
-		.of_match_table = of_match_ptr(imx290_of_match),
+		.pm = pm_ptr(&imx290_pm_ops),
+		.of_match_table = imx290_of_match,
 	},
 };
 
Signature · 3 lines
Regards,

Laurent Pinchart
#2 lore raw
Quoted 7 lines · Laurent Pinchart
Quoted 6 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The runtime suspend/resume functions are only referenced from the dev_pm_ops, but they use the old SET_RUNTIME_PM_OPS() helper that requires a __maybe_unused annotation to avoid a warning:

Quoted 7 lines
Quoted 7 lines

drivers/media/i2c/imx290.c:1082:12: error: unused function 'imx290_runtime_resume' [-Werror,-Wunused-function] static int imx290_runtime_resume(struct device *dev)

           ^
drivers/media/i2c/imx290.c:1090:12: error: unused function 'imx290_runtime_suspend' [-Werror,-Wunused-function]
static int imx290_runtime_suspend(struct device *dev)
           ^

I might be missing something (if so, please tell me), but to me it looks
this fix for a build issue in 6.3-rc (which shows up in Guenters weekly
reports to Linus) didn't make any progress in the past few weeks. Is there a reason why? Who actually needs to pick it up and send it towards mainline? Manivannan Sadhasivam? Sakari Ailus?

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) --
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
If I did something stupid, please tell me, as explained on that page.

#regzbot poke

Quoted 45 lines
Quoted 5 lines

Convert this to the new RUNTIME_PM_OPS() helper that so this is not required. To improve this further, also use the pm_ptr() helper that lets the dev_pm_ops get dropped entirely when CONFIG_PM is disabled.

Quoted 8 lines

A related mistake happened in the of_match_ptr() macro here, which like SET_RUNTIME_PM_OPS() requires the match table to be marked as __maybe_unused, though I could not reproduce building this without CONFIG_OF. Remove the of_match_ptr() here as there is no point in dropping the match table in configurations without CONFIG_OF.

Fixes 02852c01f654 ("media: i2c: imx290: Initialize runtime PM before subdev")
Quoted 28 lines
---
 drivers/media/i2c/imx290.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/i2c/imx290.c +3 -3
index 49d6c8bdec41..48ae2e0adf9e 100644
@@ -1098,7 +1098,7 @@ static int imx290_runtime_suspend(struct device *dev)
 }
 
 static const struct dev_pm_ops imx290_pm_ops = {
-	SET_RUNTIME_PM_OPS(imx290_runtime_suspend, imx290_runtime_resume, NULL)
+	RUNTIME_PM_OPS(imx290_runtime_suspend, imx290_runtime_resume, NULL)
 };
 
 /* ----------------------------------------------------------------------------
@@ -1362,8 +1362,8 @@ static struct i2c_driver imx290_i2c_driver = {
 	.remove = imx290_remove,
 	.driver = {
 		.name  = "imx290",
-		.pm = &imx290_pm_ops,
-		.of_match_table = of_match_ptr(imx290_of_match),
+		.pm = pm_ptr(&imx290_pm_ops),
+		.of_match_table = imx290_of_match,
 	},
 };
 
maintainer Reviewed-by on v1 1/1
#7 lore raw
In reply to Arnd Bergmann
Quoted 18 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The runtime suspend/resume functions are only referenced from the dev_pm_ops, but they use the old SET_RUNTIME_PM_OPS() helper that requires a __maybe_unused annotation to avoid a warning:

drivers/media/i2c/imx290.c:1082:12: error: unused function 'imx290_runtime_resume' [-Werror,-Wunused-function] static int imx290_runtime_resume(struct device *dev)

           ^
drivers/media/i2c/imx290.c:1090:12: error: unused function 'imx290_runtime_suspend' [-Werror,-Wunused-function]
static int imx290_runtime_suspend(struct device *dev)
           ^

Convert this to the new RUNTIME_PM_OPS() helper that so this is not required. To improve this further, also use the pm_ptr() helper that lets the dev_pm_ops get dropped entirely when CONFIG_PM is disabled.

Quoted 8 lines

A related mistake happened in the of_match_ptr() macro here, which like SET_RUNTIME_PM_OPS() requires the match table to be marked as __maybe_unused, though I could not reproduce building this without CONFIG_OF. Remove the of_match_ptr() here as there is no point in dropping the match table in configurations without CONFIG_OF.

Fixes 02852c01f654 ("media: i2c: imx290: Initialize runtime PM before subdev")

Thanks,
Mani

Quoted 31 lines
---
 drivers/media/i2c/imx290.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/i2c/imx290.c +3 -3
index 49d6c8bdec41..48ae2e0adf9e 100644
@@ -1098,7 +1098,7 @@ static int imx290_runtime_suspend(struct device *dev)
 }
 
 static const struct dev_pm_ops imx290_pm_ops = {
-	SET_RUNTIME_PM_OPS(imx290_runtime_suspend, imx290_runtime_resume, NULL)
+	RUNTIME_PM_OPS(imx290_runtime_suspend, imx290_runtime_resume, NULL)
 };
 
 /* ----------------------------------------------------------------------------
@@ -1362,8 +1362,8 @@ static struct i2c_driver imx290_i2c_driver = {
 	.remove = imx290_remove,
 	.driver = {
 		.name  = "imx290",
-		.pm = &imx290_pm_ops,
-		.of_match_table = of_match_ptr(imx290_of_match),
+		.pm = pm_ptr(&imx290_pm_ops),
+		.of_match_table = imx290_of_match,
 	},
 };
 
Signature · 1 line
2.39.1
Signature · 1 line
மணிவண்ணன் சதாசிவம்
maintainer
#3 lore raw
In reply to Linux regression tracking (Thorsten Leemhuis)

Hello,

Quoted 16 lines · Linux regression tracking (Thorsten Leemhuis)
Quoted 7 lines · Laurent Pinchart
Quoted 6 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The runtime suspend/resume functions are only referenced from the dev_pm_ops, but they use the old SET_RUNTIME_PM_OPS() helper that requires a __maybe_unused annotation to avoid a warning:

Quoted 7 lines
Quoted 7 lines

drivers/media/i2c/imx290.c:1082:12: error: unused function 'imx290_runtime_resume' [-Werror,-Wunused-function] static int imx290_runtime_resume(struct device *dev)

           ^
drivers/media/i2c/imx290.c:1090:12: error: unused function 'imx290_runtime_suspend' [-Werror,-Wunused-function]
static int imx290_runtime_suspend(struct device *dev)
           ^
Quoted 5 lines

I might be missing something (if so, please tell me), but to me it looks
this fix for a build issue in 6.3-rc (which shows up in Guenters weekly
reports to Linus) didn't make any progress in the past few weeks. Is there a reason why? Who actually needs to pick it up and send it towards mainline? Manivannan Sadhasivam? Sakari Ailus?

Mauro has recently pulled my PR including this and I understand it's in Mauro's tree now.

Signature · 3 lines
Kind regards,

Sakari Ailus
#4 lore raw
Quoted 17 lines · Sakari Ailus
Quoted 16 lines · Linux regression tracking (Thorsten Leemhuis)
Quoted 14 lines · Laurent Pinchart
Quoted 13 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The runtime suspend/resume functions are only referenced from the dev_pm_ops, but they use the old SET_RUNTIME_PM_OPS() helper that requires a __maybe_unused annotation to avoid a warning:

drivers/media/i2c/imx290.c:1082:12: error: unused function 'imx290_runtime_resume' [-Werror,-Wunused-function] static int imx290_runtime_resume(struct device *dev)

           ^
drivers/media/i2c/imx290.c:1090:12: error: unused function 'imx290_runtime_suspend' [-Werror,-Wunused-function]
static int imx290_runtime_suspend(struct device *dev)
           ^
Quoted 8 lines
Quoted 5 lines

I might be missing something (if so, please tell me), but to me it looks
this fix for a build issue in 6.3-rc (which shows up in Guenters weekly
reports to Linus) didn't make any progress in the past few weeks. Is there a reason why? Who actually needs to pick it up and send it towards mainline? Manivannan Sadhasivam? Sakari Ailus?

Mauro has recently pulled my PR including this and I understand it's in Mauro's tree now.

Ahh, great, many thx.

I checked Linux-next before writing my mail, but didn't sport it there. :-/

Ciao, Thorsten

#5 lore raw
Quoted 24 lines · Linux regression tracking (Thorsten Leemhuis)
Quoted 23 lines · Sakari Ailus
Quoted 21 lines · Linux regression tracking (Thorsten Leemhuis)
Quoted 7 lines · Laurent Pinchart
Quoted 6 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The runtime suspend/resume functions are only referenced from the dev_pm_ops, but they use the old SET_RUNTIME_PM_OPS() helper that requires a __maybe_unused annotation to avoid a warning:

Quoted 7 lines
Quoted 7 lines

drivers/media/i2c/imx290.c:1082:12: error: unused function 'imx290_runtime_resume' [-Werror,-Wunused-function] static int imx290_runtime_resume(struct device *dev)

           ^
drivers/media/i2c/imx290.c:1090:12: error: unused function 'imx290_runtime_suspend' [-Werror,-Wunused-function]
static int imx290_runtime_suspend(struct device *dev)
           ^

I might be missing something (if so, please tell me), but to me it looks
this fix for a build issue in 6.3-rc (which shows up in Guenters weekly
reports to Linus) didn't make any progress in the past few weeks. Is there a reason why? Who actually needs to pick it up and send it towards mainline? Manivannan Sadhasivam? Sakari Ailus?

Quoted 6 lines
Quoted 2 lines

Mauro has recently pulled my PR including this and I understand it's in Mauro's tree now.

Ahh, great, many thx.

I checked Linux-next before writing my mail, but didn't sport it there. :-/

Argh, ohh no, it's there. Sorry for the noise. Second time something like this happens today. Seems today is not my best day. :-/

Ciao, Thorsten

maintainer
#6 lore raw
Quoted 2 lines · Thorsten Leemhuis

Argh, ohh no, it's there. Sorry for the noise. Second time something like this happens today. Seems today is not my best day. :-/

No worries!

Signature · 1 line
Sakari Ailus