Re: [PATCH] staging: vme_user: add missing includes

From: Greg KH
Date: Sat May 24 2025 - 12:18:04 EST


On Sat, May 24, 2025 at 07:09:46PM +0300, Heikki Huttu wrote:
> Wed, May 21, 2025 at 01:43:24PM +0200, Greg KH kirjoitti:
> > On Thu, May 15, 2025 at 10:40:13PM +0300, Heikki Huttu wrote:
> > > Header files use u32, size_t, dma_addr_t, struct device, struct list_head.
> > > Add direct includes to make the headers self-contained.
> > >
> > > Signed-off-by: Heikki Huttu <heissendo88@xxxxxxxxx>
> > > ---
> > > drivers/staging/vme_user/vme.h | 5 +++++
> > > drivers/staging/vme_user/vme_user.h | 2 ++
> > > 2 files changed, 7 insertions(+)
> > >
> > > diff --git a/drivers/staging/vme_user/vme.h b/drivers/staging/vme_user/vme.h
> > > index 7753e736f9fd..55499b240dc3 100644
> > > --- a/drivers/staging/vme_user/vme.h
> > > +++ b/drivers/staging/vme_user/vme.h
> > > @@ -3,6 +3,11 @@
> > > #define _VME_H_
> > >
> > > #include <linux/bitops.h>
> > > +#include <linux/types.h>
> > > +#include <linux/device.h>
> > > +#include <linux/list.h>
> > > +#include <linux/mm.h>
> > > +#include <linux/dma-mapping.h>
> >
> > If you are going to add these, please do so in a sorted way.
> >
> > But really, why is this needed at all?
> >
> > >
> > > /* Resource Type */
> > > enum vme_resource_type {
> > > diff --git a/drivers/staging/vme_user/vme_user.h b/drivers/staging/vme_user/vme_user.h
> > > index 19ecb05781cc..297b25fab164 100644
> > > --- a/drivers/staging/vme_user/vme_user.h
> > > +++ b/drivers/staging/vme_user/vme_user.h
> > > @@ -2,6 +2,8 @@
> > > #ifndef _VME_USER_H_
> > > #define _VME_USER_H_
> > >
> > > +#include <linux/types.h>
> >
> > Same here, are you sure this is needed?
> >
> > thanks,
> >
> > greg k-h
>
> Hi Greg,
>
> Thank you for the feedback.
>
> I was under the impression that it's generally preferred to use direct includes to make headers self-contained and avoid relying on transitive includes.
> If I was mistaken, apologies — feel free to disregard this.

Generally, yes, it is a good idea, but if nothing is broken, adding
additional .h files to other .h files is not a required change at all.

Are you doing this for all of the staging driver files? Is this a goal
to try to fix up more than just this one file?

thanks,

greg k-h