From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
To: Andy Yan <andy.yan@rock-chips.com>,
robh+dt@kernel.org, sre@kernel.org, heiko@sntech.de,
john.stultz@linaro.org, arnd@arndb.de
Cc: mark.rutland@arm.com, catalin.marinas@arm.com,
will.deacon@arm.com, alexandre.belloni@free-electrons.com,
f.fainelli@gmail.com, linux@arm.linux.org.uk,
dbaryshkov@gmail.com, linux-pm@vger.kernel.org,
linux-rockchip@lists.infradead.org, wxt@rock-chips.com,
devicetree@vger.kernel.org, pawel.moll@arm.com,
ijc+devicetree@hellion.org.uk, lorenzo.pieralisi@arm.com,
matthias.bgg@gmail.com, linux-arm-kernel@lists.infradead.org,
moritz.fischer@ettus.com, mbrugger@suse.com,
linux-kernel@vger.kernel.org, galak@codeaurora.org,
olof@lixom.net, jun.nie@linaro.org, dwmw2@infradead.org
Subject: Re: [PATCH v7 2/4] power: reset: add reboot mode driver
Date: Wed, 06 Apr 2016 10:00:13 +0900 [thread overview]
Message-ID: <57045F9D.1000502@samsung.com> (raw)
In-Reply-To: <57045D6B.2080907@rock-chips.com>
On 06.04.2016 09:50, Andy Yan wrote:
(...)
>>> + return -ENOMEM;
>>> +
>>> + info->mode = kstrdup_const(prop->name + len, GFP_KERNEL);
>>> + if (of_property_read_u32(np, prop->name, &info->magic)) {
>>> + dev_err(dev, "reboot mode %s without magic number\n",
>>> + info->mode);
>>> + devm_kfree(dev, info);
>>> + continue;
>>> + }
>>> + list_add_tail(&info->list, &reboot->head);
>>> + }
>>> + of_node_put(np);
>> If you of_node_put() here, there is no sense in getting it before. I
>> mentioned of_node_get() only because I am not sure about life-cycle of
>> nodes in case of DT overlays and you are storing the pointer to string
>> from DT.
>>
>> The doubts I have are concerning only the case of freeing nodes from
>> overlay.
>>
>> I don't know if of_node_get() is needed but of_node_get()+of_node_put()
>> seems useless.
>
>
> I am also not sure about it. Maybe just drop of_node_get/put ?
OK, let's drop both get() and put().
(...)
>>> +
>>> +static const struct of_device_id syscon_reboot_mode_of_match[] = {
>>> + { .compatible = "syscon-reboot-mode" },
>>> + {}
>>> +};
>>> +
>>> +static struct platform_driver syscon_reboot_mode_driver = {
>>> + .probe = syscon_reboot_mode_probe,
>> Cleanup needed. What will happen after device unbind? Memory will be
>> released (devm-*()) but reboot notifier won't thus leading to OOPS on
>> reboot.
>
> From the kernel_restart_prepare function, the reboot notifier will
> be called before device_shutdown. Is there any other case the device
> unbind before reboot notifier
> called?
This is a regular module platform driver so unbind can happen any time
initiated by user, either by unbind command or by module removal. User
can then re-bind device or not - probably does not matter. Anyway after
such first unbind, the restart will kaboom instead of do a restart.
Beside that, you always should clean up, regardless of restart or not.
If you do not want unbind (thus no need of cleanup) then forbid it by
making it a non-module with suppressed bind.
Best regards,
Krzysztof
next prev parent reply other threads:[~2016-04-06 1:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-30 2:18 [PATCH v7 0/4] add reboot mode driver Andy Yan
[not found] ` <1459304304-9713-1-git-send-email-andy.yan-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-03-30 2:19 ` [PATCH v7 1/4] dt-bindings: power: reset: add document for reboot-mode driver Andy Yan
2016-03-30 3:44 ` Krzysztof Kozlowski
2016-03-30 2:20 ` [PATCH v7 2/4] power: reset: add reboot mode driver Andy Yan
2016-03-30 3:36 ` Krzysztof Kozlowski
2016-04-06 0:50 ` Andy Yan
2016-04-06 1:00 ` Krzysztof Kozlowski [this message]
2016-04-12 9:27 ` Andy Yan
2016-04-12 11:18 ` Krzysztof Kozlowski
2016-04-12 11:29 ` Andy Yan
2016-03-30 2:21 ` [PATCH v7 3/4] ARM: dts: rockchip: add syscon-reboot-mode DT node Andy Yan
2016-03-30 2:22 ` [PATCH v7 4/4] ARM64: " Andy Yan
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=57045F9D.1000502@samsung.com \
--to=k.kozlowski@samsung.com \
--cc=alexandre.belloni@free-electrons.com \
--cc=andy.yan@rock-chips.com \
--cc=arnd@arndb.de \
--cc=catalin.marinas@arm.com \
--cc=dbaryshkov@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dwmw2@infradead.org \
--cc=f.fainelli@gmail.com \
--cc=galak@codeaurora.org \
--cc=heiko@sntech.de \
--cc=ijc+devicetree@hellion.org.uk \
--cc=john.stultz@linaro.org \
--cc=jun.nie@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux@arm.linux.org.uk \
--cc=lorenzo.pieralisi@arm.com \
--cc=mark.rutland@arm.com \
--cc=matthias.bgg@gmail.com \
--cc=mbrugger@suse.com \
--cc=moritz.fischer@ettus.com \
--cc=olof@lixom.net \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=sre@kernel.org \
--cc=will.deacon@arm.com \
--cc=wxt@rock-chips.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;
as well as URLs for NNTP newsgroup(s).