lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240802164143.GA153790@bhelgaas>
Date: Fri, 2 Aug 2024 11:41:43 -0500
From: Bjorn Helgaas <helgaas@...nel.org>
To: ngn <ngn@....tf>
Cc: Nam Cao <namcao@...utronix.de>, linux-pci@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] PCI: shpchp: Remove hpc_ops

On Fri, Aug 02, 2024 at 04:06:09PM +0300, ngn wrote:
> On Thu, Aug 01, 2024 at 07:08:52PM -0500, Bjorn Helgaas wrote:
> > On Tue, Jul 23, 2024 at 02:43:25PM +0300, ngn wrote:
> > > Remove the hpc_ops struct from shpchp. This struct is unnecessary as
> > > no other hotplug controller implements it. A similar thing has already
> > > been done in pciehp with commit 82a9e79ef132 ("PCI: pciehp: remove hpc_ops")
> > 
> > > +++ b/drivers/pci/hotplug/shpchp_hpc.c
> > > @@ -167,7 +167,6 @@
> > >  
> > >  static irqreturn_t shpc_isr(int irq, void *dev_id);
> > >  static void start_int_poll_timer(struct controller *ctrl, int sec);
> > > -static int hpc_check_cmd_status(struct controller *ctrl);
> > >  
> > >  static inline u8 shpc_readb(struct controller *ctrl, int reg)
> > >  {
> > > @@ -317,7 +316,7 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd)
> > >  	if (retval)
> > >  		goto out;
> > >  
> > > -	cmd_status = hpc_check_cmd_status(slot->ctrl);
> > > +	cmd_status = shpchp_check_cmd_status(slot->ctrl);
> > 
> > This rename looks like it should be a separate patch because it's not
> > part of removing hpc_ops.
> 
> I think hpc_check_cmd_status meant to be a part of the hpc_ops struct.
> Here is the original struct:
> 
> struct hpc_ops {
> 	int (*power_on_slot)(struct slot *slot);
> 	int (*slot_enable)(struct slot *slot);
> 	int (*slot_disable)(struct slot *slot);
> 	int (*set_bus_speed_mode)(struct slot *slot, enum pci_bus_speed speed);
> 	int (*get_power_status)(struct slot *slot, u8 *status);
> 	int (*get_attention_status)(struct slot *slot, u8 *status);
> 	int (*set_attention_status)(struct slot *slot, u8 status);
> 	int (*get_latch_status)(struct slot *slot, u8 *status);
> 	int (*get_adapter_status)(struct slot *slot, u8 *status);
> 	int (*get_adapter_speed)(struct slot *slot, enum pci_bus_speed *speed);
> 	int (*get_prog_int)(struct slot *slot, u8 *prog_int);
> 	int (*query_power_fault)(struct slot *slot);
> 	void (*green_led_on)(struct slot *slot);
> 	void (*green_led_off)(struct slot *slot);
> 	void (*green_led_blink)(struct slot *slot);
> 	void (*release_ctlr)(struct controller *ctrl);
> 	int (*check_cmd_status)(struct controller *ctrl);
> };
> 
> As you can see it contains a pointer for check_cmd_status function,
> however the hpc_check_cmd_status was never assigned to it:
> 
> static const struct hpc_ops shpchp_hpc_ops = {
> 	.power_on_slot			= hpc_power_on_slot,
> 	.slot_enable			= hpc_slot_enable,
> 	.slot_disable			= hpc_slot_disable,
> 	.set_bus_speed_mode		= hpc_set_bus_speed_mode,
> 	.set_attention_status	= hpc_set_attention_status,
> 	.get_power_status		= hpc_get_power_status,
> 	.get_attention_status	= hpc_get_attention_status,
> 	.get_latch_status		= hpc_get_latch_status,
> 	.get_adapter_status		= hpc_get_adapter_status,
> 
> 	.get_adapter_speed		= hpc_get_adapter_speed,
> 	.get_prog_int			= hpc_get_prog_int,
> 
> 	.query_power_fault		= hpc_query_power_fault,
> 	.green_led_on			= hpc_set_green_led_on,
> 	.green_led_off			= hpc_set_green_led_off,
> 	.green_led_blink		= hpc_set_green_led_blink,
> 
> 	.release_ctlr			= hpc_release_ctlr,
> };
> 
> Which made me believe that this function supposed to be a part of the
> hpc_ops struct and whoever wrote the code added a pointer for it but
> then they forgot to assign the function to it during the actual
> definition of the struct. So I renamed it anyway.

Good point, thanks.  Applied to pci/hotplug for v6.12, thanks for your
work!

Bjorn

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