2024-01-25 23:12:10

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH v2 2/3] usb: typec: ucsi: Update connector cap and status

On Wed, Jan 24, 2024 at 04:44:53PM -0800, Abhishek Pandit-Subedi wrote:
> diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h
> index bec920fa6b8a..94b373378f63 100644
> --- a/drivers/usb/typec/ucsi/ucsi.h
> +++ b/drivers/usb/typec/ucsi/ucsi.h
> @@ -3,6 +3,7 @@
> #ifndef __DRIVER_USB_TYPEC_UCSI_H
> #define __DRIVER_USB_TYPEC_UCSI_H
>
> +#include <asm-generic/unaligned.h>

Do you really need to include a asm/ include file? This feels very
wrong.

It's also in the wrong place, AND why "asm-generic"? That also feels
wrong.

thanks,

greg k-h


2024-01-26 00:23:11

by Abhishek Pandit-Subedi

[permalink] [raw]
Subject: Re: [PATCH v2 2/3] usb: typec: ucsi: Update connector cap and status

On Thu, Jan 25, 2024 at 3:03 PM Greg Kroah-Hartman
<[email protected]> wrote:
>
> On Wed, Jan 24, 2024 at 04:44:53PM -0800, Abhishek Pandit-Subedi wrote:
> > diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h
> > index bec920fa6b8a..94b373378f63 100644
> > --- a/drivers/usb/typec/ucsi/ucsi.h
> > +++ b/drivers/usb/typec/ucsi/ucsi.h
> > @@ -3,6 +3,7 @@
> > #ifndef __DRIVER_USB_TYPEC_UCSI_H
> > #define __DRIVER_USB_TYPEC_UCSI_H
> >
> > +#include <asm-generic/unaligned.h>
>
> Do you really need to include a asm/ include file? This feels very
> wrong.

I didn't see any header in include/linux that already had these
unaligned access functions so I opted to include
asm-generic/unaligned.h. Is there a reason not to use an asm/ include
file?

>
> It's also in the wrong place, AND why "asm-generic"? That also feels
> wrong.

asm-generic is definitely wrong; I misunderstood how these headers are
supposed to be used (should be just asm/unaligned.h).
For ordering, I took a look at some other files and it looks like
<asm/...> goes below the <linux/...> includes. This also probably
deserves documenting in the style guide.

>
> thanks,
>
> greg k-h

2024-01-26 01:51:06

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH v2 2/3] usb: typec: ucsi: Update connector cap and status

On Thu, Jan 25, 2024 at 04:21:47PM -0800, Abhishek Pandit-Subedi wrote:
> On Thu, Jan 25, 2024 at 3:03 PM Greg Kroah-Hartman
> <[email protected]> wrote:
> >
> > On Wed, Jan 24, 2024 at 04:44:53PM -0800, Abhishek Pandit-Subedi wrote:
> > > diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h
> > > index bec920fa6b8a..94b373378f63 100644
> > > --- a/drivers/usb/typec/ucsi/ucsi.h
> > > +++ b/drivers/usb/typec/ucsi/ucsi.h
> > > @@ -3,6 +3,7 @@
> > > #ifndef __DRIVER_USB_TYPEC_UCSI_H
> > > #define __DRIVER_USB_TYPEC_UCSI_H
> > >
> > > +#include <asm-generic/unaligned.h>
> >
> > Do you really need to include a asm/ include file? This feels very
> > wrong.
>
> I didn't see any header in include/linux that already had these
> unaligned access functions so I opted to include
> asm-generic/unaligned.h. Is there a reason not to use an asm/ include
> file?

Yes, you should never need to include a asm/ file, unless you are
arch-specific code.

But the big issue is that you don't really need this, right?

> > It's also in the wrong place, AND why "asm-generic"? That also feels
> > wrong.
>
> asm-generic is definitely wrong; I misunderstood how these headers are
> supposed to be used (should be just asm/unaligned.h).

Why? What are you requiring this .h file for?

> For ordering, I took a look at some other files and it looks like
> <asm/...> goes below the <linux/...> includes. This also probably
> deserves documenting in the style guide.

It is somewhere, checkpatch should complain about it.

thanks,

greg k-h