Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: otg: mv_otg: remove unused clock

The origianl understanding of clock is wrong. The OTG 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>
Signed-off-by: Felipe Balbi <balbi@ti.com>

authored by

Chao Xie and committed by
Felipe Balbi
df18feda 1919811f

+8 -23
+7 -21
drivers/usb/phy/phy-mv-usb.c
··· 237 237 238 238 static void otg_clock_enable(struct mv_otg *mvotg) 239 239 { 240 - unsigned int i; 241 - 242 - for (i = 0; i < mvotg->clknum; i++) 243 - clk_prepare_enable(mvotg->clk[i]); 240 + clk_prepare_enable(mvotg->clk); 244 241 } 245 242 246 243 static void otg_clock_disable(struct mv_otg *mvotg) 247 244 { 248 - unsigned int i; 249 - 250 - for (i = 0; i < mvotg->clknum; i++) 251 - clk_disable_unprepare(mvotg->clk[i]); 245 + clk_disable_unprepare(mvotg->clk); 252 246 } 253 247 254 248 static int mv_otg_enable_internal(struct mv_otg *mvotg) ··· 678 684 struct mv_otg *mvotg; 679 685 struct usb_otg *otg; 680 686 struct resource *r; 681 - int retval = 0, clk_i, i; 682 - size_t size; 687 + int retval = 0, i; 683 688 684 689 if (pdata == NULL) { 685 690 dev_err(&pdev->dev, "failed to get platform data\n"); 686 691 return -ENODEV; 687 692 } 688 693 689 - size = sizeof(*mvotg) + sizeof(struct clk *) * pdata->clknum; 690 - mvotg = devm_kzalloc(&pdev->dev, size, GFP_KERNEL); 694 + mvotg = devm_kzalloc(&pdev->dev, sizeof(*mvotg), GFP_KERNEL); 691 695 if (!mvotg) { 692 696 dev_err(&pdev->dev, "failed to allocate memory!\n"); 693 697 return -ENOMEM; ··· 700 708 mvotg->pdev = pdev; 701 709 mvotg->pdata = pdata; 702 710 703 - mvotg->clknum = pdata->clknum; 704 - for (clk_i = 0; clk_i < mvotg->clknum; clk_i++) { 705 - mvotg->clk[clk_i] = devm_clk_get(&pdev->dev, 706 - pdata->clkname[clk_i]); 707 - if (IS_ERR(mvotg->clk[clk_i])) { 708 - retval = PTR_ERR(mvotg->clk[clk_i]); 709 - return retval; 710 - } 711 - } 711 + mvotg->clk = devm_clk_get(&pdev->dev, NULL); 712 + if (IS_ERR(mvotg->clk)) 713 + return PTR_ERR(mvotg->clk); 712 714 713 715 mvotg->qwork = create_singlethread_workqueue("mv_otg_queue"); 714 716 if (!mvotg->qwork) {
+1 -2
drivers/usb/phy/phy-mv-usb.h
··· 158 158 159 159 unsigned int active; 160 160 unsigned int clock_gating; 161 - unsigned int clknum; 162 - struct clk *clk[0]; 161 + struct clk *clk; 163 162 }; 164 163 165 164 #endif