Skip to contentSkip to conversation

PCI: cpci: remove unused fields

PATCH Applied Guilherme Giacomo Simoes 2 participants 2 messages Feb 17, 2025 – Feb 21, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 PCI: cpci: remove unused fields

The get_power() and set_power() function pointers in the cpci_hp_controller ops struct were declared but never implemented by any driver. To improve code readability and reduce resource usage, remove this pointers.

---
v2 changes

- Remove uneccessary SLOT_ENABLE constant
- Remove uneccessary flags fields

---
 drivers/pci/hotplug/cpci_hotplug.h      |  2 --
 drivers/pci/hotplug/cpci_hotplug_core.c | 17 ++---------------
 2 files changed, 2 insertions(+), 17 deletions(-)
drivers/pci/hotplug/cpci_hotplug.h +0 -2
index 03fa39ab0c88..a31d6b62f523 100644
@@ -44,8 +44,6 @@ struct cpci_hp_controller_ops {
 	int (*enable_irq)(void);
 	int (*disable_irq)(void);
 	int (*check_irq)(void *dev_id);
-	u8  (*get_power)(struct slot *slot);
-	int (*set_power)(struct slot *slot, int value);
 };
 
 struct cpci_hp_controller {
drivers/pci/hotplug/cpci_hotplug_core.c +2 -15
index d0559d2faf50..dd93e53ea7c2 100644
@@ -71,13 +71,10 @@ static int
 enable_slot(struct hotplug_slot *hotplug_slot)
 {
 	struct slot *slot = to_slot(hotplug_slot);
-	int retval = 0;
 
 	dbg("%s - physical_slot = %s", __func__, slot_name(slot));
 
-	if (controller->ops->set_power)
-		retval = controller->ops->set_power(slot, 1);
-	return retval;
+	return 0;
 }
 
 static int
@@ -109,12 +106,6 @@ disable_slot(struct hotplug_slot *hotplug_slot)
 	}
 	cpci_led_on(slot);
 
-	if (controller->ops->set_power) {
-		retval = controller->ops->set_power(slot, 0);
-		if (retval)
-			goto disable_error;
-	}
-
 	slot->adapter_status = 0;
 
 	if (slot->extracting) {
@@ -129,11 +120,7 @@ disable_slot(struct hotplug_slot *hotplug_slot)
 static u8
 cpci_get_power_status(struct slot *slot)
 {
-	u8 power = 1;
-
-	if (controller->ops->get_power)
-		power = controller->ops->get_power(slot);
-	return power;
+	return 1;
 }
 
 static int
Signature · 1 line
2.34.1
#1 lore raw
Quoted 6 lines · Guilherme Giacomo Simoes

The get_power() and set_power() function pointers in the cpci_hp_controller ops struct were declared but never implemented by any driver. To improve code readability and reduce resource usage, remove this pointers.

Applied to pci/hotplug for v6.15, thanks!

Quoted 71 lines

---
v2 changes

- Remove uneccessary SLOT_ENABLE constant
- Remove uneccessary flags fields

---
 drivers/pci/hotplug/cpci_hotplug.h      |  2 --
 drivers/pci/hotplug/cpci_hotplug_core.c | 17 ++---------------
 2 files changed, 2 insertions(+), 17 deletions(-)
drivers/pci/hotplug/cpci_hotplug.h +0 -2
index 03fa39ab0c88..a31d6b62f523 100644
@@ -44,8 +44,6 @@ struct cpci_hp_controller_ops {
 	int (*enable_irq)(void);
 	int (*disable_irq)(void);
 	int (*check_irq)(void *dev_id);
-	u8  (*get_power)(struct slot *slot);
-	int (*set_power)(struct slot *slot, int value);
 };
 
 struct cpci_hp_controller {
drivers/pci/hotplug/cpci_hotplug_core.c +2 -15
index d0559d2faf50..dd93e53ea7c2 100644
@@ -71,13 +71,10 @@ static int
 enable_slot(struct hotplug_slot *hotplug_slot)
 {
 	struct slot *slot = to_slot(hotplug_slot);
-	int retval = 0;
 
 	dbg("%s - physical_slot = %s", __func__, slot_name(slot));
 
-	if (controller->ops->set_power)
-		retval = controller->ops->set_power(slot, 1);
-	return retval;
+	return 0;
 }
 
 static int
@@ -109,12 +106,6 @@ disable_slot(struct hotplug_slot *hotplug_slot)
 	}
 	cpci_led_on(slot);
 
-	if (controller->ops->set_power) {
-		retval = controller->ops->set_power(slot, 0);
-		if (retval)
-			goto disable_error;
-	}
-
 	slot->adapter_status = 0;
 
 	if (slot->extracting) {
@@ -129,11 +120,7 @@ disable_slot(struct hotplug_slot *hotplug_slot)
 static u8
 cpci_get_power_status(struct slot *slot)
 {
-	u8 power = 1;
-
-	if (controller->ops->get_power)
-		power = controller->ops->get_power(slot);
-	return power;
+	return 1;
 }
 
 static int
Signature · 1 line
2.34.1