aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clocksource
diff options
context:
space:
mode:
authorLadislav Michl <ladis@linux-mips.org>2018-02-15 01:01:49 -0500
committerTony Lindgren <tony@atomide.com>2018-02-22 13:54:14 -0500
commit1a3acad26613fff7c7590ab32ff21f8c2a10fba9 (patch)
treeb1916138b3dfb99f9f8fb364fac0c6140a66b909 /drivers/clocksource
parent76234f7c074ca18c0bfe0b5a608973f9b43c7ebd (diff)
clocksource: timer-ti-dm: Hook device platform data if not already assigned
In the case of device tree boot the device platform data is usually NULL so hook the platform data obtained from the match. As part of un-constify the platform_data pointer. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Keerthy <j-keerthy@ti.com> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'drivers/clocksource')
-rw-r--r--drivers/clocksource/timer-ti-dm.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/clocksource/timer-ti-dm.c b/drivers/clocksource/timer-ti-dm.c
index 4496172b2927..70782a41c493 100644
--- a/drivers/clocksource/timer-ti-dm.c
+++ b/drivers/clocksource/timer-ti-dm.c
@@ -806,14 +806,16 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
806 struct omap_dm_timer *timer; 806 struct omap_dm_timer *timer;
807 struct resource *mem, *irq; 807 struct resource *mem, *irq;
808 struct device *dev = &pdev->dev; 808 struct device *dev = &pdev->dev;
809 const struct of_device_id *match;
810 const struct dmtimer_platform_data *pdata; 809 const struct dmtimer_platform_data *pdata;
811 int ret; 810 int ret;
812 811
813 match = of_match_device(of_match_ptr(omap_timer_match), dev); 812 pdata = of_device_get_match_data(dev);
814 pdata = match ? match->data : dev->platform_data; 813 if (!pdata)
814 pdata = dev_get_platdata(dev);
815 else
816 dev->platform_data = (void *)pdata;
815 817
816 if (!pdata && !dev->of_node) { 818 if (!pdata) {
817 dev_err(dev, "%s: no platform data.\n", __func__); 819 dev_err(dev, "%s: no platform data.\n", __func__);
818 return -ENODEV; 820 return -ENODEV;
819 } 821 }