mirror of https://gitee.com/openkylin/linux.git
rtc: ds1685: use devm_platform_ioremap_resource helper
Simplify ioremapping of registers by using devm_platform_ioremap_resource. Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de> Acked-by: Joshua Kinard <kumba@gentoo.org> Link: https://lore.kernel.org/r/20191011150546.9186-2-tbogendoerfer@suse.de Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
This commit is contained in:
parent
9e420d7f12
commit
af818031f4
|
@ -1040,7 +1040,6 @@ static int
|
||||||
ds1685_rtc_probe(struct platform_device *pdev)
|
ds1685_rtc_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct rtc_device *rtc_dev;
|
struct rtc_device *rtc_dev;
|
||||||
struct resource *res;
|
|
||||||
struct ds1685_priv *rtc;
|
struct ds1685_priv *rtc;
|
||||||
struct ds1685_rtc_platform_data *pdata;
|
struct ds1685_rtc_platform_data *pdata;
|
||||||
u8 ctrla, ctrlb, hours;
|
u8 ctrla, ctrlb, hours;
|
||||||
|
@ -1070,25 +1069,9 @@ ds1685_rtc_probe(struct platform_device *pdev)
|
||||||
* that sits behind the IOC3 PCI metadevice.
|
* that sits behind the IOC3 PCI metadevice.
|
||||||
*/
|
*/
|
||||||
if (pdata->alloc_io_resources) {
|
if (pdata->alloc_io_resources) {
|
||||||
/* Get the platform resources. */
|
rtc->regs = devm_platform_ioremap_resource(pdev, 0);
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
if (IS_ERR(rtc->regs))
|
||||||
if (!res)
|
return PTR_ERR(rtc->regs);
|
||||||
return -ENXIO;
|
|
||||||
rtc->size = resource_size(res);
|
|
||||||
|
|
||||||
/* Request a memory region. */
|
|
||||||
/* XXX: mmio-only for now. */
|
|
||||||
if (!devm_request_mem_region(&pdev->dev, res->start, rtc->size,
|
|
||||||
pdev->name))
|
|
||||||
return -EBUSY;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set the base address for the rtc, and ioremap its
|
|
||||||
* registers.
|
|
||||||
*/
|
|
||||||
rtc->regs = devm_ioremap(&pdev->dev, res->start, rtc->size);
|
|
||||||
if (!rtc->regs)
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the register step size. */
|
/* Get the register step size. */
|
||||||
|
|
|
@ -43,7 +43,6 @@ struct ds1685_priv {
|
||||||
struct rtc_device *dev;
|
struct rtc_device *dev;
|
||||||
void __iomem *regs;
|
void __iomem *regs;
|
||||||
u32 regstep;
|
u32 regstep;
|
||||||
size_t size;
|
|
||||||
int irq_num;
|
int irq_num;
|
||||||
bool bcd_mode;
|
bool bcd_mode;
|
||||||
bool no_irq;
|
bool no_irq;
|
||||||
|
|
Loading…
Reference in New Issue