From patchwork Sun Jun 26 07:28:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 70874 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp555939qgy; Sun, 26 Jun 2016 00:33:41 -0700 (PDT) X-Received: by 10.66.12.102 with SMTP id x6mr22915372pab.151.1466926419828; Sun, 26 Jun 2016 00:33:39 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id os6si18111579pac.128.2016.06.26.00.33.39; Sun, 26 Jun 2016 00:33:39 -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 S1752080AbcFZHdi (ORCPT + 8 others); Sun, 26 Jun 2016 03:33:38 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:33068 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752154AbcFZH3E (ORCPT ); Sun, 26 Jun 2016 03:29:04 -0400 Received: by mail-pa0-f41.google.com with SMTP id b13so49586224pat.0 for ; Sun, 26 Jun 2016 00:29:04 -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=EXvElyRcc86usOiHXYKo9mVoYHmGvaakzWqSM4QpZmM=; b=JQkmp0phEqeoT6w4lAzZtUFpnRlqQ6fewvQQZJoKdwUTwTYKvi4v27BrY/eNkkB63L irk4U1aS1/WoEMjMyPrBG11QB5XCEPmfF7Oh/NUaJc2Z+npOowZa7F1OTvgjmWMz0QLV 01MvEuScEJc9KCVXf456Kq0vCZ7XLPSY47DFo= 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=EXvElyRcc86usOiHXYKo9mVoYHmGvaakzWqSM4QpZmM=; b=R1WBgks7yVAHUz1PCnG7CcTlVCm9ZPq/gfgcM+h+ndhyBXmYqbYij0nmFwnpFLs+su xmWZ757l+969WtACXF+Tr6Dc0tVZ30LjcLH5uY/fp8xMA8Z5smB9B00w/5CDD+XKK+Sc iACpWvy8TQvLDPLM/MFORmF/rT2CKVzjhnU/sw1lRB4r5WmwBE/CqeUZyO1oAx3YWxhR TwHsGt9vNBC2gIqojPnu4hmkicew8x+aMiPhqWHY8J+pN7jxYs1at3ofjHHJ6AGs5a+R ggkNIDJOKeACx3I51r4it/6L3fF5ri+zWWdxT6tj/btavG3a+XSILHodjH0tunzht+8B qblg== X-Gm-Message-State: ALyK8tLW9uN3dDWkD1vBj86U0tE3TZBMUI1PQ791N+vwgRsBhRhV99pHdzvun8eTM8OmbJJv X-Received: by 10.66.97.104 with SMTP id dz8mr14491607pab.22.1466926143630; Sun, 26 Jun 2016 00:29:03 -0700 (PDT) Received: from localhost.localdomain (ip68-101-172-78.sd.sd.cox.net. [68.101.172.78]) by smtp.gmail.com with ESMTPSA id f138sm3790495pfa.17.2016.06.26.00.29.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 26 Jun 2016 00:29:03 -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 17/21] usb: chipidea: msm: Make platform data driver local instead of global Date: Sun, 26 Jun 2016 00:28:34 -0700 Message-Id: <20160626072838.28082-18-stephen.boyd@linaro.org> X-Mailer: git-send-email 2.9.0.rc2.8.ga28705d In-Reply-To: <20160626072838.28082-1-stephen.boyd@linaro.org> References: <20160626072838.28082-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. Cc: Peter Chen Cc: Greg Kroah-Hartman Signed-off-by: Stephen Boyd --- drivers/usb/chipidea/ci_hdrc_msm.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) -- 2.9.0.rc2.8.ga28705d -- 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 cc6f9b0df9d5..fb4340f02c16 100644 --- a/drivers/usb/chipidea/ci_hdrc_msm.c +++ b/drivers/usb/chipidea/ci_hdrc_msm.c @@ -37,6 +37,7 @@ struct ci_hdrc_msm { struct clk *core_clk; struct clk *iface_clk; struct extcon_dev *vbus_edev; + struct ci_hdrc_platform_data pdata; bool secondary_phy; bool hsic; void __iomem *base; @@ -79,16 +80,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) { @@ -151,6 +142,12 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev) return -ENOMEM; platform_set_drvdata(pdev, ci); + 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; + reset = devm_reset_control_get(&pdev->dev, "core"); if (IS_ERR(reset)) return PTR_ERR(reset); @@ -204,7 +201,7 @@ 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); + 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);