[4/5] dm: ofnode: rename dev_read_prop() to dev_get_property()

Message ID 1498118047-11918-4-git-send-email-yamada.masahiro@socionext.com
State New
Headers show
Series
  • [1/5] dm: ofnode: use ofnode_read_bool() to check property existence
Related show

Commit Message

Masahiro Yamada June 22, 2017, 7:54 a.m.
The previous commit renamed ofnode_read_prop() to ofnode_get_propery()
and fixed its return type.  Likewise, rename dev_read_prop() and fix
its return type.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/core/read.c        | 3 ++-
 drivers/input/key_matrix.c | 4 ++--
 include/dm/read.h          | 9 +++++----
 3 files changed, 9 insertions(+), 7 deletions(-)

Comments

Simon Glass July 6, 2017, 4:49 a.m. | #1
On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> The previous commit renamed ofnode_read_prop() to ofnode_get_propery()
> and fixed its return type.  Likewise, rename dev_read_prop() and fix
> its return type.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  drivers/core/read.c        | 3 ++-
>  drivers/input/key_matrix.c | 4 ++--
>  include/dm/read.h          | 9 +++++----
>  3 files changed, 9 insertions(+), 7 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>
Simon Glass July 7, 2017, 3:57 a.m. | #2
Hi Masahiro,

On 5 July 2017 at 22:49, Simon Glass <sjg@chromium.org> wrote:
> On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>> The previous commit renamed ofnode_read_prop() to ofnode_get_propery()
>> and fixed its return type.  Likewise, rename dev_read_prop() and fix
>> its return type.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>> ---
>>
>>  drivers/core/read.c        | 3 ++-
>>  drivers/input/key_matrix.c | 4 ++--
>>  include/dm/read.h          | 9 +++++----
>>  3 files changed, 9 insertions(+), 7 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Actually I take that back. I'd like all functions in read.h to start
with dev_read...().

Regards,
Simon
Masahiro Yamada July 14, 2017, 2:38 a.m. | #3
Hi Simon,


2017-07-07 12:57 GMT+09:00 Simon Glass <sjg@chromium.org>:
> Hi Masahiro,
>
> On 5 July 2017 at 22:49, Simon Glass <sjg@chromium.org> wrote:
>> On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>>> The previous commit renamed ofnode_read_prop() to ofnode_get_propery()
>>> and fixed its return type.  Likewise, rename dev_read_prop() and fix
>>> its return type.
>>>
>>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>>> ---
>>>
>>>  drivers/core/read.c        | 3 ++-
>>>  drivers/input/key_matrix.c | 4 ++--
>>>  include/dm/read.h          | 9 +++++----
>>>  3 files changed, 9 insertions(+), 7 deletions(-)
>>
>> Acked-by: Simon Glass <sjg@chromium.org>
>
> Actually I take that back. I'd like all functions in read.h to start
> with dev_read...().
>

Do you want me to fix the return type?
Simon Glass July 14, 2017, 2:20 p.m. | #4
Hi Masahiro,

On 13 July 2017 at 20:38, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> Hi Simon,
>
>
> 2017-07-07 12:57 GMT+09:00 Simon Glass <sjg@chromium.org>:
>> Hi Masahiro,
>>
>> On 5 July 2017 at 22:49, Simon Glass <sjg@chromium.org> wrote:
>>> On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>>>> The previous commit renamed ofnode_read_prop() to ofnode_get_propery()
>>>> and fixed its return type.  Likewise, rename dev_read_prop() and fix
>>>> its return type.
>>>>
>>>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>>>> ---
>>>>
>>>>  drivers/core/read.c        | 3 ++-
>>>>  drivers/input/key_matrix.c | 4 ++--
>>>>  include/dm/read.h          | 9 +++++----
>>>>  3 files changed, 9 insertions(+), 7 deletions(-)
>>>
>>> Acked-by: Simon Glass <sjg@chromium.org>
>>
>> Actually I take that back. I'd like all functions in read.h to start
>> with dev_read...().
>>
>
> Do you want me to fix the return type?

Yes void * would be better I suppose. Also what happened with that
patch with the DEBUG problem?

Regards,
Simon
Masahiro Yamada July 17, 2017, 3:29 a.m. | #5
Hi Simon,

2017-07-14 23:20 GMT+09:00 Simon Glass <sjg@chromium.org>:
> Hi Masahiro,
>
> On 13 July 2017 at 20:38, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>> Hi Simon,
>>
>>
>> 2017-07-07 12:57 GMT+09:00 Simon Glass <sjg@chromium.org>:
>>> Hi Masahiro,
>>>
>>> On 5 July 2017 at 22:49, Simon Glass <sjg@chromium.org> wrote:
>>>> On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>>>>> The previous commit renamed ofnode_read_prop() to ofnode_get_propery()
>>>>> and fixed its return type.  Likewise, rename dev_read_prop() and fix
>>>>> its return type.
>>>>>
>>>>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>>>>> ---
>>>>>
>>>>>  drivers/core/read.c        | 3 ++-
>>>>>  drivers/input/key_matrix.c | 4 ++--
>>>>>  include/dm/read.h          | 9 +++++----
>>>>>  3 files changed, 9 insertions(+), 7 deletions(-)
>>>>
>>>> Acked-by: Simon Glass <sjg@chromium.org>
>>>
>>> Actually I take that back. I'd like all functions in read.h to start
>>> with dev_read...().
>>>
>>
>> Do you want me to fix the return type?
>
> Yes void * would be better I suppose. Also what happened with that
> patch with the DEBUG problem?
>

Why do you need dm_dbg()
instead of generic debug() or pr_debug()?
Simon Glass July 28, 2017, 4:19 a.m. | #6
Hi Masahiro,

On 16 July 2017 at 21:29, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> Hi Simon,
>
> 2017-07-14 23:20 GMT+09:00 Simon Glass <sjg@chromium.org>:
>> Hi Masahiro,
>>
>> On 13 July 2017 at 20:38, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>>> Hi Simon,
>>>
>>>
>>> 2017-07-07 12:57 GMT+09:00 Simon Glass <sjg@chromium.org>:
>>>> Hi Masahiro,
>>>>
>>>> On 5 July 2017 at 22:49, Simon Glass <sjg@chromium.org> wrote:
>>>>> On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>>>>>> The previous commit renamed ofnode_read_prop() to ofnode_get_propery()
>>>>>> and fixed its return type.  Likewise, rename dev_read_prop() and fix
>>>>>> its return type.
>>>>>>
>>>>>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>>>>>> ---
>>>>>>
>>>>>>  drivers/core/read.c        | 3 ++-
>>>>>>  drivers/input/key_matrix.c | 4 ++--
>>>>>>  include/dm/read.h          | 9 +++++----
>>>>>>  3 files changed, 9 insertions(+), 7 deletions(-)
>>>>>
>>>>> Acked-by: Simon Glass <sjg@chromium.org>
>>>>
>>>> Actually I take that back. I'd like all functions in read.h to start
>>>> with dev_read...().
>>>>
>>>
>>> Do you want me to fix the return type?
>>
>> Yes void * would be better I suppose. Also what happened with that
>> patch with the DEBUG problem?
>>
>
> Why do you need dm_dbg()
> instead of generic debug() or pr_debug()?

I don't really understand the question, but debug() / pr_debug() are find.

Regards,
Simon
Masahiro Yamada July 28, 2017, 12:57 p.m. | #7
Hi Simon,


2017-07-28 13:19 GMT+09:00 Simon Glass <sjg@chromium.org>:
> Hi Masahiro,
>
> On 16 July 2017 at 21:29, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>> Hi Simon,
>>
>> 2017-07-14 23:20 GMT+09:00 Simon Glass <sjg@chromium.org>:
>>> Hi Masahiro,
>>>
>>> On 13 July 2017 at 20:38, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>>>> Hi Simon,
>>>>
>>>>
>>>> 2017-07-07 12:57 GMT+09:00 Simon Glass <sjg@chromium.org>:
>>>>> Hi Masahiro,
>>>>>
>>>>> On 5 July 2017 at 22:49, Simon Glass <sjg@chromium.org> wrote:
>>>>>> On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>>>>>>> The previous commit renamed ofnode_read_prop() to ofnode_get_propery()
>>>>>>> and fixed its return type.  Likewise, rename dev_read_prop() and fix
>>>>>>> its return type.
>>>>>>>
>>>>>>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>>>>>>> ---
>>>>>>>
>>>>>>>  drivers/core/read.c        | 3 ++-
>>>>>>>  drivers/input/key_matrix.c | 4 ++--
>>>>>>>  include/dm/read.h          | 9 +++++----
>>>>>>>  3 files changed, 9 insertions(+), 7 deletions(-)
>>>>>>
>>>>>> Acked-by: Simon Glass <sjg@chromium.org>
>>>>>
>>>>> Actually I take that back. I'd like all functions in read.h to start
>>>>> with dev_read...().
>>>>>
>>>>
>>>> Do you want me to fix the return type?
>>>
>>> Yes void * would be better I suppose. Also what happened with that
>>> patch with the DEBUG problem?
>>>
>>
>> Why do you need dm_dbg()
>> instead of generic debug() or pr_debug()?
>
> I don't really understand the question, but debug() / pr_debug() are find.
>


In U-Boot, debug() is often used for debugging.

My question was, why don't you use it in DM core too?
(Then dm_dbg() will be unnecessary, I think.)
Simon Glass Aug. 6, 2017, 5:16 a.m. | #8
Hi Masahiro,

