diff mbox

[U-Boot,v2,2/7] rockchip: pinctrl: rv1108: access of-offset via dev_of_offset(...)

Message ID 1496756553-19901-3-git-send-email-philipp.tomsich@theobroma-systems.com
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Philipp Tomsich June 6, 2017, 1:42 p.m. UTC
After rebasing to u-boot-rockchip/master@2b19b2f, buildman fails for
rv1108 with:
  ../drivers/pinctrl/rockchip/pinctrl_rv1108.c: In function 'rv1108_pinctrl_get_periph_id':
  ../drivers/pinctrl/rockchip/pinctrl_rv1108.c:111:49: error: 'struct udevice' has no member named 'of_offset'
    ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset,
                                                     ^

This change access the of-offset of periph via the dev_of_offset()
helper-function to fix this issue and (hopefully) to ensure it doesn't
recur if there's more changes to the DM subsystem.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

---

Changes in v2:
- (new patch) access of-offset of periph via dev_of_offset in the RV1108
  pinctrl driver to fix a buildman failure for u-boot-rockchip/master@2b19b2f

 drivers/pinctrl/rockchip/pinctrl_rv1108.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Glass June 6, 2017, 9:09 p.m. UTC | #1
Hi,

On 6 June 2017 at 07:42, Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
> After rebasing to u-boot-rockchip/master@2b19b2f, buildman fails for
> rv1108 with:
>   ../drivers/pinctrl/rockchip/pinctrl_rv1108.c: In function 'rv1108_pinctrl_get_periph_id':
>   ../drivers/pinctrl/rockchip/pinctrl_rv1108.c:111:49: error: 'struct udevice' has no member named 'of_offset'
>     ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset,
>                                                      ^
>
> This change access the of-offset of periph via the dev_of_offset()
> helper-function to fix this issue and (hopefully) to ensure it doesn't
> recur if there's more changes to the DM subsystem.
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>
> ---
>
> Changes in v2:
> - (new patch) access of-offset of periph via dev_of_offset in the RV1108
>   pinctrl driver to fix a buildman failure for u-boot-rockchip/master@2b19b2f
>
>  drivers/pinctrl/rockchip/pinctrl_rv1108.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/rockchip/pinctrl_rv1108.c b/drivers/pinctrl/rockchip/pinctrl_rv1108.c
> index d98ec81..bdf3910 100644
> --- a/drivers/pinctrl/rockchip/pinctrl_rv1108.c
> +++ b/drivers/pinctrl/rockchip/pinctrl_rv1108.c
> @@ -108,7 +108,7 @@ static int rv1108_pinctrl_get_periph_id(struct udevice *dev,
>         u32 cell[3];
>         int ret;
>
> -       ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset,
> +       ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph),
>                                    "interrupts", cell, ARRAY_SIZE(cell));

Could you use dev_read_u32_array() here instead? That is the new new
way :-) I added the dev_of_offset() as a transition mechanism but it
should not be used ideally.

>         if (ret < 0)
>                 return -EINVAL;
> --
> 2.1.4
>

Regards,
Simon
Philipp Tomsich June 7, 2017, 8 a.m. UTC | #2
Simon,

> On 06 Jun 2017, at 23:09, Simon Glass <sjg@chromium.org> wrote:
> 
> Hi,
> 
> On 6 June 2017 at 07:42, Philipp Tomsich
> <philipp.tomsich@theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>> wrote:
>> After rebasing to u-boot-rockchip/master@2b19b2f, buildman fails for
>> rv1108 with:
>>  ../drivers/pinctrl/rockchip/pinctrl_rv1108.c: In function 'rv1108_pinctrl_get_periph_id':
>>  ../drivers/pinctrl/rockchip/pinctrl_rv1108.c:111:49: error: 'struct udevice' has no member named 'of_offset'
>>    ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset,
>>                                                     ^
>> 
>> This change access the of-offset of periph via the dev_of_offset()
>> helper-function to fix this issue and (hopefully) to ensure it doesn't
>> recur if there's more changes to the DM subsystem.
>> 
>> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>> 
>> ---
>> 
>> Changes in v2:
>> - (new patch) access of-offset of periph via dev_of_offset in the RV1108
>>  pinctrl driver to fix a buildman failure for u-boot-rockchip/master@2b19b2f
>> 
>> drivers/pinctrl/rockchip/pinctrl_rv1108.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/drivers/pinctrl/rockchip/pinctrl_rv1108.c b/drivers/pinctrl/rockchip/pinctrl_rv1108.c
>> index d98ec81..bdf3910 100644
>> --- a/drivers/pinctrl/rockchip/pinctrl_rv1108.c
>> +++ b/drivers/pinctrl/rockchip/pinctrl_rv1108.c
>> @@ -108,7 +108,7 @@ static int rv1108_pinctrl_get_periph_id(struct udevice *dev,
>>        u32 cell[3];
>>        int ret;
>> 
>> -       ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset,
>> +       ret =fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph),
>>                                   "interrupts", cell, ARRAY_SIZE(cell));
> 
> Could you use dev_read_u32_array() here instead? That is the new new
> way :-) I added the dev_of_offset() as a transition mechanism but it
> should not be used ideally.

