Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933196AbcDLLSf (ORCPT ); Tue, 12 Apr 2016 07:18:35 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:40777 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756611AbcDLLSd (ORCPT ); Tue, 12 Apr 2016 07:18:33 -0400 X-AuditID: cbfec7f5-f792a6d000001302-bf-570cd985d364 Subject: Re: [PATCH v7 2/4] power: reset: add reboot mode driver To: Andy Yan , robh+dt@kernel.org, sre@kernel.org, heiko@sntech.de, john.stultz@linaro.org, arnd@arndb.de References: <1459304304-9713-1-git-send-email-andy.yan@rock-chips.com> <1459304443-9811-1-git-send-email-andy.yan@rock-chips.com> <56FB49B3.2040505@samsung.com> <57045D6B.2080907@rock-chips.com> <57045F9D.1000502@samsung.com> <570CBF7F.9090300@rock-chips.com> 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 From: Krzysztof Kozlowski Message-id: <570CD983.9090202@samsung.com> Date: Tue, 12 Apr 2016 13:18:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-version: 1.0 In-reply-to: <570CBF7F.9090300@rock-chips.com> Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA02SfSzUcRzH973fI7uzXxf1nVbsFm0Wkh6+tWo2q/36B+th1Fa5+A3j0O8w aiuP8/wQNrlKuHMitKGSEplJSLhzmLJwK6KOqJUbl2Mt/70/7/fr8/DHh8bEq7gtHRIexfHh 0jAJaYn3rL4Zck4ZFfruU/TvRWk6pQDlvh8FaCW/k0IGdRZA+XoDhh509BHodlUBhpa/d1Ao d66MQKbJWQL1fa0CqNfojFT6CQrNTruh+ikdgTTN90i0mN0B0I9PJgyNaURozjhNoYrhAQFK THZHpQV6AvXG+6Hu4UUS5RXV4iilZW1yz4soNLPQhaPUJLXAYxdbU1ID2OSkLJI1LucDVpOT LWCLuxspVl8/ANjnio8UW1W5RLIND53Y+up0kv2ge7lWqW6x2q5Egl1RtOJsTmM1YJ/pSjAf 8UXLY4FcWEgMx7ue8LcMbppfwCNNdGytUknFg7tUBqBpyByAOfGSDGCxJrfB/vHHZAawpMVM BYBjU2rBRvEZwFV1GmWmtjIesGwwhTIH1kwygK8rXxEbVLoA6qoy1xOM0eJQu9REmFtIxh02 VKpIsxYxTjA9sYAw78YZB2jqCTTbNowf1N9/CzaQLfB3wThu1haMC1SaRtdPxZg9sLBQZrYx xg421HzD8gCj2NSh+E8pNlGlAKsGNlx0QKT8apBsv4tcKpNHhwe5BETI6sHGV/xsAhWdR9sB QwOJUHTklNBXTEhj5HGydgBpTGItchxZs0SB0rjrHB9xhY8O4+TtYAeNS7aLipsN58RMkDSK C+W4SI7/lwpoC9t4EHz6PKe9cJaftrIXTqh+PXU8rvHw8dy5W3TyTC3dO+9xyfGg40hA/6Fr /vN1Y+VKL4cgPrPUfcg7QZiYU2Tfkl4e2mbnGYtm5gxfJu8kLGX1deJ8/xzwAqbWOr9HN8tv xL07rMgOsULefaFJxrbUy17lGit1dN6i658nhkGVmwSXB0vdnDBeLv0LMh1XVREDAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1123 Lines: 28 On 04/12/2016 11:27 AM, Andy Yan wrote: >>>>> + >>>>> +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? Yes, you need to clean up everything in remove() callback (in a reversed order). Best regards, Krzysztof