From patchwork Fri Jul 18 09:31:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Lothar_Wa=C3=9Fmann?= X-Patchwork-Id: 371420 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 467BD140088 for ; Fri, 18 Jul 2014 19:35:16 +1000 (EST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X84Wb-0001O7-Rc; Fri, 18 Jul 2014 09:32:21 +0000 Received: from mail.karo-electronics.de ([81.173.242.67]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X84WW-0001BE-3u for linux-arm-kernel@lists.infradead.org; Fri, 18 Jul 2014 09:32:20 +0000 From: =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= To: Felipe Balbi , Greg Kroah-Hartman , , , Ezequiel Garcia , George Cherian , , Roger Quadros Subject: [PATCH 4/9] usb: phy: am335x-control: prevent module from being unloaded when in use Date: Fri, 18 Jul 2014 11:31:25 +0200 Message-Id: <1405675890-8802-5-git-send-email-LW@KARO-electronics.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1405675890-8802-4-git-send-email-LW@KARO-electronics.de> References: <1405675890-8802-1-git-send-email-LW@KARO-electronics.de> <1405675890-8802-2-git-send-email-LW@KARO-electronics.de> <1405675890-8802-3-git-send-email-LW@KARO-electronics.de> <1405675890-8802-4-git-send-email-LW@KARO-electronics.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140718_023216_373615_70380DB8 X-CRM114-Status: UNSURE ( 9.60 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [81.173.242.67 listed in list.dnswl.org] -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org This patch fixes the real cause of the crash that was "fixed" by commit 7adb5c876e9c usb: musb: Fix panic upon musb_am335x module removal Signed-off-by: Lothar Waßmann --- drivers/usb/phy/phy-am335x-control.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/usb/phy/phy-am335x-control.c b/drivers/usb/phy/phy-am335x-control.c index 35b6083..df3e1ba 100644 --- a/drivers/usb/phy/phy-am335x-control.c +++ b/drivers/usb/phy/phy-am335x-control.c @@ -140,6 +140,9 @@ static int am335x_control_usb_probe(struct platform_device *pdev) const struct of_device_id *of_id; const struct phy_control *phy_ctrl; + if (!try_module_get(pdev->dev.parent->driver->owner)) + return -EPROBE_DEFER; + of_id = of_match_node(omap_control_usb_id_table, pdev->dev.of_node); if (!of_id) return -EINVAL; @@ -171,8 +174,15 @@ static int am335x_control_usb_probe(struct platform_device *pdev) return 0; } +static int am335x_control_usb_remove(struct platform_device *pdev) +{ + module_put(pdev->dev.parent->driver->owner); + return 0; +} + static struct platform_driver am335x_control_driver = { .probe = am335x_control_usb_probe, + .remove = am335x_control_usb_remove, .driver = { .name = "am335x-control-usb", .owner = THIS_MODULE,