On 28 July 2017 at 06:57, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
> Hi Simon,
>
>
> 2017-07-28 13:19 GMT+09:00 Simon Glass <sjg@chromium.org>:
>> Hi Masahiro,
>>
>> On 16 July 2017 at 21:29, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>>> Hi Simon,
>>>
>>> 2017-07-14 23:20 GMT+09:00 Simon Glass <sjg@chromium.org>:
>>>> Hi Masahiro,
>>>>
>>>> On 13 July 2017 at 20:38, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>>>>> Hi Simon,
>>>>>
>>>>>
>>>>> 2017-07-07 12:57 GMT+09:00 Simon Glass <sjg@chromium.org>:
>>>>>> Hi Masahiro,
>>>>>>
>>>>>> On 5 July 2017 at 22:49, Simon Glass <sjg@chromium.org> wrote:
>>>>>>> On 22 June 2017 at 01:54, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>>>>>>>> The previous commit renamed ofnode_read_prop() to ofnode_get_propery()
>>>>>>>> and fixed its return type.  Likewise, rename dev_read_prop() and fix
>>>>>>>> its return type.
>>>>>>>>
>>>>>>>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>>>>>>>> ---
>>>>>>>>
>>>>>>>>  drivers/core/read.c        | 3 ++-
>>>>>>>>  drivers/input/key_matrix.c | 4 ++--
>>>>>>>>  include/dm/read.h          | 9 +++++----
>>>>>>>>  3 files changed, 9 insertions(+), 7 deletions(-)
>>>>>>>
>>>>>>> Acked-by: Simon Glass <sjg@chromium.org>
>>>>>>
>>>>>> Actually I take that back. I'd like all functions in read.h to start
>>>>>> with dev_read...().
>>>>>>
>>>>>
>>>>> Do you want me to fix the return type?
>>>>
>>>> Yes void * would be better I suppose. Also what happened with that
>>>> patch with the DEBUG problem?
>>>>
>>>
>>> Why do you need dm_dbg()
>>> instead of generic debug() or pr_debug()?
>>
>> I don't really understand the question, but debug() / pr_debug() are find.
>>
>
>
> In U-Boot, debug() is often used for debugging.
>
> My question was, why don't you use it in DM core too?
> (Then dm_dbg() will be unnecessary, I think.)

I am not quite sure - perhaps Marek will remember.

Regards,
Simon

Patch

diff --git a/drivers/core/read.c b/drivers/core/read.c
index c1fe949808fa..61fda9334a7c 100644
--- a/drivers/core/read.c
+++ b/drivers/core/read.c
@@ -104,7 +104,8 @@  int dev_read_phandle(struct udevice *dev)
 		return fdt_get_phandle(gd->fdt_blob, ofnode_to_offset(node));
 }
 
-const u32 *dev_read_prop(struct udevice *dev, const char *propname, int *lenp)
+const void *dev_get_property(struct udevice *dev, const char *propname,
+			     int *lenp)
 {
 	return ofnode_get_property(dev_ofnode(dev), propname, lenp);
 }
diff --git a/drivers/input/key_matrix.c b/drivers/input/key_matrix.c
index cd5bce361356..3669019cb9ff 100644
--- a/drivers/input/key_matrix.c
+++ b/drivers/input/key_matrix.c
@@ -144,7 +144,7 @@  int key_matrix_decode_fdt(struct udevice *dev, struct key_matrix *config)
 	int proplen;
 	uchar *plain_keycode;
 
-	prop = dev_read_prop(dev, "linux,keymap", &proplen);
+	prop = dev_get_property(dev, "linux,keymap", &proplen);
 	/* Basic keymap is required */
 	if (!prop) {
 		debug("%s: cannot find keycode-plain map\n", __func__);
@@ -158,7 +158,7 @@  int key_matrix_decode_fdt(struct udevice *dev, struct key_matrix *config)
 	if (!config->plain_keycode)
 		return -1;
 
-	prop = dev_read_prop(dev, "linux,fn-keymap", &proplen);
+	prop = dev_get_property(dev, "linux,fn-keymap", &proplen);
 	/* fn keymap is optional */
 	if (!prop)
 		goto done;
diff --git a/include/dm/read.h b/include/dm/read.h
index 562881962a64..74d5490ad2ce 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -227,14 +227,15 @@  int dev_read_size_cells(struct udevice *dev);
 int dev_read_phandle(struct udevice *dev);
 
 /**
- * dev_read_prop()- - read a property from a device's node
+ * dev_get_property()- - get a pointer to the value of a device's node
  *
  * @dev: device to check
  * @propname: property to read
  * @lenp: place to put length on success
  * @return pointer to property, or NULL if not found
  */
-const u32 *dev_read_prop(struct udevice *dev, const char *propname, int *lenp);
+const void *dev_get_property(struct udevice *dev, const char *propname,
+			     int *lenp);
 
 /**
  * dev_read_alias_seq() - Get the alias sequence number of a node
@@ -386,8 +387,8 @@  static inline int dev_read_phandle(struct udevice *dev)
 	return fdt_get_phandle(gd->fdt_blob, dev_of_offset(dev));
 }
 
-static inline const u32 *dev_read_prop(struct udevice *dev,
-				       const char *propname, int *lenp)
+static inline const void *dev_get_property(struct udevice *dev,
+					  const char *propname, int *lenp)
 {
 	return ofnode_get_property(dev_ofnode(dev), propname, lenp);
 }