[U-Boot] [PATCH] gpio: xilinx: Add support for using label property

Michal Simek michal.simek at xilinx.com
Mon Aug 6 06:43:33 UTC 2018


On 5.8.2018 09:56, Stefan Herbrechtsmeier wrote:
> Am 02.08.2018 um 13:31 schrieb Michal Simek:
>> Add support for reading label property from DT and set up bank name
>> based on that. If label property is not present full device node name is
>> used.
>>
>> Signed-off-by: Michal Simek <michal.simek at xilinx.com>
>> ---
>>
>>   drivers/gpio/xilinx_gpio.c | 14 ++++++++++++--
>>   drivers/gpio/zynq_gpio.c   | 14 ++++++++++++--
>>   2 files changed, 24 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpio/xilinx_gpio.c b/drivers/gpio/xilinx_gpio.c
>> index cccfa7561739..da50d1634570 100644
>> --- a/drivers/gpio/xilinx_gpio.c
>> +++ b/drivers/gpio/xilinx_gpio.c
>> @@ -224,8 +224,18 @@ static int xilinx_gpio_probe(struct udevice *dev)
>>   {
>>       struct xilinx_gpio_platdata *platdata = dev_get_platdata(dev);
>>       struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
>> -
>> -    uc_priv->bank_name = dev->name;
>> +    const void *label_ptr;
>> +    void *label_c;
>> +    int size;
>> +
>> +    label_ptr = dev_read_prop(dev, "label", &size);
>> +    if (label_ptr) {
>> +        label_c = calloc(1, size);
>> +        memcpy(label_c, label_ptr, size);
>> +        uc_priv->bank_name = label_c;
> 
> This could be simplified by the function strdup.

I have sent v2 with this change. Let's make it clean.

Thanks,
Michal



More information about the U-Boot mailing list