diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2014-03-04 07:04:48 -0500 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2014-04-16 06:03:27 -0400 |
commit | 7dad72de1b475d02935e5c79c218637b6c63108b (patch) | |
tree | 0f2d4ea76a6489e213d09aa2f755813a34dea703 /drivers/clocksource | |
parent | 42752cc619c0ee619b56f86932ce42b00adb5052 (diff) |
clocksource: sh_mtu2: Rename struct sh_mtu2_priv to sh_mtu2_device
Channel data is private as well, rename priv to device to make the
distrinction between the core device and the channels clearer.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa@sang-engineering.com>
Diffstat (limited to 'drivers/clocksource')
-rw-r--r-- | drivers/clocksource/sh_mtu2.c | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c index e509f417ef64..256621c156e6 100644 --- a/drivers/clocksource/sh_mtu2.c +++ b/drivers/clocksource/sh_mtu2.c | |||
@@ -34,15 +34,15 @@ | |||
34 | #include <linux/pm_domain.h> | 34 | #include <linux/pm_domain.h> |
35 | #include <linux/pm_runtime.h> | 35 | #include <linux/pm_runtime.h> |
36 | 36 | ||
37 | struct sh_mtu2_priv; | 37 | struct sh_mtu2_device; |
38 | 38 | ||
39 | struct sh_mtu2_channel { | 39 | struct sh_mtu2_channel { |
40 | struct sh_mtu2_priv *mtu; | 40 | struct sh_mtu2_device *mtu; |
41 | int irq; | 41 | int irq; |
42 | struct clock_event_device ced; | 42 | struct clock_event_device ced; |
43 | }; | 43 | }; |
44 | 44 | ||
45 | struct sh_mtu2_priv { | 45 | struct sh_mtu2_device { |
46 | struct platform_device *pdev; | 46 | struct platform_device *pdev; |
47 | 47 | ||
48 | void __iomem *mapbase; | 48 | void __iomem *mapbase; |
@@ -273,75 +273,76 @@ static int sh_mtu2_register(struct sh_mtu2_channel *ch, char *name, | |||
273 | return 0; | 273 | return 0; |
274 | } | 274 | } |
275 | 275 | ||
276 | static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev) | 276 | static int sh_mtu2_setup(struct sh_mtu2_device *mtu, |
277 | struct platform_device *pdev) | ||
277 | { | 278 | { |
278 | struct sh_timer_config *cfg = pdev->dev.platform_data; | 279 | struct sh_timer_config *cfg = pdev->dev.platform_data; |
279 | struct resource *res; | 280 | struct resource *res; |
280 | int ret; | 281 | int ret; |
281 | ret = -ENXIO; | 282 | ret = -ENXIO; |
282 | 283 | ||
283 | memset(p, 0, sizeof(*p)); | 284 | memset(mtu, 0, sizeof(*mtu)); |
284 | p->pdev = pdev; | 285 | mtu->pdev = pdev; |
285 | 286 | ||
286 | if (!cfg) { | 287 | if (!cfg) { |
287 | dev_err(&p->pdev->dev, "missing platform data\n"); | 288 | dev_err(&mtu->pdev->dev, "missing platform data\n"); |
288 | goto err0; | 289 | goto err0; |
289 | } | 290 | } |
290 | 291 | ||
291 | platform_set_drvdata(pdev, p); | 292 | platform_set_drvdata(pdev, mtu); |
292 | 293 | ||
293 | res = platform_get_resource(p->pdev, IORESOURCE_MEM, 0); | 294 | res = platform_get_resource(mtu->pdev, IORESOURCE_MEM, 0); |
294 | if (!res) { | 295 | if (!res) { |
295 | dev_err(&p->pdev->dev, "failed to get I/O memory\n"); | 296 | dev_err(&mtu->pdev->dev, "failed to get I/O memory\n"); |
296 | goto err0; | 297 | goto err0; |
297 | } | 298 | } |
298 | 299 | ||
299 | p->channel.irq = platform_get_irq(p->pdev, 0); | 300 | mtu->channel.irq = platform_get_irq(mtu->pdev, 0); |
300 | if (p->channel.irq < 0) { | 301 | if (mtu->channel.irq < 0) { |
301 | dev_err(&p->pdev->dev, "failed to get irq\n"); | 302 | dev_err(&mtu->pdev->dev, "failed to get irq\n"); |
302 | goto err0; | 303 | goto err0; |
303 | } | 304 | } |
304 | 305 | ||
305 | /* map memory, let mapbase point to our channel */ | 306 | /* map memory, let mapbase point to our channel */ |
306 | p->mapbase = ioremap_nocache(res->start, resource_size(res)); | 307 | mtu->mapbase = ioremap_nocache(res->start, resource_size(res)); |
307 | if (p->mapbase == NULL) { | 308 | if (mtu->mapbase == NULL) { |
308 | dev_err(&p->pdev->dev, "failed to remap I/O memory\n"); | 309 | dev_err(&mtu->pdev->dev, "failed to remap I/O memory\n"); |
309 | goto err0; | 310 | goto err0; |
310 | } | 311 | } |
311 | 312 | ||
312 | /* get hold of clock */ | 313 | /* get hold of clock */ |
313 | p->clk = clk_get(&p->pdev->dev, "mtu2_fck"); | 314 | mtu->clk = clk_get(&mtu->pdev->dev, "mtu2_fck"); |
314 | if (IS_ERR(p->clk)) { | 315 | if (IS_ERR(mtu->clk)) { |
315 | dev_err(&p->pdev->dev, "cannot get clock\n"); | 316 | dev_err(&mtu->pdev->dev, "cannot get clock\n"); |
316 | ret = PTR_ERR(p->clk); | 317 | ret = PTR_ERR(mtu->clk); |
317 | goto err1; | 318 | goto err1; |
318 | } | 319 | } |
319 | 320 | ||
320 | ret = clk_prepare(p->clk); | 321 | ret = clk_prepare(mtu->clk); |
321 | if (ret < 0) | 322 | if (ret < 0) |
322 | goto err2; | 323 | goto err2; |
323 | 324 | ||
324 | p->channel.mtu = p; | 325 | mtu->channel.mtu = mtu; |
325 | 326 | ||
326 | ret = sh_mtu2_register(&p->channel, (char *)dev_name(&p->pdev->dev), | 327 | ret = sh_mtu2_register(&mtu->channel, (char *)dev_name(&mtu->pdev->dev), |
327 | cfg->clockevent_rating); | 328 | cfg->clockevent_rating); |
328 | if (ret < 0) | 329 | if (ret < 0) |
329 | goto err3; | 330 | goto err3; |
330 | 331 | ||
331 | return 0; | 332 | return 0; |
332 | err3: | 333 | err3: |
333 | clk_unprepare(p->clk); | 334 | clk_unprepare(mtu->clk); |
334 | err2: | 335 | err2: |
335 | clk_put(p->clk); | 336 | clk_put(mtu->clk); |
336 | err1: | 337 | err1: |
337 | iounmap(p->mapbase); | 338 | iounmap(mtu->mapbase); |
338 | err0: | 339 | err0: |
339 | return ret; | 340 | return ret; |
340 | } | 341 | } |
341 | 342 | ||
342 | static int sh_mtu2_probe(struct platform_device *pdev) | 343 | static int sh_mtu2_probe(struct platform_device *pdev) |
343 | { | 344 | { |
344 | struct sh_mtu2_priv *p = platform_get_drvdata(pdev); | 345 | struct sh_mtu2_device *mtu = platform_get_drvdata(pdev); |
345 | struct sh_timer_config *cfg = pdev->dev.platform_data; | 346 | struct sh_timer_config *cfg = pdev->dev.platform_data; |
346 | int ret; | 347 | int ret; |
347 | 348 | ||
@@ -350,20 +351,20 @@ static int sh_mtu2_probe(struct platform_device *pdev) | |||
350 | pm_runtime_enable(&pdev->dev); | 351 | pm_runtime_enable(&pdev->dev); |
351 | } | 352 | } |
352 | 353 | ||
353 | if (p) { | 354 | if (mtu) { |
354 | dev_info(&pdev->dev, "kept as earlytimer\n"); | 355 | dev_info(&pdev->dev, "kept as earlytimer\n"); |
355 | goto out; | 356 | goto out; |
356 | } | 357 | } |
357 | 358 | ||
358 | p = kmalloc(sizeof(*p), GFP_KERNEL); | 359 | mtu = kmalloc(sizeof(*mtu), GFP_KERNEL); |
359 | if (p == NULL) { | 360 | if (mtu == NULL) { |
360 | dev_err(&pdev->dev, "failed to allocate driver data\n"); | 361 | dev_err(&pdev->dev, "failed to allocate driver data\n"); |
361 | return -ENOMEM; | 362 | return -ENOMEM; |
362 | } | 363 | } |
363 | 364 | ||
364 | ret = sh_mtu2_setup(p, pdev); | 365 | ret = sh_mtu2_setup(mtu, pdev); |
365 | if (ret) { | 366 | if (ret) { |
366 | kfree(p); | 367 | kfree(mtu); |
367 | pm_runtime_idle(&pdev->dev); | 368 | pm_runtime_idle(&pdev->dev); |
368 | return ret; | 369 | return ret; |
369 | } | 370 | } |