Skip to content

Commit

Permalink
lib: devres: provide devm_ioremap_resource_wc()
Browse files Browse the repository at this point in the history
Provide a variant of devm_ioremap_resource() for write-combined ioremap.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Arnd Bergmann <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
brgl authored and gregkh committed Nov 5, 2019
1 parent 6e92482 commit b873af6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions Documentation/driver-api/driver-model/devres.rst
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ IOMAP
devm_ioremap_nocache()
devm_ioremap_wc()
devm_ioremap_resource() : checks resource, requests memory region, ioremaps
devm_ioremap_resource_wc()
devm_platform_ioremap_resource() : calls devm_ioremap_resource() for platform device
devm_iounmap()
pcim_iomap()
Expand Down
2 changes: 2 additions & 0 deletions include/linux/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,8 @@ extern void devm_free_pages(struct device *dev, unsigned long addr);

void __iomem *devm_ioremap_resource(struct device *dev,
const struct resource *res);
void __iomem *devm_ioremap_resource_wc(struct device *dev,
const struct resource *res);

void __iomem *devm_of_iomap(struct device *dev,
struct device_node *node, int index,
Expand Down
15 changes: 15 additions & 0 deletions lib/devres.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,21 @@ void __iomem *devm_ioremap_resource(struct device *dev,
}
EXPORT_SYMBOL(devm_ioremap_resource);

/**
* devm_ioremap_resource_wc() - write-combined variant of
* devm_ioremap_resource()
* @dev: generic device to handle the resource for
* @res: resource to be handled
*
* Returns a pointer to the remapped memory or an ERR_PTR() encoded error code
* on failure. Usage example:
*/
void __iomem *devm_ioremap_resource_wc(struct device *dev,
const struct resource *res)
{
return __devm_ioremap_resource(dev, res, DEVM_IOREMAP_WC);
}

/*
* devm_of_iomap - Requests a resource and maps the memory mapped IO
* for a given device_node managed by a given device
Expand Down

0 comments on commit b873af6

Please sign in to comment.