davinci: clkdev cleanup: remove clk_lookup wrapper, use clkdev_add_table()
authorKevin Hilman <khilman@deeprootsystems.com>
Mon, 11 Jan 2010 16:22:23 +0000 (08:22 -0800)
committerKevin Hilman <khilman@deeprootsystems.com>
Thu, 4 Feb 2010 21:30:09 +0000 (13:30 -0800)
Remove unneeded 'struct davinci_clk' wrapper around 'struct clk_lookup'
and use clkdev_add_table() to add the list of clocks in one go.

Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
arch/arm/mach-davinci/clock.c
arch/arm/mach-davinci/clock.h
arch/arm/mach-davinci/da830.c
arch/arm/mach-davinci/da850.c
arch/arm/mach-davinci/dm355.c
arch/arm/mach-davinci/dm365.c
arch/arm/mach-davinci/dm644x.c
arch/arm/mach-davinci/dm646x.c
arch/arm/mach-davinci/include/mach/common.h

index 0fc63f93a222e3fec0bb0afdccb21f057195328e..bf6218ee94e193a69b9de7ef1da240f2d320e16b 100644 (file)
@@ -427,13 +427,14 @@ int davinci_set_pllrate(struct pll_data *pll, unsigned int prediv,
 }
 EXPORT_SYMBOL(davinci_set_pllrate);
 
