public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: jeffy <jeffy.chen@rock-chips.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: linux-kernel@vger.kernel.org, dmitry.torokhov@gmail.com,
	heiko@sntech.de, briannorris@chromium.org, dianders@chromium.org,
	tfiga@chromium.org, broonie@kernel.org, seanpaul@chromium.org,
	thierry.reding@gmail.com,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH] driver core: Make sure device detached from driver before deleting it
Date: Wed, 18 Oct 2017 19:11:04 +0800	[thread overview]
Message-ID: <59E736C8.3080002@rock-chips.com> (raw)
In-Reply-To: <1742035.QldI8RN9SY@aspire.rjw.lan>

Hi Rafael,

Thanks for your reply.

On 10/18/2017 06:04 PM, Rafael J. Wysocki wrote:
> But device_del() calls bus_remove_device() which in turn calls
> device_release_driver(), so this looks like an ordering issue to me.
>
uh, right, didn't notice that, it indeed to be a ordering issue...

it turns out in device_del() we are calling device_links_purge() before 
bus_remove_device()...

> What*exactly*  is not working?  Or rather, what symptoms do you see?
>
my board has these devices:
spi master device->spi child device->spi based pwm->pwm_bl

and i add a device link to the pwm and pwm_bl, and got a warning about 
the pwm not unbound:

static void device_links_purge(struct device *dev)
{
...
         list_for_each_entry_safe_reverse(link, ln, 
&dev->links.consumers, s_node) {
                 WARN_ON(link->status != DL_STATE_DORMANT &&
                         link->status != DL_STATE_NONE); <-- warning here!
                 __device_link_del(link);
         }


and i was confused by:
static void mac80211_hwsim_del_radio(struct mac80211_hwsim_data *data,
                                      const char *hwname,
                                      struct genl_info *info)
{
...
         device_release_driver(data->dev);
         device_unregister(data->dev);

and adding that device_release_driver hide that issue(oops...)


so we should move device_links_purge() after bus_remove_device() in 
device_del() right? maybe after device_remove_properties(), and that did 
solve the issue :)


> Thanks,
> Rafael

  reply	other threads:[~2017-10-18 11:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-18  5:49 [PATCH] driver core: Make sure device detached from driver before deleting it Jeffy Chen
2017-10-18  6:19 ` Greg Kroah-Hartman
2017-10-18  7:06   ` jeffy
2017-10-18  7:33     ` Greg Kroah-Hartman
2017-10-18  8:32       ` jeffy
2017-10-18  9:47   ` Mark Brown
2017-10-18 10:01     ` Rafael J. Wysocki
2017-10-18 10:04 ` Rafael J. Wysocki
2017-10-18 11:11   ` jeffy [this message]
2017-10-18 11:32     ` jeffy
2017-10-18 11:32       ` Rafael J. Wysocki
2017-10-18 11:33       ` Rafael J. Wysocki

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=59E736C8.3080002@rock-chips.com \
    --to=jeffy.chen@rock-chips.com \
    --cc=briannorris@chromium.org \
    --cc=broonie@kernel.org \
    --cc=dianders@chromium.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heiko@sntech.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=seanpaul@chromium.org \
    --cc=tfiga@chromium.org \
    --cc=thierry.reding@gmail.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