From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932079AbbE0Ijo (ORCPT ); Wed, 27 May 2015 04:39:44 -0400 Received: from mga02.intel.com ([134.134.136.20]:57321 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752556AbbE0Ijk (ORCPT ); Wed, 27 May 2015 04:39:40 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,503,1427785200"; d="scan'208";a="716224929" Date: Wed, 27 May 2015 11:39:33 +0300 From: Heikki Krogerus To: Greg KH Cc: Tal Shorer , Sudip Mukherjee , Sasha Levin , USB list , "" , David Cohen , Felipe Balbi , Lu Baolu Subject: Re: [PATCH] usb: ulpi: don't register drivers if bus doesn't exist Message-ID: <20150527083933.GA13844@kuha.fi.intel.com> References: <1432150406-20550-1-git-send-email-sasha.levin@oracle.com> <20150524071948.GA20923@kroah.com> <20150524080940.GA4033@sudip-PC> <20150525114010.GA30679@kuha.fi.intel.com> <20150525161312.GB9772@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150525161312.GB9772@kroah.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg, > > But couldn't we add a helper function to drivers/base/bus.c that the > > bus drivers can use to at least check was the bus already loaded or > > not? It looks like there are a couple of bus drivers that use the > > struct bus member "p" to check that. > > > > Greg, what do you think? > > I think your design is wrong if you need to worry about this :) This problem is not ulpi specific. We have the same issue with every single bus. With a bus like PCI it's just really unlikely to hit it because PCI bus driver uses postcore_initcall. But if there was a PCI driver that used postcore_initcall itself, maybe a gpio controller driver for example, exactly the same panic would happen that we see happening when a driver tries to register itself with ulpi bus before ulpi bus has been registered. I can appreciate now that fixing the core problem like I2C did is wrong, but I still feel that the driver core should provide something like the helper for checking if the bus was registered already or not. Otherwise all the bus drivers should really have a variable like Sudip suggested for checking it, but that would be boilerplate, no? Thanks, -- heikki