A quick grep shows that only simple-bus.c uses the new way of doing things, yet.

Please use this one as-is and I’ll send another series (to be applied on top of this)
to rewrite to dev_read_u32_array() across the entire driver population.

Regards,
Philipp.
Philipp Tomsich June 7, 2017, 4:51 p.m. UTC | #3
Simon,

> On 07 Jun 2017, at 10:00, Dr. Philipp Tomsich <philipp.tomsich@theobroma-systems.com> wrote:
> 
>> On 06 Jun 2017, at 23:09, Simon Glass <sjg@chromium.org <mailto:sjg@chromium.org>> wrote:
>> 
>> On 6 June 2017 at 07:42, Philipp Tomsich
>> <philipp.tomsich@theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>> wrote:
>>> After rebasing to u-boot-rockchip/master@2b19b2f, buildman fails for
>>> rv1108 with:
>>>  ../drivers/pinctrl/rockchip/pinctrl_rv1108.c: In function 'rv1108_pinctrl_get_periph_id':
>>>  ../drivers/pinctrl/rockchip/pinctrl_rv1108.c:111:49: error: 'struct udevice' has no member named 'of_offset'
>>>    ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset,
>>>                                                     ^
>>> 
>>> This change access the of-offset of periph via the dev_of_offset()
>>> helper-function to fix this issue and (hopefully) to ensure it doesn't
>>> recur if there's more changes to the DM subsystem.
>>> 
>>> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>>
>>> 
>>> ---
>>> 
>>> Changes in v2:
>>> - (new patch) access of-offset of periph via dev_of_offset in the RV1108
>>>  pinctrl driver to fix a buildman failure for u-boot-rockchip/master@2b19b2f
>>> 
>>> drivers/pinctrl/rockchip/pinctrl_rv1108.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>> 
>>> diff --git a/drivers/pinctrl/rockchip/pinctrl_rv1108.c b/drivers/pinctrl/rockchip/pinctrl_rv1108.c
>>> index d98ec81..bdf3910 100644
>>> --- a/drivers/pinctrl/rockchip/pinctrl_rv1108.c
>>> +++ b/drivers/pinctrl/rockchip/pinctrl_rv1108.c
>>> @@ -108,7 +108,7 @@ static int rv1108_pinctrl_get_periph_id(struct udevice *dev,
>>>        u32 cell[3];
>>>        int ret;
>>> 
>>> -       ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset,
>>> +       ret =fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph),
>>>                                   "interrupts", cell, ARRAY_SIZE(cell));
>> 
>> Could you use dev_read_u32_array() here instead? That is the new new
>> way :-) I added the dev_of_offset() as a transition mechanism but it
>> should not be used ideally.
> 
> A quick grep shows that only simple-bus.c uses the new way of doing things, yet.
> 
> Please use this one as-is and I’ll send another series (to be applied on top of this)
> to rewrite to dev_read_u32_array() across the entire driver population.

I dropped a change-set for most fdt_get occurrences in the rockchip subarch (and
common drivers used by those boards).

However, there’s at least one fdtdev_get function that I didn’t find an equivalent for:
	fdtdec_get_int_array_count
In case you are wondering: this one is used RK3188 and RK3288 pinctrl-drivers…

Regards,
Philipp.
Simon Glass June 7, 2017, 4:56 p.m. UTC | #4
Hi,

