Skip to content
Snippets Groups Projects
Commit 0c7a6b91 authored by Stephen Boyd's avatar Stephen Boyd Committed by Greg Kroah-Hartman
Browse files

driver core: platform: Document return type of more functions


I can't always remember the return values of these functions, and so I
usually jump to the function to read the kernel-doc and see that it
doesn't tell me. Then I have to spend more time reading the code to jump
to the function that actually tells me the return values. Let's document
it here so that we don't all have to spend time digging through the code
to understand the return values.

Cc: <linux-doc@vger.kernel.org>
Signed-off-by: default avatarStephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20200910060440.2302925-1-swboyd@chromium.org


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f601e8f3
No related branches found
No related tags found
Loading
...@@ -45,6 +45,8 @@ EXPORT_SYMBOL_GPL(platform_bus); ...@@ -45,6 +45,8 @@ EXPORT_SYMBOL_GPL(platform_bus);
* @dev: platform device * @dev: platform device
* @type: resource type * @type: resource type
* @num: resource index * @num: resource index
*
* Return: a pointer to the resource or NULL on failure.
*/ */
struct resource *platform_get_resource(struct platform_device *dev, struct resource *platform_get_resource(struct platform_device *dev,
unsigned int type, unsigned int num) unsigned int type, unsigned int num)
...@@ -70,6 +72,9 @@ EXPORT_SYMBOL_GPL(platform_get_resource); ...@@ -70,6 +72,9 @@ EXPORT_SYMBOL_GPL(platform_get_resource);
* resource management * resource management
* @index: resource index * @index: resource index
* @res: optional output parameter to store a pointer to the obtained resource. * @res: optional output parameter to store a pointer to the obtained resource.
*
* Return: a pointer to the remapped memory or an ERR_PTR() encoded error code
* on failure.
*/ */
void __iomem * void __iomem *
devm_platform_get_and_ioremap_resource(struct platform_device *pdev, devm_platform_get_and_ioremap_resource(struct platform_device *pdev,
...@@ -91,6 +96,9 @@ EXPORT_SYMBOL_GPL(devm_platform_get_and_ioremap_resource); ...@@ -91,6 +96,9 @@ EXPORT_SYMBOL_GPL(devm_platform_get_and_ioremap_resource);
* @pdev: platform device to use both for memory resource lookup as well as * @pdev: platform device to use both for memory resource lookup as well as
* resource management * resource management
* @index: resource index * @index: resource index
*
* Return: a pointer to the remapped memory or an ERR_PTR() encoded error code
* on failure.
*/ */
void __iomem *devm_platform_ioremap_resource(struct platform_device *pdev, void __iomem *devm_platform_ioremap_resource(struct platform_device *pdev,
unsigned int index) unsigned int index)
...@@ -106,6 +114,9 @@ EXPORT_SYMBOL_GPL(devm_platform_ioremap_resource); ...@@ -106,6 +114,9 @@ EXPORT_SYMBOL_GPL(devm_platform_ioremap_resource);
* @pdev: platform device to use both for memory resource lookup as well as * @pdev: platform device to use both for memory resource lookup as well as
* resource management * resource management
* @index: resource index * @index: resource index
*
* Return: a pointer to the remapped memory or an ERR_PTR() encoded error code
* on failure.
*/ */
void __iomem *devm_platform_ioremap_resource_wc(struct platform_device *pdev, void __iomem *devm_platform_ioremap_resource_wc(struct platform_device *pdev,
unsigned int index) unsigned int index)
...@@ -124,6 +135,9 @@ void __iomem *devm_platform_ioremap_resource_wc(struct platform_device *pdev, ...@@ -124,6 +135,9 @@ void __iomem *devm_platform_ioremap_resource_wc(struct platform_device *pdev,
* @pdev: platform device to use both for memory resource lookup as well as * @pdev: platform device to use both for memory resource lookup as well as
* resource management * resource management
* @name: name of the resource * @name: name of the resource
*
* Return: a pointer to the remapped memory or an ERR_PTR() encoded error code
* on failure.
*/ */
void __iomem * void __iomem *
devm_platform_ioremap_resource_byname(struct platform_device *pdev, devm_platform_ioremap_resource_byname(struct platform_device *pdev,
......
...@@ -162,13 +162,15 @@ __devm_ioremap_resource(struct device *dev, const struct resource *res, ...@@ -162,13 +162,15 @@ __devm_ioremap_resource(struct device *dev, const struct resource *res,
* region and ioremaps it. All operations are managed and will be undone * region and ioremaps it. All operations are managed and will be undone
* on driver detach. * on driver detach.
* *
* Returns a pointer to the remapped memory or an ERR_PTR() encoded error code * Usage example:
* on failure. Usage example:
* *
* res = platform_get_resource(pdev, IORESOURCE_MEM, 0); * res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
* base = devm_ioremap_resource(&pdev->dev, res); * base = devm_ioremap_resource(&pdev->dev, res);
* if (IS_ERR(base)) * if (IS_ERR(base))
* return PTR_ERR(base); * return PTR_ERR(base);
*
* Return: a pointer to the remapped memory or an ERR_PTR() encoded error code
* on failure.
*/ */
void __iomem *devm_ioremap_resource(struct device *dev, void __iomem *devm_ioremap_resource(struct device *dev,
const struct resource *res) const struct resource *res)
...@@ -183,8 +185,8 @@ EXPORT_SYMBOL(devm_ioremap_resource); ...@@ -183,8 +185,8 @@ EXPORT_SYMBOL(devm_ioremap_resource);
* @dev: generic device to handle the resource for * @dev: generic device to handle the resource for
* @res: resource to be handled * @res: resource to be handled
* *
* Returns a pointer to the remapped memory or an ERR_PTR() encoded error code * Return: a pointer to the remapped memory or an ERR_PTR() encoded error code
* on failure. Usage example: * on failure.
*/ */
void __iomem *devm_ioremap_resource_wc(struct device *dev, void __iomem *devm_ioremap_resource_wc(struct device *dev,
const struct resource *res) const struct resource *res)
...@@ -207,8 +209,8 @@ void __iomem *devm_ioremap_resource_wc(struct device *dev, ...@@ -207,8 +209,8 @@ void __iomem *devm_ioremap_resource_wc(struct device *dev,
* @node: The device-tree node where the resource resides * @node: The device-tree node where the resource resides
* @index: index of the MMIO range in the "reg" property * @index: index of the MMIO range in the "reg" property
* @size: Returns the size of the resource (pass NULL if not needed) * @size: Returns the size of the resource (pass NULL if not needed)
* Returns a pointer to the requested and mapped memory or an ERR_PTR() encoded *
* error code on failure. Usage example: * Usage example:
* *
* base = devm_of_iomap(&pdev->dev, node, 0, NULL); * base = devm_of_iomap(&pdev->dev, node, 0, NULL);
* if (IS_ERR(base)) * if (IS_ERR(base))
...@@ -219,6 +221,8 @@ void __iomem *devm_ioremap_resource_wc(struct device *dev, ...@@ -219,6 +221,8 @@ void __iomem *devm_ioremap_resource_wc(struct device *dev,
* two drivers try to map the same memory, the of_iomap() function will succeed * two drivers try to map the same memory, the of_iomap() function will succeed
* but the devm_of_iomap() function will return -EBUSY. * but the devm_of_iomap() function will return -EBUSY.
* *
* Return: a pointer to the requested and mapped memory or an ERR_PTR() encoded
* error code on failure.
*/ */
void __iomem *devm_of_iomap(struct device *dev, struct device_node *node, int index, void __iomem *devm_of_iomap(struct device *dev, struct device_node *node, int index,
resource_size_t *size) resource_size_t *size)
...@@ -256,6 +260,8 @@ static int devm_ioport_map_match(struct device *dev, void *res, ...@@ -256,6 +260,8 @@ static int devm_ioport_map_match(struct device *dev, void *res,
* *
* Managed ioport_map(). Map is automatically unmapped on driver * Managed ioport_map(). Map is automatically unmapped on driver
* detach. * detach.
*
* Return: a pointer to the remapped memory or NULL on failure.
*/ */
void __iomem *devm_ioport_map(struct device *dev, unsigned long port, void __iomem *devm_ioport_map(struct device *dev, unsigned long port,
unsigned int nr) unsigned int nr)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment