From patchwork Mon May 27 20:38:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 2621481 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id CE5253FDBC for ; Mon, 27 May 2013 20:38:49 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uh4Bn-00069h-3F; Mon, 27 May 2013 20:38:43 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uh4Bk-0007Vh-5u; Mon, 27 May 2013 20:38:40 +0000 Received: from moutng.kundenserver.de ([212.227.126.171]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uh4Bh-0007VC-60 for linux-arm-kernel@lists.infradead.org; Mon, 27 May 2013 20:38:38 +0000 Received: from klappe2.localnet (HSI-KBW-095-208-002-043.hsi5.kabel-badenwuerttemberg.de [95.208.2.43]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0LiIi3-1U2Ysw24e3-00nLkv; Mon, 27 May 2013 22:38:13 +0200 From: Arnd Bergmann To: Manjunath Goudar Subject: Re: [RFC V7 PATCH 3/3] USB: OHCI: make ohci-pci a separate driver Date: Mon, 27 May 2013 22:38:08 +0200 User-Agent: KMail/1.12.2 (Linux/3.8.0-22-generic; KDE/4.3.2; x86_64; ; ) References: <1365746856-7772-2-git-send-email-manjunath.goudar@linaro.org> <1369657550-24101-1-git-send-email-manjunath.goudar@linaro.org> <1369657550-24101-4-git-send-email-manjunath.goudar@linaro.org> In-Reply-To: <1369657550-24101-4-git-send-email-manjunath.goudar@linaro.org> MIME-Version: 1.0 Message-Id: <201305272238.08984.arnd@arndb.de> X-Provags-ID: V02:K0:fEpywTBcMbvw6hMEBM5Bqp1fbubmCUD+1vRknX+RRJD 9H9/mx7RegOEV+o5qTtULh7maBqbVQeVolUUsdtfamxDjuvane xuqXIZwDaAcKPVWN1YtBmLkkmGI/OMtUzrAzUfpaRmCsSPuj2G cf0j07cesfAtjm01Lu3WPR8PeE9e8W4YmsjLavUeIJ2yTSDOxJ /G9sDssbmy3AlBXk9CDgVEDuCFZY1UotugHLfbmq/R5b+OTYfb fePN9DJLZXWSenAsSsjlFrl/Sg70ZUD7NxSFcco9rbAiC8enw0 Ug1AXF1COS3aPkILEuMft08FshebDn5zzDne7UNYVUvagEUsIL cK8q3+T1EH/Emw9U0O9o= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130527_163837_441049_39CE54D9 X-CRM114-Status: GOOD ( 21.56 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.227.126.171 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linaro-dev@lists.linaro.org, patches@linaro.org, Greg KH , linux-usb@vger.kernel.org, stern@rowland.harvard.edu, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Monday 27 May 2013, Manjunath Goudar wrote: > This patch splits the PCI portion of ohci-hcd out into its > own separate driver module, called ohci-pci. > > The major point of difficulty lies in ohci-pci's many vendor- and > device-specific workarounds. Some of them have to be applied before > calling ohci_start() some after, which necessitates a fair amount of > code motion. The other platform drivers require much smaller changes. > > The complete sb800_prefetch() function moved to ohci-q.c,because its > only related to ohci-pci driver. I just gave this a little test run in qemu and on my server. > @@ -446,7 +446,7 @@ config USB_OHCI_HCD_PPC_OF > default USB_OHCI_HCD_PPC_OF_BE || USB_OHCI_HCD_PPC_OF_LE > > config USB_OHCI_HCD_PCI > - bool "OHCI support for PCI-bus USB controllers" > + tristate "OHCI support for PCI-bus USB controllers" > depends on PCI && (STB03xxx || PPC_MPC52xx || USB_OHCI_HCD_PPC_OF) > default y > select USB_OHCI_LITTLE_ENDIAN There is a preexisting bug in this symbol: USB_OHCI_HCD_PCI was previously unused, and has a bogus 'depends' line, which causes it to not be selectable on anything but PPC. You have to change this to only 'depends on PCI'. > } > - if (ret == 0) { > - ohci_hcd_init (ohci); > - return ohci_init (ohci); > - } > - return ret; > -} I found that the call to ohci_hcd_init() that is removed here is not getting added in any other place, which caused a NULL pointer dereference the first time we actually try to use the driver. Adding the call back into the new ohci_setup function makes it work again. Please fold the patch below into your patch, unless Alan discovers something wrong with it. Signed-off-by: Arnd Bergmann diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index f948e8f..eef6dc5 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -454,7 +454,7 @@ config USB_OHCI_HCD_PPC_OF config USB_OHCI_HCD_PCI tristate "OHCI support for PCI-bus USB controllers" - depends on PCI && (STB03xxx || PPC_MPC52xx || USB_OHCI_HCD_PPC_OF) + depends on PCI default y select USB_OHCI_CORE select USB_OHCI_LITTLE_ENDIAN diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 3da8c3a..5601139 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -763,6 +763,8 @@ int ohci_setup(struct usb_hcd *hcd) { struct ohci_hcd *ohci = hcd_to_ohci(hcd); + ohci_hcd_init(ohci); + return ohci_init(ohci); } EXPORT_SYMBOL_GPL(ohci_setup); diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index ea088c1..3133354 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c @@ -250,7 +250,7 @@ static int ohci_pci_reset (struct usb_hcd *hcd) } } if (ret == 0) - ohci_setup(hcd); + ret = ohci_setup(hcd); /* * After ohci setup RWC may not be set for add-in PCI cards. * This transfers PCI PM wakeup capabilities.