-int __init davinci_clk_init(struct davinci_clk *clocks)
+int __init davinci_clk_init(struct clk_lookup *clocks)
   {
-       struct davinci_clk *c;
+       struct clk_lookup *c;
        struct clk *clk;
+       size_t num_clocks = 0;
 
-       for (c = clocks; c->lk.clk; c++) {
-               clk = c->lk.clk;
+       for (c = clocks; c->clk; c++) {
+               clk = c->clk;
 
                if (!clk->recalc) {
 
@@ -456,14 +457,16 @@ int __init davinci_clk_init(struct davinci_clk *clocks)
                if (clk->lpsc)
                        clk->flags |= CLK_PSC;
 
-               clkdev_add(&c->lk);
                clk_register(clk);
+               num_clocks++;
 
                /* Turn on clocks that Linux doesn't otherwise manage */
                if (clk->flags & ALWAYS_ENABLED)
                        clk_enable(clk);
        }
 
+       clkdev_add_table(clocks, num_clocks);
+
        return 0;
 }
 
index 31fb6eac712cb49f1f401d6963de66fbce00792e..aa0a611503255a7a7a2d350ada2fab676354f373 100644 (file)
@@ -106,20 +106,14 @@ struct clk {
 #define CLK_PLL                        BIT(4) /* PLL-derived clock */
 #define PRE_PLL                 BIT(5) /* source is before PLL mult/div */
 
-struct davinci_clk {
-       struct clk_lookup lk;
-};
-
-#define CLK(dev, con, ck)              \
-       {                               \
-               .lk = {                 \
-                       .dev_id = dev,  \
-                       .con_id = con,  \
-                       .clk = ck,      \
-               },                      \
-       }
-
-int davinci_clk_init(struct davinci_clk *clocks);
+#define CLK(dev, con, ck)      \
+       {                       \
+               .dev_id = dev,  \
+               .con_id = con,  \
+               .clk = ck,      \
+       }                       \
+
+int davinci_clk_init(struct clk_lookup *clocks);
 int davinci_set_pllrate(struct pll_data *pll, unsigned int prediv,
                                unsigned int mult, unsigned int postdiv);
 
index 54796050a2ff7d352add485356f50edb56c8fba7..122e61a9f505a6e3142a8a203c765f879ad53802 100644 (file)
@@ -371,7 +371,7 @@ static struct clk rmii_clk = {
        .parent         = &pll0_sysclk7,
 };
 
-static struct davinci_clk da830_clks[] = {
+static struct clk_lookup da830_clks[] = {
        CLK(NULL,               "ref",          &ref_clk),
        CLK(NULL,               "pll0",         &pll0_clk),
        CLK(NULL,               "pll0_aux",     &pll0_aux_clk),
index b9a7b3bc36b256ce595527a80338f9bfd3a823f9..d0fd7566712a1ffb7983999a16b9d6600768dbd1 100644 (file)
@@ -335,7 +335,7 @@ static struct clk aemif_clk = {
        .flags          = ALWAYS_ENABLED,
 };
 
-static struct davinci_clk da850_clks[] = {
+static struct clk_lookup da850_clks[] = {
        CLK(NULL,               "ref",          &ref_clk),
        CLK(NULL,               "pll0",         &pll0_clk),
        CLK(NULL,               "pll0_aux",     &pll0_aux_clk),
@@ -834,12 +834,12 @@ static struct davinci_timer_info da850_timer_info = {
 static void da850_set_async3_src(int pllnum)
 {
        struct clk *clk, *newparent = pllnum ? &pll1_sysclk2 : &pll0_sysclk2;
-       struct davinci_clk *c;
+       struct clk_lookup *c;
        unsigned int v;
        int ret;
 
-       for (c = da850_clks; c->lk.clk; c++) {
-               clk = c->lk.clk;
+       for (c = da850_clks; c->clk; c++) {
+               clk = c->clk;
                if (clk->flags & DA850_CLK_ASYNC3) {
                        ret = clk_set_parent(clk, newparent);
                        WARN(ret, "DA850: unable to re-parent clock %s",
index b1185f82ffb3ecd5cd6791df71442fe2e97ab612..2cdd8740aad97a2d7965cddf0aea7ffc0813478d 100644 (file)
@@ -335,7 +335,7 @@ static struct clk usb_clk = {
        .lpsc = DAVINCI_LPSC_USB,
 };
 
-static struct davinci_clk dm355_clks[] = {
+static struct clk_lookup dm355_clks[] = {
        CLK(NULL, "ref", &ref_clk),
        CLK(NULL, "pll1", &pll1_clk),
        CLK(NULL, "pll1_sysclk1", &pll1_sysclk1),
index d5010567b496a660fc0eaa28d05546fb98941470..e88f2624df68447b5a8a936ad68517047625e699 100644 (file)
@@ -403,7 +403,7 @@ static struct clk mjcp_clk = {
        .lpsc           = DM365_LPSC_MJCP,
 };
 
-static struct davinci_clk dm365_clks[] = {
+static struct clk_lookup dm365_clks[] = {
        CLK(NULL, "ref", &ref_clk),
        CLK(NULL, "pll1", &pll1_clk),
        CLK(NULL, "pll1_aux", &pll1_aux_clk),
index fc060e7aefdf32541ef6028cfead5d3b35f7b7d1..a7b57237461a2b649ee1579cc4e93ec2bf8764a8 100644 (file)
@@ -277,7 +277,7 @@ static struct clk timer2_clk = {
        .usecount = 1,              /* REVISIT: why cant' this be disabled? */
 };
 
-struct davinci_clk dm644x_clks[] = {
+struct clk_lookup dm644x_clks[] = {
        CLK(NULL, "ref", &ref_clk),
        CLK(NULL, "pll1", &pll1_clk),
        CLK(NULL, "pll1_sysclk1", &pll1_sysclk1),
index 7eb34e9253c635fff9c1c1eef2099b9e2a85b005..893baf4ad37dc45bda883026a7eb7b3d73012097 100644 (file)
@@ -311,7 +311,7 @@ static struct clk vpif1_clk = {
        .flags = ALWAYS_ENABLED,
 };
 
-struct davinci_clk dm646x_clks[] = {
+struct clk_lookup dm646x_clks[] = {
        CLK(NULL, "ref", &ref_clk),
        CLK(NULL, "aux", &aux_clkin),
        CLK(NULL, "pll1", &pll1_clk),
index 6ca2c9a0a4827839c105d037e73ad5bb83a8b53c..50a955f05ef9e127b3a28d0b82d344b797521fd1 100644 (file)
@@ -43,7 +43,7 @@ struct davinci_soc_info {
        void __iomem                    *jtag_id_base;
        struct davinci_id               *ids;
        unsigned long                   ids_num;
-       struct davinci_clk              *cpu_clks;
+       struct clk_lookup               *cpu_clks;
        void __iomem                    **psc_bases;
        unsigned long                   psc_bases_num;
        void __iomem                    *pinmux_base;