public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH] PCI: cpci: remove unused fields
@ 2025-01-02 15:26 Guilherme Giacomo Simoes
  0 siblings, 0 replies; 10+ messages in thread
From: Guilherme Giacomo Simoes @ 2025-01-02 15:26 UTC (permalink / raw)
  To: scott, bhelgaas; +Cc: Guilherme Giacomo Simoes, linux-pci, linux-kernel

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 and replace with a `flags` field.

Use the new `flags` field in `enable_slot()`, `disable_slot()`, and
`cpci_get_power_s atus()` to track the slot's power state using the
`SLOT_ENABLED` macro.

Signed-off-by: Guilherme Giacomo Simoes <trintaeoitogc@gmail.com>
---
 drivers/pci/hotplug/cpci_hotplug.h      |  3 +--
 drivers/pci/hotplug/cpci_hotplug_core.c | 21 +++++++--------------
 2 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/pci/hotplug/cpci_hotplug.h b/drivers/pci/hotplug/cpci_hotplug.h
index 03fa39ab0c88..c5cb12cad2b4 100644
--- a/drivers/pci/hotplug/cpci_hotplug.h
+++ b/drivers/pci/hotplug/cpci_hotplug.h
@@ -44,8 +44,7 @@ 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);
+	int flags;
 };
 
 struct cpci_hp_controller {
diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c
index d0559d2faf50..87a743c2a5f1 100644
--- a/drivers/pci/hotplug/cpci_hotplug_core.c
+++ b/drivers/pci/hotplug/cpci_hotplug_core.c
@@ -27,6 +27,8 @@
 #define DRIVER_AUTHOR	"Scott Murray <scottm@somanetworks.com>"
 #define DRIVER_DESC	"CompactPCI Hot Plug Core"
 
+#define SLOT_ENABLED 0x00000001
+
 #define MY_NAME	"cpci_hotplug"
 
 #define dbg(format, arg...)					\
@@ -71,13 +73,12 @@ 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;
+	controller->ops->flags |= SLOT_ENABLED;
+
+	return 0;
 }
 
 static int
@@ -109,11 +110,7 @@ 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;
-	}
+	controller->ops->flags &= ~SLOT_ENABLED;
 
 	slot->adapter_status = 0;
 
@@ -129,11 +126,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 controller->ops->flags & SLOT_ENABLED;
 }
 
 static int
-- 
2.34.1


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

* [RESEND PATCH] PCI: cpci: remove unused fields
@ 2025-01-16 15:55 Guilherme Giacomo Simoes
  0 siblings, 0 replies; 10+ messages in thread
From: Guilherme Giacomo Simoes @ 2025-01-16 15:55 UTC (permalink / raw)
  To: scott, bhelgaas; +Cc: Guilherme Giacomo Simoes, linux-pci, linux-kernel

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 and replace with a `flags` field.

Use the new `flags` field in `enable_slot()`, `disable_slot()`, and
`cpci_get_power_s atus()` to track the slot's power state using the
`SLOT_ENABLED` macro.

Signed-off-by: Guilherme Giacomo Simoes <trintaeoitogc@gmail.com>
---
 drivers/pci/hotplug/cpci_hotplug.h      |  3 +--
 drivers/pci/hotplug/cpci_hotplug_core.c | 21 +++++++--------------
 2 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/pci/hotplug/cpci_hotplug.h b/drivers/pci/hotplug/cpci_hotplug.h
index 03fa39ab0c88..c5cb12cad2b4 100644
--- a/drivers/pci/hotplug/cpci_hotplug.h
+++ b/drivers/pci/hotplug/cpci_hotplug.h
@@ -44,8 +44,7 @@ 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);
+	int flags;
 };
 
 struct cpci_hp_controller {
diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c
index d0559d2faf50..87a743c2a5f1 100644
--- a/drivers/pci/hotplug/cpci_hotplug_core.c
+++ b/drivers/pci/hotplug/cpci_hotplug_core.c
@@ -27,6 +27,8 @@
 #define DRIVER_AUTHOR	"Scott Murray <scottm@somanetworks.com>"
 #define DRIVER_DESC	"CompactPCI Hot Plug Core"
 
+#define SLOT_ENABLED 0x00000001
+
 #define MY_NAME	"cpci_hotplug"
 
 #define dbg(format, arg...)					\
@@ -71,13 +73,12 @@ 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;
+	controller->ops->flags |= SLOT_ENABLED;
+
+	return 0;
 }
 
 static int
@@ -109,11 +110,7 @@ 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;
-	}
+	controller->ops->flags &= ~SLOT_ENABLED;
 
 	slot->adapter_status = 0;
 
@@ -129,11 +126,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 controller->ops->flags & SLOT_ENABLED;
 }
 
 static int
-- 
2.34.1


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

* [RESEND PATCH] PCI: cpci: remove unused fields
@ 2025-01-30 14:01 Guilherme Giacomo Simoes
  0 siblings, 0 replies; 10+ messages in thread
From: Guilherme Giacomo Simoes @ 2025-01-30 14:01 UTC (permalink / raw)
  To: scott, bhelgaas; +Cc: Guilherme Giacomo Simoes, linux-pci, linux-kernel

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 and replace with a `flags` field.

Use the new `flags` field in `enable_slot()`, `disable_slot()`, and
`cpci_get_power_s atus()` to track the slot's power state using the
`SLOT_ENABLED` macro.

Signed-off-by: Guilherme Giacomo Simoes <trintaeoitogc@gmail.com>
---
 drivers/pci/hotplug/cpci_hotplug.h      |  3 +--
 drivers/pci/hotplug/cpci_hotplug_core.c | 21 +++++++--------------
 2 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/pci/hotplug/cpci_hotplug.h b/drivers/pci/hotplug/cpci_hotplug.h
index 03fa39ab0c88..c5cb12cad2b4 100644
--- a/drivers/pci/hotplug/cpci_hotplug.h
+++ b/drivers/pci/hotplug/cpci_hotplug.h
@@ -44,8 +44,7 @@ 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);
+	int flags;
 };
 
 struct cpci_hp_controller {
diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c
index d0559d2faf50..87a743c2a5f1 100644
--- a/drivers/pci/hotplug/cpci_hotplug_core.c
+++ b/drivers/pci/hotplug/cpci_hotplug_core.c
@@ -27,6 +27,8 @@
 #define DRIVER_AUTHOR	"Scott Murray <scottm@somanetworks.com>"
 #define DRIVER_DESC	"CompactPCI Hot Plug Core"
 
+#define SLOT_ENABLED 0x00000001
+
 #define MY_NAME	"cpci_hotplug"
 
 #define dbg(format, arg...)					\
@@ -71,13 +73,12 @@ 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;
+	controller->ops->flags |= SLOT_ENABLED;
+
+	return 0;
 }
 
 static int
@@ -109,11 +110,7 @@ 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;
-	}
+	controller->ops->flags &= ~SLOT_ENABLED;
 
 	slot->adapter_status = 0;
 
@@ -129,11 +126,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 controller->ops->flags & SLOT_ENABLED;
 }
 
 static int
-- 
2.34.1


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

* [RESEND PATCH] PCI: cpci: remove unused fields
@ 2025-02-13 17:39 Guilherme Giacomo Simoes
  2025-02-13 20:44 ` Christophe JAILLET
  2025-02-13 21:26 ` Bjorn Helgaas
  0 siblings, 2 replies; 10+ messages in thread
From: Guilherme Giacomo Simoes @ 2025-02-13 17:39 UTC (permalink / raw)
  To: scott, bhelgaas; +Cc: Guilherme Giacomo Simoes, linux-pci, linux-kernel

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 and replace with a `flags` field.

Use the new `flags` field in `enable_slot()`, `disable_slot()`, and
`cpci_get_power_s atus()` to track the slot's power state using the
`SLOT_ENABLED` macro.

Signed-off-by: Guilherme Giacomo Simoes <trintaeoitogc@gmail.com>
---
 drivers/pci/hotplug/cpci_hotplug.h      |  3 +--
 drivers/pci/hotplug/cpci_hotplug_core.c | 21 +++++++--------------
 2 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/pci/hotplug/cpci_hotplug.h b/drivers/pci/hotplug/cpci_hotplug.h
index 03fa39ab0c88..c5cb12cad2b4 100644
--- a/drivers/pci/hotplug/cpci_hotplug.h
+++ b/drivers/pci/hotplug/cpci_hotplug.h
@@ -44,8 +44,7 @@ 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);
+	int flags;
 };
 
 struct cpci_hp_controller {
diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c
index d0559d2faf50..87a743c2a5f1 100644
--- a/drivers/pci/hotplug/cpci_hotplug_core.c
+++ b/drivers/pci/hotplug/cpci_hotplug_core.c
@@ -27,6 +27,8 @@
 #define DRIVER_AUTHOR	"Scott Murray <scottm@somanetworks.com>"
 #define DRIVER_DESC	"CompactPCI Hot Plug Core"
 
+#define SLOT_ENABLED 0x00000001
+
 #define MY_NAME	"cpci_hotplug"
 
 #define dbg(format, arg...)					\
@@ -71,13 +73,12 @@ 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;
+	controller->ops->flags |= SLOT_ENABLED;
+
+	return 0;
 }
 
 static int
@@ -109,11 +110,7 @@ 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;
-	}
+	controller->ops->flags &= ~SLOT_ENABLED;
 
 	slot->adapter_status = 0;
 
@@ -129,11 +126,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 controller->ops->flags & SLOT_ENABLED;
 }
 
 static int
-- 
2.34.1


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

* Re: [RESEND PATCH] PCI: cpci: remove unused fields
  2025-02-13 17:39 [RESEND PATCH] PCI: cpci: remove unused fields Guilherme Giacomo Simoes
@ 2025-02-13 20:44 ` Christophe JAILLET
  2025-02-15  2:10   ` Guilherme Giacomo Simoes
  2025-02-13 21:26 ` Bjorn Helgaas
  1 sibling, 1 reply; 10+ messages in thread
From: Christophe JAILLET @ 2025-02-13 20:44 UTC (permalink / raw)
  To: Guilherme Giacomo Simoes, scott, bhelgaas; +Cc: linux-pci, linux-kernel

Le 13/02/2025 à 18:39, Guilherme Giacomo Simoes a écrit :
> 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 and replace with a `flags` field.
> 
> Use the new `flags` field in `enable_slot()`, `disable_slot()`, and
> `cpci_get_power_s atus()` to track the slot's power state using the
> `SLOT_ENABLED` macro.
> 
> Signed-off-by: Guilherme Giacomo Simoes <trintaeoitogc@gmail.com>
> ---
>   drivers/pci/hotplug/cpci_hotplug.h      |  3 +--
>   drivers/pci/hotplug/cpci_hotplug_core.c | 21 +++++++--------------
>   2 files changed, 8 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/pci/hotplug/cpci_hotplug.h b/drivers/pci/hotplug/cpci_hotplug.h
> index 03fa39ab0c88..c5cb12cad2b4 100644
> --- a/drivers/pci/hotplug/cpci_hotplug.h
> +++ b/drivers/pci/hotplug/cpci_hotplug.h
> @@ -44,8 +44,7 @@ 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);
> +	int flags;
>   };
>   
>   struct cpci_hp_controller {
> diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c
> index d0559d2faf50..87a743c2a5f1 100644
> --- a/drivers/pci/hotplug/cpci_hotplug_core.c
> +++ b/drivers/pci/hotplug/cpci_hotplug_core.c
> @@ -27,6 +27,8 @@
>   #define DRIVER_AUTHOR	"Scott Murray <scottm@somanetworks.com>"
>   #define DRIVER_DESC	"CompactPCI Hot Plug Core"
>   
> +#define SLOT_ENABLED 0x00000001
> +
>   #define MY_NAME	"cpci_hotplug"
>   
>   #define dbg(format, arg...)					\
> @@ -71,13 +73,12 @@ 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;
> +	controller->ops->flags |= SLOT_ENABLED;
> +
> +	return 0;
>   }
>   
>   static int
> @@ -109,11 +110,7 @@ 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;
> -	}
> +	controller->ops->flags &= ~SLOT_ENABLED;
>   
>   	slot->adapter_status = 0;
>   
> @@ -129,11 +126,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 controller->ops->flags & SLOT_ENABLED;

If neither get_power nor set_power where defined in any driver, then 
cpci_get_power_status() was always returning 1.

IIUC, now it may return 1 or 0 depending of if enable_slot() or 
disable_slot() have been called.

I don't know the impact of this change and I dont know if it is correct, 
but I think you should explain why this change of behavior is fine.

Just my 2c.

CJ


>   }
>   
>   static int


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

* Re: [RESEND PATCH] PCI: cpci: remove unused fields
  2025-02-13 17:39 [RESEND PATCH] PCI: cpci: remove unused fields Guilherme Giacomo Simoes
  2025-02-13 20:44 ` Christophe JAILLET
@ 2025-02-13 21:26 ` Bjorn Helgaas
  2025-02-15  2:06   ` Guilherme Giacomo Simoes
  1 sibling, 1 reply; 10+ messages in thread
From: Bjorn Helgaas @ 2025-02-13 21:26 UTC (permalink / raw)
  To: Guilherme Giacomo Simoes; +Cc: scott, bhelgaas, linux-pci, linux-kernel

On Thu, Feb 13, 2025 at 02:39:25PM -0300, Guilherme Giacomo Simoes wrote:
> 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 and replace with a `flags` field.
> 
> Use the new `flags` field in `enable_slot()`, `disable_slot()`, and
> `cpci_get_power_s atus()` to track the slot's power state using the
> `SLOT_ENABLED` macro.
> 
> Signed-off-by: Guilherme Giacomo Simoes <trintaeoitogc@gmail.com>
> ---
>  drivers/pci/hotplug/cpci_hotplug.h      |  3 +--
>  drivers/pci/hotplug/cpci_hotplug_core.c | 21 +++++++--------------
>  2 files changed, 8 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/pci/hotplug/cpci_hotplug.h b/drivers/pci/hotplug/cpci_hotplug.h
> index 03fa39ab0c88..c5cb12cad2b4 100644
> --- a/drivers/pci/hotplug/cpci_hotplug.h
> +++ b/drivers/pci/hotplug/cpci_hotplug.h
> @@ -44,8 +44,7 @@ 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);
> +	int flags;
>  };
>  
>  struct cpci_hp_controller {
> diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c
> index d0559d2faf50..87a743c2a5f1 100644
> --- a/drivers/pci/hotplug/cpci_hotplug_core.c
> +++ b/drivers/pci/hotplug/cpci_hotplug_core.c
> @@ -27,6 +27,8 @@
>  #define DRIVER_AUTHOR	"Scott Murray <scottm@somanetworks.com>"
>  #define DRIVER_DESC	"CompactPCI Hot Plug Core"
>  
> +#define SLOT_ENABLED 0x00000001
> +
>  #define MY_NAME	"cpci_hotplug"
>  
>  #define dbg(format, arg...)					\
> @@ -71,13 +73,12 @@ 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;
> +	controller->ops->flags |= SLOT_ENABLED;

There are no implementations of ->set_power() or ->get_power(), are
there?  If not, we can just remove them and the calls to them.

I don't see why we should add SLOT_ENABLED.

> +	return 0;
>  }
>  
>  static int
> @@ -109,11 +110,7 @@ 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;
> -	}
> +	controller->ops->flags &= ~SLOT_ENABLED;
>  
>  	slot->adapter_status = 0;
>  
> @@ -129,11 +126,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 controller->ops->flags & SLOT_ENABLED;
>  }
>  
>  static int
> -- 
> 2.34.1
> 

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

* Re: [RESEND PATCH] PCI: cpci: remove unused fields
  2025-02-13 21:26 ` Bjorn Helgaas
@ 2025-02-15  2:06   ` Guilherme Giacomo Simoes
  0 siblings, 0 replies; 10+ messages in thread
From: Guilherme Giacomo Simoes @ 2025-02-15  2:06 UTC (permalink / raw)
  To: helgaas; +Cc: bhelgaas, linux-kernel, linux-pci, scott, trintaeoitogc

Bjorn Helgaas <helgaas@kernel.org> wrote:
> There are no implementations of ->set_power() or ->get_power(), are
> there?  If not, we can just remove them and the calls to them.
> 
> I don't see why we should add SLOT_ENABLED.
Are not implementations of set_power() and get_power(). 
I removed this funcions and in enable_slot(), disable_slot() and
cpci_get_power_status() I use a `flags` field that I create in
cpci_hp_controller_ops struct. I created this `flags` for store a power_status
and use this in enable_slot(), disable_slot() and cpci_get_power_status() that
before uses a set_power() and get_power(). I do this way, because I seeing this
patter in another pci subsystems. In adittion on this, the flags can be used
for store anothers values.

But the Christophe JAILLET <christophe.jaillet@wanadoo.fr> say:
"If neither get_power nor set_power where defined in any driver, then 
cpci_get_power_status() was always returning 1.
IIUC, now it may return 1 or 0 depending of if enable_slot() or 
disable_slot() have been called."

Do you think that is better we only return 1 in pci_get_power_status() and
remove SLOT_ENABLED and `flags` field?

Thanks,
Guilherme

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

* Re: [RESEND PATCH] PCI: cpci: remove unused fields
  2025-02-13 20:44 ` Christophe JAILLET
@ 2025-02-15  2:10   ` Guilherme Giacomo Simoes
  2025-02-15  8:56     ` Christophe JAILLET
  0 siblings, 1 reply; 10+ messages in thread
From: Guilherme Giacomo Simoes @ 2025-02-15  2:10 UTC (permalink / raw)
  To: christophe.jaillet
  Cc: bhelgaas, linux-kernel, linux-pci, scott, trintaeoitogc

Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
> If neither get_power nor set_power where defined in any driver, then 
> cpci_get_power_status() was always returning 1.
> 
> IIUC, now it may return 1 or 0 depending of if enable_slot() or 
> disable_slot() have been called.
You is right... ever return 1, but, this is a expected behavior?
Don't seems for me, that ever return 1 is the right way.

> I don't know the impact of this change and I dont know if it is correct, 
> but I think you should explain why this change of behavior is fine.
I submitt this patch only with intention that save resources removing the
get_power and set_power pointers and yours calls.

Thoughts ?? 

Thanks,
Guilherme

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

* Re: [RESEND PATCH] PCI: cpci: remove unused fields
  2025-02-15  2:10   ` Guilherme Giacomo Simoes
@ 2025-02-15  8:56     ` Christophe JAILLET
  2025-02-15 14:05       ` Guilherme Giacomo Simoes
  0 siblings, 1 reply; 10+ messages in thread
From: Christophe JAILLET @ 2025-02-15  8:56 UTC (permalink / raw)
  To: Guilherme Giacomo Simoes; +Cc: bhelgaas, linux-kernel, linux-pci, scott

Le 15/02/2025 à 03:10, Guilherme Giacomo Simoes a écrit :
> Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
>> If neither get_power nor set_power where defined in any driver, then
>> cpci_get_power_status() was always returning 1.
>>
>> IIUC, now it may return 1 or 0 depending of if enable_slot() or
>> disable_slot() have been called.
> You is right... ever return 1, but, this is a expected behavior?
> Don't seems for me, that ever return 1 is the right way.
> 
>> I don't know the impact of this change and I dont know if it is correct,
>> but I think you should explain why this change of behavior is fine.
> I submitt this patch only with intention that save resources removing the
> get_power and set_power pointers and yours calls.

So, if unsure if the change of behavior you introduce is correct, you 
should only do what you wanted to do.

If you still want to propose the other change, you should do the 2 
things in 2 different steps.

CJ

> 
> Thoughts ??
> 
> Thanks,
> Guilherme
> 
> 


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

* Re: [RESEND PATCH] PCI: cpci: remove unused fields
  2025-02-15  8:56     ` Christophe JAILLET
@ 2025-02-15 14:05       ` Guilherme Giacomo Simoes
  0 siblings, 0 replies; 10+ messages in thread
From: Guilherme Giacomo Simoes @ 2025-02-15 14:05 UTC (permalink / raw)
  To: christophe.jaillet
  Cc: bhelgaas, linux-kernel, linux-pci, scott, trintaeoitogc

Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
> So, if unsure if the change of behavior you introduce is correct, you 
> should only do what you wanted to do.
> 
> If you still want to propose the other change, you should do the 2 
> things in 2 different steps.
Okay, I will send a patch with only (g|s)et_power() removed.

Thanks,
Guilherme

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

end of thread, other threads:[~2025-02-15 14:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-13 17:39 [RESEND PATCH] PCI: cpci: remove unused fields Guilherme Giacomo Simoes
2025-02-13 20:44 ` Christophe JAILLET
2025-02-15  2:10   ` Guilherme Giacomo Simoes
2025-02-15  8:56     ` Christophe JAILLET
2025-02-15 14:05       ` Guilherme Giacomo Simoes
2025-02-13 21:26 ` Bjorn Helgaas
2025-02-15  2:06   ` Guilherme Giacomo Simoes
  -- strict thread matches above, loose matches on Subject: below --
2025-01-30 14:01 Guilherme Giacomo Simoes
2025-01-16 15:55 Guilherme Giacomo Simoes
2025-01-02 15:26 Guilherme Giacomo Simoes

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