From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753341AbbE0QrP (ORCPT ); Wed, 27 May 2015 12:47:15 -0400 Received: from mga02.intel.com ([134.134.136.20]:47517 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753244AbbE0Qqe (ORCPT ); Wed, 27 May 2015 12:46:34 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,506,1427785200"; d="scan'208";a="716460146" Date: Wed, 27 May 2015 09:49:01 -0700 From: David Cohen To: Greg KH Cc: =?iso-8859-1?Q?Bj=F8rn?= Mork , Heikki Krogerus , Tal Shorer , Sudip Mukherjee , Sasha Levin , USB list , "" , Felipe Balbi , Lu Baolu Subject: Re: [PATCH] usb: ulpi: don't register drivers if bus doesn't exist Message-ID: <20150527164901.GA1028@psi-dev26.jf.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> <87a8wsoan6.fsf@nemi.mork.no> <20150526175401.GA26397@psi-dev26.jf.intel.com> <20150527024118.GD7038@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20150527024118.GD7038@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, On Tue, May 26, 2015 at 07:41:18PM -0700, Greg KH wrote: > On Tue, May 26, 2015 at 10:54:01AM -0700, David Cohen wrote: > > Hi, > > > > On Mon, May 25, 2015 at 07:00:13PM +0200, Bjørn Mork wrote: > > > Greg KH writes: > > > > > > > If there are other bus drivers that do this, I'll go fix them up, > > > > pointers to those files would be appreciated. > > > > > > git grep -E 'if .*\.p\W' found a couple of interesting candidates you > > > might want to check out: > > > > > > drivers/i2c/i2c-core.c: if (unlikely(WARN_ON(!i2c_bus_type.p))) { > > > drivers/i2c/i2c-core.c: if (unlikely(WARN_ON(!i2c_bus_type.p))) > > > drivers/spmi/spmi.c: if (WARN_ON(!spmi_bus_type.p)) > > > > > > And this looks somewhat suspicious too, but could very well be OK for > > > all I know (very close to nothing :) > > > > > > drivers/gpio/gpiolib-sysfs.c: if (!gpio_class.p) { > > > drivers/gpio/gpiolib-sysfs.c: if (!gpio_class.p) > > > > I think we need a clear statement on how to proceed on this case. > > Don't mess with bus->p. I can rename it to > "do_not_touch_this_isnt_for_you" if people think that would make it more > obvious that a private data structure shouldn't be messed with in any > way. Outside of the driver core, you have no knowledge that even if it > is a pointer, what that means with regards to anything. I get that, I agree it's ugly and I'm not trying to push it further. If you follow the thread, you'll see I reviewed and commented a macro would make more sense than checking the private data directly for the same reaon you mentioned. But since with Linux development the source code is part of the documentation, we need a clear state about what's the correct way to handle it before go telling people "do not do what kernel is already doing because it's wrong". Br, David