clocksource: Use dev_name() universally across the SH drivers.
authorPaul Mundt <lethal@linux-sh.org>
Wed, 10 Mar 2010 07:26:25 +0000 (16:26 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Wed, 10 Mar 2010 07:26:25 +0000 (16:26 +0900)
There is no need to copy in the name from the sh timer config now that
dev_name() is available early. We prefer the dev_name() variant for
consistent naming.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
drivers/clocksource/sh_cmt.c
drivers/clocksource/sh_mtu2.c
drivers/clocksource/sh_tmu.c

index 578595c..a1d3811 100644 (file)
@@ -149,13 +149,12 @@ static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start)
 
 static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate)
 {
-       struct sh_timer_config *cfg = p->pdev->dev.platform_data;
        int ret;
 
        /* enable clock */
        ret = clk_enable(p->clk);
        if (ret) {
-               pr_err("sh_cmt: cannot enable clock \"%s\"\n", cfg->clk);
+               dev_err(&p->pdev->dev, "cannot enable clock\n");
                return ret;
        }
 
@@ -278,7 +277,7 @@ static void sh_cmt_clock_event_program_verify(struct sh_cmt_priv *p,
                        delay = 1;
 
                if (!delay)
-                       pr_warning("sh_cmt: too long delay\n");
+                       dev_warn(&p->pdev->dev, "too long delay\n");
 
        } while (delay);
 }
@@ -288,7 +287,7 @@ static void sh_cmt_set_next(struct sh_cmt_priv *p, unsigned long delta)
        unsigned long flags;
 
        if (delta > p->max_match_value)
-               pr_warning("sh_cmt: delta out of range\n");
+               dev_warn(&p->pdev->dev, "delta out of range\n");
 
        spin_lock_irqsave(&p->lock, flags);
        p->next_match_value = delta;
@@ -450,7 +449,7 @@ static int sh_cmt_register_clocksource(struct sh_cmt_priv *p,
        cs->resume = sh_cmt_clocksource_resume;
        cs->mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8);
        cs->flags = CLOCK_SOURCE_IS_CONTINUOUS;
-       pr_info("sh_cmt: %s used as clock source\n", cs->name);
+       dev_info(&p->pdev->dev, "used as clock source\n");
        clocksource_register(cs);
        return 0;
 }
