Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752842AbaG1PiR (ORCPT ); Mon, 28 Jul 2014 11:38:17 -0400 Received: from cantor2.suse.de ([195.135.220.15]:56149 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751478AbaG1PiO (ORCPT ); Mon, 28 Jul 2014 11:38:14 -0400 Date: Mon, 28 Jul 2014 17:38:11 +0200 From: "Luis R. Rodriguez" To: Yuval Mintz Cc: "Luis R. Rodriguez" , "gregkh@linuxfoundation.org" , linux-kernel , Tetsuo Handa , Joseph Salisbury , Kay Sievers , One Thousand Gnomes , Tim Gardner , Pierre Fersing , Andrew Morton , Oleg Nesterov , Benjamin Poirier , Nagalakshmi Nandigama , Praveen Krishnamoorthy , Sreekanth Reddy , Abhijit Mahajan , Hariprasad S , Santosh Rastapur , "MPT-FusionLinux.pdl@avagotech.com" , linux-scsi , netdev Subject: Re: [PATCH 1/3] driver core: enable drivers to use deferred probe from init Message-ID: <20140728153811.GD21930@wotan.suse.de> References: <1406558067-25308-1-git-send-email-mcgrof@do-not-panic.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 28, 2014 at 03:12:11PM +0000, Yuval Mintz wrote: > > +static int __driver_probe_device(struct device_driver *drv, struct > > +device *dev) { > > + if (drv->delay_probe && !dev->init_delayed_probe) { > > + dev_info(dev, "Driver %s requests probe deferral on init\n", > > + drv->name); > > + dev->init_delayed_probe = true; > > + driver_deferred_probe_add(dev); > > + return -EPROBE_DEFER; > > + } > > + > > + return really_probe(dev, drv); > > +} > > Perhaps this is a silly question, but what guarantees that the deferred probe > list will actually be triggered, e.g., in case the delayed device is the last device > in the system? The dev->init_delayed_probe is used to ensure that we'd add the device to the deferred probe list once making this a per device thing if the driver has the field delay_probe set to true. This technically also allows this to be a per device thing so with some more work we could enable drivers to only enable this for specific devices but at this point this did not seem required. > [From drivers/base/dd.c - "A successful driver probe will trigger moving all > devices from the pending to the active list so that the workqueue will > eventually retry them] I had not noticed this, thanks for pointing this out, in this case if __driver_probe_device() is still used to retrigger a probe it will be added back to the deferred list but since dev->init_delayed_probe is still false. I checked the original commit that added this feature d1c3414c but in the code I see that bus_probe_device(dev) is used and I only see the device itself being removed from the deferred probe list, nothing else. Luis -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/