summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2014-01-27 22:04:17 +0100
committerStephane Desneux <stephane.desneux@open.eurogiciel.org>2015-02-04 11:14:21 +0100
commit1de1f039e0387b2063d43d38871341cdad7bd487 (patch)
tree7be9ede6897850e05c10eb07ee7273d3e825b6ae /drivers
parent51159a788ffed858e453cf1e992a633b92b7d024 (diff)
downloadlinux-stable-1de1f039e0387b2063d43d38871341cdad7bd487.tar.gz
linux-stable-1de1f039e0387b2063d43d38871341cdad7bd487.tar.bz2
linux-stable-1de1f039e0387b2063d43d38871341cdad7bd487.zip
clocksource: sh_cmt: Allocate channels dynamically
This prepares the driver for multi-channel support. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> (cherry picked from commit f5ec9b194a93c05e2ccdb3e90d9061cfedc806d9) Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/clocksource/sh_cmt.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index 0779bf194aea..f94db327ac7c 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -62,7 +62,8 @@ struct sh_cmt_device {
void __iomem *mapbase;
struct clk *clk;
- struct sh_cmt_channel channel;
+ struct sh_cmt_channel *channels;
+ unsigned int num_channels;
unsigned long width; /* 16 or 32 bit version of hardware block */
unsigned long overflow_bit;
@@ -822,7 +823,15 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
cmt->clear_bits = ~0xc000;
}
- ret = sh_cmt_setup_channel(&cmt->channel, cfg->timer_bit, cmt);
+ cmt->channels = kzalloc(sizeof(*cmt->channels), GFP_KERNEL);
+ if (cmt->channels == NULL) {
+ ret = -ENOMEM;
+ goto err4;
+ }
+
+ cmt->num_channels = 1;
+
+ ret = sh_cmt_setup_channel(&cmt->channels[0], cfg->timer_bit, cmt);
if (ret < 0)
goto err4;
@@ -830,6 +839,7 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
return 0;
err4:
+ kfree(cmt->channels);
clk_unprepare(cmt->clk);
err3:
clk_put(cmt->clk);