From ac3e2fa6770052a82d42fc4db194a27317518c97 Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 22 Sep 2011 12:20:55 +0100 Subject: clk: amba bus: convert to clk_prepare()/clk_unprepare() Signed-off-by: Russell King --- drivers/amba/bus.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index 84bdaac..bd230e8 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c @@ -460,9 +460,17 @@ static int amba_get_enable_pclk(struct amba_device *pcdev) if (IS_ERR(pclk)) return PTR_ERR(pclk); + ret = clk_prepare(pclk); + if (ret) { + clk_put(pclk); + return ret; + } + ret = clk_enable(pclk); - if (ret) + if (ret) { + clk_unprepare(pclk); clk_put(pclk); + } return ret; } @@ -472,6 +480,7 @@ static void amba_put_disable_pclk(struct amba_device *pcdev) struct clk *pclk = pcdev->pclk; clk_disable(pclk); + clk_unprepare(pclk); clk_put(pclk); } -- cgit v1.1 From 99df4ee107a85530f3d4f6d628c8a86db9b1a8b3 Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 22 Sep 2011 12:34:31 +0100 Subject: clk: amba-clcd: convert to clk_prepare()/clk_unprepare() Signed-off-by: Russell King --- drivers/video/amba-clcd.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c index cf03ad0..2cda6ba 100644 --- a/drivers/video/amba-clcd.c +++ b/drivers/video/amba-clcd.c @@ -447,6 +447,10 @@ static int clcdfb_register(struct clcd_fb *fb) goto out; } + ret = clk_prepare(fb->clk); + if (ret) + goto free_clk; + fb->fb.device = &fb->dev->dev; fb->fb.fix.mmio_start = fb->dev->res.start; @@ -456,7 +460,7 @@ static int clcdfb_register(struct clcd_fb *fb) if (!fb->regs) { printk(KERN_ERR "CLCD: unable to remap registers\n"); ret = -ENOMEM; - goto free_clk; + goto clk_unprep; } fb->fb.fbops = &clcdfb_ops; @@ -530,6 +534,8 @@ static int clcdfb_register(struct clcd_fb *fb) fb_dealloc_cmap(&fb->fb.cmap); unmap: iounmap(fb->regs); + clk_unprep: + clk_unprepare(fb->clk); free_clk: clk_put(fb->clk); out: @@ -595,6 +601,7 @@ static int clcdfb_remove(struct amba_device *dev) if (fb->fb.cmap.len) fb_dealloc_cmap(&fb->fb.cmap); iounmap(fb->regs); + clk_unprepare(fb->clk); clk_put(fb->clk); fb->board->remove(fb); -- cgit v1.1 From 36b8f1e2dc8d0da4571788053af70f1f45d96ecf Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 22 Sep 2011 11:35:09 +0100 Subject: clk: amba-pl010: convert to clk_prepare()/clk_unprepare() Signed-off-by: Russell King --- drivers/tty/serial/amba-pl010.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/tty/serial/amba-pl010.c b/drivers/tty/serial/amba-pl010.c index c0d10c4..efdf92c 100644 --- a/drivers/tty/serial/amba-pl010.c +++ b/drivers/tty/serial/amba-pl010.c @@ -312,12 +312,16 @@ static int pl010_startup(struct uart_port *port) struct uart_amba_port *uap = (struct uart_amba_port *)port; int retval; + retval = clk_prepare(uap->clk); + if (retval) + goto out; + /* * Try to enable the clock producer. */ retval = clk_enable(uap->clk); if (retval) - goto out; + goto clk_unprep; uap->port.uartclk = clk_get_rate(uap->clk); @@ -343,6 +347,8 @@ static int pl010_startup(struct uart_port *port) clk_dis: clk_disable(uap->clk); + clk_unprep: + clk_unprepare(uap->clk); out: return retval; } @@ -370,6 +376,7 @@ static void pl010_shutdown(struct uart_port *port) * Shut down the clock producer */ clk_disable(uap->clk); + clk_unprepare(uap->clk); } static void @@ -626,6 +633,7 @@ static int __init pl010_console_setup(struct console *co, char *options) int bits = 8; int parity = 'n'; int flow = 'n'; + int ret; /* * Check whether an invalid uart number has been specified, and @@ -638,6 +646,10 @@ static int __init pl010_console_setup(struct console *co, char *options) if (!uap) return -ENODEV; + ret = clk_prepare(uap->clk); + if (ret) + return ret; + uap->port.uartclk = clk_get_rate(uap->clk); if (options) -- cgit v1.1 From 4b4851c65d926f46e208e4731409022d986a1355 Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 22 Sep 2011 11:35:30 +0100 Subject: clk: amba-pl011: convert to clk_prepare()/clk_unprepare() Signed-off-by: Russell King --- drivers/tty/serial/amba-pl011.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index f5f6831..00233af 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -1367,12 +1367,16 @@ static int pl011_startup(struct uart_port *port) unsigned int cr; int retval; + retval = clk_prepare(uap->clk); + if (retval) + goto out; + /* * Try to enable the clock producer. */ retval = clk_enable(uap->clk); if (retval) - goto out; + goto clk_unprep; uap->port.uartclk = clk_get_rate(uap->clk); @@ -1446,6 +1450,8 @@ static int pl011_startup(struct uart_port *port) clk_dis: clk_disable(uap->clk); + clk_unprep: + clk_unprepare(uap->clk); out: return retval; } @@ -1497,6 +1503,7 @@ static void pl011_shutdown(struct uart_port *port) * Shut down the clock producer */ clk_disable(uap->clk); + clk_unprepare(uap->clk); if (uap->port.dev->platform_data) { struct amba_pl011_data *plat; @@ -1800,6 +1807,7 @@ static int __init pl011_console_setup(struct console *co, char *options) int bits = 8; int parity = 'n'; int flow = 'n'; + int ret; /* * Check whether an invalid uart number has been specified, and @@ -1812,6 +1820,10 @@ static int __init pl011_console_setup(struct console *co, char *options) if (!uap) return -ENODEV; + ret = clk_prepare(uap->clk); + if (ret) + return ret; + if (uap->port.dev->platform_data) { struct amba_pl011_data *plat; -- cgit v1.1 From 52ca0f3ab568497adeac217e4167b51d9b4d4884 Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 22 Sep 2011 11:36:41 +0100 Subject: clk: mmci: convert to clk_prepare()/clk_unprepare() Signed-off-by: Russell King --- drivers/mmc/host/mmci.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 5e142b7..7be8db0 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -1160,10 +1160,14 @@ static int __devinit mmci_probe(struct amba_device *dev, goto host_free; } - ret = clk_enable(host->clk); + ret = clk_prepare(host->clk); if (ret) goto clk_free; + ret = clk_enable(host->clk); + if (ret) + goto clk_unprep; + host->plat = plat; host->variant = variant; host->mclk = clk_get_rate(host->clk); @@ -1351,6 +1355,8 @@ static int __devinit mmci_probe(struct amba_device *dev, iounmap(host->base); clk_disable: clk_disable(host->clk); + clk_unprep: + clk_unprepare(host->clk); clk_free: clk_put(host->clk); host_free: @@ -1398,6 +1404,7 @@ static int __devexit mmci_remove(struct amba_device *dev) iounmap(host->base); clk_disable(host->clk); + clk_unprepare(host->clk); clk_put(host->clk); if (host->vcc) -- cgit v1.1 From 7ff6bcf048e6a9849ea0b44269fa4c1c72869db2 Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 22 Sep 2011 14:27:11 +0100 Subject: clk: spi-pl022: convert to clk_prepare()/clk_unprepare() Signed-off-by: Russell King --- drivers/spi/spi-pl022.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'drivers') diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index 3520cf9..1ab2fa0 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c @@ -2187,6 +2187,13 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id) dev_err(&adev->dev, "could not retrieve SSP/SPI bus clock\n"); goto err_no_clk; } + + status = clk_prepare(pl022->clk); + if (status) { + dev_err(&adev->dev, "could not prepare SSP/SPI bus clock\n"); + goto err_clk_prep; + } + /* Disable SSP */ writew((readw(SSP_CR1(pl022->virtbase)) & (~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase)); @@ -2238,6 +2245,8 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id) pl022_dma_remove(pl022); free_irq(adev->irq[0], pl022); err_no_irq: + clk_unprepare(pl022->clk); + err_clk_prep: clk_put(pl022->clk); err_no_clk: iounmap(pl022->virtbase); @@ -2271,6 +2280,7 @@ pl022_remove(struct amba_device *adev) pl022_dma_remove(pl022); free_irq(adev->irq[0], pl022); clk_disable(pl022->clk); + clk_unprepare(pl022->clk); clk_put(pl022->clk); iounmap(pl022->virtbase); amba_release_regions(adev); -- cgit v1.1