From: Guenter Roeck <linux@roeck-us.net>
To: "Stefan Wahren" <info@lategoodbye.de>,
"Noralf Trønnes" <noralf@tronnes.org>,
linux-arm-kernel@lists.infradead.org
Cc: devicetree@vger.kernel.org, linux-watchdog@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-rpi-kernel@lists.infradead.org
Subject: Re: [PATCH 2/3] watchdog: bcm2835: Add poweroff code for the Raspberry Pi
Date: Fri, 12 Jun 2015 05:18:15 -0700 [thread overview]
Message-ID: <557ACE07.3040104@roeck-us.net> (raw)
In-Reply-To: <557AC203.6060600@lategoodbye.de>
On 06/12/2015 04:26 AM, Stefan Wahren wrote:
> Hi Noralf,
>
> Am 09.06.2015 um 12:21 schrieb Noralf Trønnes:
>> This adds a new poweroff function to the watchdog driver for the
>> Raspberry Pi. Currently poweroff/halt results in a reboot.
>>
>> [...]
>>
>> +static void rpi_power_off(void)
>> +{
>> + struct device_node *np =
>> + of_find_compatible_node(NULL, NULL, "brcm,raspberrypi-pm-wdt");
>> + struct platform_device *pdev = of_find_device_by_node(np);
>> + struct bcm2835_wdt *wdt = platform_get_drvdata(pdev);
>> + u32 val;
>> +
>> + val = readl_relaxed(wdt->base + PM_RSTS);
>
> do you think it's safe here to assume wdt could never be NULL?
>
If the call is made, the driver must be instantiated. We can therefore assume
that neither np, pdev, nor wdt is NULL. If one of those is NULL, it would be
a bug, which should not be ignored.
Guenter
WARNING: multiple messages have this Message-ID (diff)
From: linux@roeck-us.net (Guenter Roeck)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] watchdog: bcm2835: Add poweroff code for the Raspberry Pi
Date: Fri, 12 Jun 2015 05:18:15 -0700 [thread overview]
Message-ID: <557ACE07.3040104@roeck-us.net> (raw)
In-Reply-To: <557AC203.6060600@lategoodbye.de>
On 06/12/2015 04:26 AM, Stefan Wahren wrote:
> Hi Noralf,
>
> Am 09.06.2015 um 12:21 schrieb Noralf Tr?nnes:
>> This adds a new poweroff function to the watchdog driver for the
>> Raspberry Pi. Currently poweroff/halt results in a reboot.
>>
>> [...]
>>
>> +static void rpi_power_off(void)
>> +{
>> + struct device_node *np =
>> + of_find_compatible_node(NULL, NULL, "brcm,raspberrypi-pm-wdt");
>> + struct platform_device *pdev = of_find_device_by_node(np);
>> + struct bcm2835_wdt *wdt = platform_get_drvdata(pdev);
>> + u32 val;
>> +
>> + val = readl_relaxed(wdt->base + PM_RSTS);
>
> do you think it's safe here to assume wdt could never be NULL?
>
If the call is made, the driver must be instantiated. We can therefore assume
that neither np, pdev, nor wdt is NULL. If one of those is NULL, it would be
a bug, which should not be ignored.
Guenter
WARNING: multiple messages have this Message-ID (diff)
From: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
To: "Stefan Wahren" <info-saaNCTdWVBT7BZbvpMY5sg@public.gmane.org>,
"Noralf Trønnes" <noralf-L59+Z2yzLopAfugRpC6u6w@public.gmane.org>,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 2/3] watchdog: bcm2835: Add poweroff code for the Raspberry Pi
Date: Fri, 12 Jun 2015 05:18:15 -0700 [thread overview]
Message-ID: <557ACE07.3040104@roeck-us.net> (raw)
In-Reply-To: <557AC203.6060600-saaNCTdWVBT7BZbvpMY5sg@public.gmane.org>
On 06/12/2015 04:26 AM, Stefan Wahren wrote:
> Hi Noralf,
>
> Am 09.06.2015 um 12:21 schrieb Noralf Trønnes:
>> This adds a new poweroff function to the watchdog driver for the
>> Raspberry Pi. Currently poweroff/halt results in a reboot.
>>
>> [...]
>>
>> +static void rpi_power_off(void)
>> +{
>> + struct device_node *np =
>> + of_find_compatible_node(NULL, NULL, "brcm,raspberrypi-pm-wdt");
>> + struct platform_device *pdev = of_find_device_by_node(np);
>> + struct bcm2835_wdt *wdt = platform_get_drvdata(pdev);
>> + u32 val;
>> +
>> + val = readl_relaxed(wdt->base + PM_RSTS);
>
> do you think it's safe here to assume wdt could never be NULL?
>
If the call is made, the driver must be instantiated. We can therefore assume
that neither np, pdev, nor wdt is NULL. If one of those is NULL, it would be
a bug, which should not be ignored.
Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-06-12 12:18 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-09 10:21 [PATCH 1/3] dt-bindings: Add Raspberry Pi compatible string for watchdog Noralf Trønnes
2015-06-09 10:21 ` Noralf Trønnes
2015-06-09 10:21 ` Noralf Trønnes
2015-06-09 10:21 ` [PATCH 2/3] watchdog: bcm2835: Add poweroff code for the Raspberry Pi Noralf Trønnes
2015-06-09 10:21 ` Noralf Trønnes
2015-06-09 10:21 ` Noralf Trønnes
2015-06-12 11:26 ` Stefan Wahren
2015-06-12 11:26 ` Stefan Wahren
2015-06-12 11:26 ` Stefan Wahren
2015-06-12 12:18 ` Guenter Roeck [this message]
2015-06-12 12:18 ` Guenter Roeck
2015-06-12 12:18 ` Guenter Roeck
2015-06-12 12:23 ` Guenter Roeck
2015-06-12 12:23 ` Guenter Roeck
2015-06-09 10:21 ` [PATCH 3/3] ARM: dts: bcm2835-rpi: Add "brcm,raspberrypi-pm-wdt" to wdt compatible Noralf Trønnes
2015-06-09 10:21 ` [PATCH 3/3] ARM: dts: bcm2835-rpi: Add "brcm, raspberrypi-pm-wdt" " Noralf Trønnes
2015-06-09 10:21 ` Noralf Trønnes
2015-06-13 6:46 ` [PATCH 1/3] dt-bindings: Add Raspberry Pi compatible string for watchdog Jeff Epler
2015-06-13 6:46 ` Jeff Epler
2015-06-13 6:46 ` Jeff Epler
2015-06-13 6:46 ` Jeff Epler
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=557ACE07.3040104@roeck-us.net \
--to=linux@roeck-us.net \
--cc=devicetree@vger.kernel.org \
--cc=info@lategoodbye.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=noralf@tronnes.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.