Skip to content

Commit

Permalink
[ARM] Remove clk_use()/clk_unuse()
Browse files Browse the repository at this point in the history
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: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Russell King authored and Russell King committed Jan 3, 2006
1 parent f47fc0a commit a8d3584
Show file tree
Hide file tree
Showing 18 changed files with 3 additions and 122 deletions.
11 changes: 0 additions & 11 deletions arch/arm/mach-aaec2000/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,6 @@ void clk_disable(struct clk *clk)
}
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)
{
return clk->rate;
Expand Down
11 changes: 0 additions & 11 deletions arch/arm/mach-integrator/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,6 @@ void clk_disable(struct clk *clk)
}
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)
{
return clk->rate;
Expand Down
11 changes: 0 additions & 11 deletions arch/arm/mach-realview/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,6 @@ void clk_disable(struct clk *clk)
}
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)
{
return clk->rate;
Expand Down
15 changes: 0 additions & 15 deletions arch/arm/mach-s3c2410/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
if (IS_ERR(clk))
Expand Down Expand Up @@ -196,8 +184,6 @@ EXPORT_SYMBOL(clk_get);
EXPORT_SYMBOL(clk_put);
EXPORT_SYMBOL(clk_enable);
EXPORT_SYMBOL(clk_disable);
EXPORT_SYMBOL(clk_use);
EXPORT_SYMBOL(clk_unuse);
EXPORT_SYMBOL(clk_get_rate);
EXPORT_SYMBOL(clk_round_rate);
EXPORT_SYMBOL(clk_set_rate);
Expand Down Expand Up @@ -370,7 +356,6 @@ static struct clk init_clocks[] = {
int s3c24xx_register_clock(struct clk *clk)
{
clk->owner = THIS_MODULE;
atomic_set(&clk->used, 0);

if (clk->enable == NULL)
clk->enable = clk_null_enable;
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-s3c2410/clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ struct clk {
struct clk *parent;
const char *name;
int id;
atomic_t used;
unsigned long rate;
unsigned long ctrlbit;
int (*enable)(struct clk *, int enable);
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-s3c2410/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ static void s3c2410_timer_setup (void)
if (IS_ERR(clk))
panic("failed to get clock for system timer");

clk_use(clk);
clk_enable(clk);

pclk = clk_get_rate(clk);
Expand Down
11 changes: 0 additions & 11 deletions arch/arm/mach-versatile/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,6 @@ void clk_disable(struct clk *clk)
}
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)
{
return clk->rate;
Expand Down
2 changes: 0 additions & 2 deletions drivers/char/watchdog/s3c2410_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
return -ENOENT;
}

clk_use(wdt_clock);
clk_enable(wdt_clock);

/* see if we can actually set the requested timer margin, and if
Expand Down Expand Up @@ -444,7 +443,6 @@ static int s3c2410wdt_remove(struct platform_device *dev)

if (wdt_clock != NULL) {
clk_disable(wdt_clock);
clk_unuse(wdt_clock);
clk_put(wdt_clock);
wdt_clock = NULL;
}
Expand Down
2 changes: 0 additions & 2 deletions drivers/i2c/busses/i2c-s3c2410.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,6 @@ static void s3c24xx_i2c_free(struct s3c24xx_i2c *i2c)
{
if (i2c->clk != NULL && !IS_ERR(i2c->clk)) {
clk_disable(i2c->clk);
clk_unuse(i2c->clk);
clk_put(i2c->clk);
i2c->clk = NULL;
}
Expand Down Expand Up @@ -778,7 +777,6 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)

dev_dbg(&pdev->dev, "clock source %p\n", i2c->clk);

clk_use(i2c->clk);
clk_enable(i2c->clk);

/* map the registers */
Expand Down
9 changes: 1 addition & 8 deletions drivers/input/serio/ambakmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,9 @@ static int amba_kmi_open(struct serio *io)
unsigned int divisor;
int ret;

ret = clk_use(kmi->clk);
if (ret)
goto out;

ret = clk_enable(kmi->clk);
if (ret)
goto clk_unuse;
goto out;

divisor = clk_get_rate(kmi->clk) / 8000000 - 1;
writeb(divisor, KMICLKDIV);
Expand All @@ -97,8 +93,6 @@ static int amba_kmi_open(struct serio *io)

clk_disable:
clk_disable(kmi->clk);
clk_unuse:
clk_unuse(kmi->clk);
out:
return ret;
}
Expand All @@ -111,7 +105,6 @@ static void amba_kmi_close(struct serio *io)

free_irq(kmi->irq, kmi);
clk_disable(kmi->clk);
clk_unuse(kmi->clk);
}

static int amba_kmi_probe(struct amba_device *dev, void *id)
Expand Down
9 changes: 1 addition & 8 deletions drivers/mmc/mmci.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,13 +479,9 @@ static int mmci_probe(struct amba_device *dev, void *id)
goto host_free;
}

ret = clk_use(host->clk);
if (ret)
goto clk_free;

ret = clk_enable(host->clk);
if (ret)
goto clk_unuse;
goto clk_free;

host->plat = plat;
host->mclk = clk_get_rate(host->clk);
Expand Down Expand Up @@ -558,8 +554,6 @@ static int mmci_probe(struct amba_device *dev, void *id)
iounmap(host->base);
clk_disable:
clk_disable(host->clk);
clk_unuse:
clk_unuse(host->clk);
clk_free:
clk_put(host->clk);
host_free:
Expand Down Expand Up @@ -594,7 +588,6 @@ static int mmci_remove(struct amba_device *dev)

