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

Krzysztof Wilczyński kw at linux.com
Tue Nov 14 00:18:47 AEDT 2023


> > > 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.
> Note that the issue of casting is something we cannot fix easily:
> some *_device_id structs use "kernel_ulong_t" for the "data" member,
> others use "void *".
> git grep -W "_device_id" -- include/linux/mod_devicetable.h | grep data
> In addition, several drivers use multiple types of device IDs, so you
> cannot settle on one type to avoid casts.
> Also, putting enum values in instances of that struct, as suggested,
> increases kernel size, for IMHO no additional gain.

All good points!  Thank you for taking the time to get back to me.  Appreciated. :)

> If there is more data to put in the struct, I agree it makes sense to use
> a struct.

Yeah.  Perhaps if there is such a need in the future, indeed.


More information about the Linuxppc-dev mailing list