[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [RFC 07/19] xen/dts: Use unsigned int for MMIO and IRQ index



Hi Stefano,

On 06/18/2014 07:54 PM, Stefano Stabellini wrote:
> On Mon, 16 Jun 2014, Julien Grall wrote:
>> There is no reason to use signed integer for an index. Futhermore, this will
>> avoid possible issue when theses functions will be exposed to the guest
>> via new hypercalls.
>>
>> Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx>
>> ---
>>  xen/common/device_tree.c      |   10 +++++-----
>>  xen/include/xen/device_tree.h |    7 ++++---
>>  2 files changed, 9 insertions(+), 8 deletions(-)
>>
>> diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
>> index f0b17a3..4736e0d 100644
>> --- a/xen/common/device_tree.c
>> +++ b/xen/common/device_tree.c
>> @@ -876,7 +876,7 @@ static const struct dt_bus *dt_match_bus(const struct 
>> dt_device_node *np)
>>  }
>>  
>>  static const __be32 *dt_get_address(const struct dt_device_node *dev,
>> -                                    int index, u64 *size,
>> +                                    unsigned index, u64 *size,
> 
> It is the same thing but you might as well use unsigned int.

I forgot to add int here. I will do in the next version.

>>                                      unsigned int *flags)
>>  {
>>      const __be32 *prop;
>> @@ -1063,7 +1063,7 @@ bail:
>>  }
>>  
>>  /* dt_device_address - Translate device tree address and return it */
>> -int dt_device_get_address(const struct dt_device_node *dev, int index,
>> +int dt_device_get_address(const struct dt_device_node *dev, unsigned int 
>> index,
>>                            u64 *addr, u64 *size)
>>  {
>>      const __be32 *addrp;
>> @@ -1386,7 +1386,7 @@ fail:
>>      return -EINVAL;
>>  }
>>  
>> -int dt_device_get_raw_irq(const struct dt_device_node *device, int index,
>> +int dt_device_get_raw_irq(const struct dt_device_node *device, uint32_t 
>> index,
> 
> Why are you changing the other indexes to unsigned int and this one to
> uint32_t?

I don't remember. I will change it to unsigned int.

>>                            struct dt_raw_irq *out_irq)
>>  {
>>      const struct dt_device_node *p;
>> @@ -1394,7 +1394,7 @@ int dt_device_get_raw_irq(const struct dt_device_node 
>> *device, int index,
>>      u32 intsize, intlen;
>>      int res = -EINVAL;
>>  
>> -    dt_dprintk("dt_device_get_raw_irq: dev=%s, index=%d\n",
>> +    dt_dprintk("dt_device_get_raw_irq: dev=%s, index=%u\n",
>>                 device->full_name, index);
>>  
>>      /* Get the interrupts property */
>> @@ -1445,7 +1445,7 @@ int dt_irq_translate(const struct dt_raw_irq *raw,
>>                          &out_irq->irq, &out_irq->type);
>>  }
>>  
>> -int dt_device_get_irq(const struct dt_device_node *device, int index,
>> +int dt_device_get_irq(const struct dt_device_node *device, uint32_t index,
> 
> ditto

Same here :/.

Regards,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.