提交 214a607a 编写于 作者: P Paul Mundt

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: NPaul Mundt <lethal@linux-sh.org>
上级 a636ee7f
...@@ -149,13 +149,12 @@ static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start) ...@@ -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) 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; int ret;
/* enable clock */ /* enable clock */
ret = clk_enable(p->clk); ret = clk_enable(p->clk);
if (ret) { if (ret) {
pr_err("sh_cmt: cannot enable clock \"%s\"\n", cfg->clk); dev_err(&p->pdev->dev, "cannot enable clock\n");
return ret; return ret;
} }
...@@ -278,7 +277,7 @@ static void sh_cmt_clock_event_program_verify(struct sh_cmt_priv *p, ...@@ -278,7 +277,7 @@ static void sh_cmt_clock_event_program_verify(struct sh_cmt_priv *p,
delay = 1; delay = 1;
if (!delay) if (!delay)
pr_warning("sh_cmt: too long delay\n"); dev_warn(&p->pdev->dev, "too long delay\n");
} while (delay); } while (delay);
} }
...@@ -288,7 +287,7 @@ static void sh_cmt_set_next(struct sh_cmt_priv *p, unsigned long delta) ...@@ -288,7 +287,7 @@ static void sh_cmt_set_next(struct sh_cmt_priv *p, unsigned long delta)
unsigned long flags; unsigned long flags;
if (delta > p->max_match_value) 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); spin_lock_irqsave(&p->lock, flags);
p->next_match_value = delta; p->next_match_value = delta;
...@@ -450,7 +449,7 @@ static int sh_cmt_register_clocksource(struct sh_cmt_priv *p, ...@@ -450,7 +449,7 @@ static int sh_cmt_register_clocksource(struct sh_cmt_priv *p,
cs->resume = sh_cmt_clocksource_resume; cs->resume = sh_cmt_clocksource_resume;
cs->mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8); cs->mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8);
cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; 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); clocksource_register(cs);
return 0; return 0;
} }
...@@ -496,13 +495,11 @@ static void sh_cmt_clock_event_mode(enum clock_event_mode mode, ...@@ -496,13 +495,11 @@ static void sh_cmt_clock_event_mode(enum clock_event_mode mode,
switch (mode) { switch (mode) {
case CLOCK_EVT_MODE_PERIODIC: case CLOCK_EVT_MODE_PERIODIC:
pr_info("sh_cmt: %s used for periodic clock events\n", dev_info(&p->pdev->dev, "used for periodic clock events\n");
ced->name);
sh_cmt_clock_event_start(p, 1); sh_cmt_clock_event_start(p, 1);
break; break;
case CLOCK_EVT_MODE_ONESHOT: case CLOCK_EVT_MODE_ONESHOT:
pr_info("sh_cmt: %s used for oneshot clock events\n", dev_info(&p->pdev->dev, "used for oneshot clock events\n");
ced->name);
sh_cmt_clock_event_start(p, 0); sh_cmt_clock_event_start(p, 0);
break; break;
case CLOCK_EVT_MODE_SHUTDOWN: case CLOCK_EVT_MODE_SHUTDOWN:
...@@ -543,7 +540,7 @@ static void sh_cmt_register_clockevent(struct sh_cmt_priv *p, ...@@ -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_next_event = sh_cmt_clock_event_next;
ced->set_mode = sh_cmt_clock_event_mode; 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); clockevents_register_device(ced);
} }
...@@ -600,12 +597,12 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev) ...@@ -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 */ /* map memory, let mapbase point to our channel */
p->mapbase = ioremap_nocache(res->start, resource_size(res)); p->mapbase = ioremap_nocache(res->start, resource_size(res));
if (p->mapbase == NULL) { 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; goto err0;
} }
/* request irq using setup_irq() (too early for request_irq()) */ /* 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.handler = sh_cmt_interrupt;
p->irqaction.dev_id = p; p->irqaction.dev_id = p;
p->irqaction.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL; 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,7 +610,7 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
/* get hold of clock */ /* get hold of clock */
p->clk = clk_get(&p->pdev->dev, cfg->clk); p->clk = clk_get(&p->pdev->dev, cfg->clk);
if (IS_ERR(p->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); ret = PTR_ERR(p->clk);
goto err1; goto err1;
} }
...@@ -628,17 +625,17 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev) ...@@ -628,17 +625,17 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
p->clear_bits = ~0xc000; 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->clockevent_rating,
cfg->clocksource_rating); cfg->clocksource_rating);
if (ret) { if (ret) {
pr_err("sh_cmt: registration failed\n"); dev_err(&p->pdev->dev, "registration failed\n");
goto err1; goto err1;
} }
ret = setup_irq(irq, &p->irqaction); ret = setup_irq(irq, &p->irqaction);
if (ret) { 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; goto err1;
} }
...@@ -653,11 +650,10 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev) ...@@ -653,11 +650,10 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
static int __devinit sh_cmt_probe(struct platform_device *pdev) static int __devinit sh_cmt_probe(struct platform_device *pdev)
{ {
struct sh_cmt_priv *p = platform_get_drvdata(pdev); struct sh_cmt_priv *p = platform_get_drvdata(pdev);
struct sh_timer_config *cfg = pdev->dev.platform_data;
int ret; int ret;
if (p) { if (p) {
pr_info("sh_cmt: %s kept as earlytimer\n", cfg->name); dev_info(&pdev->dev, "kept as earlytimer\n");
return 0; return 0;
} }
......
...@@ -118,13 +118,12 @@ static void sh_mtu2_start_stop_ch(struct sh_mtu2_priv *p, int start) ...@@ -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) static int sh_mtu2_enable(struct sh_mtu2_priv *p)
{ {
struct sh_timer_config *cfg = p->pdev->dev.platform_data;
int ret; int ret;
/* enable clock */ /* enable clock */
ret = clk_enable(p->clk); ret = clk_enable(p->clk);
if (ret) { if (ret) {
pr_err("sh_mtu2: cannot enable clock \"%s\"\n", cfg->clk); dev_err(&p->pdev->dev, "cannot enable clock\n");
return ret; return ret;
} }
...@@ -193,8 +192,7 @@ static void sh_mtu2_clock_event_mode(enum clock_event_mode mode, ...@@ -193,8 +192,7 @@ static void sh_mtu2_clock_event_mode(enum clock_event_mode mode,
switch (mode) { switch (mode) {
case CLOCK_EVT_MODE_PERIODIC: case CLOCK_EVT_MODE_PERIODIC:
pr_info("sh_mtu2: %s used for periodic clock events\n", dev_info(&p->pdev->dev, "used for periodic clock events\n");
ced->name);
sh_mtu2_enable(p); sh_mtu2_enable(p);
break; break;
case CLOCK_EVT_MODE_UNUSED: case CLOCK_EVT_MODE_UNUSED:
...@@ -221,13 +219,13 @@ static void sh_mtu2_register_clockevent(struct sh_mtu2_priv *p, ...@@ -221,13 +219,13 @@ static void sh_mtu2_register_clockevent(struct sh_mtu2_priv *p,
ced->cpumask = cpumask_of(0); ced->cpumask = cpumask_of(0);
ced->set_mode = sh_mtu2_clock_event_mode; 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); clockevents_register_device(ced);
ret = setup_irq(p->irqaction.irq, &p->irqaction); ret = setup_irq(p->irqaction.irq, &p->irqaction);
if (ret) { if (ret) {
pr_err("sh_mtu2: failed to request irq %d\n", dev_err(&p->pdev->dev, "failed to request irq %d\n",
p->irqaction.irq); p->irqaction.irq);
return; return;
} }
} }
...@@ -273,12 +271,12 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev) ...@@ -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 */ /* map memory, let mapbase point to our channel */
p->mapbase = ioremap_nocache(res->start, resource_size(res)); p->mapbase = ioremap_nocache(res->start, resource_size(res));
if (p->mapbase == NULL) { 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; goto err0;
} }
/* setup data for setup_irq() (too early for request_irq()) */ /* 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.handler = sh_mtu2_interrupt;
p->irqaction.dev_id = p; p->irqaction.dev_id = p;
p->irqaction.irq = irq; p->irqaction.irq = irq;
...@@ -287,12 +285,13 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev) ...@@ -287,12 +285,13 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev)
/* get hold of clock */ /* get hold of clock */
p->clk = clk_get(&p->pdev->dev, cfg->clk); p->clk = clk_get(&p->pdev->dev, cfg->clk);
if (IS_ERR(p->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); ret = PTR_ERR(p->clk);
goto err1; 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: err1:
iounmap(p->mapbase); iounmap(p->mapbase);
err0: err0:
...@@ -302,11 +301,10 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev) ...@@ -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) static int __devinit sh_mtu2_probe(struct platform_device *pdev)
{ {
struct sh_mtu2_priv *p = platform_get_drvdata(pdev); struct sh_mtu2_priv *p = platform_get_drvdata(pdev);
struct sh_timer_config *cfg = pdev->dev.platform_data;
int ret; int ret;
if (p) { if (p) {
pr_info("sh_mtu2: %s kept as earlytimer\n", cfg->name); dev_info(&pdev->dev, "kept as earlytimer\n");
return 0; return 0;
} }
......
...@@ -106,13 +106,12 @@ static void sh_tmu_start_stop_ch(struct sh_tmu_priv *p, int start) ...@@ -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) static int sh_tmu_enable(struct sh_tmu_priv *p)
{ {
struct sh_timer_config *cfg = p->pdev->dev.platform_data;
int ret; int ret;
/* enable clock */ /* enable clock */
ret = clk_enable(p->clk); ret = clk_enable(p->clk);
if (ret) { if (ret) {
pr_err("sh_tmu: cannot enable clock \"%s\"\n", cfg->clk); dev_err(&p->pdev->dev, "cannot enable clock\n");
return ret; return ret;
} }
...@@ -228,7 +227,7 @@ static int sh_tmu_register_clocksource(struct sh_tmu_priv *p, ...@@ -228,7 +227,7 @@ static int sh_tmu_register_clocksource(struct sh_tmu_priv *p,
cs->disable = sh_tmu_clocksource_disable; cs->disable = sh_tmu_clocksource_disable;
cs->mask = CLOCKSOURCE_MASK(32); cs->mask = CLOCKSOURCE_MASK(32);
cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; 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); clocksource_register(cs);
return 0; return 0;
} }
...@@ -276,13 +275,11 @@ static void sh_tmu_clock_event_mode(enum clock_event_mode mode, ...@@ -276,13 +275,11 @@ static void sh_tmu_clock_event_mode(enum clock_event_mode mode,
switch (mode) { switch (mode) {
case CLOCK_EVT_MODE_PERIODIC: case CLOCK_EVT_MODE_PERIODIC:
pr_info("sh_tmu: %s used for periodic clock events\n", dev_info(&p->pdev->dev, "used for periodic clock events\n");
ced->name);
sh_tmu_clock_event_start(p, 1); sh_tmu_clock_event_start(p, 1);
break; break;
case CLOCK_EVT_MODE_ONESHOT: case CLOCK_EVT_MODE_ONESHOT:
pr_info("sh_tmu: %s used for oneshot clock events\n", dev_info(&p->pdev->dev, "used for oneshot clock events\n");
ced->name);
sh_tmu_clock_event_start(p, 0); sh_tmu_clock_event_start(p, 0);
break; break;
case CLOCK_EVT_MODE_UNUSED: case CLOCK_EVT_MODE_UNUSED:
...@@ -323,13 +320,13 @@ static void sh_tmu_register_clockevent(struct sh_tmu_priv *p, ...@@ -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_next_event = sh_tmu_clock_event_next;
ced->set_mode = sh_tmu_clock_event_mode; 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); clockevents_register_device(ced);
ret = setup_irq(p->irqaction.irq, &p->irqaction); ret = setup_irq(p->irqaction.irq, &p->irqaction);
if (ret) { if (ret) {
pr_err("sh_tmu: failed to request irq %d\n", dev_err(&p->pdev->dev, "failed to request irq %d\n",
p->irqaction.irq); p->irqaction.irq);
return; return;
} }
} }
...@@ -378,12 +375,12 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev) ...@@ -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 */ /* map memory, let mapbase point to our channel */
p->mapbase = ioremap_nocache(res->start, resource_size(res)); p->mapbase = ioremap_nocache(res->start, resource_size(res));
if (p->mapbase == NULL) { 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; goto err0;
} }
/* setup data for setup_irq() (too early for request_irq()) */ /* 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.handler = sh_tmu_interrupt;
p->irqaction.dev_id = p; p->irqaction.dev_id = p;
p->irqaction.irq = irq; p->irqaction.irq = irq;
...@@ -392,12 +389,12 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev) ...@@ -392,12 +389,12 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev)
/* get hold of clock */ /* get hold of clock */
p->clk = clk_get(&p->pdev->dev, cfg->clk); p->clk = clk_get(&p->pdev->dev, cfg->clk);
if (IS_ERR(p->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); ret = PTR_ERR(p->clk);
goto err1; goto err1;
} }
return sh_tmu_register(p, cfg->name, return sh_tmu_register(p, (char *)dev_name(&p->pdev->dev),
cfg->clockevent_rating, cfg->clockevent_rating,
cfg->clocksource_rating); cfg->clocksource_rating);
err1: err1:
...@@ -409,11 +406,10 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev) ...@@ -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) static int __devinit sh_tmu_probe(struct platform_device *pdev)
{ {
struct sh_tmu_priv *p = platform_get_drvdata(pdev); struct sh_tmu_priv *p = platform_get_drvdata(pdev);
struct sh_timer_config *cfg = pdev->dev.platform_data;
int ret; int ret;
if (p) { if (p) {
pr_info("sh_tmu: %s kept as earlytimer\n", cfg->name); dev_info(&pdev->dev, "kept as earlytimer\n");
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册