Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1417649 > unrolled thread

[PATCH] nvmem: fix nvmem_cell_read() return type for !CONFIG_NVMEM

Started byBrian Norris <briannorris@chromium.org>
First post2016-06-08 18:30 +0200
Last post2016-06-08 22:10 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] nvmem: fix nvmem_cell_read() return type for !CONFIG_NVMEM Brian Norris <briannorris@chromium.org> - 2016-06-08 18:30 +0200
    Re: [PATCH] nvmem: fix nvmem_cell_read() return type for  !CONFIG_NVMEM Brian Norris <briannorris@chromium.org> - 2016-06-08 18:50 +0200
      Re: [PATCH] nvmem: fix nvmem_cell_read() return type for  !CONFIG_NVMEM Guenter Roeck <linux@roeck-us.net> - 2016-06-08 19:50 +0200
      Re: [PATCH] nvmem: fix nvmem_cell_read() return type for  !CONFIG_NVMEM Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2016-06-08 21:00 +0200
        Re: [PATCH] nvmem: fix nvmem_cell_read() return type for  !CONFIG_NVMEM Brian Norris <briannorris@chromium.org> - 2016-06-08 22:10 +0200

#1417649 — [PATCH] nvmem: fix nvmem_cell_read() return type for !CONFIG_NVMEM

FromBrian Norris <briannorris@chromium.org>
Date2016-06-08 18:30 +0200
Subject[PATCH] nvmem: fix nvmem_cell_read() return type for !CONFIG_NVMEM
Message-ID<rHOwG-2ud-13@gated-at.bofh.it>
With CONFIG_NVMEM, nvmem_cell_read() returns void *. With !CONFIG_NVMEM
it returns char *. Let's make that consistent. Also drop the
incorrect/inconsistent comment about char * above the nvmem_cell_read()
definition.

drivers/thermal/mtk_thermal.c is already working around this by casting
to (u32 *).

Signed-off-by: Brian Norris <briannorris@chromium.org>
---
 drivers/nvmem/core.c           | 4 ++--
 include/linux/nvmem-consumer.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 965911d9b36a..398ea7f54826 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -981,8 +981,8 @@ static int __nvmem_cell_read(struct nvmem_device *nvmem,
  * @cell: nvmem cell to be read.
  * @len: pointer to length of cell which will be populated on successful read.
  *
- * Return: ERR_PTR() on error or a valid pointer to a char * buffer on success.
- * The buffer should be freed by the consumer with a kfree().
+ * Return: ERR_PTR() on error or a valid pointer to a buffer on success. The
+ * buffer should be freed by the consumer with a kfree().
  */
 void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len)
 {
diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h
index 9bb77d3ed6e0..c2256d746543 100644
--- a/include/linux/nvmem-consumer.h
+++ b/include/linux/nvmem-consumer.h
@@ -74,7 +74,7 @@ static inline void nvmem_cell_put(struct nvmem_cell *cell)
 {
 }
 
-static inline char *nvmem_cell_read(struct nvmem_cell *cell, size_t *len)
+static inline void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len)
 {
 	return ERR_PTR(-ENOSYS);
 }
-- 
2.8.0.rc3.226.g39d4020

[toc] | [next] | [standalone]


#1417685 — Re: [PATCH] nvmem: fix nvmem_cell_read() return type for !CONFIG_NVMEM

FromBrian Norris <briannorris@chromium.org>
Date2016-06-08 18:50 +0200
SubjectRe: [PATCH] nvmem: fix nvmem_cell_read() return type for !CONFIG_NVMEM
Message-ID<rHOQ3-2Bc-39@gated-at.bofh.it>
In reply to#1417649
On Wed, Jun 08, 2016 at 09:26:46AM -0700, Brian Norris wrote:
> With CONFIG_NVMEM, nvmem_cell_read() returns void *. With !CONFIG_NVMEM
> it returns char *. Let's make that consistent. Also drop the
> incorrect/inconsistent comment about char * above the nvmem_cell_read()
> definition.
> 
> drivers/thermal/mtk_thermal.c is already working around this by casting
> to (u32 *).
> 
> Signed-off-by: Brian Norris <briannorris@chromium.org>

Seems Guenter submitted the same thing a week ago, with no response:

https://patchwork.kernel.org/patch/9148325/

I'll selfishly suggest that mine is better, since it also corrects the
comments :)

Brian

> ---
>  drivers/nvmem/core.c           | 4 ++--
>  include/linux/nvmem-consumer.h | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index 965911d9b36a..398ea7f54826 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -981,8 +981,8 @@ static int __nvmem_cell_read(struct nvmem_device *nvmem,
>   * @cell: nvmem cell to be read.
>   * @len: pointer to length of cell which will be populated on successful read.
>   *
> - * Return: ERR_PTR() on error or a valid pointer to a char * buffer on success.
> - * The buffer should be freed by the consumer with a kfree().
> + * Return: ERR_PTR() on error or a valid pointer to a buffer on success. The
> + * buffer should be freed by the consumer with a kfree().
>   */
>  void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len)
>  {
> diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h
> index 9bb77d3ed6e0..c2256d746543 100644
> --- a/include/linux/nvmem-consumer.h
> +++ b/include/linux/nvmem-consumer.h
> @@ -74,7 +74,7 @@ static inline void nvmem_cell_put(struct nvmem_cell *cell)
>  {
>  }
>  
> -static inline char *nvmem_cell_read(struct nvmem_cell *cell, size_t *len)
> +static inline void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len)
>  {
>  	return ERR_PTR(-ENOSYS);
>  }
> -- 
> 2.8.0.rc3.226.g39d4020
> 

[toc] | [prev] | [next] | [standalone]


#1417739 — Re: [PATCH] nvmem: fix nvmem_cell_read() return type for !CONFIG_NVMEM

FromGuenter Roeck <linux@roeck-us.net>
Date2016-06-08 19:50 +0200
SubjectRe: [PATCH] nvmem: fix nvmem_cell_read() return type for !CONFIG_NVMEM
Message-ID<rHPM6-3cI-15@gated-at.bofh.it>
In reply to#1417685
On Wed, Jun 08, 2016 at 09:40:11AM -0700, Brian Norris wrote:
> On Wed, Jun 08, 2016 at 09:26:46AM -0700, Brian Norris wrote:
> > With CONFIG_NVMEM, nvmem_cell_read() returns void *. With !CONFIG_NVMEM
> > it returns char *. Let's make that consistent. Also drop the
> > incorrect/inconsistent comment about char * above the nvmem_cell_read()
> > definition.
> > 
> > drivers/thermal/mtk_thermal.c is already working around this by casting
> > to (u32 *).
> > 
> > Signed-off-by: Brian Norris <briannorris@chromium.org>
> 
> Seems Guenter submitted the same thing a week ago, with no response:
> 
> https://patchwork.kernel.org/patch/9148325/
> 
> I'll selfishly suggest that mine is better, since it also corrects the
> comments :)
> 
Perfectly fine with me.

Guenter

[toc] | [prev] | [next] | [standalone]


#1417774 — Re: [PATCH] nvmem: fix nvmem_cell_read() return type for !CONFIG_NVMEM

FromSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Date2016-06-08 21:00 +0200
SubjectRe: [PATCH] nvmem: fix nvmem_cell_read() return type for !CONFIG_NVMEM
Message-ID<rHQRQ-3QN-3@gated-at.bofh.it>
In reply to#1417685

On 08/06/16 17:40, Brian Norris wrote:
> On Wed, Jun 08, 2016 at 09:26:46AM -0700, Brian Norris wrote:
>> With CONFIG_NVMEM, nvmem_cell_read() returns void *. With !CONFIG_NVMEM
>> it returns char *. Let's make that consistent. Also drop the
>> incorrect/inconsistent comment about char * above the nvmem_cell_read()
>> definition.
>>
>> drivers/thermal/mtk_thermal.c is already working around this by casting
>> to (u32 *).
>>
>> Signed-off-by: Brian Norris <briannorris@chromium.org>
>
> Seems Guenter submitted the same thing a week ago, with no response:

This patch has been already sent to Greg few days back with my sign off 
http://permalink.gmane.org/gmane.linux.kernel/2233276

>
> https://patchwork.kernel.org/patch/9148325/
>
> I'll selfishly suggest that mine is better, since it also corrects the
> comments :)
>
I agree, If Greg has not picked that up yet, then its easy to apply 
this, else we need another patch to fix the comment. :-).


--srini
> Brian
>
>> ---
>>   drivers/nvmem/core.c           | 4 ++--
>>   include/linux/nvmem-consumer.h | 2 +-
>>   2 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
>> index 965911d9b36a..398ea7f54826 100644
>> --- a/drivers/nvmem/core.c
>> +++ b/drivers/nvmem/core.c
>> @@ -981,8 +981,8 @@ static int __nvmem_cell_read(struct nvmem_device *nvmem,
>>    * @cell: nvmem cell to be read.
>>    * @len: pointer to length of cell which will be populated on successful read.
>>    *
>> - * Return: ERR_PTR() on error or a valid pointer to a char * buffer on success.
>> - * The buffer should be freed by the consumer with a kfree().
>> + * Return: ERR_PTR() on error or a valid pointer to a buffer on success. The
>> + * buffer should be freed by the consumer with a kfree().
>>    */
>>   void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len)
>>   {
>> diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h
>> index 9bb77d3ed6e0..c2256d746543 100644
>> --- a/include/linux/nvmem-consumer.h
>> +++ b/include/linux/nvmem-consumer.h
>> @@ -74,7 +74,7 @@ static inline void nvmem_cell_put(struct nvmem_cell *cell)
>>   {
>>   }
>>
>> -static inline char *nvmem_cell_read(struct nvmem_cell *cell, size_t *len)
>> +static inline void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len)
>>   {
>>   	return ERR_PTR(-ENOSYS);
>>   }
>> --
>> 2.8.0.rc3.226.g39d4020
>>

[toc] | [prev] | [next] | [standalone]


#1417835 — Re: [PATCH] nvmem: fix nvmem_cell_read() return type for !CONFIG_NVMEM

FromBrian Norris <briannorris@chromium.org>
Date2016-06-08 22:10 +0200
SubjectRe: [PATCH] nvmem: fix nvmem_cell_read() return type for !CONFIG_NVMEM
Message-ID<rHRXz-4Km-1@gated-at.bofh.it>
In reply to#1417774
On Wed, Jun 08, 2016 at 07:52:06PM +0100, Srinivas Kandagatla wrote:
> On 08/06/16 17:40, Brian Norris wrote:
> >On Wed, Jun 08, 2016 at 09:26:46AM -0700, Brian Norris wrote:
> >>With CONFIG_NVMEM, nvmem_cell_read() returns void *. With !CONFIG_NVMEM
> >>it returns char *. Let's make that consistent. Also drop the
> >>incorrect/inconsistent comment about char * above the nvmem_cell_read()
> >>definition.
> >>
> >>drivers/thermal/mtk_thermal.c is already working around this by casting
> >>to (u32 *).
> >>
> >>Signed-off-by: Brian Norris <briannorris@chromium.org>
> >
> >Seems Guenter submitted the same thing a week ago, with no response:
> 
> This patch has been already sent to Greg few days back with my sign
> off http://permalink.gmane.org/gmane.linux.kernel/2233276

Ah, didn't notice that either. Anyway, doesn't seem to show up in
linux-next.

Brian

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web