Re: [PATCH 3/4] rtc: rtc-jz4740: Use devm_ioremap_resource()

From: Lars-Peter Clausen
Date: Fri Feb 07 2014 - 03:49:22 EST

On 02/07/2014 09:31 AM, Jingoo Han wrote:
On Friday, February 07, 2014 5:13 PM, Lars-Peter Clausen wrote:
On 02/07/2014 08:58 AM, Jingoo Han wrote:
- rtc->base = devm_ioremap_nocache(&pdev->dev, rtc->mem->start,
- resource_size(rtc->mem));
- if (!rtc->base) {
- dev_err(&pdev->dev, "Failed to ioremap mmio memory\n");
- return -EBUSY;
- }
+ mem->flags &= ~IORESOURCE_CACHEABLE;

You shouldn't be modifying the resource, strictly speaking it is not owned
by the device. And IORESOURCE_CACHEABLE is never set for this device anyway.

(+cc Thierry Reding)

Hi Lars-Peter Clausen,

Do you mean that resource's flags should NOT be modified by the
device driver, right?
Then, without 'mem->flags &= ~IORESOURCE_CACHEABLE', is it possible
that devm_ioremap_nocache() can be called at devm_ioremap_resource()?

Yes. ioremap_nocache() will be called, when the flag is not set, ioremap_cached() will be called when the flag is set. If the flag is set the intention is probably that the region should be mapped cached.

Do you have any comments on this?

Thank you.

Best regards,
Jingoo Han

+ rtc->base = devm_ioremap_resource(&pdev->dev, mem);
+ if (IS_ERR(rtc->base))
+ return PTR_ERR(rtc->base);


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at