Re: [PATCH v1 1/3] driver core: Split device data types to device/types.h

From: Rafael J. Wysocki

Date: Tue Feb 24 2026 - 09:36:08 EST


On Tue, Feb 24, 2026 at 3:02 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> On Tue, Feb 24, 2026 at 05:17:43AM -0800, Greg Kroah-Hartman wrote:
> > On Tue, Feb 24, 2026 at 01:21:10PM +0100, Rafael J. Wysocki wrote:
> > > On Tue, Feb 24, 2026 at 10:05 AM Andy Shevchenko
> > > <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> > > > On Mon, Feb 23, 2026 at 09:53:17PM +0100, Rafael J. Wysocki wrote:
> > > > > On Mon, Feb 23, 2026 at 9:44 PM Andy Shevchenko
> > > > > <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> > > > > >
> > > > > > device.h is a huge header which is hard to follow and easy to miss
> > > > > > something. Improve that by splitting device data types to device/types.h.
> > > > > >
> > > > > > In particular this helps to speedup the build of the code that includes
> > > > > > device.h solely for a device data types.
> > > > > >
> > > > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> > > > >
> > > > > But why do you want to move the struct device definition out of device.h?
> > > >
> > > > Because it's a data type, and we have many drivers that may require it
> > > > (embed the struct device), but no device.h API is called directly —
> > > > only via a certain framework).
> > > >
> > > > device.h also includes many unrelated headers in such a case.
> > >
> > > Why is this a problem?
> > >
> > > Could those headers be moved to different header files instead?
> > >
> > > device.h is mostly about the struct device definition and the other
> > > stuff in it is more or less additional. Why do you want to make it
> > > the other way around?
> >
> > I agree, this feels wrong.
>
> Nobody is going to remove device.h :-)

And nobody is talking about removing it.

We are simply saying that the definition of struct device should
remain in device.h proper. I'm not sure what is unclear about that.

> It's a split based on the trend in the kernel.

Well, in this particular case that trend doesn't appear to be helpful.