Skip to content

PCI: ibmphp: Simplify ibmphp_init_devno() parameter

Pramod Maurya linux-pci lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1PCI: ibmphp: Simplify ibmphp_init_devno() to take struct slot *drivers/pci/hotplug/ibmphp.h drivers/pci/hotplug/ibmphp_core.c drivers/pci/hotplug/ibmphp_ebda.c+18 -170 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH v1 0/1] PCI: ibmphp: Simplify ibmphp_init_devno() parameter

ibmphp_init_devno() in the IBM PCI Hot Plug controller driver takes a struct slot ** (double pointer) parameter, but the function never re-assigns the pointer itself -- it only dereferences it to read and write the slot's fields. The double indirection is therefore unnecessary and makes the code harder to read.

Root cause:
The function was originally written with a struct slot ** parameter, perhaps anticipating that the pointer might need to be re-assigned, but this never happens in practice. All accesses inside the function are of the form (*cur_slot)->field, which is equivalent to cur_slot->field when the parameter is a struct slot *.

Fix:
- Change the parameter type from struct slot ** to struct slot *.
- Replace all (*cur_slot)->field accesses with cur_slot->field.
- Add the parameter name to the declaration in ibmphp.h and move the comment to its own line to stay within 100 columns.
- Update the single call site in ibmphp_ebda.c to pass tmp_slot directly instead of &tmp_slot.

Note: a few pre-existing CHECK-level style issues (cast spacing, debug() argument alignment) appear in the diff because the changed lines are touched by this patch. They are not introduced by this change and are left for a separate cleanup.

This patch has been validated with scripts/checkpatch.pl --strict and produces 0 errors, 0 warnings, and 0 checks introduced by this patch.

Pramod Maurya (1):
PCI: ibmphp: Simplify ibmphp_init_devno() to take struct slot *

 drivers/pci/hotplug/ibmphp.h      |  3 ++-
 drivers/pci/hotplug/ibmphp_core.c | 30 +++++++++++++++---------------
 drivers/pci/hotplug/ibmphp_ebda.c |  2 +-
 3 files changed, 18 insertions(+), 17 deletions(-)
Signature · 1 line
2.52.0