From patchwork Thu Sep 1 00:40:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 9308171 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 01E1660487 for ; Thu, 1 Sep 2016 00:54:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E61C528C7B for ; Thu, 1 Sep 2016 00:54:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DAC9928FC2; Thu, 1 Sep 2016 00:54:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 61B6628C7B for ; Thu, 1 Sep 2016 00:54:15 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bfGFG-0001IG-Oi; Thu, 01 Sep 2016 00:52:42 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bfG4J-0007hY-8V for linux-arm-kernel@bombadil.infradead.org; Thu, 01 Sep 2016 00:41:23 +0000 Received: from mail-pf0-x22e.google.com ([2607:f8b0:400e:c00::22e]) by merlin.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bfG4G-0001W7-6z for linux-arm-kernel@lists.infradead.org; Thu, 01 Sep 2016 00:41:22 +0000 Received: by mail-pf0-x22e.google.com with SMTP id p64so24789339pfb.1 for ; Wed, 31 Aug 2016 17:40:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HtGY81R9B+CAYwGqD1YE0fAAX8S9XThfnbY9wu0SvFs=; b=MFee9b3jqYAqk+QwIoIzMdGetOsEaSYif0FJ+FZQU8qi3AjqvzvH+J/WwB6zJnQcZ3 Or219QFXR1l94UmtkyRcpqCvNowniV9yRZxDPaYxHKvtHLaEoeeViZsu2g2pGy3W5nCZ MBInCA2WGrtwYyh5kBC7GRSaaLbHkibVWwRhk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HtGY81R9B+CAYwGqD1YE0fAAX8S9XThfnbY9wu0SvFs=; b=AluuGXXBR5gz8hCrzDJY2uOy8z7y/4g+xgsM57C4LqC5ilj8c7NRuSMyYX2XepRLDp sUn/I90PGea5ZMfTiPhnj3sSB7w/F/oEAPtPBp2QnTdkJPVnHkzMwWpNnX974rHQvvHG AmCnSdLL+E6qoWfINHKn0lYM06WRPqWiher8ivFGTxehf7+M5zvfw9MJWyyfki8297HE BVDcW0DroJydSfZwk4GOgZejKnOyukM+GnPrhyKvvkR6mDr3mHaXA5s7+uN0OyUsR0uL chC+xDe8NIkc2SnyBBG9Zpx3YEvMZhSF2NeN/tIx0a9+HTyDngUk9n1cH4D8e0/VX02h slpQ== X-Gm-Message-State: AE9vXwNgoSDrtpbj0OFtJt+dqzD8gTlbfndc3qU7HHlSO0fr2Xfhz4R+w4y809qeUffYBx7L X-Received: by 10.98.34.151 with SMTP id p23mr22138741pfj.102.1472690455877; Wed, 31 Aug 2016 17:40:55 -0700 (PDT) Received: from localhost.localdomain (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id m5sm2292303paw.40.2016.08.31.17.40.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 Aug 2016 17:40:55 -0700 (PDT) From: Stephen Boyd To: linux-usb@vger.kernel.org Subject: [PATCH v3 17/22] usb: chipidea: msm: Make platform data driver local instead of global Date: Wed, 31 Aug 2016 17:40:31 -0700 Message-Id: <20160901004036.23936-18-stephen.boyd@linaro.org> X-Mailer: git-send-email 2.9.0.rc2.8.ga28705d In-Reply-To: <20160901004036.23936-1-stephen.boyd@linaro.org> References: <20160901004036.23936-1-stephen.boyd@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160831_204120_393152_CE882918 X-CRM114-Status: GOOD ( 14.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , Arnd Bergmann , Neil Armstrong , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Andersson , Peter Chen , Greg Kroah-Hartman , Andy Gross , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP If two devices are probed with this same driver, they'll share the same platform data structure, while the chipidea core layer writes and modifies it. This can lead to interesting results especially if one device is an OTG type chipidea controller and another is a host. Let's create a copy of this structure per each device instance so that odd things don't happen. Acked-by: Peter Chen Cc: Greg Kroah-Hartman Signed-off-by: Stephen Boyd --- drivers/usb/chipidea/ci_hdrc_msm.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c index 333817291798..2489a63d3e75 100644 --- a/drivers/usb/chipidea/ci_hdrc_msm.c +++ b/drivers/usb/chipidea/ci_hdrc_msm.c @@ -39,6 +39,7 @@ struct ci_hdrc_msm { struct clk *core_clk; struct clk *iface_clk; struct clk *fs_clk; + struct ci_hdrc_platform_data pdata; bool secondary_phy; bool hsic; void __iomem *base; @@ -94,16 +95,6 @@ static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event) } } -static struct ci_hdrc_platform_data ci_hdrc_msm_platdata = { - .name = "ci_hdrc_msm", - .capoffset = DEF_CAPOFFSET, - .flags = CI_HDRC_REGS_SHARED | - CI_HDRC_DISABLE_STREAMING | - CI_HDRC_OVERRIDE_AHB_BURST, - - .notify_event = ci_hdrc_msm_notify_event, -}; - static int ci_hdrc_msm_mux_phy(struct ci_hdrc_msm *ci, struct platform_device *pdev) { @@ -164,7 +155,12 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev) if (IS_ERR(phy)) return PTR_ERR(phy); - ci_hdrc_msm_platdata.usb_phy = phy; + ci->pdata.name = "ci_hdrc_msm"; + ci->pdata.capoffset = DEF_CAPOFFSET; + ci->pdata.flags = CI_HDRC_REGS_SHARED | CI_HDRC_DISABLE_STREAMING | + CI_HDRC_OVERRIDE_AHB_BURST; + ci->pdata.notify_event = ci_hdrc_msm_notify_event; + ci->pdata.usb_phy = phy; reset = devm_reset_control_get(&pdev->dev, "core"); if (IS_ERR(reset)) @@ -220,9 +216,8 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev) } of_node_put(ulpi_node); - plat_ci = ci_hdrc_add_device(&pdev->dev, - pdev->resource, pdev->num_resources, - &ci_hdrc_msm_platdata); + plat_ci = ci_hdrc_add_device(&pdev->dev, pdev->resource, + pdev->num_resources, &ci->pdata); if (IS_ERR(plat_ci)) { dev_err(&pdev->dev, "ci_hdrc_add_device failed!\n"); ret = PTR_ERR(plat_ci);