aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clocksource/sh_cmt.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-03-10 02:26:25 -0500
committerPaul Mundt <lethal@linux-sh.org>2010-03-10 02:26:25 -0500
commit214a607a4f5bf5a14dab0304ba350cdaf3916795 (patch)
treeb277d47ffff520d368024c4a5c539fafcea88c3e /drivers/clocksource/sh_cmt.c
parenta636ee7fb35b731ba2b331f6294e809bb6be09c8 (diff)
clocksource: Use dev_name() universally across the SH drivers.
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>
Diffstat (limited to 'drivers/clocksource/sh_cmt.c')
-rw-r--r--drivers/clocksource/sh_cmt.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index 578595c4425d..a1d381171388 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -149,13 +149,12 @@ static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start)
149 149
150static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate) 150static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate)
151{ 151{
152 struct sh_timer_config *cfg = p->pdev->dev.platform_data;
153 int ret; 152 int ret;
154 153
155 /* enable clock */ 154 /* enable clock */
156 ret = clk_enable(p->clk); 155 ret = clk_enable(p->clk);
157 if (ret) { 156 if (ret) {
158 pr_err("sh_cmt: cannot enable clock \"%s\"\n", cfg->clk); 157 dev_err(&p->pdev->dev, "cannot enable clock\n");
159 return ret; 158 return ret;
160 } 159 }
161 160
@@ -278,7 +277,7 @@ static void sh_cmt_clock_event_program_verify(struct sh_cmt_priv *p,
278 delay = 1; 277 delay = 1;
279 278
280 if (!delay) 279 if (!delay)
281 pr_warning("sh_cmt: too long delay\n"); 280 dev_warn(&p->pdev->dev, "too long delay\n");
282 281
283 } while (delay); 282 } while (delay);
284} 283}
@@ -288,7 +287,7 @@ static void sh_cmt_set_next(struct sh_cmt_priv *p, unsigned long delta)
288 unsigned long flags; 287 unsigned long flags;
289 288
290 if (delta > p->max_match_value) 289 if (delta > p->max_match_value)
291 pr_warning("sh_cmt: delta out of range\n"); 290 dev_warn(&p->pdev->dev, "delta out of range\n");
292 291
293 spin_lock_irqsave(&p->lock, flags); 292 spin_lock_irqsave(&p->lock, flags);
294 p->next_match_value = delta; 293 p->next_match_value = delta;
@@ -450,7 +449,7 @@ static int sh_cmt_register_clocksource(struct sh_cmt_priv *p,
450 cs->resume = sh_cmt_clocksource_resume; 449 cs->resume = sh_cmt_clocksource_resume;
451 cs->mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8); 450 cs->mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8);
452 cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; 451 cs->flags = CLOCK_SOURCE_IS_CONTINUOUS;
453 pr_info("sh_cmt: %s used as clock source\n", cs->name); 452 dev_info(&p->pdev->dev, "used as clock source\n");
454 clocksource_register(cs); 453 clocksource_register(cs);
455 return 0; 454 return 0;
456} 455}
@@ -496,13 +495,11 @@ static void sh_cmt_clock_event_mode(enum clock_event_mode mode,
496 495
497 switch (mode) { 496 switch (mode) {
498 case CLOCK_EVT_MODE_PERIODIC: 497 case CLOCK_EVT_MODE_PERIODIC:
499 pr_info("sh_cmt: %s used for periodic clock events\n", 498 dev_info(&p->pdev->dev, "used for periodic clock events\n");
500 ced->name);
501 sh_cmt_clock_event_start(p, 1); 499 sh_cmt_clock_event_start(p, 1);
502 break; 500 break;
503 case CLOCK_EVT_MODE_ONESHOT: 501 case CLOCK_EVT_MODE_ONESHOT:
504 pr_info("sh_cmt: %s used for oneshot clock events\n", 502 dev_info(&p->pdev->dev, "used for oneshot clock events\n");
505 ced->name);
506 sh_cmt_clock_event_start(p, 0); 503 sh_cmt_clock_event_start(p, 0);
507 break; 504 break;
508 case CLOCK_EVT_MODE_SHUTDOWN: 505 case CLOCK_EVT_MODE_SHUTDOWN:
@@ -543,7 +540,7 @@ static void sh_cmt_register_clockevent(struct sh_cmt_priv *p,
543 ced->set_next_event = sh_cmt_clock_event_next; 540 ced->set_next_event = sh_cmt_clock_event_next;
544 ced->set_mode = sh_cmt_clock_event_mode; 541 ced->set_mode = sh_cmt_clock_event_mode;
545 542
546 pr_info("sh_cmt: %s used for clock events\n", ced->name); 543 dev_info(&p->pdev->dev, "used for clock events\n");
547 clockevents_register_device(ced); 544 clockevents_register_device(ced);
548} 545}
549 546
@@ -600,12 +597,12 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
600 /* map memory, let mapbase point to our channel */ 597 /* map memory, let mapbase point to our channel */
601 p->mapbase = ioremap_nocache(res->start, resource_size(res)); 598 p->mapbase = ioremap_nocache(res->start, resource_size(res));
602 if (p->mapbase == NULL) { 599 if (p->mapbase == NULL) {
603 pr_err("sh_cmt: failed to remap I/O memory\n"); 600 dev_err(&p->pdev->dev, "failed to remap I/O memory\n");
604 goto err0; 601 goto err0;
605 } 602 }
606 603
607 /* request irq using setup_irq() (too early for request_irq()) */ 604 /* request irq using setup_irq() (too early for request_irq()) */
608 p->irqaction.name = cfg->name; 605 p->irqaction.name = dev_name(&p->pdev->dev);
609 p->irqaction.handler = sh_cmt_interrupt; 606 p->irqaction.handler = sh_cmt_interrupt;
610 p->irqaction.dev_id = p; 607 p->irqaction.dev_id = p;
611 p->irqaction.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL; 608 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)
613 /* get hold of clock */ 610 /* get hold of clock */
614 p->clk = clk_get(&p->pdev->dev, cfg->clk); 611 p->clk = clk_get(&p->pdev->dev, cfg->clk);
615 if (IS_ERR(p->clk)) { 612 if (IS_ERR(p->clk)) {
616 pr_err("sh_cmt: cannot get clock \"%s\"\n", cfg->clk); 613 dev_err(&p->pdev->dev, "cannot get clock\n");
617 ret = PTR_ERR(p->clk); 614 ret = PTR_ERR(p->clk);
618 goto err1; 615 goto err1;
619 } 616 }
@@ -628,17 +625,17 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
628 p->clear_bits = ~0xc000; 625 p->clear_bits = ~0xc000;
629 } 626 }
630 627
631 ret = sh_cmt_register(p, cfg->name, 628 ret = sh_cmt_register(p, (char *)dev_name(&p->pdev->dev),
632 cfg->clockevent_rating, 629 cfg->clockevent_rating,
633 cfg->clocksource_rating); 630 cfg->clocksource_rating);
634 if (ret) { 631 if (ret) {
635 pr_err("sh_cmt: registration failed\n"); 632 dev_err(&p->pdev->dev, "registration failed\n");
636 goto err1; 633 goto err1;
637 } 634 }
638 635
639 ret = setup_irq(irq, &p->irqaction); 636 ret = setup_irq(irq, &p->irqaction);
640 if (ret) { 637 if (ret) {
641 pr_err("sh_cmt: failed to request irq %d\n", irq); 638 dev_err(&p->pdev->dev, "failed to request irq %d\n", irq);
642 goto err1; 639 goto err1;
643 } 640 }
644 641
@@ -653,11 +650,10 @@ err0:
653static int __devinit sh_cmt_probe(struct platform_device *pdev) 650static int __devinit sh_cmt_probe(struct platform_device *pdev)
654{ 651{
655 struct sh_cmt_priv *p = platform_get_drvdata(pdev); 652 struct sh_cmt_priv *p = platform_get_drvdata(pdev);
656 struct sh_timer_config *cfg = pdev->dev.platform_data;
657 int ret; 653 int ret;
658 654
659 if (p) { 655 if (p) {
660 pr_info("sh_cmt: %s kept as earlytimer\n", cfg->name); 656 dev_info(&pdev->dev, "kept as earlytimer\n");
661 return 0; 657 return 0;
662 } 658 }
663 659