From: Atsushi Nemoto Date: Wed, 16 Dec 2009 00:46:04 +0000 (-0800) Subject: rtc: do not use container_of macro as an argument for to_platform_device X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=50e49bee3fc5c0cd0aff80ebd8061f356b7b9bd8;p=openwrt%2Fstaging%2Fblogic.git rtc: do not use container_of macro as an argument for to_platform_device The to_platform_device macro itself uses container_of macro. Nested use of container_of macro causes following sparse warnings: rtc-ds1553.c:259:3: warning: symbol '__mptr' shadows an earlier one rtc-ds1553.c:259:3: originally declared here Signed-off-by: Atsushi Nemoto Cc: Alessandro Zummo Cc: David Brownell Cc: Andrew Sharp Cc: Thomas Hommel Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c index dadd0f517d5a..ed1ef7c9cc06 100644 --- a/drivers/rtc/rtc-ds1553.c +++ b/drivers/rtc/rtc-ds1553.c @@ -255,8 +255,8 @@ static ssize_t ds1553_nvram_read(struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t pos, size_t size) { - struct platform_device *pdev = - to_platform_device(container_of(kobj, struct device, kobj)); + struct device *dev = container_of(kobj, struct device, kobj); + struct platform_device *pdev = to_platform_device(dev); struct rtc_plat_data *pdata = platform_get_drvdata(pdev); void __iomem *ioaddr = pdata->ioaddr; ssize_t count; @@ -270,8 +270,8 @@ static ssize_t ds1553_nvram_write(struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t pos, size_t size) { - struct platform_device *pdev = - to_platform_device(container_of(kobj, struct device, kobj)); + struct device *dev = container_of(kobj, struct device, kobj); + struct platform_device *pdev = to_platform_device(dev); struct rtc_plat_data *pdata = platform_get_drvdata(pdev); void __iomem *ioaddr = pdata->ioaddr; ssize_t count; diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c index 19d2f3333cf0..a1273360a44e 100644 --- a/drivers/rtc/rtc-ds1742.c +++ b/drivers/rtc/rtc-ds1742.c @@ -131,8 +131,8 @@ static ssize_t ds1742_nvram_read(struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t pos, size_t size) { - struct platform_device *pdev = - to_platform_device(container_of(kobj, struct device, kobj)); + struct device *dev = container_of(kobj, struct device, kobj); + struct platform_device *pdev = to_platform_device(dev); struct rtc_plat_data *pdata = platform_get_drvdata(pdev); void __iomem *ioaddr = pdata->ioaddr_nvram; ssize_t count; @@ -146,8 +146,8 @@ static ssize_t ds1742_nvram_write(struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t pos, size_t size) { - struct platform_device *pdev = - to_platform_device(container_of(kobj, struct device, kobj)); + struct device *dev = container_of(kobj, struct device, kobj); + struct platform_device *pdev = to_platform_device(dev); struct rtc_plat_data *pdata = platform_get_drvdata(pdev); void __iomem *ioaddr = pdata->ioaddr_nvram; ssize_t count; diff --git a/drivers/rtc/rtc-stk17ta8.c b/drivers/rtc/rtc-stk17ta8.c index 31ea22070e3d..67700831b5c9 100644 --- a/drivers/rtc/rtc-stk17ta8.c +++ b/drivers/rtc/rtc-stk17ta8.c @@ -247,8 +247,8 @@ static ssize_t stk17ta8_nvram_read(struct kobject *kobj, struct bin_attribute *attr, char *buf, loff_t pos, size_t size) { - struct platform_device *pdev = - to_platform_device(container_of(kobj, struct device, kobj)); + struct device *dev = container_of(kobj, struct device, kobj); + struct platform_device *pdev = to_platform_device(dev); struct rtc_plat_data *pdata = platform_get_drvdata(pdev); void __iomem *ioaddr = pdata->ioaddr; ssize_t count; @@ -262,8 +262,8 @@ static ssize_t stk17ta8_nvram_write(struct kobject *kobj, struct bin_attribute *attr, char *buf, loff_t pos, size_t size) { - struct platform_device *pdev = - to_platform_device(container_of(kobj, struct device, kobj)); + struct device *dev = container_of(kobj, struct device, kobj); + struct platform_device *pdev = to_platform_device(dev); struct rtc_plat_data *pdata = platform_get_drvdata(pdev); void __iomem *ioaddr = pdata->ioaddr; ssize_t count;