public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: linux@roeck-us•net (Guenter Roeck)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH 2/2] ARM: BCM2835: Move the restart/power_off handling to the WDT driver.
Date: Mon, 27 Apr 2015 05:44:14 -0700	[thread overview]
Message-ID: <553E2F1E.5070909@roeck-us.net> (raw)
In-Reply-To: <2979294.WseZH0BUZW@wuerfel>

On 04/27/2015 02:18 AM, Arnd Bergmann wrote:
> On Sunday 26 April 2015 08:35:57 Guenter Roeck wrote:
>> On 04/25/2015 01:11 PM, Arnd Bergmann wrote:
>>> On Friday 24 April 2015 12:08:54 Eric Anholt wrote:
>>>> +/*
>>>> + * We can't really power off, but if we do the normal reset scheme, and
>>>> + * indicate to bootcode.bin not to reboot, then most of the chip will be
>>>> + * powered off.
>>>> + */
>>>> +static void bcm2835_power_off(void)
>>>> +{
>>>> +       struct device_node *np =
>>>> +               of_find_compatible_node(NULL, NULL, "brcm,bcm2835-pm-wdt");
>>>> +       struct platform_device *pdev = of_find_device_by_node(np);
>>>> +       struct bcm2835_wdt *wdt = platform_get_drvdata(pdev);
>>>> +       u32 val;
>>>> +
>>>
>>> Instead of doing the lookup again here, I'd suggest using a static variable
>>> in the driver to store the device pointer for the device used on power_off.
>>>
>>> Make sure that the device remove callback assigns it back to NULL though
>>> and that the function checks for NULL pointer.
>>>
>>
>> Why would that be needed ?
>
> devices can be unbound from drivers through sysfs, or using dynamic DT
> updates. If one does that, the watchdog driver will correctly destroy
> all information it has about the device, so if the power_off function
> still uses that pointer, it will crash.
>
Without calling its remove function ? That sounds odd. Lots of drivers
would break if that was really the case.

Guenter

  reply	other threads:[~2015-04-27 12:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-24 19:08 [PATCH 1/2] ARM: BCM2835: Drop the init_irq() hook Eric Anholt
2015-04-24 19:08 ` [PATCH 2/2] ARM: BCM2835: Move the restart/power_off handling to the WDT driver Eric Anholt
2015-04-24 19:32   ` Pranith Kumar
2015-04-25  4:39   ` Stephen Warren
2015-04-25 20:11   ` Arnd Bergmann
2015-04-26 15:35     ` Guenter Roeck
2015-04-27  9:18       ` Arnd Bergmann
2015-04-27 12:44         ` Guenter Roeck [this message]
2015-04-27 12:48           ` Arnd Bergmann
2015-04-27 13:28             ` Guenter Roeck
2015-04-27 13:32               ` Arnd Bergmann
2015-04-27 12:58   ` Lubomir Rintel
2015-04-27 16:04   ` Guenter Roeck
2015-04-27 16:05     ` Guenter Roeck
2015-04-27 23:12       ` Eric Anholt
2015-04-28  1:39         ` Guenter Roeck
2015-04-28  9:22           ` Lee Jones
2015-04-28 19:38           ` Eric Anholt
2015-04-27 18:28   ` Lee Jones
2015-04-29  2:35   ` [2/2] " Guenter Roeck
2015-04-29  6:45   ` [PATCH 2/2] " Lee Jones
2015-04-27 18:29 ` [PATCH 1/2] ARM: BCM2835: Drop the init_irq() hook Lee Jones

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=553E2F1E.5070909@roeck-us.net \
    --to=linux@roeck-us$(echo .)net \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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