Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933308AbcDLL37 (ORCPT ); Tue, 12 Apr 2016 07:29:59 -0400 Received: from regular1.263xmail.com ([211.150.99.137]:59508 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932393AbcDLL36 (ORCPT ); Tue, 12 Apr 2016 07:29:58 -0400 X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 X-KSVirus-check: 0 X-RL-SENDER: andy.yan@rock-chips.com X-FST-TO: dwmw2@infradead.org X-SENDER-IP: 121.15.173.1 X-LOGIN-NAME: andy.yan@rock-chips.com X-UNIQUE-TAG: <96eb7a2ce07bbb8c9df6c72337c46cdd> X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 Subject: Re: [PATCH v7 2/4] power: reset: add reboot mode driver To: Krzysztof Kozlowski , 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> <570CD983.9090202@samsung.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: Andy Yan Message-ID: <570CDC17.1090901@rock-chips.com> Date: Tue, 12 Apr 2016 19:29:27 +0800 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: <570CD983.9090202@samsung.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1302 Lines: 34 Hi Krzysztof: Thanks for you kindly suggestion. I will follow it in next version. On 2016年04月12日 19:18, Krzysztof Kozlowski wrote: > 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 > > >