From patchwork Tue Oct 18 01:56: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: 77900 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp657100qge; Mon, 17 Oct 2016 18:59:05 -0700 (PDT) X-Received: by 10.99.135.65 with SMTP id i62mr592613pge.112.1476755944952; Mon, 17 Oct 2016 18:59:04 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k3si15045599pac.288.2016.10.17.18.59.04; Mon, 17 Oct 2016 18:59:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936476AbcJRB6p (ORCPT + 10 others); Mon, 17 Oct 2016 21:58:45 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:34577 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936463AbcJRB47 (ORCPT ); Mon, 17 Oct 2016 21:56:59 -0400 Received: by mail-pa0-f47.google.com with SMTP id rz1so66783708pab.1 for ; Mon, 17 Oct 2016 18:56:59 -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=YUKA+/E6Sk5qRuHeFQL+H5tu0nWso2vmmi4FGCsVgDo=; b=L1hQeePFH0UynKbBlrp+31cSy9n/+GuoWzAf+WPmVttPdSp5u5bek9eTi88qRLGyXY PEG47aa/o80ZfPl6oqs9joVZpG+FzwnpuTYtrOZYXRB8nwO2mvIJBKYfglVIavao3jn1 eWuGCVERBedyi9giAfNtHhtTQDMW3Wh3ftxwA= 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=YUKA+/E6Sk5qRuHeFQL+H5tu0nWso2vmmi4FGCsVgDo=; b=INHRGFdKxiNtVS6Rp+aO29NBsR7Q9luDmIVH7Y07xiE90/8mXleZ4R3AmXS0UpEIY2 VRszpB45vwla1AYkg3QkMtjH6nSfxFB3he3oSU2wZswCFiNbqi6PyT8yiIOlOwXmnYr+ 1p5xj7ovl+YF7+n/WnK8de2SrX2D28Xv9/H52HyQew19tEJWqIC+XCAQY4UIuLAEAdOu 9JVU2sKV6JBuIoJFhCU2PelafZ4a6/nGwaGDGOr42sijk07WL4+wOdkxinLkh06LXNGa Vv9BtLYR2N1BnRXgtV59/Aog7DPCdr7VCJL3+kU6Hj8OtuHbUbSJlR4e5d7oiVTBcFEg S3qw== X-Gm-Message-State: AA6/9RkABORnePbrCsliecbF/Qhw6Qzgu6FSVP+z5vRtJ8/cw9TNkD0MOHa8Iw2eYkVCqMNy X-Received: by 10.66.160.132 with SMTP id xk4mr589053pab.78.1476755819064; Mon, 17 Oct 2016 18:56:59 -0700 (PDT) Received: from localhost.localdomain (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id j6sm51020430paa.44.2016.10.17.18.56.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Oct 2016 18:56:58 -0700 (PDT) From: Stephen Boyd To: linux-usb@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Andy Gross , Bjorn Andersson , Neil Armstrong , Arnd Bergmann , Felipe Balbi , Peter Chen , Greg Kroah-Hartman Subject: [PATCH v5 18/23] usb: chipidea: msm: Make platform data driver local instead of global Date: Mon, 17 Oct 2016 18:56:31 -0700 Message-Id: <20161018015636.11701-19-stephen.boyd@linaro.org> X-Mailer: git-send-email 2.10.0.297.gf6727b0 In-Reply-To: <20161018015636.11701-1-stephen.boyd@linaro.org> References: <20161018015636.11701-1-stephen.boyd@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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(-) -- 2.10.0.297.gf6727b0 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);