All of lore.kernel.org
 help / color / mirror / Atom feed
* devm_ioremap_resource() creates duplicate resource
@ 2017-04-21  1:55 Pavel Roskin
  0 siblings, 0 replies; only message in thread
From: Pavel Roskin @ 2017-04-21  1:55 UTC (permalink / raw)
  To: linux-mm

Hello!

I'm writing a device driver for a subdevice of a PCIe multifunctional
device. It's a platform device that has its resources described in the
top-level driver for the multifuctional device.

I followed the common pattern when a memory resource is obtained by
calling platform_get_resource() and then reserved and remapped by
calling devm_ioremap_resource().

  res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  base = devm_ioremap_resource(&pdev->dev, res);

The problem with that approach is that the resource appears twice in
/proc/iomem:

  fdc60000-fdc6000f : My Dev
    fdc60000-fdc6000f : My Dev

I see that devm_ioremap_resource() takes the start address and the
size of the existing resource and reserves the region at the same
address.

Some drivers (e.g. drivers/mfd/db8500-prcmu.c) use devm_ioremap()
instead. But my concern is that the resource is not marked as busy in
that case.

Which approach is preferred? If there a good way to mark an existing
resource as busy (short of direct flag manipulation)? Would it make
sense to have an API to reserve an existing resource?

-- 
Regards,
Pavel Roskin

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-04-21  1:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-21  1:55 devm_ioremap_resource() creates duplicate resource Pavel Roskin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.