summaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2017-02-15 11:35:27 -0500
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>2017-02-21 15:23:13 -0500
commit0500ce589aa7b5325af161d3c992ffb6be138ff9 (patch)
treeaf23b5a2bd7d9a3b43e98976671a8d23487e4a3e /drivers/rtc
parent8ccbd360068af1993a9359f1d31db70cf5eb8825 (diff)
rtc: m48t86: remove unused platform_data
All users of this driver have been updated to allow the driver to manage it's own resources and do the read/write operations internally. The m48t86_ops are no longer used. Remove the platform_data header and the support code in the driver. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-m48t86.c51
1 files changed, 19 insertions, 32 deletions
diff --git a/drivers/rtc/rtc-m48t86.c b/drivers/rtc/rtc-m48t86.c
index 491e8e4b300b..02af045305dd 100644
--- a/drivers/rtc/rtc-m48t86.c
+++ b/drivers/rtc/rtc-m48t86.c
@@ -16,7 +16,6 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/rtc.h> 17#include <linux/rtc.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/platform_data/rtc-m48t86.h>
20#include <linux/bcd.h> 19#include <linux/bcd.h>
21#include <linux/io.h> 20#include <linux/io.h>
22 21
@@ -45,7 +44,6 @@ struct m48t86_rtc_info {
45 void __iomem *index_reg; 44 void __iomem *index_reg;
46 void __iomem *data_reg; 45 void __iomem *data_reg;
47 struct rtc_device *rtc; 46 struct rtc_device *rtc;
48 struct m48t86_ops *ops;
49}; 47};
50 48
51static unsigned char m48t86_readb(struct device *dev, unsigned long addr) 49static unsigned char m48t86_readb(struct device *dev, unsigned long addr)
@@ -53,12 +51,9 @@ static unsigned char m48t86_readb(struct device *dev, unsigned long addr)
53 struct m48t86_rtc_info *info = dev_get_drvdata(dev); 51 struct m48t86_rtc_info *info = dev_get_drvdata(dev);
54 unsigned char value; 52 unsigned char value;
55 53
56 if (info->ops) { 54 writeb(addr, info->index_reg);
57 value = info->ops->readbyte(addr); 55 value = readb(info->data_reg);
58 } else { 56
59 writeb(addr, info->index_reg);
60 value = readb(info->data_reg);
61 }
62 return value; 57 return value;
63} 58}
64 59
@@ -67,12 +62,8 @@ static void m48t86_writeb(struct device *dev,
67{ 62{
68 struct m48t86_rtc_info *info = dev_get_drvdata(dev); 63 struct m48t86_rtc_info *info = dev_get_drvdata(dev);
69 64
70 if (info->ops) { 65 writeb(addr, info->index_reg);
71 info->ops->writebyte(value, addr); 66 writeb(value, info->data_reg);
72 } else {
73 writeb(addr, info->index_reg);
74 writeb(value, info->data_reg);
75 }
76} 67}
77 68
78static int m48t86_rtc_read_time(struct device *dev, struct rtc_time *tm) 69static int m48t86_rtc_read_time(struct device *dev, struct rtc_time *tm)
@@ -235,30 +226,26 @@ static bool m48t86_verify_chip(struct platform_device *pdev)
235static int m48t86_rtc_probe(struct platform_device *pdev) 226static int m48t86_rtc_probe(struct platform_device *pdev)
236{ 227{
237 struct m48t86_rtc_info *info; 228 struct m48t86_rtc_info *info;
229 struct resource *res;
238 unsigned char reg; 230 unsigned char reg;
239 231
240 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); 232 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
241 if (!info) 233 if (!info)
242 return -ENOMEM; 234 return -ENOMEM;
243 235
244 info->ops = dev_get_platdata(&pdev->dev); 236 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
245 if (!info->ops) { 237 if (!res)
246 struct resource *res; 238 return -ENODEV;
247 239 info->index_reg = devm_ioremap_resource(&pdev->dev, res);
248 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 240 if (IS_ERR(info->index_reg))
249 if (!res) 241 return PTR_ERR(info->index_reg);
250 return -ENODEV; 242
251 info->index_reg = devm_ioremap_resource(&pdev->dev, res); 243 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
252 if (IS_ERR(info->index_reg)) 244 if (!res)
253 return PTR_ERR(info->index_reg); 245 return -ENODEV;
254 246 info->data_reg = devm_ioremap_resource(&pdev->dev, res);
255 res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 247 if (IS_ERR(info->data_reg))
256 if (!res) 248 return PTR_ERR(info->data_reg);
257 return -ENODEV;
258 info->data_reg = devm_ioremap_resource(&pdev->dev, res);
259 if (IS_ERR(info->data_reg))
260 return PTR_ERR(info->data_reg);
261 }
262 249
263 dev_set_drvdata(&pdev->dev, info); 250 dev_set_drvdata(&pdev->dev, info);
264 251