On 7 June 2017 at 10:51, Dr. Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
> Simon,
>
> On 07 Jun 2017, at 10:00, Dr. Philipp Tomsich
> <philipp.tomsich@theobroma-systems.com> wrote:
>
> On 06 Jun 2017, at 23:09, Simon Glass <sjg@chromium.org> wrote:
>
> On 6 June 2017 at 07:42, Philipp Tomsich
> <philipp.tomsich@theobroma-systems.com> wrote:
>
> After rebasing to u-boot-rockchip/master@2b19b2f, buildman fails for
> rv1108 with:
>  ../drivers/pinctrl/rockchip/pinctrl_rv1108.c: In function
> 'rv1108_pinctrl_get_periph_id':
>  ../drivers/pinctrl/rockchip/pinctrl_rv1108.c:111:49: error: 'struct
> udevice' has no member named 'of_offset'
>    ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset,
>                                                     ^
>
> This change access the of-offset of periph via the dev_of_offset()
> helper-function to fix this issue and (hopefully) to ensure it doesn't
> recur if there's more changes to the DM subsystem.
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>
> ---
>
> Changes in v2:
> - (new patch) access of-offset of periph via dev_of_offset in the RV1108
>  pinctrl driver to fix a buildman failure for u-boot-rockchip/master@2b19b2f
>
> drivers/pinctrl/rockchip/pinctrl_rv1108.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/rockchip/pinctrl_rv1108.c
> b/drivers/pinctrl/rockchip/pinctrl_rv1108.c
> index d98ec81..bdf3910 100644
> --- a/drivers/pinctrl/rockchip/pinctrl_rv1108.c
> +++ b/drivers/pinctrl/rockchip/pinctrl_rv1108.c
> @@ -108,7 +108,7 @@ static int rv1108_pinctrl_get_periph_id(struct udevice
> *dev,
>        u32 cell[3];
>        int ret;
>
> -       ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset,
> +       ret =fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph),
>
>                                   "interrupts", cell, ARRAY_SIZE(cell));
>
>
> Could you use dev_read_u32_array() here instead? That is the new new
> way :-) I added the dev_of_offset() as a transition mechanism but it
> should not be used ideally.
>
>
> A quick grep shows that only simple-bus.c uses the new way of doing things,
> yet.
>
> Please use this one as-is and I’ll send another series (to be applied on top
> of this)
> to rewrite to dev_read_u32_array() across the entire driver population.
>
>
> I dropped a change-set for most fdt_get occurrences in the rockchip subarch
> (and
> common drivers used by those boards).

Great!

>
> However, there’s at least one fdtdev_get function that I didn’t find an
> equivalent for:
> fdtdec_get_int_array_count
> In case you are wondering: this one is used RK3188 and RK3288
> pinctrl-drivers…

OK - would you like to add one? It could be dev_read_u32_array() / ofnode_...

