Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1559160 > unrolled thread

Calling device_init_wakeup() on driver removal

Started byGuenter Roeck <linux@roeck-us.net>
First post2017-01-15 05:50 +0100
Last post2017-01-15 16:30 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  Calling device_init_wakeup() on driver removal Guenter Roeck <linux@roeck-us.net> - 2017-01-15 05:50 +0100
    Re: Calling device_init_wakeup() on driver removal "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-01-15 16:00 +0100
      Re: Calling device_init_wakeup() on driver removal Guenter Roeck <linux@roeck-us.net> - 2017-01-15 16:30 +0100

#1559160 — Calling device_init_wakeup() on driver removal

FromGuenter Roeck <linux@roeck-us.net>
Date2017-01-15 05:50 +0100
SubjectCalling device_init_wakeup() on driver removal
Message-ID<sZKVr-6yh-3@gated-at.bofh.it>
Hi folks,

while looking through driver initialization and removal functions, I noticed that many drivers
call device_init_wakeup(dev, false) in the removal function. Given that the driver is about
to be removed, that doesn't make much sense to me, especially since device_wakeup_disable()
is called from device_pm_remove() anyway.

Is it safe to assume that all those calls can be removed, or is there a possible reason for
keeping them around ?

Thanks,
Guenter

[toc] | [next] | [standalone]


#1559250

From"Rafael J. Wysocki" <rjw@rjwysocki.net>
Date2017-01-15 16:00 +0100
Message-ID<sZUrM-3Jh-11@gated-at.bofh.it>
In reply to#1559160
On Saturday, January 14, 2017 08:46:05 PM Guenter Roeck wrote:
> Hi folks,

Hi,

> while looking through driver initialization and removal functions, I noticed that many drivers
> call device_init_wakeup(dev, false) in the removal function. Given that the driver is about
> to be removed, that doesn't make much sense to me, especially since device_wakeup_disable()
> is called from device_pm_remove() anyway.
> 
> Is it safe to assume that all those calls can be removed, or is there a possible reason for
> keeping them around ?

Removing them automatically might break things, because device_init_wakeup(dev, false)
also clears the power.can_wakeup flag and removes the "wakeup" attribute from sysfs.

I guess they could be removed safely in the majority of cases, though.

Thanks,
Rafael

[toc] | [prev] | [next] | [standalone]


#1559273

FromGuenter Roeck <linux@roeck-us.net>
Date2017-01-15 16:30 +0100
Message-ID<sZUUN-47Q-5@gated-at.bofh.it>
In reply to#1559250
On 01/15/2017 06:49 AM, Rafael J. Wysocki wrote:
> On Saturday, January 14, 2017 08:46:05 PM Guenter Roeck wrote:
>> Hi folks,
>
> Hi,
>
>> while looking through driver initialization and removal functions, I noticed that many drivers
>> call device_init_wakeup(dev, false) in the removal function. Given that the driver is about
>> to be removed, that doesn't make much sense to me, especially since device_wakeup_disable()
>> is called from device_pm_remove() anyway.
>>
>> Is it safe to assume that all those calls can be removed, or is there a possible reason for
>> keeping them around ?
>
> Removing them automatically might break things, because device_init_wakeup(dev, false)
> also clears the power.can_wakeup flag and removes the "wakeup" attribute from sysfs.
>

I had the same concern, but I concluded that the wakeup attribute should be removed
automatically, since it is added with sysfs_merge_group(), and the matching unmerge call
is also made in dpm_sysfs_remove(). power.can_wakeup is part of the device structure,
which is in the process of being removed, so I am not sure I understand how that can be
problematic.

> I guess they could be removed safely in the majority of cases, though.

How would one decide if it is needed ? I see some drivers call it on remove, but others
don't. I don't see a clear pattern; unless I am missing something, it seems to be
more or less random.

Thanks,
Guenter

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web