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 1/1] PCI: ibmphp: Simplify ibmphp_init_devno() to take struct slot *
Date: Fri, 15 May 2026 07:09:44 -0400 [thread overview]
Message-ID: <20260515110944.216993-2-pramod.nexgen@gmail.com> (raw)
In-Reply-To: <20260515110944.216993-1-pramod.nexgen@gmail.com>
ibmphp_init_devno() takes a struct slot ** parameter but only ever
dereferences it to access the slot's fields. No re-assignment of the
pointer itself is performed, so the double indirection is unnecessary.
Simplify the function to take a struct slot * instead, update all
internal accesses from (*cur_slot)-> to cur_slot->, and update the
single call site in ibmphp_ebda.c to pass tmp_slot directly instead
of &tmp_slot.
Signed-off-by: Pramod Maurya <pramod.nexgen@gmail.com>
---
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(-)
diff --git a/drivers/pci/hotplug/ibmphp.h b/drivers/pci/hotplug/ibmphp.h
index c248a09be7b5..e80c45eeaa73 100644
--- a/drivers/pci/hotplug/ibmphp.h
+++ b/drivers/pci/hotplug/ibmphp.h
@@ -733,7 +733,8 @@ struct controller {
/* Functions */
-int ibmphp_init_devno(struct slot **); /* This function is called from EBDA, so we need it not be static */
+/* ibmphp_ebda.c calls this, so it cannot be static */
+int ibmphp_init_devno(struct slot *cur_slot);
int ibmphp_do_disable_slot(struct slot *slot_cur);
int ibmphp_update_slot_info(struct slot *); /* This function is called from HPC, so we need it to not be static */
int ibmphp_configure_card(struct pci_func *, u8);
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
index aca86c092d4a..b122769baee1 100644
--- a/drivers/pci/hotplug/ibmphp_core.c
+++ b/drivers/pci/hotplug/ibmphp_core.c
@@ -109,7 +109,7 @@ static int __init get_max_slots(void)
* Parameters: struct slot
* Returns 0 or errors
*/
-int ibmphp_init_devno(struct slot **cur_slot)
+int ibmphp_init_devno(struct slot *cur_slot)
{
struct irq_routing_table *rtable;
int len;
@@ -130,21 +130,21 @@ int ibmphp_init_devno(struct slot **cur_slot)
return -1;
}
for (loop = 0; loop < len; loop++) {
- if ((*cur_slot)->number == rtable->slots[loop].slot &&
- (*cur_slot)->bus == rtable->slots[loop].bus) {
- (*cur_slot)->device = PCI_SLOT(rtable->slots[loop].devfn);
+ if (cur_slot->number == rtable->slots[loop].slot &&
+ cur_slot->bus == rtable->slots[loop].bus) {
+ cur_slot->device = PCI_SLOT(rtable->slots[loop].devfn);
for (i = 0; i < 4; i++)
- (*cur_slot)->irq[i] = IO_APIC_get_PCI_irq_vector((int) (*cur_slot)->bus,
- (int) (*cur_slot)->device, i);
-
- debug("(*cur_slot)->irq[0] = %x\n",
- (*cur_slot)->irq[0]);
- debug("(*cur_slot)->irq[1] = %x\n",
- (*cur_slot)->irq[1]);
- debug("(*cur_slot)->irq[2] = %x\n",
- (*cur_slot)->irq[2]);
- debug("(*cur_slot)->irq[3] = %x\n",
- (*cur_slot)->irq[3]);
+ cur_slot->irq[i] = IO_APIC_get_PCI_irq_vector((int) cur_slot->bus,
+ (int) cur_slot->device, i);
+
+ debug("cur_slot->irq[0] = %x\n",
+ cur_slot->irq[0]);
+ debug("cur_slot->irq[1] = %x\n",
+ cur_slot->irq[1]);
+ debug("cur_slot->irq[2] = %x\n",
+ cur_slot->irq[2]);
+ debug("cur_slot->irq[3] = %x\n",
+ cur_slot->irq[3]);
debug("rtable->exclusive_irqs = %x\n",
rtable->exclusive_irqs);
diff --git a/drivers/pci/hotplug/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c
index c1939b88e75b..0b018ae3b348 100644
--- a/drivers/pci/hotplug/ibmphp_ebda.c
+++ b/drivers/pci/hotplug/ibmphp_ebda.c
@@ -880,7 +880,7 @@ static int __init ebda_rsrc_controller(void)
if (rc)
goto error;
- rc = ibmphp_init_devno(&tmp_slot);
+ rc = ibmphp_init_devno(tmp_slot);
if (rc)
goto error;
tmp_slot->hotplug_slot.ops = &ibmphp_hotplug_slot_ops;
--
2.52.0
next prev parent 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 [PATCH v1 0/1] PCI: ibmphp: Simplify ibmphp_init_devno() parameter Pramod Maurya
2026-05-15 11:09 ` Pramod Maurya [this message]
2026-05-15 11:28 ` [PATCH v1 1/1] PCI: ibmphp: Simplify ibmphp_init_devno() to take struct slot * 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-2-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