Regards,
Simon
Philipp Tomsich June 7, 2017, 5:04 p.m. UTC | #5
> On 07 Jun 2017, at 18:56, Simon Glass <sjg@chromium.org> wrote:
> 
> Hi,
> 
> On 7 June 2017 at 10:51, Dr. Philipp Tomsich
> <philipp.tomsich@theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>> wrote:
>> Simon,
>> 
>> On 07 Jun 2017, at 10:00, Dr. Philipp Tomsich
>> <philipp.tomsich@theobroma-systems.com> wrote:
>> 
>> On 06 Jun 2017, at 23:09, Simon Glass <sjg@chromium.org> wrote:
>> 
>> On 6 June 2017 at 07:42, Philipp Tomsich
>> <philipp.tomsich@theobroma-systems.com> wrote:
>> 
>> After rebasing to u-boot-rockchip/master@2b19b2f, buildman fails for
>> rv1108 with:
>> ../drivers/pinctrl/rockchip/pinctrl_rv1108.c: In function
>> 'rv1108_pinctrl_get_periph_id':
>> ../drivers/pinctrl/rockchip/pinctrl_rv1108.c:111:49: error: 'struct
>> udevice' has no member named 'of_offset'
>>   ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset,
>>                                                    ^
>> 
>> This change access the of-offset of periph via the dev_of_offset()
>> helper-function to fix this issue and (hopefully) to ensure it doesn't
>> recur if there's more changes to the DM subsystem.
>> 
>> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>> 
>> ---
>> 
>> Changes in v2:
>> - (new patch) access of-offset of periph via dev_of_offset in the RV1108
>> pinctrl driver to fix a buildman failure for u-boot-rockchip/master@2b19b2f
>> 
>> drivers/pinctrl/rockchip/pinctrl_rv1108.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/drivers/pinctrl/rockchip/pinctrl_rv1108.c
>> b/drivers/pinctrl/rockchip/pinctrl_rv1108.c
>> index d98ec81..bdf3910 100644
>> --- a/drivers/pinctrl/rockchip/pinctrl_rv1108.c
>> +++ b/drivers/pinctrl/rockchip/pinctrl_rv1108.c
>> @@ -108,7 +108,7 @@ static int rv1108_pinctrl_get_periph_id(struct udevice
>> *dev,
>>       u32 cell[3];
>>       int ret;
>> 
>> -       ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset,
>> +       ret =fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph),
>> 
>>                                  "interrupts", cell, ARRAY_SIZE(cell));
>> 
>> 
>> Could you use dev_read_u32_array() here instead? That is the new new
>> way :-) I added the dev_of_offset() as a transition mechanism but it
>> should not be used ideally.
>> 
>> 
>> A quick grep shows that only simple-bus.c uses the new way of doing things,
>> yet.
>> 
>> Please use this one as-is and I’ll send another series (to be applied on top
>> of this)
>> to rewrite to dev_read_u32_array() across the entire driver population.
>> 
>> 
>> I dropped a change-set for most fdt_get occurrences in the rockchip subarch
>> (and
>> common drivers used by those boards).
> 
> Great!
> 
>> 
>> However, there’s at least one fdtdev_get function that I didn’t find an
>> equivalent for:
>> fdtdec_get_int_array_count
>> In case you are wondering: this one is used RK3188 and RK3288
>> pinctrl-drivers…
> 
> OK - would you like to add one? It could be dev_read_u32_array() / ofnode_…

No problem, will do.
I just wanted to make sure that this wasn’t left out for a reason (e.g. to deprecate
it in the near future)…

Cheers,
Philipp.
Simon Glass June 8, 2017, 3:34 a.m. UTC | #6
> On 07 Jun 2017, at 18:56, Simon Glass <sjg@chromium.org> wrote:
>
> Hi,
>
> On 7 June 2017 at 10:51, Dr. Philipp Tomsich
> <philipp.tomsich@theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>> wrote:
>> Simon,
>>
>> On 07 Jun 2017, at 10:00, Dr. Philipp Tomsich
>> <philipp.tomsich@theobroma-systems.com> wrote:
>>
>> On 06 Jun 2017, at 23:09, Simon Glass <sjg@chromium.org> wrote:
>>
>> On 6 June 2017 at 07:42, Philipp Tomsich
>> <philipp.tomsich@theobroma-systems.com> wrote:
>>
>> After rebasing to u-boot-rockchip/master@2b19b2f, buildman fails for
>> rv1108 with:
>> ../drivers/pinctrl/rockchip/pinctrl_rv1108.c: In function
>> 'rv1108_pinctrl_get_periph_id':
>> ../drivers/pinctrl/rockchip/pinctrl_rv1108.c:111:49: error: 'struct
>> udevice' has no member named 'of_offset'
>>   ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset,
>>                                                    ^
>>
>> This change access the of-offset of periph via the dev_of_offset()
>> helper-function to fix this issue and (hopefully) to ensure it doesn't
>> recur if there's more changes to the DM subsystem.
>>
>> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>>
>> ---
>>
>> Changes in v2:
>> - (new patch) access of-offset of periph via dev_of_offset in the RV1108
>> pinctrl driver to fix a buildman failure for u-boot-rockchip/master@2b19b2f
>>
>> drivers/pinctrl/rockchip/pinctrl_rv1108.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
Applied to u-boot-rockchip, thanks!
diff mbox

Patch

diff --git a/drivers/pinctrl/rockchip/pinctrl_rv1108.c b/drivers/pinctrl/rockchip/pinctrl_rv1108.c
index d98ec81..bdf3910 100644
--- a/drivers/pinctrl/rockchip/pinctrl_rv1108.c
+++ b/drivers/pinctrl/rockchip/pinctrl_rv1108.c
@@ -108,7 +108,7 @@  static int rv1108_pinctrl_get_periph_id(struct udevice *dev,
 	u32 cell[3];
 	int ret;
 
-	ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset,
+	ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph),
 				   "interrupts", cell, ARRAY_SIZE(cell));
 	if (ret < 0)
 		return -EINVAL;