@@ -496,13 +495,11 @@ static void sh_cmt_clock_event_mode(enum clock_event_mode mode,
 
        switch (mode) {
        case CLOCK_EVT_MODE_PERIODIC:
-               pr_info("sh_cmt: %s used for periodic clock events\n",
-                       ced->name);
+               dev_info(&p->pdev->dev, "used for periodic clock events\n");
                sh_cmt_clock_event_start(p, 1);
                break;
        case CLOCK_EVT_MODE_ONESHOT:
-               pr_info("sh_cmt: %s used for oneshot clock events\n",
-                       ced->name);
+               dev_info(&p->pdev->dev, "used for oneshot clock events\n");
                sh_cmt_clock_event_start(p, 0);
                break;
        case CLOCK_EVT_MODE_SHUTDOWN:
@@ -543,7 +540,7 @@ static void sh_cmt_register_clockevent(struct sh_cmt_priv *p,
        ced->set_next_event = sh_cmt_clock_event_next;
        ced->set_mode = sh_cmt_clock_event_mode;
 
-       pr_info("sh_cmt: %s used for clock events\n", ced->name);
+       dev_info(&p->pdev->dev, "used for clock events\n");
        clockevents_register_device(ced);
 }
 
@@ -600,12 +597,12 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
        /* map memory, let mapbase point to our channel */
        p->mapbase = ioremap_nocache(res->start, resource_size(res));
        if (p->mapbase == NULL) {
-               pr_err("sh_cmt: failed to remap I/O memory\n");
+               dev_err(&p->pdev->dev, "failed to remap I/O memory\n");
                goto err0;
        }
 
        /* request irq using setup_irq() (too early for request_irq()) */
-       p->irqaction.name = cfg->name;
+       p->irqaction.name = dev_name(&p->pdev->dev);
        p->irqaction.handler = sh_cmt_interrupt;
        p->irqaction.dev_id = p;
        p->irqaction.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL;
@@ -613,7 +610,7 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
        /* get hold of clock */
        p->clk = clk_get(&p->pdev->dev, cfg->clk);
        if (IS_ERR(p->clk)) {
-               pr_err("sh_cmt: cannot get clock \"%s\"\n", cfg->clk);
+               dev_err(&p->pdev->dev, "cannot get clock\n");
                ret = PTR_ERR(p->clk);
                goto err1;
        }
@@ -628,17 +625,17 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
                p->clear_bits = ~0xc000;
        }
 
-       ret = sh_cmt_register(p, cfg->name,
+       ret = sh_cmt_register(p, (char *)dev_name(&p->pdev->dev),
                              cfg->clockevent_rating,
                              cfg->clocksource_rating);
        if (ret) {
-               pr_err("sh_cmt: registration failed\n");
+               dev_err(&p->pdev->dev, "registration failed\n");
                goto err1;
        }
 
        ret = setup_irq(irq, &p->irqaction);
        if (ret) {
-               pr_err("sh_cmt: failed to request irq %d\n", irq);
+               dev_err(&p->pdev->dev, "failed to request irq %d\n", irq);
                goto err1;
        }
 
@@ -653,11 +650,10 @@ err0:
 static int __devinit sh_cmt_probe(struct platform_device *pdev)
 {
        struct sh_cmt_priv *p = platform_get_drvdata(pdev);
-       struct sh_timer_config *cfg = pdev->dev.platform_data;
        int ret;
 
        if (p) {
-               pr_info("sh_cmt: %s kept as earlytimer\n", cfg->name);
+               dev_info(&pdev->dev, "kept as earlytimer\n");
                return 0;
        }
 
index 4c8a759..8ce3555 100644 (file)
@@ -118,13 +118,12 @@ static void sh_mtu2_start_stop_ch(struct sh_mtu2_priv *p, int start)
 
 static int sh_mtu2_enable(struct sh_mtu2_priv *p)
 {
-       struct sh_timer_config *cfg = p->pdev->dev.platform_data;
        int ret;
 
        /* enable clock */
        ret = clk_enable(p->clk);
        if (ret) {
-               pr_err("sh_mtu2: cannot enable clock \"%s\"\n", cfg->clk);
+               dev_err(&p->pdev->dev, "cannot enable clock\n");
                return ret;
        }
 
@@ -193,8 +192,7 @@ static void sh_mtu2_clock_event_mode(enum clock_event_mode mode,
 
        switch (mode) {
        case CLOCK_EVT_MODE_PERIODIC:
-               pr_info("sh_mtu2: %s used for periodic clock events\n",
-                       ced->name);
+               dev_info(&p->pdev->dev, "used for periodic clock events\n");
                sh_mtu2_enable(p);
                break;
        case CLOCK_EVT_MODE_UNUSED:
@@ -221,13 +219,13 @@ static void sh_mtu2_register_clockevent(struct sh_mtu2_priv *p,
        ced->cpumask = cpumask_of(0);
        ced->set_mode = sh_mtu2_clock_event_mode;
 
-       pr_info("sh_mtu2: %s used for clock events\n", ced->name);
+       dev_info(&p->pdev->dev, "used for clock events\n");
        clockevents_register_device(ced);
 
        ret = setup_irq(p->irqaction.irq, &p->irqaction);
        if (ret) {
-               pr_err("sh_mtu2: failed to request irq %d\n",
-                      p->irqaction.irq);
+               dev_err(&p->pdev->dev, "failed to request irq %d\n",
+                       p->irqaction.irq);
                return;
        }
 }
@@ -273,12 +271,12 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev)
        /* map memory, let mapbase point to our channel */
        p->mapbase = ioremap_nocache(res->start, resource_size(res));
        if (p->mapbase == NULL) {
-               pr_err("sh_mtu2: failed to remap I/O memory\n");
+               dev_err(&p->pdev->dev, "failed to remap I/O memory\n");
                goto err0;
        }
 
        /* setup data for setup_irq() (too early for request_irq()) */
-       p->irqaction.name = cfg->name;
+       p->irqaction.name = dev_name(&p->pdev->dev);
        p->irqaction.handler = sh_mtu2_interrupt;
        p->irqaction.dev_id = p;
        p->irqaction.irq = irq;
@@ -287,12 +285,13 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev)
        /* get hold of clock */
        p->clk = clk_get(&p->pdev->dev, cfg->clk);
        if (IS_ERR(p->clk)) {
-               pr_err("sh_mtu2: cannot get clock \"%s\"\n", cfg->clk);
+               dev_err(&p->pdev->dev, "cannot get clock\n");
                ret = PTR_ERR(p->clk);
                goto err1;
        }
 
-       return sh_mtu2_register(p, cfg->name, cfg->clockevent_rating);
+       return sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev),
+                               cfg->clockevent_rating);
  err1:
        iounmap(p->mapbase);
  err0:
@@ -302,11 +301,10 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev)
 static int __devinit sh_mtu2_probe(struct platform_device *pdev)
 {
        struct sh_mtu2_priv *p = platform_get_drvdata(pdev);
-       struct sh_timer_config *cfg = pdev->dev.platform_data;
        int ret;
 
        if (p) {
-               pr_info("sh_mtu2: %s kept as earlytimer\n", cfg->name);
+               dev_info(&pdev->dev, "kept as earlytimer\n");
                return 0;
        }
 
index 961f5b5..3423945 100644 (file)
@@ -106,13 +106,12 @@ static void sh_tmu_start_stop_ch(struct sh_tmu_priv *p, int start)
 
 static int sh_tmu_enable(struct sh_tmu_priv *p)
 {
-       struct sh_timer_config *cfg = p->pdev->dev.platform_data;
        int ret;
 
        /* enable clock */
        ret = clk_enable(p->clk);
        if (ret) {
-               pr_err("sh_tmu: cannot enable clock \"%s\"\n", cfg->clk);
+               dev_err(&p->pdev->dev, "cannot enable clock\n");
                return ret;
        }
 
@@ -228,7 +227,7 @@ static int sh_tmu_register_clocksource(struct sh_tmu_priv *p,
        cs->disable = sh_tmu_clocksource_disable;
        cs->mask = CLOCKSOURCE_MASK(32);
        cs->flags = CLOCK_SOURCE_IS_CONTINUOUS;
-       pr_info("sh_tmu: %s used as clock source\n", cs->name);
+       dev_info(&p->pdev->dev, "used as clock source\n");
        clocksource_register(cs);
        return 0;
 }
@@ -276,13 +275,11 @@ static void sh_tmu_clock_event_mode(enum clock_event_mode mode,
 
        switch (mode) {
        case CLOCK_EVT_MODE_PERIODIC:
-               pr_info("sh_tmu: %s used for periodic clock events\n",
-                       ced->name);
+               dev_info(&p->pdev->dev, "used for periodic clock events\n");
                sh_tmu_clock_event_start(p, 1);
                break;
        case CLOCK_EVT_MODE_ONESHOT:
-               pr_info("sh_tmu: %s used for oneshot clock events\n",
-                       ced->name);
+               dev_info(&p->pdev->dev, "used for oneshot clock events\n");
                sh_tmu_clock_event_start(p, 0);
                break;
        case CLOCK_EVT_MODE_UNUSED:
@@ -323,13 +320,13 @@ static void sh_tmu_register_clockevent(struct sh_tmu_priv *p,
        ced->set_next_event = sh_tmu_clock_event_next;
        ced->set_mode = sh_tmu_clock_event_mode;
 
-       pr_info("sh_tmu: %s used for clock events\n", ced->name);
+       dev_info(&p->pdev->dev, "used for clock events\n");
        clockevents_register_device(ced);
 
        ret = setup_irq(p->irqaction.irq, &p->irqaction);
        if (ret) {
-               pr_err("sh_tmu: failed to request irq %d\n",
-                      p->irqaction.irq);
+               dev_err(&p->pdev->dev, "failed to request irq %d\n",
+                       p->irqaction.irq);
                return;
        }
 }
@@ -378,12 +375,12 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev)
        /* map memory, let mapbase point to our channel */
        p->mapbase = ioremap_nocache(res->start, resource_size(res));
        if (p->mapbase == NULL) {
-               pr_err("sh_tmu: failed to remap I/O memory\n");
+               dev_err(&p->pdev->dev, "failed to remap I/O memory\n");
                goto err0;
        }
 
        /* setup data for setup_irq() (too early for request_irq()) */
-       p->irqaction.name = cfg->name;
+       p->irqaction.name = dev_name(&p->pdev->dev);
        p->irqaction.handler = sh_tmu_interrupt;
        p->irqaction.dev_id = p;
        p->irqaction.irq = irq;
@@ -392,12 +389,12 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev)
        /* get hold of clock */
        p->clk = clk_get(&p->pdev->dev, cfg->clk);
        if (IS_ERR(p->clk)) {
-               pr_err("sh_tmu: cannot get clock \"%s\"\n", cfg->clk);
+               dev_err(&p->pdev->dev, "cannot get clock\n");
                ret = PTR_ERR(p->clk);
                goto err1;
        }
 
-       return sh_tmu_register(p, cfg->name,
+       return sh_tmu_register(p, (char *)dev_name(&p->pdev->dev),
                               cfg->clockevent_rating,
                               cfg->clocksource_rating);
  err1:
@@ -409,11 +406,10 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev)
 static int __devinit sh_tmu_probe(struct platform_device *pdev)
 {
        struct sh_tmu_priv *p = platform_get_drvdata(pdev);
-       struct sh_timer_config *cfg = pdev->dev.platform_data;
        int ret;
 
        if (p) {
-               pr_info("sh_tmu: %s kept as earlytimer\n", cfg->name);
+               dev_info(&pdev->dev, "kept as earlytimer\n");
                return 0;
        }