Skip to contentSkip to conversation

checkpatch: Deprecate V4L2 pipeline power management code

PATCH In review Sakari Ailus 3 participants 6 messages Jul 14

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

PATCH 1/1 checkpatch: Deprecate V4L2 pipeline power management code

The V4L2 pipeline power management code, in particular v4l2_pipeline_link_notify(), v4l2_pipeline_pm_get() and v4l2_pipeline_pm_put() are deprecated and shall not be used in new code.

The drivers need to use the Runtime PM instead.

---
 scripts/checkpatch.pl | 3 +++
 1 file changed, 3 insertions(+)
scripts/checkpatch.pl +3 -0
index 2b7a42bbdd94..a8a7374dc9c4 100755
@@ -879,6 +879,9 @@ our %deprecated_apis = (
 	"DEFINE_IDR"				=> "DEFINE_XARRAY",
 	"idr_init"				=> "xa_init",
 	"idr_init_base"				=> "xa_init_flags",
+	"v4l2_pipeline_link_notify"		=> "",
+	"v4l2_pipeline_pm_get"			=> "",
+	"v4l2_pipeline_pm_put"			=> "",
 );
 
 #Create a search pattern for all these strings to speed up a loop below
Signature · 1 line
2.47.3
Reviewed-by on v1 1/1
#1 lore raw

Hi Sakari,

Thank you for the patch.

Quoted 5 lines · Sakari Ailus

The V4L2 pipeline power management code, in particular v4l2_pipeline_link_notify(), v4l2_pipeline_pm_get() and v4l2_pipeline_pm_put() are deprecated and shall not be used in new code.

The drivers need to use the Runtime PM instead.

I'll be happy to see this API go, so we certainly need to make sure no new drivers use it.

Quoted 19 lines
---
 scripts/checkpatch.pl | 3 +++
 1 file changed, 3 insertions(+)
scripts/checkpatch.pl +3 -0
index 2b7a42bbdd94..a8a7374dc9c4 100755
@@ -879,6 +879,9 @@ our %deprecated_apis = (
 	"DEFINE_IDR"				=> "DEFINE_XARRAY",
 	"idr_init"				=> "xa_init",
 	"idr_init_base"				=> "xa_init_flags",
+	"v4l2_pipeline_link_notify"		=> "",
+	"v4l2_pipeline_pm_get"			=> "",
+	"v4l2_pipeline_pm_put"			=> "",
 );
 
 #Create a search pattern for all these strings to speed up a loop below
Signature · 3 lines
Regards,

Laurent Pinchart
maintainer
#2 lore raw
In reply to Sakari Ailus
Quoted 5 lines · Sakari Ailus

The V4L2 pipeline power management code, in particular v4l2_pipeline_link_notify(), v4l2_pipeline_pm_get() and v4l2_pipeline_pm_put() are deprecated and shall not be used in new code.

The drivers need to use the Runtime PM instead.

Nack. Say that in the error output.

Given this patch, checkpatch's message would be something like

"Deprecated use of 'v4l2_pipeline_pm_get', prefer '' instead"

scripts/checkpatch.pl

Quoted 1 line
scripts/checkpatch.pl +0 -0

[]

