Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Pramod Maurya <pramod.nexgen@gmail.com>
To: bhelgaas@google.com
Cc: kees@kernel.org, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org, pramod.nexgen@gmail.com
Subject: [PATCH v1 0/1] PCI: ibmphp: Simplify ibmphp_init_devno() parameter
Date: Fri, 15 May 2026 07:09:43 -0400	[thread overview]
Message-ID: <20260515110944.216993-1-pramod.nexgen@gmail.com> (raw)

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


             reply	other threads:[~2026-05-15 11:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-15 11:09 Pramod Maurya [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260515110944.216993-1-pramod.nexgen@gmail.com \
    --to=pramod.nexgen@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox