All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] nvmem: core: Correct a bunch of function documentations
@ 2017-01-06  9:10 Vivek Gautam
  2017-01-06  9:10 ` [PATCH 2/2] nvmem: core: Allow getting nvmem cell with a NULL cell id Vivek Gautam
  2017-01-09 19:52 ` [PATCH 1/2] nvmem: core: Correct a bunch of function documentations Stephen Boyd
  0 siblings, 2 replies; 6+ messages in thread
From: Vivek Gautam @ 2017-01-06  9:10 UTC (permalink / raw)
  To: srinivas.kandagatla, maxime.ripard; +Cc: sboyd, linux-arm-msm, Vivek Gautam

Correct the documentation for arguments to a number
of functions.

Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
---

Based on next-20170106.

 drivers/nvmem/core.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 398ea7f54826..294cdef96277 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -608,7 +608,7 @@ static struct nvmem_device *nvmem_find(const char *name)
 /**
  * of_nvmem_device_get() - Get nvmem device from a given id
  *
- * @dev node: Device tree node that uses the nvmem device
+ * @np: Device tree node that uses the nvmem device.
  * @id: nvmem name from nvmem-names property.
  *
  * Return: ERR_PTR() on error or a valid pointer to a struct nvmem_device
@@ -634,8 +634,8 @@ struct nvmem_device *of_nvmem_device_get(struct device_node *np, const char *id)
 /**
  * nvmem_device_get() - Get nvmem device from a given id
  *
- * @dev : Device that uses the nvmem device
- * @id: nvmem name from nvmem-names property.
+ * @dev : Device that uses the nvmem device.
+ * @dev_name: name of the requested nvmem device.
  *
  * Return: ERR_PTR() on error or a valid pointer to a struct nvmem_device
  * on success.
@@ -674,6 +674,7 @@ static void devm_nvmem_device_release(struct device *dev, void *res)
 /**
  * devm_nvmem_device_put() - put alredy got nvmem device
  *
+ * @dev : Device that uses the nvmem device.
  * @nvmem: pointer to nvmem device allocated by devm_nvmem_cell_get(),
  * that needs to be released.
  */
@@ -702,8 +703,8 @@ void nvmem_device_put(struct nvmem_device *nvmem)
 /**
  * devm_nvmem_device_get() - Get nvmem cell of device form a given id
  *
- * @dev node: Device tree node that uses the nvmem cell
- * @id: nvmem name in nvmems property.
+ * @dev : Device that requests the nvmem device.
+ * @id: name id for the requested nvmem device.
  *
  * Return: ERR_PTR() on error or a valid pointer to a struct nvmem_cell
  * on success.  The nvmem_cell will be freed by the automatically once the
@@ -745,8 +746,8 @@ static struct nvmem_cell *nvmem_cell_get_from_list(const char *cell_id)
 /**
  * of_nvmem_cell_get() - Get a nvmem cell from given device node and cell id
  *
- * @dev node: Device tree node that uses the nvmem cell
- * @id: nvmem cell name from nvmem-cell-names property.
+ * @np: Device tree node that uses the nvmem cell.
+ * @name: nvmem cell name from nvmem-cell-names property.
  *
  * Return: Will be an ERR_PTR() on error or a valid pointer
  * to a struct nvmem_cell.  The nvmem_cell will be freed by the
@@ -830,8 +831,8 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node *np,
 /**
  * nvmem_cell_get() - Get nvmem cell of device form a given cell name
  *
- * @dev node: Device tree node that uses the nvmem cell
- * @id: nvmem cell name to get.
+ * @dev: Device that requests the nvmem cell.
+ * @cell_id: nvmem cell name to get.
  *
  * Return: Will be an ERR_PTR() on error or a valid pointer
  * to a struct nvmem_cell.  The nvmem_cell will be freed by the
@@ -859,8 +860,8 @@ static void devm_nvmem_cell_release(struct device *dev, void *res)
 /**
  * devm_nvmem_cell_get() - Get nvmem cell of device form a given id
  *
- * @dev node: Device tree node that uses the nvmem cell
- * @id: nvmem id in nvmem-names property.
+ * @dev: Device that requests the nvmem cell.
+ * @id: nvmem cell name id to get.
  *
  * Return: Will be an ERR_PTR() on error or a valid pointer
  * to a struct nvmem_cell.  The nvmem_cell will be freed by the
@@ -900,7 +901,8 @@ static int devm_nvmem_cell_match(struct device *dev, void *res, void *data)
  * devm_nvmem_cell_put() - Release previously allocated nvmem cell
  * from devm_nvmem_cell_get.
  *
- * @cell: Previously allocated nvmem cell by devm_nvmem_cell_get()
+ * @dev: Device that requests the nvmem cell.
+ * @cell: Previously allocated nvmem cell by devm_nvmem_cell_get().
  */
 void devm_nvmem_cell_put(struct device *dev, struct nvmem_cell *cell)
 {
@@ -916,7 +918,7 @@ void devm_nvmem_cell_put(struct device *dev, struct nvmem_cell *cell)
 /**
  * nvmem_cell_put() - Release previously allocated nvmem cell.
  *
- * @cell: Previously allocated nvmem cell by nvmem_cell_get()
+ * @cell: Previously allocated nvmem cell by nvmem_cell_get().
  */
 void nvmem_cell_put(struct nvmem_cell *cell)
 {
@@ -1126,7 +1128,7 @@ ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem,
  * nvmem_device_cell_write() - Write cell to a given nvmem device
  *
  * @nvmem: nvmem device to be written to.
- * @info: nvmem cell info to be written
+ * @info: nvmem cell info to be written.
  * @buf: buffer to be written to cell.
  *
  * Return: length of bytes written or negative error code on failure.
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] nvmem: core: Allow getting nvmem cell with a NULL cell id
  2017-01-06  9:10 [PATCH 1/2] nvmem: core: Correct a bunch of function documentations Vivek Gautam
@ 2017-01-06  9:10 ` Vivek Gautam
  2017-01-09 19:53   ` Stephen Boyd
  2017-01-09 19:52 ` [PATCH 1/2] nvmem: core: Correct a bunch of function documentations Stephen Boyd
  1 sibling, 1 reply; 6+ messages in thread
From: Vivek Gautam @ 2017-01-06  9:10 UTC (permalink / raw)
  To: srinivas.kandagatla, maxime.ripard; +Cc: sboyd, linux-arm-msm, Vivek Gautam

The nvmem cell with a NULL cell name/id should be the one
with no accompanying 'nvmem-cell-names' property, and thus
will be the cell at index 0 in the device tree.
So, we default to index 0 and update the cell index only when
nvmem cell name id exists.

Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
---

Based on next-20170106.

This patch supersede the earlier posted series [1] that added
support for getting nvmem cell by index. We don't really need that.

[1] https://lkml.org/lkml/2016/12/23/80

 drivers/nvmem/core.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 294cdef96277..d243dc6ad1a4 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -747,7 +747,9 @@ static struct nvmem_cell *nvmem_cell_get_from_list(const char *cell_id)
  * of_nvmem_cell_get() - Get a nvmem cell from given device node and cell id
  *
  * @np: Device tree node that uses the nvmem cell.
- * @name: nvmem cell name from nvmem-cell-names property.
+ * @name: nvmem cell name from nvmem-cell-names property, or NULL
+ *	  for the cell at index 0 (the lone cell with no acoompanying
+ *	  nvmem-cell-names property).
  *
  * Return: Will be an ERR_PTR() on error or a valid pointer
  * to a struct nvmem_cell.  The nvmem_cell will be freed by the
@@ -760,9 +762,12 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node *np,
 	struct nvmem_cell *cell;
 	struct nvmem_device *nvmem;
 	const __be32 *addr;
-	int rval, len, index;
+	int rval, len;
+	int index = 0;
 
-	index = of_property_match_string(np, "nvmem-cell-names", name);
+	/* if cell name exists, find index to the name */
+	if (name)
+		index = of_property_match_string(np, "nvmem-cell-names", name);
 
 	cell_np = of_parse_phandle(np, "nvmem-cells", index);
 	if (!cell_np)
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] nvmem: core: Correct a bunch of function documentations
  2017-01-06  9:10 [PATCH 1/2] nvmem: core: Correct a bunch of function documentations Vivek Gautam
  2017-01-06  9:10 ` [PATCH 2/2] nvmem: core: Allow getting nvmem cell with a NULL cell id Vivek Gautam
@ 2017-01-09 19:52 ` Stephen Boyd
  2017-01-10  7:58   ` Vivek Gautam
  1 sibling, 1 reply; 6+ messages in thread
From: Stephen Boyd @ 2017-01-09 19:52 UTC (permalink / raw)
  To: Vivek Gautam; +Cc: srinivas.kandagatla, maxime.ripard, linux-arm-msm

On 01/06, Vivek Gautam wrote:
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index 398ea7f54826..294cdef96277 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -634,8 +634,8 @@ struct nvmem_device *of_nvmem_device_get(struct device_node *np, const char *id)
>  /**
>   * nvmem_device_get() - Get nvmem device from a given id
>   *
> - * @dev : Device that uses the nvmem device
> - * @id: nvmem name from nvmem-names property.
> + * @dev : Device that uses the nvmem device.

          ^
Drop this space?

> + * @dev_name: name of the requested nvmem device.
>   *
>   * Return: ERR_PTR() on error or a valid pointer to a struct nvmem_device
>   * on success.
> @@ -674,6 +674,7 @@ static void devm_nvmem_device_release(struct device *dev, void *res)
>  /**
>   * devm_nvmem_device_put() - put alredy got nvmem device
>   *
> + * @dev : Device that uses the nvmem device.

          ^
Drop this space?

>   * @nvmem: pointer to nvmem device allocated by devm_nvmem_cell_get(),
>   * that needs to be released.
>   */
> @@ -702,8 +703,8 @@ void nvmem_device_put(struct nvmem_device *nvmem)
>  /**
>   * devm_nvmem_device_get() - Get nvmem cell of device form a given id
>   *
> - * @dev node: Device tree node that uses the nvmem cell
> - * @id: nvmem name in nvmems property.
> + * @dev : Device that requests the nvmem device.

          ^
Drop this space?

> + * @id: name id for the requested nvmem device.
>   *
>   * Return: ERR_PTR() on error or a valid pointer to a struct nvmem_cell
>   * on success.  The nvmem_cell will be freed by the automatically once the

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] nvmem: core: Allow getting nvmem cell with a NULL cell id
  2017-01-06  9:10 ` [PATCH 2/2] nvmem: core: Allow getting nvmem cell with a NULL cell id Vivek Gautam
@ 2017-01-09 19:53   ` Stephen Boyd
  2017-01-10  7:59     ` Vivek Gautam
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Boyd @ 2017-01-09 19:53 UTC (permalink / raw)
  To: Vivek Gautam; +Cc: srinivas.kandagatla, maxime.ripard, linux-arm-msm

On 01/06, Vivek Gautam wrote:
> The nvmem cell with a NULL cell name/id should be the one
> with no accompanying 'nvmem-cell-names' property, and thus
> will be the cell at index 0 in the device tree.
> So, we default to index 0 and update the cell index only when
> nvmem cell name id exists.
> 
> Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
> Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>

Except the typo below:

> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index 294cdef96277..d243dc6ad1a4 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -747,7 +747,9 @@ static struct nvmem_cell *nvmem_cell_get_from_list(const char *cell_id)
>   * of_nvmem_cell_get() - Get a nvmem cell from given device node and cell id
>   *
>   * @np: Device tree node that uses the nvmem cell.
> - * @name: nvmem cell name from nvmem-cell-names property.
> + * @name: nvmem cell name from nvmem-cell-names property, or NULL
> + *	  for the cell at index 0 (the lone cell with no acoompanying

s/acoompanying/accompanying/

> + *	  nvmem-cell-names property).
>   *
>   * Return: Will be an ERR_PTR() on error or a valid pointer
>   * to a struct nvmem_cell.  The nvmem_cell will be freed by the

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] nvmem: core: Correct a bunch of function documentations
  2017-01-09 19:52 ` [PATCH 1/2] nvmem: core: Correct a bunch of function documentations Stephen Boyd
@ 2017-01-10  7:58   ` Vivek Gautam
  0 siblings, 0 replies; 6+ messages in thread
From: Vivek Gautam @ 2017-01-10  7:58 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: srinivas.kandagatla, maxime.ripard, linux-arm-msm

Hi,


On 01/10/2017 01:22 AM, Stephen Boyd wrote:
> On 01/06, Vivek Gautam wrote:
>> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
>> index 398ea7f54826..294cdef96277 100644
>> --- a/drivers/nvmem/core.c
>> +++ b/drivers/nvmem/core.c
>> @@ -634,8 +634,8 @@ struct nvmem_device *of_nvmem_device_get(struct device_node *np, const char *id)
>>   /**
>>    * nvmem_device_get() - Get nvmem device from a given id
>>    *
>> - * @dev : Device that uses the nvmem device
>> - * @id: nvmem name from nvmem-names property.
>> + * @dev : Device that uses the nvmem device.
>            ^
> Drop this space?

Have dropped this and others in the v2 version. Thanks for pointing out.


Regards
Vivek

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] nvmem: core: Allow getting nvmem cell with a NULL cell id
  2017-01-09 19:53   ` Stephen Boyd
@ 2017-01-10  7:59     ` Vivek Gautam
  0 siblings, 0 replies; 6+ messages in thread
From: Vivek Gautam @ 2017-01-10  7:59 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: srinivas.kandagatla, maxime.ripard, linux-arm-msm

Hi


On 01/10/2017 01:23 AM, Stephen Boyd wrote:
> On 01/06, Vivek Gautam wrote:
>> The nvmem cell with a NULL cell name/id should be the one
>> with no accompanying 'nvmem-cell-names' property, and thus
>> will be the cell at index 0 in the device tree.
>> So, we default to index 0 and update the cell index only when
>> nvmem cell name id exists.
>>
>> Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
>> Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
>
> Except the typo below:

Thanks. Have fixed the typo in v2 version of the patch.


Regards
Vivek

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-01-10  8:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-06  9:10 [PATCH 1/2] nvmem: core: Correct a bunch of function documentations Vivek Gautam
2017-01-06  9:10 ` [PATCH 2/2] nvmem: core: Allow getting nvmem cell with a NULL cell id Vivek Gautam
2017-01-09 19:53   ` Stephen Boyd
2017-01-10  7:59     ` Vivek Gautam
2017-01-09 19:52 ` [PATCH 1/2] nvmem: core: Correct a bunch of function documentations Stephen Boyd
2017-01-10  7:58   ` Vivek Gautam

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.