Commit a8d3584a authored by Russell King's avatar Russell King Committed by Russell King

[ARM] Remove clk_use()/clk_unuse()

It seems that clk_use() and clk_unuse() are additional complexity
which isn't required anymore.  Remove them from the clock framework
to avoid the additional confusion which they cause, and update all
ARM machine types except for OMAP.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent f47fc0ac
...@@ -58,17 +58,6 @@ void clk_disable(struct clk *clk) ...@@ -58,17 +58,6 @@ void clk_disable(struct clk *clk)
} }
EXPORT_SYMBOL(clk_disable); EXPORT_SYMBOL(clk_disable);
int clk_use(struct clk *clk)
{
return 0;
}
EXPORT_SYMBOL(clk_use);
void clk_unuse(struct clk *clk)
{
}
EXPORT_SYMBOL(clk_unuse);
unsigned long clk_get_rate(struct clk *clk) unsigned long clk_get_rate(struct clk *clk)
{ {
return clk->rate; return clk->rate;
......
...@@ -58,17 +58,6 @@ void clk_disable(struct clk *clk) ...@@ -58,17 +58,6 @@ void clk_disable(struct clk *clk)
} }
EXPORT_SYMBOL(clk_disable); EXPORT_SYMBOL(clk_disable);
int clk_use(struct clk *clk)
{
return 0;
}
EXPORT_SYMBOL(clk_use);
void clk_unuse(struct clk *clk)
{
}
EXPORT_SYMBOL(clk_unuse);
unsigned long clk_get_rate(struct clk *clk) unsigned long clk_get_rate(struct clk *clk)
{ {
return clk->rate; return clk->rate;
......
...@@ -57,17 +57,6 @@ void clk_disable(struct clk *clk) ...@@ -57,17 +57,6 @@ void clk_disable(struct clk *clk)
} }
EXPORT_SYMBOL(clk_disable); EXPORT_SYMBOL(clk_disable);
int clk_use(struct clk *clk)
{
return 0;
}
EXPORT_SYMBOL(clk_use);
void clk_unuse(struct clk *clk)
{
}
EXPORT_SYMBOL(clk_unuse);
unsigned long clk_get_rate(struct clk *clk) unsigned long clk_get_rate(struct clk *clk)
{ {
return clk->rate; return clk->rate;
......
...@@ -151,18 +151,6 @@ void clk_disable(struct clk *clk) ...@@ -151,18 +151,6 @@ void clk_disable(struct clk *clk)
} }
int clk_use(struct clk *clk)
{
atomic_inc(&clk->used);
return 0;
}
void clk_unuse(struct clk *clk)
{
atomic_dec(&clk->used);
}
unsigned long clk_get_rate(struct clk *clk) unsigned long clk_get_rate(struct clk *clk)
{ {
if (IS_ERR(clk)) if (IS_ERR(clk))
...@@ -196,8 +184,6 @@ EXPORT_SYMBOL(clk_get); ...@@ -196,8 +184,6 @@ EXPORT_SYMBOL(clk_get);
EXPORT_SYMBOL(clk_put); EXPORT_SYMBOL(clk_put);
EXPORT_SYMBOL(clk_enable); EXPORT_SYMBOL(clk_enable);
EXPORT_SYMBOL(clk_disable); EXPORT_SYMBOL(clk_disable);
EXPORT_SYMBOL(clk_use);
EXPORT_SYMBOL(clk_unuse);
EXPORT_SYMBOL(clk_get_rate); EXPORT_SYMBOL(clk_get_rate);
EXPORT_SYMBOL(clk_round_rate); EXPORT_SYMBOL(clk_round_rate);
EXPORT_SYMBOL(clk_set_rate); EXPORT_SYMBOL(clk_set_rate);
...@@ -370,7 +356,6 @@ static struct clk init_clocks[] = { ...@@ -370,7 +356,6 @@ static struct clk init_clocks[] = {
int s3c24xx_register_clock(struct clk *clk) int s3c24xx_register_clock(struct clk *clk)
{ {
clk->owner = THIS_MODULE; clk->owner = THIS_MODULE;
atomic_set(&clk->used, 0);
if (clk->enable == NULL) if (clk->enable == NULL)
clk->enable = clk_null_enable; clk->enable = clk_null_enable;
......
...@@ -16,7 +16,6 @@ struct clk { ...@@ -16,7 +16,6 @@ struct clk {
struct clk *parent; struct clk *parent;
const char *name; const char *name;
int id; int id;
atomic_t used;
unsigned long rate; unsigned long rate;
unsigned long ctrlbit; unsigned long ctrlbit;
int (*enable)(struct clk *, int enable); int (*enable)(struct clk *, int enable);
......
...@@ -191,7 +191,6 @@ static void s3c2410_timer_setup (void) ...@@ -191,7 +191,6 @@ static void s3c2410_timer_setup (void)
if (IS_ERR(clk)) if (IS_ERR(clk))
panic("failed to get clock for system timer"); panic("failed to get clock for system timer");
clk_use(clk);
clk_enable(clk); clk_enable(clk);
pclk = clk_get_rate(clk); pclk = clk_get_rate(clk);
......
...@@ -58,17 +58,6 @@ void clk_disable(struct clk *clk) ...@@ -58,17 +58,6 @@ void clk_disable(struct clk *clk)
} }
EXPORT_SYMBOL(clk_disable); EXPORT_SYMBOL(clk_disable);
int clk_use(struct clk *clk)
{
return 0;
}
EXPORT_SYMBOL(clk_use);
void clk_unuse(struct clk *clk)
{
}
EXPORT_SYMBOL(clk_unuse);
unsigned long clk_get_rate(struct clk *clk) unsigned long clk_get_rate(struct clk *clk)
{ {
return clk->rate; return clk->rate;
......
...@@ -397,7 +397,6 @@ static int s3c2410wdt_probe(struct platform_device *pdev) ...@@ -397,7 +397,6 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
return -ENOENT; return -ENOENT;
} }
clk_use(wdt_clock);
clk_enable(wdt_clock); clk_enable(wdt_clock);
/* see if we can actually set the requested timer margin, and if /* see if we can actually set the requested timer margin, and if
...@@ -444,7 +443,6 @@ static int s3c2410wdt_remove(struct platform_device *dev) ...@@ -444,7 +443,6 @@ static int s3c2410wdt_remove(struct platform_device *dev)
if (wdt_clock != NULL) { if (wdt_clock != NULL) {
clk_disable(wdt_clock); clk_disable(wdt_clock);
clk_unuse(wdt_clock);
clk_put(wdt_clock); clk_put(wdt_clock);
wdt_clock = NULL; wdt_clock = NULL;
} }
......
...@@ -738,7 +738,6 @@ static void s3c24xx_i2c_free(struct s3c24xx_i2c *i2c) ...@@ -738,7 +738,6 @@ static void s3c24xx_i2c_free(struct s3c24xx_i2c *i2c)
{ {
if (i2c->clk != NULL && !IS_ERR(i2c->clk)) { if (i2c->clk != NULL && !IS_ERR(i2c->clk)) {
clk_disable(i2c->clk); clk_disable(i2c->clk);
clk_unuse(i2c->clk);
clk_put(i2c->clk); clk_put(i2c->clk);
i2c->clk = NULL; i2c->clk = NULL;
} }
...@@ -778,7 +777,6 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) ...@@ -778,7 +777,6 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
dev_dbg(&pdev->dev, "clock source %p\n", i2c->clk); dev_dbg(&pdev->dev, "clock source %p\n", i2c->clk);
clk_use(i2c->clk);
clk_enable(i2c->clk); clk_enable(i2c->clk);
/* map the registers */ /* map the registers */
......
...@@ -72,13 +72,9 @@ static int amba_kmi_open(struct serio *io) ...@@ -72,13 +72,9 @@ static int amba_kmi_open(struct serio *io)
unsigned int divisor; unsigned int divisor;
int ret; int ret;
ret = clk_use(kmi->clk);
if (ret)
goto out;
ret = clk_enable(kmi->clk); ret = clk_enable(kmi->clk);
if (ret) if (ret)
goto clk_unuse; goto out;
divisor = clk_get_rate(kmi->clk) / 8000000 - 1; divisor = clk_get_rate(kmi->clk) / 8000000 - 1;
writeb(divisor, KMICLKDIV); writeb(divisor, KMICLKDIV);
...@@ -97,8 +93,6 @@ static int amba_kmi_open(struct serio *io) ...@@ -97,8 +93,6 @@ static int amba_kmi_open(struct serio *io)
clk_disable: clk_disable:
clk_disable(kmi->clk); clk_disable(kmi->clk);
clk_unuse:
clk_unuse(kmi->clk);
out: out:
return ret; return ret;
} }
...@@ -111,7 +105,6 @@ static void amba_kmi_close(struct serio *io) ...@@ -111,7 +105,6 @@ static void amba_kmi_close(struct serio *io)
free_irq(kmi->irq, kmi); free_irq(kmi->irq, kmi);
clk_disable(kmi->clk); clk_disable(kmi->clk);
clk_unuse(kmi->clk);
} }
static int amba_kmi_probe(struct amba_device *dev, void *id) static int amba_kmi_probe(struct amba_device *dev, void *id)
......
...@@ -479,13 +479,9 @@ static int mmci_probe(struct amba_device *dev, void *id) ...@@ -479,13 +479,9 @@ static int mmci_probe(struct amba_device *dev, void *id)
goto host_free; goto host_free;
} }
ret = clk_use(host->clk);
if (ret)
goto clk_free;
ret = clk_enable(host->clk); ret = clk_enable(host->clk);
if (ret) if (ret)
goto clk_unuse; goto clk_free;
host->plat = plat; host->plat = plat;
host->mclk = clk_get_rate(host->clk); host->mclk = clk_get_rate(host->clk);
...@@ -558,8 +554,6 @@ static int mmci_probe(struct amba_device *dev, void *id) ...@@ -558,8 +554,6 @@ static int mmci_probe(struct amba_device *dev, void *id)
iounmap(host->base); iounmap(host->base);
clk_disable: clk_disable:
clk_disable(host->clk); clk_disable(host->clk);
clk_unuse:
clk_unuse(host->clk);
clk_free: clk_free:
clk_put(host->clk); clk_put(host->clk);
host_free: host_free:
...@@ -594,7 +588,6 @@ static int mmci_remove(struct amba_device *dev) ...@@ -594,7 +588,6 @@ static int mmci_remove(struct amba_device *dev)
iounmap(host->base); iounmap(host->base);
clk_disable(host->clk); clk_disable(host->clk);
clk_unuse(host->clk);
clk_put(host->clk); clk_put(host->clk);
mmc_free_host(mmc); mmc_free_host(mmc);
......
...@@ -460,7 +460,6 @@ static int s3c2410_nand_remove(struct platform_device *pdev) ...@@ -460,7 +460,6 @@ static int s3c2410_nand_remove(struct platform_device *pdev)
if (info->clk != NULL && !IS_ERR(info->clk)) { if (info->clk != NULL && !IS_ERR(info->clk)) {
clk_disable(info->clk); clk_disable(info->clk);
clk_unuse(info->clk);
clk_put(info->clk); clk_put(info->clk);
} }
...@@ -598,7 +597,6 @@ static int s3c24xx_nand_probe(struct platform_device *pdev, int is_s3c2440) ...@@ -598,7 +597,6 @@ static int s3c24xx_nand_probe(struct platform_device *pdev, int is_s3c2440)
goto exit_error; goto exit_error;
} }
clk_use(info->clk);
clk_enable(info->clk); clk_enable(info->clk);
/* allocate and map the resource */ /* allocate and map the resource */
......
...@@ -761,10 +761,6 @@ static int pl011_probe(struct amba_device *dev, void *id) ...@@ -761,10 +761,6 @@ static int pl011_probe(struct amba_device *dev, void *id)
goto unmap; goto unmap;
} }
ret = clk_use(uap->clk);
if (ret)
goto putclk;
uap->port.dev = &dev->dev; uap->port.dev = &dev->dev;
uap->port.mapbase = dev->res.start; uap->port.mapbase = dev->res.start;
uap->port.membase = base; uap->port.membase = base;
...@@ -782,8 +778,6 @@ static int pl011_probe(struct amba_device *dev, void *id) ...@@ -782,8 +778,6 @@ static int pl011_probe(struct amba_device *dev, void *id)
if (ret) { if (ret) {
amba_set_drvdata(dev, NULL); amba_set_drvdata(dev, NULL);
amba_ports[i] = NULL; amba_ports[i] = NULL;
clk_unuse(uap->clk);
putclk:
clk_put(uap->clk); clk_put(uap->clk);
unmap: unmap:
iounmap(base); iounmap(base);
...@@ -808,7 +802,6 @@ static int pl011_remove(struct amba_device *dev) ...@@ -808,7 +802,6 @@ static int pl011_remove(struct amba_device *dev)
amba_ports[i] = NULL; amba_ports[i] = NULL;
iounmap(uap->port.membase); iounmap(uap->port.membase);
clk_unuse(uap->clk);
clk_put(uap->clk); clk_put(uap->clk);
kfree(uap); kfree(uap);
return 0; return 0;
......
...@@ -782,11 +782,9 @@ static void s3c24xx_serial_set_termios(struct uart_port *port, ...@@ -782,11 +782,9 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
if (ourport->baudclk != NULL && !IS_ERR(ourport->baudclk)) { if (ourport->baudclk != NULL && !IS_ERR(ourport->baudclk)) {
clk_disable(ourport->baudclk); clk_disable(ourport->baudclk);
clk_unuse(ourport->baudclk);
ourport->baudclk = NULL; ourport->baudclk = NULL;
} }
clk_use(clk);
clk_enable(clk); clk_enable(clk);
ourport->clksrc = clksrc; ourport->clksrc = clksrc;
...@@ -1077,9 +1075,6 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, ...@@ -1077,9 +1075,6 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
ourport->clk = clk_get(&platdev->dev, "uart"); ourport->clk = clk_get(&platdev->dev, "uart");
if (ourport->clk != NULL && !IS_ERR(ourport->clk))
clk_use(ourport->clk);
dbg("port: map=%08x, mem=%08x, irq=%d, clock=%ld\n", dbg("port: map=%08x, mem=%08x, irq=%d, clock=%ld\n",
port->mapbase, port->membase, port->irq, port->uartclk); port->mapbase, port->membase, port->irq, port->uartclk);
......
...@@ -363,7 +363,6 @@ int usb_hcd_s3c2410_probe (const struct hc_driver *driver, ...@@ -363,7 +363,6 @@ int usb_hcd_s3c2410_probe (const struct hc_driver *driver,
goto err1; goto err1;
} }
clk_use(clk);
s3c2410_start_hc(dev, hcd); s3c2410_start_hc(dev, hcd);
hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
...@@ -384,7 +383,6 @@ int usb_hcd_s3c2410_probe (const struct hc_driver *driver, ...@@ -384,7 +383,6 @@ int usb_hcd_s3c2410_probe (const struct hc_driver *driver,
err2: err2:
s3c2410_stop_hc(dev); s3c2410_stop_hc(dev);
iounmap(hcd->regs); iounmap(hcd->regs);
clk_unuse(clk);
clk_put(clk); clk_put(clk);
err1: err1:
......
...@@ -346,10 +346,6 @@ static int clcdfb_register(struct clcd_fb *fb) ...@@ -346,10 +346,6 @@ static int clcdfb_register(struct clcd_fb *fb)
goto out; goto out;
} }
ret = clk_use(fb->clk);
if (ret)
goto free_clk;
fb->fb.fix.mmio_start = fb->dev->res.start; fb->fb.fix.mmio_start = fb->dev->res.start;
fb->fb.fix.mmio_len = SZ_4K; fb->fb.fix.mmio_len = SZ_4K;
...@@ -357,7 +353,7 @@ static int clcdfb_register(struct clcd_fb *fb) ...@@ -357,7 +353,7 @@ static int clcdfb_register(struct clcd_fb *fb)
if (!fb->regs) { if (!fb->regs) {
printk(KERN_ERR "CLCD: unable to remap registers\n"); printk(KERN_ERR "CLCD: unable to remap registers\n");
ret = -ENOMEM; ret = -ENOMEM;
goto unuse_clk; goto free_clk;
} }
fb->fb.fbops = &clcdfb_ops; fb->fb.fbops = &clcdfb_ops;
...@@ -427,8 +423,6 @@ static int clcdfb_register(struct clcd_fb *fb) ...@@ -427,8 +423,6 @@ static int clcdfb_register(struct clcd_fb *fb)
printk(KERN_ERR "CLCD: cannot register framebuffer (%d)\n", ret); printk(KERN_ERR "CLCD: cannot register framebuffer (%d)\n", ret);
iounmap(fb->regs); iounmap(fb->regs);
unuse_clk:
clk_unuse(fb->clk);
free_clk: free_clk:
clk_put(fb->clk); clk_put(fb->clk);
out: out:
...@@ -489,7 +483,6 @@ static int clcdfb_remove(struct amba_device *dev) ...@@ -489,7 +483,6 @@ static int clcdfb_remove(struct amba_device *dev)
clcdfb_disable(fb); clcdfb_disable(fb);
unregister_framebuffer(&fb->fb); unregister_framebuffer(&fb->fb);
iounmap(fb->regs); iounmap(fb->regs);
clk_unuse(fb->clk);
clk_put(fb->clk); clk_put(fb->clk);
fb->board->remove(fb); fb->board->remove(fb);
......
...@@ -746,7 +746,6 @@ int __init s3c2410fb_probe(struct platform_device *pdev) ...@@ -746,7 +746,6 @@ int __init s3c2410fb_probe(struct platform_device *pdev)
goto release_irq; goto release_irq;
} }
clk_use(info->clk);
clk_enable(info->clk); clk_enable(info->clk);
dprintk("got and enabled clock\n"); dprintk("got and enabled clock\n");
...@@ -783,7 +782,6 @@ free_video_memory: ...@@ -783,7 +782,6 @@ free_video_memory:
s3c2410fb_unmap_video_memory(info); s3c2410fb_unmap_video_memory(info);
release_clock: release_clock:
clk_disable(info->clk); clk_disable(info->clk);
clk_unuse(info->clk);
clk_put(info->clk); clk_put(info->clk);
release_irq: release_irq:
free_irq(irq,info); free_irq(irq,info);
...@@ -828,7 +826,6 @@ static int s3c2410fb_remove(struct platform_device *pdev) ...@@ -828,7 +826,6 @@ static int s3c2410fb_remove(struct platform_device *pdev)
if (info->clk) { if (info->clk) {
clk_disable(info->clk); clk_disable(info->clk);
clk_unuse(info->clk);
clk_put(info->clk); clk_put(info->clk);
info->clk = NULL; info->clk = NULL;
} }
......
...@@ -62,20 +62,6 @@ int clk_enable(struct clk *clk); ...@@ -62,20 +62,6 @@ int clk_enable(struct clk *clk);
*/ */
void clk_disable(struct clk *clk); void clk_disable(struct clk *clk);
/**
* clk_use - increment the use count
* @clk: clock source
*
* Returns success (0) or negative errno.
*/
int clk_use(struct clk *clk);
/**
* clk_unuse - decrement the use count
* @clk: clock source
*/
void clk_unuse(struct clk *clk);
/** /**
* clk_get_rate - obtain the current clock rate (in Hz) for a clock source. * clk_get_rate - obtain the current clock rate (in Hz) for a clock source.
* This is only valid once the clock source has been enabled. * This is only valid once the clock source has been enabled.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment