media: intel: ipu-bridge: cleanup checkpatch warnings
cover media: intel: ipu-bridge: cleanup checkpatch warnings
This series addresses two checkpatch.pl findings in drivers/media/pci/intel/ipu-bridge.c.
Patch 1 adds a terminating entry to ivsc_acpi_ids[]. Patch 2 adds a blank line after local variable declarations.
No functional changes intended.
Hungyu Lin (2):
media: intel: ipu-bridge: add sentinel to ivsc_acpi_ids
media: intel: ipu-bridge: add blank line after declarations
drivers/media/pci/intel/ipu-bridge.c | 2 ++ 1 file changed, 2 insertions(+)
Signature · 1 line
2.34.1
PATCH 1/2 media: intel: ipu-bridge: add sentinel to ivsc_acpi_ids
Add a terminating empty entry to ivsc_acpi_ids[].
The table currently contains only valid ACPI IDs. Add a terminating entry to follow the common convention used by device ID tables.
No functional change intended.
--- drivers/media/pci/intel/ipu-bridge.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/pci/intel/ipu-bridge.c +1 -0
@@ -168,6 +168,7 @@ static const struct acpi_device_id ivsc_acpi_ids[] = { { "INTC1095" }, { "INTC100A" }, { "INTC10CF" }, + {} };static struct acpi_device *ipu_bridge_get_ivsc_acpi_dev (struct acpi_device *adev)
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH 1/2] media: intel: ipu-bridge: add sentinel to ivsc_acpi_ids
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Adding a sentinel entry without updating the ARRAY_SIZE loop bound causes the loop to process the…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Adding a sentinel entry without updating the ARRAY_SIZE loop bound causes the loop to process the sentinel as a valid device ID, leading to an unnecessary full-bus ACPI device traversal. --
commit 554863b8fea7ba90e96f5d3f59ce90e9d589634c
Author: Hungyu Lin <[email protected]>
media: intel: ipu-bridge: add sentinel to ivsc_acpi_ids
This commit adds an empty terminating entry to the ivsc_acpi_ids array. It intends to follow the common convention used by device ID tables.
drivers/media/pci/intel/ipu-bridge.c static const struct acpi_device_id ivsc_acpi_ids[] = { · line 174
Quoted 12 lines
drivers/media/pci/intel/ipu-bridge.c +1
-0@@ -168,6 +168,7 @@ static const struct acpi_device_id ivsc_acpi_ids[] = { { "INTC1095" }, { "INTC100A" }, { "INTC10CF" }, + {} };static struct acpi_device *ipu_bridge_get_ivsc_acpi_dev (struct acpi_device *adev)
[Severity: Low]
Does adding this sentinel cause an unnecessary ACPI bus traversal?
Since ipu_bridge_get_ivsc_acpi_dev() uses ARRAY_SIZE() to iterate over ivsc_acpi_ids, it will now process the newly added empty sentinel:
ipu_bridge_get_ivsc_acpi_dev() {
...
for (i = 0; i < ARRAY_SIZE(ivsc_acpi_ids); i++) {
const struct acpi_device_id *acpi_id = &ivsc_acpi_ids[i];
...
for_each_acpi_dev_match(ivsc_adev, acpi_id->id, NULL, -1)
}On the final iteration, acpi_id->id is an empty string. Passing an empty string to for_each_acpi_dev_match() triggers an unnecessary traversal of all registered ACPI devices, as it tries to find a match that does not exist.
Could the loop condition be updated to break on the empty sentinel, or should ARRAY_SIZE() be avoided here since the array is now null-terminated?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Re: [PATCH 1/2] media: intel: ipu-bridge: add sentinel to ivsc_acpi_ids
In reply to Hungyu LinHi Hungyu,
Quoted 18 lines · Hungyu Lin
Add a terminating empty entry to ivsc_acpi_ids[].
The table currently contains only valid ACPI IDs. Add a terminating entry to follow the common convention used by device ID tables.
No functional change intended.
Signed-off-by Hungyu Lin <[email protected]>--- drivers/media/pci/intel/ipu-bridge.c | 1 + 1 file changed, 1 insertion(+)drivers/media/pci/intel/ipu-bridge.c +0
-0
drivers/media/pci/intel/ipu-bridge.c static const struct acpi_device_id ivsc_acpi_ids[] = { · line 171
Quoted 4 lines
drivers/media/pci/intel/ipu-bridge.c +1
-0@@ -168,6 +168,7 @@ static const struct acpi_device_id ivsc_acpi_ids[] = { { "INTC1095" }, { "INTC100A" }, { "INTC10CF" }, + {}
There's no need to add a sentinel entry to the array as the code working on it relies on its length for the boundary check (not its contents).
Quoted 3 lines
drivers/media/pci/intel/ipu-bridge.c +0
-0};static struct acpi_device *ipu_bridge_get_ivsc_acpi_dev (struct acpi_device *adev)
Signature · 3 lines
Regards, Sakari Ailus
PATCH 2/2 media: intel: ipu-bridge: add blank line after declarations
In reply to Hungyu LinAdd a blank line between the local variable declarations and the following statement in ipu_bridge_get_ivsc_acpi_dev().
This addresses a checkpatch.pl warning.
No functional change intended.
--- drivers/media/pci/intel/ipu-bridge.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/pci/intel/ipu-bridge.c +1 -0
@@ -180,6 +180,7 @@ static struct acpi_device *ipu_bridge_get_ivsc_acpi_dev(struct acpi_device *adevstruct acpi_device *consumer, *ivsc_adev;acpi_handle handle =acpi_device_handle (ACPI_PTR (adev)); +for_each_acpi_dev_match (ivsc_adev, acpi_id->id,NULL ,-1 )/* camera sensor depends on IVSC in DSDT if exist */ for_each_acpi_consumer_dev (ivsc_adev, consumer)
Signature · 1 line
2.34.1
Re: [PATCH 2/2] media: intel: ipu-bridge: add blank line after declarations
Hi Hungyu,
Quoted 17 lines · Hungyu Lin
Add a blank line between the local variable declarations and the following statement in
ipu_bridge_get_ivsc_acpi_dev().This addresses a checkpatch.pl warning.
No functional change intended.
Signed-off-by Hungyu Lin <[email protected]>--- drivers/media/pci/intel/ipu-bridge.c | 1 + 1 file changed, 1 insertion(+)drivers/media/pci/intel/ipu-bridge.c +0
-0
drivers/media/pci/intel/ipu-bridge.c static struct acpi_device *ipu_bridge_get_ivsc_acpi_dev(struct acpi_device *adev · line 183
Quoted 4 lines
drivers/media/pci/intel/ipu-bridge.c +1
-0@@ -180,6 +180,7 @@ static struct acpi_device *ipu_bridge_get_ivsc_acpi_dev(struct acpi_device *adevstruct acpi_device *consumer, *ivsc_adev;acpi_handle handle =acpi_device_handle (ACPI_PTR (adev)); +
This newline indeed is added where appropriate, but there's an extra one just a few lines above. Please remove that one as well.
Quoted 3 lines
drivers/media/pci/intel/ipu-bridge.c +0
-0for_each_acpi_dev_match (ivsc_adev, acpi_id->id,NULL ,-1 )/* camera sensor depends on IVSC in DSDT if exist */ for_each_acpi_consumer_dev (ivsc_adev, consumer)
Signature · 1 line
Sakari Ailus