Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH v1 0/1] PCI: ibmphp: Simplify ibmphp_init_devno() parameter
@ 2026-05-15 11:09 Pramod Maurya
  2026-05-15 11:09 ` [PATCH v1 1/1] PCI: ibmphp: Simplify ibmphp_init_devno() to take struct slot * Pramod Maurya
  0 siblings, 1 reply; 3+ messages in thread
From: Pramod Maurya @ 2026-05-15 11:09 UTC (permalink / raw)
  To: bhelgaas; +Cc: kees, linux-pci, linux-kernel, pramod.nexgen

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(-)

-- 
2.52.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-15 11:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-15 11:09 [PATCH v1 0/1] PCI: ibmphp: Simplify ibmphp_init_devno() parameter Pramod Maurya
2026-05-15 11:09 ` [PATCH v1 1/1] PCI: ibmphp: Simplify ibmphp_init_devno() to take struct slot * Pramod Maurya
2026-05-15 11:28   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox