From patchwork Thu Jul 7 22:21:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 9219797 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 B3DB060467 for ; Thu, 7 Jul 2016 22:30:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A485E277D9 for ; Thu, 7 Jul 2016 22:30:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 977FD27E63; Thu, 7 Jul 2016 22:30:26 +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 4991C277D9 for ; Thu, 7 Jul 2016 22:30:26 +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 1bLHnm-00028w-9w; Thu, 07 Jul 2016 22:29:46 +0000 Received: from mail-pf0-x236.google.com ([2607:f8b0:400e:c00::236]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bLHgK-0007h3-Ln for linux-arm-kernel@lists.infradead.org; Thu, 07 Jul 2016 22:22:06 +0000 Received: by mail-pf0-x236.google.com with SMTP id h14so9719245pfe.1 for ; Thu, 07 Jul 2016 15:21:44 -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=udYY+VOpG4FV3JBd2bugHV+iSEeoogK0aP76qLDaxZg=; b=BaoI83V4xYp5vW+KUaBVQ7BDZuStkhS+EU1yx88FuKNcLS6iUYZq9QbWjlsO4iPEKM q/rPuRmXz2u4RU4QMvkVcwsxNCs3bxLzgbI4gPlXnOnsQmBg4NZQxHZimmUjTYzH7xXl pbtW9oR4xlgRbFpkOiPPQZWhvnsu2DUgMzP3Y= 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=udYY+VOpG4FV3JBd2bugHV+iSEeoogK0aP76qLDaxZg=; b=IUKJL0p5YI1ib5r6ZTqu09XlOyWizFZPEguYbLa0/reip3vUEz4mMTRNrxOxEwOSgd 2PlR9gcrojIu5nQ5vPVVX/kOC+1OdKpVMP6HziYkTaXqcVjFk+d829PYZuKaqGoy6vNj CSgn2vdLHZ6Gvn7GkIyrRCVKJDvDga/d3puYkkWgzgeAnr9VqDLJEd+jkIQd7rwKjG9a Dsbh3MXw9bA4SiPdS3CNzPYZ1mSq3v5rTZUjo6tvgy7ZO5Vxwc90ZCINPgzWygWL71um cAwJ4fYqVBNkd/GFMLxoenujqvQk1GYkFnuI3yklJZSpkYbkYsA7IxoXj5YwBVrMOHc5 wMxA== X-Gm-Message-State: ALyK8tImhnll1fURFSRbe5TDpljY8KScHF+6yxM9YqqqF5YQADWuIJ+WqQyQJlbj2AztSf2Z X-Received: by 10.98.72.150 with SMTP id q22mr4278926pfi.122.1467930104182; Thu, 07 Jul 2016 15:21:44 -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 j8sm6781807paj.22.2016.07.07.15.21.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Jul 2016 15:21:43 -0700 (PDT) From: Stephen Boyd To: linux-usb@vger.kernel.org Subject: [PATCH v2 17/22] usb: chipidea: msm: Make platform data driver local instead of global Date: Thu, 7 Jul 2016 15:21:08 -0700 Message-Id: <20160707222114.1673-18-stephen.boyd@linaro.org> X-Mailer: git-send-email 2.9.0.rc2.8.ga28705d In-Reply-To: <20160707222114.1673-1-stephen.boyd@linaro.org> References: <20160707222114.1673-1-stephen.boyd@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160707_152204_764254_6BC2192A X-CRM114-Status: GOOD ( 13.93 ) 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. Cc: Peter Chen Cc: Greg Kroah-Hartman Signed-off-by: Stephen Boyd Acked-by: Peter Chen --- drivers/usb/chipidea/ci_hdrc_msm.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c index 81437c8cea82..da2d399acdd2 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)) @@ -221,7 +217,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);