[ARM] Remove clk_use()/clk_unuse()
authorRussell King <rmk@dyn-67.arm.linux.org.uk>
Tue, 3 Jan 2006 18:41:37 +0000 (18:41 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 3 Jan 2006 18:41:37 +0000 (18:41 +0000)
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>
18 files changed:
arch/arm/mach-aaec2000/clock.c
arch/arm/mach-integrator/clock.c
arch/arm/mach-realview/clock.c
arch/arm/mach-s3c2410/clock.c
arch/arm/mach-s3c2410/clock.h
arch/arm/mach-s3c2410/time.c
arch/arm/mach-versatile/clock.c
drivers/char/watchdog/s3c2410_wdt.c
drivers/i2c/busses/i2c-s3c2410.c
drivers/input/serio/ambakmi.c
drivers/mmc/mmci.c
drivers/mtd/nand/s3c2410.c
drivers/serial/amba-pl011.c
drivers/serial/s3c2410.c
drivers/usb/host/ohci-s3c2410.c
drivers/video/amba-clcd.c
drivers/video/s3c2410fb.c
include/asm-arm/hardware/clock.h

index 0340ddc4824ea3e7e8f0ebb733d71c3385c9bb7b..828208348b767045db0c2380be560b4cc0d92381 100644 (file)
@@ -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;
index 73c360685cad5eac086d56e03243620ee83a7ac7..bbfe46cd91fe3be545a1095cd85ec22317f45491 100644 (file)
@@ -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;
index 002635c97bb6dcb5c2485332144b4770ad1680fc..331e1b483aa74ec1bdb0de038c84b7dabd68185e 100644 (file)
@@ -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;
index 82e8253b1fa04d556c4da51b2db7ca905bb642c3..77f321fac281006a252804a770628b7fc0a0f3de 100644 (file)
@@ -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))
@@ -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);
@@ -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;
index 7953b6f397b9b6495570cdc0858245bcacc39cb4..177d5c8decf74306bbf5eb874840507fd5557b2c 100644 (file)
@@ -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);
index 8a00e3c3cd089cf3bec4f192c72322cee95ebd93..9acda44b25a673b5f2424776ef631440bd686937 100644 (file)
@@ -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);
index b96a2ea15d41b61b517204c770cfe9cc4d19ec7c..ada3142da8dc9bd3dcc6179595aefecbc8334393 100644 (file)
@@ -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;
index eb667daee19b6de487c28a2563ce42b2dc44935a..621e8a99e733d43d88c4817d050b29e8393ee17a 100644 (file)
@@ -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
@@ -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;
        }
index 58cfd3111ef62fac86eadd283b437018995bd4b4..2a2f86d8c2d87426b88dfadd624e89c5ae7574ff 100644 (file)
@@ -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;
        }
@@ -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 */
index 9b1ab5e7a98d12657bd2faa8e351de65726dc716..d847ed51cfb19fe9950220626aedeec45e210088 100644 (file)
@@ -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);
@@ -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;
 }
@@ -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)
index 166c9b0ad04ef7a43be4e63f6f5e66483cbdd80a..31b0b6d612bf2ee0eace4cf4016d9ebb52a0f2d7 100644 (file)
@@ -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);
@@ -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:
@@ -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);
index d209214b1318b451e9680c629b3db767438c51b0..b796a9a6b924ac842bc8f13687049ec3f8ac1dfd 100644 (file)
@@ -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);
        }
 
@@ -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 */
index d84476ee65923d85a4ce5043b162565324c6db79..531b0e4f25e5bac6c27afe880b42e068fe4dc6c5 100644 (file)
@@ -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;
@@ -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);
@@ -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;
index 47681c4654e4d110d1cd76ea4d37752881de8b0c..eb47f5b71aeb1b94ae3a6137c6c5bc1f791e5052 100644 (file)
@@ -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;
@@ -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);
 
index 35cc9402adc03dcaceccfe6e6cdd1dd16a5a220c..add198a4be79ffb398a57fd08e05668410b71f74 100644 (file)
@@ -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);
@@ -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:
index a3c2c45e29e03e7d9e42a64036501904305ee4df..69421c86252c58900ff7b08c5b05de1b9efdbefc 100644 (file)
@@ -346,10 +346,6 @@ 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;
 
@@ -357,7 +353,7 @@ static int clcdfb_register(struct clcd_fb *fb)
        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;
@@ -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:
@@ -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);
index ce6e749db3a7aa5433401833e28ee5b56f4ad135..d9c08cc7ac44840f9ee93c3806029b1a758e5917 100644 (file)
@@ -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");
 
@@ -783,7 +782,6 @@ free_video_memory:
        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);
@@ -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;
        }
index 5c5689409a4b59ad3bb508fbcbdf35c83036da67..69f33215e43723abd84c6f21af41bf97dd65529a 100644 (file)
@@ -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.