From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Lunn Subject: Re: [PATCH v3 1/3] power: reset: add linkstation-reset driver Date: Tue, 3 Jan 2017 14:09:16 +0100 Message-ID: <20170103130916.GA30197@lunn.ch> References: <20161216100501.18173-1-rogershimizu@gmail.com> <20161227070611.14852-1-rogershimizu@gmail.com> <20161227070611.14852-2-rogershimizu@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Florian Fainelli Cc: devicetree@vger.kernel.org, Ryan Tandy , linux-pm@vger.kernel.org, Sebastian Reichel , Roger Shimizu , Herbert Valerio Riedel , Martin Michlmayr , linux-arm-kernel@lists.infradead.org, Sylver Bruneau List-Id: linux-pm@vger.kernel.org > > + > > + /* Check that nothing else has already setup a handler */ > > + if (pm_power_off) { > > + lookup_symbol_name((ulong)pm_power_off, symname); > > + dev_err(&pdev->dev, > > + "pm_power_off already claimed %p %s", > > + pm_power_off, symname); > > + return -EBUSY; > > + } > > + pm_power_off = linkstation_reset; > > That seems a bit complicated, why not just assume that there will be > either this driver used, or not at all? That is probably my fault. This is a copy from code i wrote many years ago for the QNAP. I guess at the time i was battling with two different pm_power_off handlers, so put in this code. > Also, you are supposed to register a reboot notifier to which you can > pass private context: At the time i wrote the QNAP code, this did not exist. So maybe my code is no longer a good example to copy. Andrew