iounmap(host->base);
clk_disable(host->clk);
clk_unuse(host->clk);
clk_put(host->clk);

mmc_free_host(mmc);
Expand Down
2 changes: 0 additions & 2 deletions drivers/mtd/nand/s3c2410.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,6 @@ static int s3c2410_nand_remove(struct platform_device *pdev)

if (info->clk != NULL && !IS_ERR(info->clk)) {
clk_disable(info->clk);
clk_unuse(info->clk);
clk_put(info->clk);
}

Expand Down Expand Up @@ -598,7 +597,6 @@ static int s3c24xx_nand_probe(struct platform_device *pdev, int is_s3c2440)
goto exit_error;
}

clk_use(info->clk);
clk_enable(info->clk);

/* allocate and map the resource */
Expand Down
7 changes: 0 additions & 7 deletions drivers/serial/amba-pl011.c
Original file line number Diff line number Diff line change
Expand Up @@ -761,10 +761,6 @@ static int pl011_probe(struct amba_device *dev, void *id)
goto unmap;
}

ret = clk_use(uap->clk);
if (ret)
goto putclk;

uap->port.dev = &dev->dev;
uap->port.mapbase = dev->res.start;
uap->port.membase = base;
Expand All @@ -782,8 +778,6 @@ static int pl011_probe(struct amba_device *dev, void *id)
if (ret) {
amba_set_drvdata(dev, NULL);
amba_ports[i] = NULL;
clk_unuse(uap->clk);
putclk:
clk_put(uap->clk);
unmap:
iounmap(base);
Expand All @@ -808,7 +802,6 @@ static int pl011_remove(struct amba_device *dev)
amba_ports[i] = NULL;

iounmap(uap->port.membase);
clk_unuse(uap->clk);
clk_put(uap->clk);
kfree(uap);
return 0;
Expand Down
5 changes: 0 additions & 5 deletions drivers/serial/s3c2410.c
Original file line number Diff line number Diff line change
Expand Up @@ -782,11 +782,9 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,

if (ourport->baudclk != NULL && !IS_ERR(ourport->baudclk)) {
clk_disable(ourport->baudclk);
clk_unuse(ourport->baudclk);
ourport->baudclk = NULL;
}

clk_use(clk);
clk_enable(clk);

ourport->clksrc = clksrc;
Expand Down Expand Up @@ -1077,9 +1075,6 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,

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",
port->mapbase, port->membase, port->irq, port->uartclk);

Expand Down
2 changes: 0 additions & 2 deletions drivers/usb/host/ohci-s3c2410.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ int usb_hcd_s3c2410_probe (const struct hc_driver *driver,
goto err1;
}

clk_use(clk);
s3c2410_start_hc(dev, hcd);

hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
Expand All @@ -384,7 +383,6 @@ int usb_hcd_s3c2410_probe (const struct hc_driver *driver,
err2:
s3c2410_stop_hc(dev);
iounmap(hcd->regs);
clk_unuse(clk);
clk_put(clk);

err1:
Expand Down
9 changes: 1 addition & 8 deletions drivers/video/amba-clcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,18 +346,14 @@ static int clcdfb_register(struct clcd_fb *fb)
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_len = SZ_4K;

fb->regs = ioremap(fb->fb.fix.mmio_start, fb->fb.fix.mmio_len);
if (!fb->regs) {
printk(KERN_ERR "CLCD: unable to remap registers\n");
ret = -ENOMEM;
goto unuse_clk;
goto free_clk;
}

fb->fb.fbops = &clcdfb_ops;
Expand Down Expand Up @@ -427,8 +423,6 @@ static int clcdfb_register(struct clcd_fb *fb)
printk(KERN_ERR "CLCD: cannot register framebuffer (%d)\n", ret);

iounmap(fb->regs);
unuse_clk:
clk_unuse(fb->clk);
free_clk:
clk_put(fb->clk);
out:
Expand Down Expand Up @@ -489,7 +483,6 @@ static int clcdfb_remove(struct amba_device *dev)
clcdfb_disable(fb);
unregister_framebuffer(&fb->fb);
iounmap(fb->regs);
clk_unuse(fb->clk);
clk_put(fb->clk);

fb->board->remove(fb);
Expand Down
3 changes: 0 additions & 3 deletions drivers/video/s3c2410fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,6 @@ int __init s3c2410fb_probe(struct platform_device *pdev)
goto release_irq;
}

clk_use(info->clk);
clk_enable(info->clk);
dprintk("got and enabled clock\n");

Expand Down Expand Up @@ -783,7 +782,6 @@ int __init s3c2410fb_probe(struct platform_device *pdev)
s3c2410fb_unmap_video_memory(info);
release_clock:
clk_disable(info->clk);
clk_unuse(info->clk);
clk_put(info->clk);
release_irq:
free_irq(irq,info);
Expand Down Expand Up @@ -828,7 +826,6 @@ static int s3c2410fb_remove(struct platform_device *pdev)

if (info->clk) {
clk_disable(info->clk);
clk_unuse(info->clk);
clk_put(info->clk);
info->clk = NULL;
}
Expand Down
14 changes: 0 additions & 14 deletions include/asm-arm/hardware/clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,6 @@ int clk_enable(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.
* This is only valid once the clock source has been enabled.
Expand Down

0 comments on commit a8d3584

Please sign in to comment.