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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

> Note: Currently, from a typechecking point of view this patch change
>       nothing because only the constants defined by the enum
>       are bitwise, not the enum itself (sparse doesn't have
>       the notion of 'bitwise enum'). This may change in some
>       not too far future, hence the patch.
> 
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
> ---
>  Documentation/PCI/pci-error-recovery.rst    | 2 +-
>  drivers/block/rsxx/core.c                   | 2 +-
>  drivers/dma/ioat/init.c                     | 2 +-
>  drivers/media/pci/ngene/ngene-cards.c       | 2 +-
>  drivers/misc/genwqe/card_base.c             | 2 +-
>  drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-
>  drivers/net/ethernet/intel/ixgb/ixgb_main.c | 4 ++--
>  drivers/net/ethernet/sfc/efx.c              | 2 +-
>  drivers/net/ethernet/sfc/falcon/efx.c       | 2 +-
>  drivers/pci/pcie/portdrv_pci.c              | 2 +-
>  drivers/scsi/aacraid/linit.c                | 2 +-
>  drivers/scsi/sym53c8xx_2/sym_glue.c         | 2 +-
>  drivers/staging/qlge/qlge_main.c            | 2 +-
>  include/linux/pci.h                         | 2 +-
>  14 files changed, 15 insertions(+), 15 deletions(-)



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux