Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

H Hartley Sweeten and committed by
Alexandre Belloni
0500ce58 8ccbd360

+18 -47
+18 -31
drivers/rtc/rtc-m48t86.c
··· 16 16 #include <linux/module.h> 17 17 #include <linux/rtc.h> 18 18 #include <linux/platform_device.h> 19 - #include <linux/platform_data/rtc-m48t86.h> 20 19 #include <linux/bcd.h> 21 20 #include <linux/io.h> 22 21 ··· 44 45 void __iomem *index_reg; 45 46 void __iomem *data_reg; 46 47 struct rtc_device *rtc; 47 - struct m48t86_ops *ops; 48 48 }; 49 49 50 50 static unsigned char m48t86_readb(struct device *dev, unsigned long addr) ··· 51 53 struct m48t86_rtc_info *info = dev_get_drvdata(dev); 52 54 unsigned char value; 53 55 54 - if (info->ops) { 55 - value = info->ops->readbyte(addr); 56 - } else { 57 - writeb(addr, info->index_reg); 58 - value = readb(info->data_reg); 59 - } 56 + writeb(addr, info->index_reg); 57 + value = readb(info->data_reg); 58 + 60 59 return value; 61 60 } 62 61 ··· 62 67 { 63 68 struct m48t86_rtc_info *info = dev_get_drvdata(dev); 64 69 65 - if (info->ops) { 66 - info->ops->writebyte(value, addr); 67 - } else { 68 - writeb(addr, info->index_reg); 69 - writeb(value, info->data_reg); 70 - } 70 + writeb(addr, info->index_reg); 71 + writeb(value, info->data_reg); 71 72 } 72 73 73 74 static int m48t86_rtc_read_time(struct device *dev, struct rtc_time *tm) ··· 226 235 static int m48t86_rtc_probe(struct platform_device *pdev) 227 236 { 228 237 struct m48t86_rtc_info *info; 238 + struct resource *res; 229 239 unsigned char reg; 230 240 231 241 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); 232 242 if (!info) 233 243 return -ENOMEM; 234 244 235 - info->ops = dev_get_platdata(&pdev->dev); 236 - if (!info->ops) { 237 - struct resource *res; 245 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 246 + if (!res) 247 + return -ENODEV; 248 + info->index_reg = devm_ioremap_resource(&pdev->dev, res); 249 + if (IS_ERR(info->index_reg)) 250 + return PTR_ERR(info->index_reg); 238 251 239 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 240 - if (!res) 241 - return -ENODEV; 242 - info->index_reg = devm_ioremap_resource(&pdev->dev, res); 243 - if (IS_ERR(info->index_reg)) 244 - return PTR_ERR(info->index_reg); 245 - 246 - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 247 - if (!res) 248 - return -ENODEV; 249 - info->data_reg = devm_ioremap_resource(&pdev->dev, res); 250 - if (IS_ERR(info->data_reg)) 251 - return PTR_ERR(info->data_reg); 252 - } 252 + res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 253 + if (!res) 254 + return -ENODEV; 255 + info->data_reg = devm_ioremap_resource(&pdev->dev, res); 256 + if (IS_ERR(info->data_reg)) 257 + return PTR_ERR(info->data_reg); 253 258 254 259 dev_set_drvdata(&pdev->dev, info); 255 260
-16
include/linux/platform_data/rtc-m48t86.h
··· 1 - /* 2 - * ST M48T86 / Dallas DS12887 RTC driver 3 - * Copyright (c) 2006 Tower Technologies 4 - * 5 - * Author: Alessandro Zummo <a.zummo@towertech.it> 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License version 2 as 9 - * published by the Free Software Foundation. 10 - */ 11 - 12 - struct m48t86_ops 13 - { 14 - void (*writebyte)(unsigned char value, unsigned long addr); 15 - unsigned char (*readbyte)(unsigned long addr); 16 - };