scripts/checkpatch.pl our %deprecated_apis = ( · line 884

Quoted 7 lines
scripts/checkpatch.pl +3 -0
@@ -879,6 +879,9 @@ our %deprecated_apis = (
 	"DEFINE_IDR"				=> "DEFINE_XARRAY",
 	"idr_init"				=> "xa_init",
 	"idr_init_base"				=> "xa_init_flags",
+	"v4l2_pipeline_link_notify"		=> "",
+	"v4l2_pipeline_pm_get"			=> "",
+	"v4l2_pipeline_pm_put"			=> "",

Add something like "v4l2 runtime power management API" instead At least point out what that is.

And in today's '-next' there's seems to be no indication in documentation or code these calls are deprecated.

#3 lore raw

Hi Joe,

Quoted 5 lines · Joe Perches
Quoted 4 lines · Sakari Ailus

The V4L2 pipeline power management code, in particular v4l2_pipeline_link_notify(), v4l2_pipeline_pm_get() and v4l2_pipeline_pm_put() are deprecated and shall not be used in new code.

Quoted 7 lines
Quoted 1 line

The drivers need to use the Runtime PM instead.

Nack. Say that in the error output.

Given this patch, checkpatch's message would be something like

"Deprecated use of 'v4l2_pipeline_pm_get', prefer '' instead"

That's even technically correct: these functions serve no useful purpose anymore, all new drivers effectively use Runtime PM anyway.

Quoted 13 lines

scripts/checkpatch.pl

Quoted 2 lines
scripts/checkpatch.pl +0 -0

[]

scripts/checkpatch.pl our %deprecated_apis = ( · line 884

Quoted 7 lines
scripts/checkpatch.pl +3 -0
@@ -879,6 +879,9 @@ our %deprecated_apis = (
 	"DEFINE_IDR"				=> "DEFINE_XARRAY",
 	"idr_init"				=> "xa_init",
 	"idr_init_base"				=> "xa_init_flags",
+	"v4l2_pipeline_link_notify"		=> "",
+	"v4l2_pipeline_pm_get"			=> "",
+	"v4l2_pipeline_pm_put"			=> "",

Add something like "v4l2 runtime power management API" instead At least point out what that is.

How about simply "Runtime PM"?

Quoted 3 lines

And in today's '-next' there's seems to be no indication in documentation or code these calls are deprecated.

The deprecation notes were introduced in commits b97213a41140b87f48865ba594a1f4b5c5566631 and 4ec2caab775606c4bf9d0f026f8942a0b33e2255, the latter of which was merged in 2024.

Signature · 3 lines
Regards,

Sakari Ailus
maintainer
#4 lore raw
Quoted 6 lines · Sakari Ailus
Quoted 2 lines

Given this patch, checkpatch's message would be something like

"Deprecated use of 'v4l2_pipeline_pm_get', prefer '' instead"

That's even technically correct: these functions serve no useful purpose anymore, all new drivers effectively use Runtime PM anyway.

OK, but given that there are only 32 uses in 16 files in all of -next, why not just fix the uses then delete the functions?

$ git grep -P -w 'v4l2_pipeline_(?:link_notify|pm_get|pm_put)' | \
  grep -vP '^(?:include|drivers/media/v4l2-core)' | \
  wc -l
32
$ git grep -P -w -l 'v4l2_pipeline_(?:link_notify|pm_get|pm_put)' | \
  grep -vP '^(?:include|drivers/media/v4l2-core)' | \
  wc -l
16
Quoted 13 lines
Quoted 12 lines

scripts/checkpatch.pl

Quoted 1 line
scripts/checkpatch.pl +0 -0

[]

scripts/checkpatch.pl our %deprecated_apis = ( · line 884

Quoted 7 lines
scripts/checkpatch.pl +3 -0
@@ -879,6 +879,9 @@ our %deprecated_apis = (
 	"DEFINE_IDR"				=> "DEFINE_XARRAY",
 	"idr_init"				=> "xa_init",
 	"idr_init_base"				=> "xa_init_flags",
+	"v4l2_pipeline_link_notify"		=> "",
+	"v4l2_pipeline_pm_get"			=> "",
+	"v4l2_pipeline_pm_put"			=> "",

Add something like "v4l2 runtime power management API" instead At least point out what that is.

Quoted 1 line

How about simply "Runtime PM"?

Better than nothing IMO.

#5 lore raw

Hi Joe,

Quoted 16 lines · Joe Perches
Quoted 6 lines · Sakari Ailus
Quoted 2 lines

Given this patch, checkpatch's message would be something like

"Deprecated use of 'v4l2_pipeline_pm_get', prefer '' instead"

That's even technically correct: these functions serve no useful purpose anymore, all new drivers effectively use Runtime PM anyway.

OK, but given that there are only 32 uses in 16 files in all of -next, why not just fix the uses then delete the functions?

$ git grep -P -w 'v4l2_pipeline_(?:link_notify|pm_get|pm_put)' | \
  grep -vP '^(?:include|drivers/media/v4l2-core)' | \
  wc -l
32
Quoted 4 lines
$ git grep -P -w -l 'v4l2_pipeline_(?:link_notify|pm_get|pm_put)' | \
  grep -vP '^(?:include|drivers/media/v4l2-core)' | \
  wc -l
16

There are about 20 V4L2 sub-device drivers that implement the s_power() sub-device video callback used by the v4l2_pipeline_*() functions. These are generally old drivers and the conversion is typically not entirely trivial.

The intent here is to avoid adding new users to these functions now -- some have slipped through recently.

Quoted 14 lines
Quoted 14 lines
Quoted 13 lines

scripts/checkpatch.pl

Quoted 2 lines
scripts/checkpatch.pl +0 -0

[]

scripts/checkpatch.pl our %deprecated_apis = ( · line 884

Quoted 7 lines
scripts/checkpatch.pl +3 -0
@@ -879,6 +879,9 @@ our %deprecated_apis = (
 	"DEFINE_IDR"				=> "DEFINE_XARRAY",
 	"idr_init"				=> "xa_init",
 	"idr_init_base"				=> "xa_init_flags",
+	"v4l2_pipeline_link_notify"		=> "",
+	"v4l2_pipeline_pm_get"			=> "",
+	"v4l2_pipeline_pm_put"			=> "",

Add something like "v4l2 runtime power management API" instead At least point out what that is.

Quoted 3 lines
Quoted 1 line

How about simply "Runtime PM"?

Better than nothing IMO.

I'll send v2 with that.

Signature · 3 lines
Regards,

Sakari Ailus