Re: [char-misc-next v2 1/5] mei: set parent for char device

From: Greg Kroah-Hartman
Date: Wed Jul 16 2025 - 03:47:33 EST


On Wed, Jul 16, 2025 at 07:44:28AM +0000, Usyskin, Alexander wrote:
> > Subject: Re: [char-misc-next v2 1/5] mei: set parent for char device
> >
> > On Mon, Jun 30, 2025 at 01:02:12PM +0000, Usyskin, Alexander wrote:
> > > > Subject: Re: [char-misc-next v2 1/5] mei: set parent for char device
> > > >
> > > > On Mon, Jun 30, 2025 at 12:19:38PM +0300, Alexander Usyskin wrote:
> > > > > Connect char device to parent device to avoid
> > > > > parent device unload while char device is
> > > > > still held open by user-space.
> > > >
> > > > No, that's not what cdev_set_parent() does.
> > > >
> > > https://elixir.bootlin.com/linux/v6.16-rc3/source/fs/char_dev.c#L511
> > > * cdev_set_parent() sets a parent kobject which will be referenced
> > > * appropriately so the parent is not freed before the cdev. This
> > > * should be called before cdev_add.
> > >
> > > This is what written there. Is my interpretation wrong?
> >
> > It has nothing to do with a char device being open or closed from
> > userspace, it has to deal with properly placing the device in the
> > kobject tree and the object references being correct.
> >
> > Surely the mei device had this set up before, right? If not, how did
> > sysfs look with these char devices with no real parent?
> >
>
> Mei device never had this setup.

So what is the "parent" of a mei device today?

> I've looked at other drivers - some of them do not have this setup.

Then they are broken, don't copy them :)

thanks,

greg k-h