[PATCH 0/3] PCI: dwc: Improve code readability

Yoshihiro Shimoda yoshihiro.shimoda.uh at renesas.com
Tue Nov 14 11:20:23 AEDT 2023


Hello,

> From: Krzysztof Wilczyński, Sent: Monday, November 13, 2023 9:22 PM
> 
> [...]
> > > > Now, while you are looking at things, can you also take care about the following:
> > > >
> > > >   drivers/pci/controller/dwc/pcie-rcar-gen4.c:439:15: warning: cast to smaller integer type 'enum
> dw_pcie_device_mode'
> > > from 'const void *' [-Wvoid-pointer-to-enum-cast]
> >
> > Thank you for the report!
> >
> > > > This requires adding structs for each data member of the of_device_id type.
> > >
> > > That sounds like overkill to me.
> > > An intermediate cast to uintptr_t should fix the issue as well.
> >
> > I confirmed that the uintptr_t fixed the issue.
> 
> We declined a similar fix in the past[1] ...
> 
> > I also think that adding a new struct with the mode is overkill.
> 
> ... with the hopes that a driver could drop the switch statements in place
> of using the other pattern.  Also, to be consistent with other drivers that
> do this already.
> 
> > So, I would like to fix the issue by using the cast of uintptr_t.
> 
> Sure.  I appreciate that this would be more work.  When you send your
> patch, can you include an update to the iproc driver (and credit the
> original author from [1])?  I would appreciate it.
> 
> 1. https://lore.kernel.org/linux-pci/20230814230008.GA196797@bhelgaas/

I got it. I'll include the following patch on v2.

https://lore.kernel.org/linux-pci/20230814-void-drivers-pci-controller-pcie-iproc-platform-v1-1-81a121607851@google.com/

Best regards,
Yoshihiro Shimoda

> 
> 	Krzysztof


More information about the Linuxppc-dev mailing list