From: chao.xie@marvell.com (Chao Xie)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/6] usb: gadget: mv_udc_core: remove unused clock
Date: Mon, 18 Mar 2013 03:55:28 -0400 [thread overview]
Message-ID: <1363593333-6077-2-git-send-email-chao.xie@marvell.com> (raw)
In-Reply-To: <1363593333-6077-1-git-send-email-chao.xie@marvell.com>
The origianl understanding of clock is wrong. The UDC 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/gadget/mv_udc.h | 3 +--
drivers/usb/gadget/mv_udc_core.c | 27 +++++++--------------------
2 files changed, 8 insertions(+), 22 deletions(-)
diff --git a/drivers/usb/gadget/mv_udc.h b/drivers/usb/gadget/mv_udc.h
index 9073436..be77f20 100644
--- a/drivers/usb/gadget/mv_udc.h
+++ b/drivers/usb/gadget/mv_udc.h
@@ -222,8 +222,7 @@ struct mv_udc {
struct mv_usb_platform_data *pdata;
/* some SOC has mutiple clock sources for USB*/
- unsigned int clknum;
- struct clk *clk[0];
+ struct clk *clk;
};
/* endpoint data structure */
diff --git a/drivers/usb/gadget/mv_udc_core.c b/drivers/usb/gadget/mv_udc_core.c
index c8cf959..988e94a 100644
--- a/drivers/usb/gadget/mv_udc_core.c
+++ b/drivers/usb/gadget/mv_udc_core.c
@@ -1006,18 +1006,12 @@ static struct usb_ep_ops mv_ep_ops = {
static void udc_clock_enable(struct mv_udc *udc)
{
- unsigned int i;
-
- for (i = 0; i < udc->clknum; i++)
- clk_prepare_enable(udc->clk[i]);
+ clk_prepare_enable(udc->clk);
}
static void udc_clock_disable(struct mv_udc *udc)
{
- unsigned int i;
-
- for (i = 0; i < udc->clknum; i++)
- clk_disable_unprepare(udc->clk[i]);
+ clk_disable_unprepare(udc->clk);
}
static void udc_stop(struct mv_udc *udc)
@@ -2151,7 +2145,6 @@ static int mv_udc_probe(struct platform_device *pdev)
struct mv_usb_platform_data *pdata = pdev->dev.platform_data;
struct mv_udc *udc;
int retval = 0;
- int clk_i = 0;
struct resource *r;
size_t size;
@@ -2160,8 +2153,7 @@ static int mv_udc_probe(struct platform_device *pdev)
return -ENODEV;
}
- size = sizeof(*udc) + sizeof(struct clk *) * pdata->clknum;
- udc = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
+ udc = devm_kzalloc(&pdev->dev, sizeof(*udc), GFP_KERNEL);
if (udc == NULL) {
dev_err(&pdev->dev, "failed to allocate memory for udc\n");
return -ENOMEM;
@@ -2184,15 +2176,10 @@ static int mv_udc_probe(struct platform_device *pdev)
}
#endif
- udc->clknum = pdata->clknum;
- for (clk_i = 0; clk_i < udc->clknum; clk_i++) {
- udc->clk[clk_i] = devm_clk_get(&pdev->dev,
- pdata->clkname[clk_i]);
- if (IS_ERR(udc->clk[clk_i])) {
- retval = PTR_ERR(udc->clk[clk_i]);
- return retval;
- }
- }
+ /* udc only have one sysclk. */
+ udc->clk = devm_clk_get(&pdev->dev, NULL);
+ if (IS_ERR(udc->clk))
+ return PTR_ERR(udc->clk);
r = platform_get_resource_byname(udc->dev, IORESOURCE_MEM, "capregs");
if (r == NULL) {
--
1.7.4.1
next prev parent reply other threads:[~2013-03-18 7:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-18 7:55 [PATCH 0/6] remove the clock name from pdata Chao Xie
2013-03-18 7:55 ` Chao Xie [this message]
2013-03-18 7:55 ` [PATCH 2/6] usb: otg: mv_otg: remove unused clock Chao Xie
2013-03-20 13:09 ` Felipe Balbi
2013-03-21 9:16 ` Chao Xie
2013-03-21 9:17 ` Kishon Vijay Abraham I
2013-03-21 9:36 ` Felipe Balbi
2013-03-18 7:55 ` [PATCH 3/6] usb: ehci: mv_ehci: " Chao Xie
2013-03-18 10:38 ` Sergei Shtylyov
2013-03-18 7:55 ` [PATCH 4/6] arm: mmp: remove clock from usb pdata for aspenite Chao Xie
2013-03-18 7:55 ` [PATCH 5/6] arm: mmp: remove clock name from usb pdata for ttc Chao Xie
2013-03-18 7:55 ` [PATCH 6/6] usb: mv_usb: remove clock name from pdata 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=1363593333-6077-2-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).