[U-Boot] [U-Boot,v3,04/19] dm: core: add dev_read_addr_ptr()
Heinrich Schuchardt
xypron.glpk at gmx.de
Fri Oct 6 18:50:08 UTC 2017
On 10/06/2017 02:00 PM, Dr. Philipp Tomsich wrote:
>
>> On 6 Oct 2017, at 13:47, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>>
>> On 09/11/2017 10:04 PM, Philipp Tomsich wrote:
>>> The dev_read_addr_ptr() mimics the behaviour of the devfdt_get_addr_ptr(),
>>> retrieving the first address of the node's reg-property and returning
>>> it as a pointer (or NULL on failure).
>>>
>>> Signed-off-by: Philipp Tomsich <philipp.tomsich at theobroma-systems.com>
>>> Acked-by: Philipp Tomsich <philipp.tomsich at theobroma-systems.com>
>>> ---
>>>
>>> Changes in v3: None
>>> Changes in v2:
>>> - implements the dev_read_addr_ptr() function
>>>
>>> drivers/core/read.c | 7 +++++++
>>> include/dm/read.h | 15 +++++++++++++++
>>> 2 files changed, 22 insertions(+)
>>>
>>> diff --git a/drivers/core/read.c b/drivers/core/read.c
>>> index 6acb333..065589a 100644
>>> --- a/drivers/core/read.c
>>> +++ b/drivers/core/read.c
>>> @@ -57,6 +57,13 @@ fdt_addr_t dev_read_addr(struct udevice *dev)
>>> return dev_read_addr_index(dev, 0);
>>> }
>>>
>>> +void *dev_read_addr_ptr(struct udevice *dev)
>>> +{
>>> + fdt_addr_t addr = dev_read_addr(dev);
>>> +
>>> + return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)addr;
>>
>> Hello Philipp,
>>
>> this line produces a compiler warning:
>>
>> sandbox: + sandbox
>> + return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)addr;
>> + ^
>> w+drivers/core/read.c: In function ?dev_read_addr_ptr?:
>> w+drivers/core/read.c:64:44: warning: cast to pointer from integer of
>> different size [-Wint-to-pointer-cast]
>>
>> Could you, please, provide a follow-up patch.
>
> Heinrich,
>
> I don’t fully understand what exactly to do here, as there is a patch to
> address this in flight (https://patchwork.ozlabs.org/patch/819567/) and
> you had even been on the CC-list for that one…
>
> Regards,
> Philipp.
Sorry for the noise.
Regards
Heinrich
>
>>
>> Regards
>>
>> Heinrich
>>
>>> +}
>>> +
>>> fdt_addr_t dev_read_addr_size(struct udevice *dev, const char *property,
>>> fdt_size_t *sizep)
>>> {
>>> diff --git a/include/dm/read.h b/include/dm/read.h
>>> index 49d69c9..e7f7125 100644
>>> --- a/include/dm/read.h
>>> +++ b/include/dm/read.h
>>> @@ -113,6 +113,16 @@ fdt_addr_t dev_read_addr_index(struct udevice *dev, int index);
>>> fdt_addr_t dev_read_addr(struct udevice *dev);
>>>
>>> /**
>>> + * dev_read_addr_ptr() - Get the reg property of a device
>>> + * as a pointer
>>> + *
>>> + * @dev: Device to read from
>>> + *
>>> + * @return pointer or NULL if not found
>>> + */
>>> +void *dev_read_addr_ptr(struct udevice *dev);
>>> +
>>> +/**
>>> * dev_read_addr_size() - get address and size from a device property
>>> *
>>> * This does no address translation. It simply reads an property that contains
>>> @@ -417,6 +427,11 @@ static inline fdt_addr_t dev_read_addr(struct udevice *dev)
>>> return devfdt_get_addr(dev);
>>> }
>>>
>>> +static inline void *dev_read_addr_ptr(struct udevice *dev)
>>> +{
>>> + return devfdt_get_addr_ptr(dev);
>>> +}
>>> +
>>> static inline fdt_addr_t dev_read_addr_size(struct udevice *dev,
>>> const char *propname,
>>> fdt_size_t *sizep)
>>>
>>
>
>
More information about the U-Boot
mailing list