From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Rafael J. Wysocki" Subject: Re: [PATCH] bus: subsys: propagate errors from subsys interface's ->add_dev() Date: Thu, 30 Jul 2015 01:01:21 +0200 Message-ID: <2867166.mZBGleMS1o@vostro.rjw.lan> References: <20150729211916.GA11972@kroah.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7Bit Return-path: Received: from v094114.home.net.pl ([79.96.170.134]:55390 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751246AbbG2WeY (ORCPT ); Wed, 29 Jul 2015 18:34:24 -0400 In-Reply-To: <20150729211916.GA11972@kroah.com> Sender: linux-pm-owner@vger.kernel.org List-Id: linux-pm@vger.kernel.org To: Greg KH Cc: Viresh Kumar , linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, pi-cheng.chen@linaro.org On Wednesday, July 29, 2015 02:19:16 PM Greg KH wrote: > On Fri, Jun 26, 2015 at 02:32:47PM +0530, Viresh Kumar wrote: > > ->add_dev() may fail and the error returned from it can be useful for > > the caller. > > > > For example, if some of the resources aren't ready yet and -EPROBE_DEFER > > is returned from ->add_dev(), then the owner of 'struct > > subsys_interface' may want to try probing again at a later point of > > time. And that requires a proper return value from ->add_dev(). > > > > Also, if we hit an error while registering subsys_interface, then we > > should stop proceeding further and rollback whatever has been done until > > then. Break part of subsys_interface_unregister() into another routine, > > which lets us call ->remove_dev() for all devices for which ->add_dev() > > is already called. > > > > Cc: 3.3+ # 3.3+ > > Fixes: ca22e56debc5 ("driver-core: implement 'sysdev' functionality for regular devices and buses") > > I don't see how this is a stable bug fix, what is resolved by it that > doesn't work today? Is there some code that is expecting this > functionality that has never been present? > > I'll go queue it up, but I don't think it is -stable material, but feel > free to change my mind. There is a small problem with it that I've already pointed out to Viresh. Namely, while changing subsys_interface_(un)register() to handle return values from ->add_dev(), it doesn't do the same thing in bus_probe_device() which I believe it should for consistency at least. But then, the question is whether or not the probing should fail and what if device_attach() returns 0 and one of the ->add_dev() callbacks returns an error. Thanks, Rafael