Linux IIO development
 help / color / mirror / Atom feed
From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
To: Ulf Hansson <ulf.hansson@linaro.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	dakr@kernel.org, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	geert@linux-m68k.org,
	Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-iio@vger.kernel.org, bhelgaas@google.com
Subject: Re: [PATCH] driver core: platform: Use devres group to free driver probe resources
Date: Wed, 21 May 2025 08:41:33 +0300	[thread overview]
Message-ID: <a20fc6ee-c6c3-4013-b175-4918b9a44380@tuxon.dev> (raw)
In-Reply-To: <CAPDyKFqMB7XutXba73YHx1X4rm6uc3Fz6yMZ8yM=wgduEmgUDg@mail.gmail.com>

Hi, Ulf,

On 20.05.2025 15:09, Ulf Hansson wrote:
> For example, even if the order is made correctly, suppose a driver's
> ->remove() callback completes by turning off the resources for its
> device and leaves runtime PM enabled, as it relies on devres to do it
> some point later. Beyond this point, nothing would prevent userspace
> for runtime resuming/suspending the device via sysfs. 

If I'm not wrong, that can't happen? The driver_sysfs_remove() is called
before device_remove() (which calls the driver remove) is called, this
being the call path:

device_driver_detach() ->
  device_release_driver_internal() ->
    __device_release_driver() ->
      driver_sysfs_remove()
      // ...
      device_remove()

And the driver_sysfs_remove() calls in the end __kernfs_remove() which
looks to me like the place that actually drops the entries from sysfs, this
being a call path for it:

driver_sysfs_remove() ->
  sysfs_remove_link() ->
    kernfs_remove_by_name() ->
      kernfs_remove_by_name_ns() ->
        __kernfs_remove() ->

activating the following line in __kernfs_remove():

pr_debug("kernfs %s: removing\n", kernfs_rcu_name(kn));

leads to the following prints when unbinding the watchdog device from its
watchdog driver (attached to platform bus) on my board:
https://p.fr33tux.org/935252

Thank you,
Claudiu

  parent reply	other threads:[~2025-05-21  5:41 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20250215130849.227812-1-claudiu.beznea.uj@bp.renesas.com>
     [not found] ` <2025021539-untrained-prompter-a48f@gregkh>
     [not found]   ` <4bf01946-90e3-4169-91fa-10d9f90310e9@tuxon.dev>
     [not found]     ` <8d83ea72-bb81-4c63-bf69-28cf5848ae20@tuxon.dev>
2025-03-05 14:03       ` [PATCH] driver core: platform: Use devres group to free driver probe resources Jonathan Cameron
2025-03-06  6:11         ` Dmitry Torokhov
2025-03-27 16:47           ` Claudiu Beznea
2025-03-30 15:31             ` Jonathan Cameron
2025-04-09 16:12               ` Claudiu Beznea
2025-05-09 11:51                 ` Claudiu Beznea
2025-05-09 13:07                   ` Ulf Hansson
2025-05-09 14:12                     ` Claudiu Beznea
2025-05-11 11:01                       ` Jonathan Cameron
2025-05-19 16:20                         ` Dmitry Torokhov
2025-05-19 15:02                       ` Ulf Hansson
2025-05-19 16:13                         ` Dmitry Torokhov
2025-05-20 12:09                           ` Ulf Hansson
2025-05-20 19:08                             ` Dmitry Torokhov
2025-05-21  5:41                             ` Claudiu Beznea [this message]
2025-05-21 12:37                               ` Ulf Hansson
2025-05-21 14:57                                 ` Dmitry Torokhov
2025-05-22  9:48                                   ` Claudiu Beznea
2025-05-22 11:53                                     ` Ulf Hansson
2025-05-22 14:08                                       ` Claudiu Beznea
2025-05-22 16:28                                         ` Ulf Hansson
2025-05-22 18:47                                           ` Dmitry Torokhov
2025-05-22 22:09                                             ` Ulf Hansson
2025-05-22 23:06                                               ` Dmitry Torokhov
2025-05-23  9:47                                                 ` Ulf Hansson
2025-05-23 10:52                                                   ` Claudiu Beznea
2025-05-23 13:48                                                     ` Ulf Hansson
2025-05-22 14:55                                       ` Geert Uytterhoeven
2025-05-22 22:24                                         ` Ulf Hansson
2025-05-22 10:32                                   ` Ulf Hansson

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=a20fc6ee-c6c3-4013-b175-4918b9a44380@tuxon.dev \
    --to=claudiu.beznea@tuxon.dev \
    --cc=bhelgaas@google.com \
    --cc=claudiu.beznea.uj@bp.renesas.com \
    --cc=dakr@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=ulf.hansson@linaro.org \
    /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