linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: chao.xie@marvell.com (Chao Xie)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V2 3/6] usb: ehci: mv_ehci: remove unused clock
Date: Mon, 25 Mar 2013 03:06:54 -0400	[thread overview]
Message-ID: <1364195217-1226-4-git-send-email-chao.xie@marvell.com> (raw)
In-Reply-To: <1364195217-1226-1-git-send-email-chao.xie@marvell.com>

The origianl understanding of clock is wrong. The EHCI controller
only have one clock input.
Passing clock name by pdata is wrong. The clock is defined by device
iteself.

Signed-off-by: Chao Xie <chao.xie@marvell.com>
---
 drivers/usb/host/ehci-mv.c |   35 ++++++++++-------------------------
 1 files changed, 10 insertions(+), 25 deletions(-)

diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c
index 3804820..6bad41a 100644
--- a/drivers/usb/host/ehci-mv.c
+++ b/drivers/usb/host/ehci-mv.c
@@ -33,25 +33,17 @@ struct ehci_hcd_mv {
 
 	struct mv_usb_platform_data *pdata;
 
-	/* clock source and total clock number */
-	unsigned int clknum;
-	struct clk *clk[0];
+	struct clk *clk;
 };
 
 static void ehci_clock_enable(struct ehci_hcd_mv *ehci_mv)
 {
-	unsigned int i;
-
-	for (i = 0; i < ehci_mv->clknum; i++)
-		clk_prepare_enable(ehci_mv->clk[i]);
+	clk_prepare_enable(ehci_mv->clk);
 }
 
 static void ehci_clock_disable(struct ehci_hcd_mv *ehci_mv)
 {
-	unsigned int i;
-
-	for (i = 0; i < ehci_mv->clknum; i++)
-		clk_disable_unprepare(ehci_mv->clk[i]);
+	clk_disable_unprepare(ehci_mv->clk);
 }
 
 static int mv_ehci_enable(struct ehci_hcd_mv *ehci_mv)
@@ -144,9 +136,8 @@ static int mv_ehci_probe(struct platform_device *pdev)
 	struct ehci_hcd *ehci;
 	struct ehci_hcd_mv *ehci_mv;
 	struct resource *r;
-	int clk_i, retval = -ENODEV;
+	int retval = -ENODEV;
 	u32 offset;
-	size_t size;
 
 	if (!pdata) {
 		dev_err(&pdev->dev, "missing platform_data\n");
@@ -160,8 +151,7 @@ static int mv_ehci_probe(struct platform_device *pdev)
 	if (!hcd)
 		return -ENOMEM;
 
-	size = sizeof(*ehci_mv) + sizeof(struct clk *) * pdata->clknum;
-	ehci_mv = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
+	ehci_mv = devm_kzalloc(&pdev->dev, sizeof(*ehci_mv), GFP_KERNEL);
 	if (ehci_mv == NULL) {
 		dev_err(&pdev->dev, "cannot allocate ehci_hcd_mv\n");
 		retval = -ENOMEM;
@@ -172,16 +162,11 @@ static int mv_ehci_probe(struct platform_device *pdev)
 	ehci_mv->pdata = pdata;
 	ehci_mv->hcd = hcd;
 
-	ehci_mv->clknum = pdata->clknum;
-	for (clk_i = 0; clk_i < ehci_mv->clknum; clk_i++) {
-		ehci_mv->clk[clk_i] =
-		    devm_clk_get(&pdev->dev, pdata->clkname[clk_i]);
-		if (IS_ERR(ehci_mv->clk[clk_i])) {
-			dev_err(&pdev->dev, "error get clck \"%s\"\n",
-				pdata->clkname[clk_i]);
-			retval = PTR_ERR(ehci_mv->clk[clk_i]);
-			goto err_clear_drvdata;
-		}
+	ehci_mv->clk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(ehci_mv->clk)) {
+		dev_err(&pdev->dev, "error getting clock\n");
+		retval = PTR_ERR(ehci_mv->clk);
+		goto err_clear_drvdata;
 	}
 
 	r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phyregs");
-- 
1.7.4.1

  parent reply	other threads:[~2013-03-25  7:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-25  7:06 [PATCH V2 0/6] remove the clock name from pdata Chao Xie
2013-03-25  7:06 ` [PATCH V2 1/6] usb: gadget: mv_udc_core: remove unused clock Chao Xie
2013-03-25  7:06 ` [PATCH V2 2/6] usb: otg: mv_otg: " Chao Xie
2013-03-25  7:06 ` Chao Xie [this message]
2013-03-28  0:52   ` [PATCH V2 3/6] usb: ehci: mv_ehci: " Chao Xie
2013-03-28 14:38     ` Alan Stern
2013-03-25  7:06 ` [PATCH V2 4/6] arm: mmp: remove clock from usb pdata for aspenite Chao Xie
2013-03-28  0:59   ` Chao Xie
2013-03-28  1:42     ` Haojian Zhuang
2013-03-25  7:06 ` [PATCH V2 5/6] arm: mmp: remove clock name from usb pdata for ttc Chao Xie
2013-03-28  1:42   ` Haojian Zhuang
2013-03-25  7:06 ` [PATCH V2 6/6] usb: mv_usb: remove clock name from pdata Chao Xie
2013-04-02  8:14   ` Felipe Balbi
2013-04-02  8:42     ` Yu Xu
2013-03-27 13:14 ` [PATCH V2 0/6] remove the " Felipe Balbi
2013-03-28  0:50   ` Chao Xie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1364195217-1226-4-git-send-email-chao.xie@marvell.com \
    --to=chao.xie@marvell.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).