Re: [PATCH 4/6] device: add cmdmem support for MMIO address
From: Christoph Hellwig
Date: Wed Apr 01 2020 - 03:19:45 EST
> +/**
> + * devm_cmdmem_remap - Managed wrapper for cmdmem ioremap()
> + * @dev: Generic device to remap IO address for
> + * @offset: Resource address to map
> + * @size: Size of map
> + *
> + * Managed cmdmem ioremap() wrapper. Map is automatically unmapped on
> + * driver detach.
> + */
> +void __iomem *devm_cmdmem_remap(struct device *dev, resource_size_t offset,
> + resource_size_t size)
> +{
> + if (!device_supports_cmdmem(dev))
> + return NULL;
> +
> + return devm_ioremap(dev, offset, size);
All this could be trivially open coded in the caller.