From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Alexander Usyskin <alexander.usyskin@intel.com>
Cc: Reuven Abliyev <reuven.abliyev@intel.com>, linux-kernel@vger.kernel.org
Subject: Re: [char-misc-next v3 2/5] mei: make char device control its own lifetime
Date: Wed, 16 Jul 2025 11:54:26 +0200 [thread overview]
Message-ID: <2025071601-squatter-lent-4260@gregkh> (raw)
In-Reply-To: <20250709151344.104942-3-alexander.usyskin@intel.com>
On Wed, Jul 09, 2025 at 06:13:41PM +0300, Alexander Usyskin wrote:
> Allocate character device dynamically and allow to
> control its own lifetime as it may outlive mei_device
> structure while character device closes after parent
> device is removed from the system.
>
> Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
> ---
> drivers/misc/mei/main.c | 36 +++++++++++++++++++++++-------------
> drivers/misc/mei/mei_dev.h | 4 ++--
> 2 files changed, 25 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
> index 95d4c1d8e4e6..5335cf39d663 100644
> --- a/drivers/misc/mei/main.c
> +++ b/drivers/misc/mei/main.c
> @@ -51,7 +51,9 @@ static int mei_open(struct inode *inode, struct file *file)
>
> int err;
>
> - dev = container_of(inode->i_cdev, struct mei_device, cdev);
> + dev = idr_find(&mei_idr, iminor(inode));
What keeps the device structure in this idr after it has been removed
from the system before the char device is closed? Does the class device
lifespan outlive this? It seems like it really isn't saved anywhere,
but the release function accesses it, right?
Or is that a _different_ device pointer? How many different
pointers/structures are associated with a struct mei_device now?
confused,
greg k-h
next prev parent reply other threads:[~2025-07-16 9:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-09 15:13 [char-misc-next v3 0/5] mei: fix mei_device lifetime Alexander Usyskin
2025-07-09 15:13 ` [char-misc-next v3 1/5] mei: set parent for char device Alexander Usyskin
2025-07-10 5:31 ` Greg Kroah-Hartman
2025-07-16 9:47 ` Greg Kroah-Hartman
2025-07-09 15:13 ` [char-misc-next v3 2/5] mei: make char device control its own lifetime Alexander Usyskin
2025-07-16 9:54 ` Greg Kroah-Hartman [this message]
2025-07-17 11:54 ` Usyskin, Alexander
2025-07-09 15:13 ` [char-misc-next v3 3/5] mei: bus: use cldev in prints Alexander Usyskin
2025-07-09 15:13 ` [char-misc-next v3 4/5] mei: more prints with client prefix Alexander Usyskin
2025-07-09 15:13 ` [char-misc-next v3 5/5] mei: hook mei_device on class device Alexander Usyskin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2025071601-squatter-lent-4260@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=alexander.usyskin@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=reuven.abliyev@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox