Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1376589
| From | Andy Yan <andy.yan@rock-chips.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v7 2/4] power: reset: add reboot mode driver |
| Date | 2016-04-12 11:30 +0200 |
| Message-ID | <rn2NX-4Qf-9@gated-at.bofh.it> (permalink) |
| References | <ridTH-76E-1@gated-at.bofh.it> <rie3o-7aW-1@gated-at.bofh.it> <rif97-7UH-1@gated-at.bofh.it> <rkJZ8-3Wx-5@gated-at.bofh.it> <rkK8O-4jp-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi Krzysztof:
On 2016年04月06日 09:00, Krzysztof Kozlowski wrote:
> 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.
I just need to do clean up in remove?
> 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
>
>
>
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH v7 2/4] power: reset: add reboot mode driver Andy Yan <andy.yan@rock-chips.com> - 2016-04-06 03:00 +0200
Re: [PATCH v7 2/4] power: reset: add reboot mode driver Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-04-06 03:10 +0200
Re: [PATCH v7 2/4] power: reset: add reboot mode driver Andy Yan <andy.yan@rock-chips.com> - 2016-04-12 11:30 +0200
Re: [PATCH v7 2/4] power: reset: add reboot mode driver Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-04-12 13:20 +0200
Re: [PATCH v7 2/4] power: reset: add reboot mode driver Andy Yan <andy.yan@rock-chips.com> - 2016-04-12 13:40 +0200
csiph-web