aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clocksource/sh_mtu2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/clocksource/sh_mtu2.c')
-rw-r--r--drivers/clocksource/sh_mtu2.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c
index 4c8a759e60cd..8ce355572d16 100644
--- a/drivers/clocksource/sh_mtu2.c
+++ b/drivers/clocksource/sh_mtu2.c
@@ -118,13 +118,12 @@ static void sh_mtu2_start_stop_ch(struct sh_mtu2_priv *p, int start)
118 118
119static int sh_mtu2_enable(struct sh_mtu2_priv *p) 119static int sh_mtu2_enable(struct sh_mtu2_priv *p)
120{ 120{
121 struct sh_timer_config *cfg = p->pdev->dev.platform_data;
122 int ret; 121 int ret;
123 122
124 /* enable clock */ 123 /* enable clock */
125 ret = clk_enable(p->clk); 124 ret = clk_enable(p->clk);
126 if (ret) { 125 if (ret) {
127 pr_err("sh_mtu2: cannot enable clock \"%s\"\n", cfg->clk); 126 dev_err(&p->pdev->dev, "cannot enable clock\n");
128 return ret; 127 return ret;
129 } 128 }
130 129
@@ -193,8 +192,7 @@ static void sh_mtu2_clock_event_mode(enum clock_event_mode mode,
193 192
194 switch (mode) { 193 switch (mode) {
195 case CLOCK_EVT_MODE_PERIODIC: 194 case CLOCK_EVT_MODE_PERIODIC:
196 pr_info("sh_mtu2: %s used for periodic clock events\n", 195 dev_info(&p->pdev->dev, "used for periodic clock events\n");
197 ced->name);
198 sh_mtu2_enable(p); 196 sh_mtu2_enable(p);
199 break; 197 break;
200 case CLOCK_EVT_MODE_UNUSED: 198 case CLOCK_EVT_MODE_UNUSED:
@@ -221,13 +219,13 @@ static void sh_mtu2_register_clockevent(struct sh_mtu2_priv *p,
221 ced->cpumask = cpumask_of(0); 219 ced->cpumask = cpumask_of(0);
222 ced->set_mode = sh_mtu2_clock_event_mode; 220 ced->set_mode = sh_mtu2_clock_event_mode;
223 221
224 pr_info("sh_mtu2: %s used for clock events\n", ced->name); 222 dev_info(&p->pdev->dev, "used for clock events\n");
225 clockevents_register_device(ced); 223 clockevents_register_device(ced);
226 224
227 ret = setup_irq(p->irqaction.irq, &p->irqaction); 225 ret = setup_irq(p->irqaction.irq, &p->irqaction);
228 if (ret) { 226 if (ret) {
229 pr_err("sh_mtu2: failed to request irq %d\n", 227 dev_err(&p->pdev->dev, "failed to request irq %d\n",
230 p->irqaction.irq); 228 p->irqaction.irq);
231 return; 229 return;
232 } 230 }
233} 231}
@@ -273,12 +271,12 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev)
273 /* map memory, let mapbase point to our channel */ 271 /* map memory, let mapbase point to our channel */
274 p->mapbase = ioremap_nocache(res->start, resource_size(res)); 272 p->mapbase = ioremap_nocache(res->start, resource_size(res));
275 if (p->mapbase == NULL) { 273 if (p->mapbase == NULL) {
276 pr_err("sh_mtu2: failed to remap I/O memory\n"); 274 dev_err(&p->pdev->dev, "failed to remap I/O memory\n");
277 goto err0; 275 goto err0;
278 } 276 }
279 277
280 /* setup data for setup_irq() (too early for request_irq()) */ 278 /* setup data for setup_irq() (too early for request_irq()) */
281 p->irqaction.name = cfg->name; 279 p->irqaction.name = dev_name(&p->pdev->dev);
282 p->irqaction.handler = sh_mtu2_interrupt; 280 p->irqaction.handler = sh_mtu2_interrupt;
283 p->irqaction.dev_id = p; 281 p->irqaction.dev_id = p;
284 p->irqaction.irq = irq; 282 p->irqaction.irq = irq;
@@ -287,12 +285,13 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev)
287 /* get hold of clock */ 285 /* get hold of clock */
288 p->clk = clk_get(&p->pdev->dev, cfg->clk); 286 p->clk = clk_get(&p->pdev->dev, cfg->clk);
289 if (IS_ERR(p->clk)) { 287 if (IS_ERR(p->clk)) {
290 pr_err("sh_mtu2: cannot get clock \"%s\"\n", cfg->clk); 288 dev_err(&p->pdev->dev, "cannot get clock\n");
291 ret = PTR_ERR(p->clk); 289 ret = PTR_ERR(p->clk);
292 goto err1; 290 goto err1;
293 } 291 }
294 292
295 return sh_mtu2_register(p, cfg->name, cfg->clockevent_rating); 293 return sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev),
294 cfg->clockevent_rating);
296 err1: 295 err1:
297 iounmap(p->mapbase); 296 iounmap(p->mapbase);
298 err0: 297 err0:
@@ -302,11 +301,10 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev)
302static int __devinit sh_mtu2_probe(struct platform_device *pdev) 301static int __devinit sh_mtu2_probe(struct platform_device *pdev)
303{ 302{
304 struct sh_mtu2_priv *p = platform_get_drvdata(pdev); 303 struct sh_mtu2_priv *p = platform_get_drvdata(pdev);
305 struct sh_timer_config *cfg = pdev->dev.platform_data;
306 int ret; 304 int ret;
307 305
308 if (p) { 306 if (p) {
309 pr_info("sh_mtu2: %s kept as earlytimer\n", cfg->name); 307 dev_info(&pdev->dev, "kept as earlytimer\n");
310 return 0; 308 return 0;
311 } 309 }
312 310