From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout4.w1.samsung.com (mailout4.w1.samsung.com [210.118.77.14]) by ozlabs.org (Postfix) with ESMTP id 6392AB6EF7 for ; Sat, 31 Jul 2010 02:06:56 +1000 (EST) MIME-version: 1.0 Content-type: text/plain; charset=utf-8; format=flowed; delsp=yes Received: from eu_spt2 ([210.118.77.14]) by mailout4.w1.samsung.com (Sun Java(tm) System Messaging Server 6.3-8.04 (built Jul 29 2009; 32bit)) with ESMTP id <0L6D00M4EORI0K80@mailout4.w1.samsung.com> for linuxppc-dev@ozlabs.org; Fri, 30 Jul 2010 17:06:54 +0100 (BST) Received: from linux.samsung.com ([106.116.38.10]) by spt2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0L6D009WLORGQF@spt2.w1.samsung.com> for linuxppc-dev@ozlabs.org; Fri, 30 Jul 2010 17:06:54 +0100 (BST) Date: Fri, 30 Jul 2010 18:08:23 +0200 From: =?utf-8?B?TWljaGHFgiBOYXphcmV3aWN6?= Subject: Re: [PATCH RFC] usb gadget: introduce usb_gadget_probe_driver In-reply-to: <20100730152602.GA28042@pengutronix.de> To: =?utf-8?Q?Uwe_Kleine-K=C3=B6nig?= Message-id: References: <1280501361-13410-1-git-send-email-u.kleine-koenig@pengutronix.de> <20100730152602.GA28042@pengutronix.de> Cc: Cliff Cai , Greg Kroah-Hartman , Dinh Nguyen , Tony Lindgren , Nicolas Ferre , linux-kernel@vger.kernel.org, linuxppc-dev@ozlabs.org, Julia Lawall , Philipp Zabel , Mark Brown , Felipe Balbi , Andrea Gelmini , Robert Jarzmik , Fabien Chouteau , Dan Carpenter , David Brownell , Vladimir Zapolskiy , Sergei Shtylyov , Vincent Sanders , Marc Singer , =?utf-8?Q?Andr=C3=A9_Goddard_Rosa?= , Alan Stern , Sean MacLennan , Russell King , Tobias Klauser , Marc Kleine-Budde , Eirik Aanonsen , Mike Frysinger , Thomas Dahlmann , linux-geode@lists.infradead.org, Ben Dooks , Magnus Damm , Anton Vorontsov , Andrew Victor , linux-arm-kernel@lists.infradead.org, Anatolij Gustschin , Eric Miao , =?utf-8?Q?N=C3=A9meth_M=C3=A1rton?= , Jiri Kosina , Yoshihiro Shimoda , linux-usb@vger.kernel.org, Harro Haan , FUJITA Tomonori , H Hartley Sweeten , Paul Mundt , Tejun Heo , Andrew Morton , Cory Maccarrone List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Fri, 30 Jul 2010 17:26:02 +0200, Uwe Kleine-K=C3=B6nig wrote: > On Fri, Jul 30, 2010 at 05:16:46PM +0200, Micha=C5=82 Nazarewicz wrote= : >> On Fri, 30 Jul 2010 16:49:14 +0200, Uwe Kleine-K=C3=B6nig wrote: >> >>> This is like usb_gadget_register_driver with the only difference tha= t it >>> gets the bind function as parameter instead of using driver->bind. = This >>> allows fixing section mismatches like >>> >>> WARNING: drivers/usb/gadget/g_printer.o(.data+0xc): Section mismatc= h in >>> reference from the variable printer_driver to the function >>> .init.text:printer_bind() >>> The variable printer_driver references >>> the function __init printer_bind() >>> >>> by using usb_gadget_probe_driver with driver->bind =3D NULL. When a= ll >>> drivers are fixed to use the new function the bind member of struct >>> usb_gadget_driver can go away. >>> >>> Signed-off-by: Uwe Kleine-K=C3=B6nig >>> Cc: Michal Nazarewicz >>> Cc: Greg Kroah-Hartman BTW. Dunno if there is a reason to put me on Cc and Greg will be in Signed-off-by anyway. >>> --- >>> Hello, >>> >>> there is an alternative patch in Greg's tree [1], but IMHO mine is >>> better as it doesn't need __ref. >>> >>> Thoughts? >> >> Personally I don't see advantage of this over changing the __init to = __ref. >> Or am I missing something? I see your patch as an unnecessary API ch= ange. >> The way I understand it, __ref was introduced exactly for cases like = this >> one where function is referenced from "normal" data but used only dur= ing >> init. Could you try to clarify for me why you think your solution is= >> better then mine? > - Using __ref instead of __init moves all bind functions from .init.te= xt > to .text and so the code isn't freed after booting or module loading= . > (OK, you could fix this by marking the driver structs as __ref and > keep __init for the bind functions.) I believe this to be untrue. __ref puts code in .ref.text which AFAIK i= s freed. > - Using __ref might hide section mismatches. (Your patch hasn't this > problem as the bind functions used to live in .init.text, so any > reference to .init should be OK assuming that it was OK to live in > .init.text in the first place. But when marking the driver structs > this is an issue.) That's why I don't like __ref and said my patch > were better as it doesn't make use of it. > > - The bind functions are only called at init time, so there is no need= > to save a pointer to it. OK, I see some merit in this approach. However, the same issue is with usb_configuration and ?usb_composite_driver -- those should be changed in the same way or it would defeat the purpose of the patch. -- = Best regards, _ _ | Humble Liege of Serenely Enlightened Majesty of o' \,=3D./ `o | Computer Science, Micha=C5=82 "mina86" Nazarewicz (o o) +----[mina86*mina86.com]---[mina86*jabber.org]----ooO--(_)--Ooo--