Re: [PATCH] pci: consolidate typing of pci_error_handlers::error_detected()

From: Luc Van Oostenryck
Date: Mon Jun 29 2020 - 19:11:16 EST


On Mon, Jun 29, 2020 at 04:29:28PM -0500, Bjorn Helgaas wrote:
> On Sun, Jun 28, 2020 at 06:12:33PM +0200, Luc Van Oostenryck wrote:
> > The method struct pci_error_handlers::error_detected() is defined and
> > documented as taking an 'enum pci_channel_state' for the second
> > argument but most drivers use 'pci_channel_state_t' instead.
> > This 'pci_channel_state_t' is not a typedef for the enum but a typedef
> > for a bitwise type in order to have better/stricter typechecking.
> >
> > So, consolidate everything by using the restricted type in the
> > method's definition, in the documentation and in the drivers not
> > using 'pci_channel_state_t'.
>
> $ git grep "\<pci_channel_state\>"
> Documentation/PCI/pci-error-recovery.rst: enum pci_channel_state {
> Documentation/PCI/pci-error-recovery.rst:pci_channel_state value of pci_channel_io_perm_failure.
> arch/powerpc/kernel/eeh_driver.c:static void eeh_set_channel_state(struct eeh_pe *root, enum pci_channel_state s)
> drivers/net/ethernet/intel/ice/ice_main.c:ice_pci_err_detected(struct pci_dev *pdev, enum pci_channel_state err)
> drivers/pci/pci.h: enum pci_channel_state state,
> drivers/pci/pcie/err.c: enum pci_channel_state state,
> drivers/pci/pcie/err.c: enum pci_channel_state state,
>
> Should these be changed as well? If not, why not? Some of them look
> analogous to the ones changed below.

Oh yes, surely. This is in fact a resend of an old patch (Dec 2018)
and it seems that these are more recent. I'll check, update and send
a new version.

-- Luc