From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966051AbbJVXfX (ORCPT ); Thu, 22 Oct 2015 19:35:23 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:60056 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965977AbbJVXfL (ORCPT ); Thu, 22 Oct 2015 19:35:11 -0400 Date: Thu, 22 Oct 2015 14:20:21 +0100 From: Mark Brown To: Russell King - ARM Linux Cc: Geert Uytterhoeven , Tomeu Vizoso , Greg Kroah-Hartman , Rob Herring , Michael Turquette , Stephen Boyd , Vinod Koul , Dan Williams , Linus Walleij , Alexandre Courbot , Thierry Reding , David Airlie , Terje =?iso-8859-1?Q?Bergstr=F6m?= , Stephen Warren , Wolfram Sang , Frank Rowand , Grant Likely , Kishon Vijay Abraham I , Sebastian Reichel , Dmitry Eremin-Solenikov , David Woodhouse , Liam Girdwood , Felipe Balbi , Jingoo Han , Lee Jones , Jean-Christophe Plagniol-Villard , Tomi Valkeinen , "linux-kernel@vger.kernel.org" , linux-clk , dmaengine@vger.kernel.org, "linux-gpio@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "linux-tegra@vger.kernel.org" , Linux I2C , "devicetree@vger.kernel.org" , "linux-pm@vger.kernel.org" , Linux PWM List , "linux-usb@vger.kernel.org" , Linux Fbdev development list Message-ID: <20151022132021.GO8232@sirena.org.uk> References: <20151018193757.GA9147@kroah.com> <20151018195330.GB14956@sirena.org.uk> <20151019131821.GA32532@n2100.arm.linux.org.uk> <20151019143045.GE32532@n2100.arm.linux.org.uk> <20151019153548.GM32532@n2100.arm.linux.org.uk> <20151020154656.GY32532@n2100.arm.linux.org.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="MmQIYbZiCoQ2kDro" Content-Disposition: inline In-Reply-To: <20151020154656.GY32532@n2100.arm.linux.org.uk> X-Cookie: Does not include installation. User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: 211.36.156.43 X-SA-Exim-Mail-From: broonie@sirena.org.uk Subject: Re: Alternative approach to solve the deferred probe (was: [GIT PULL] On-demand device probing) X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --MmQIYbZiCoQ2kDro Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Oct 20, 2015 at 04:46:56PM +0100, Russell King - ARM Linux wrote: > Something like this. I haven't put a lot of effort into it to change all > the places which return an -EPROBE_DEFER, and it also looks like we need > some helpers to report when we have only an device_node (or should that > be fwnode?) See the commented out of_warn_deferred() in > drivers/gpio/gpiolib-of.c. Adding this stuff in the subsystems searching > for resources should make debugging why things are getting deferred easier. Yeah, plus I'd expect it to also result in better error reporting overall if the subsystems are able to report when they fail to get something rather than just returning an error to the driver. > +/** > + * dev_warn_deferred() - report why a probe has been deferred > + */ > +void dev_warn_deferred(struct device *dev, const char *fmt, ...) > +{ > + if (driver_deferred_probe_report) { > + struct va_format vaf; > + va_list ap; > + > + va_start(ap, fmt); > + vaf.fmt = fmt; > + vaf.va = ≈ > + > + dev_warn(dev, "deferring probe: %pV", &vaf); > + va_end(ap); > + } > +} > +EXPORT_SYMBOL_GPL(dev_warn_deferred); I'm not currently able to think of a nice way of writing this but I think what I'd really like to see from a driver point of view is something which decays into dev_err() if it's a non-deferral error. That way drivers can have minimal log and return error handling code and we will still get the output sensibly. The best I can think of is something like void dev_warn_deferred(struct device *dev, int err, const char *fmt, ...) which requires the caller to pass in err twice to get it logged. That's not a thing of beauty but it gets the job done... but perhaps your original interface is better, it's a bit cleaner. --MmQIYbZiCoQ2kDro Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJWKOKUAAoJECTWi3JdVIfQFcwH/2Bsw1x5Qw+VgkL/0LyC6iV4 8QUyxsL3BhSrQ1Oy5EVszY51yxiqW1bWOKCZKGe8uMuLcHdfpkSypeMNtqeEUKvp qfqnzd1DRT2mIy3wIDab7BFEWW+yRDXc+B9cbfkLUX3R3ysMSMNtb8ilZJUk+TLK KHxIGcjk7tFpWEtSAlJ+v9im8+HWMsdAioAOKc+lUgWlm9wftuARlM3MacsGfjuA 33SGbUwuvKMyqsSbflUlZGZQUoGFhxUFSzTqfqBeV3jIWgSyEJCEYxeBTIAlHpTQ k9bgJeCmEQlpd8bkv2L85XtQ9D4dMFHhG7KIO+i8gTzPfiLLDl/bo96X9dEK/tE= =wdzj -----END PGP SIGNATURE----- --MmQIYbZiCoQ2kDro--