From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [RFC 07/19] xen/dts: Use unsigned int for MMIO and IRQ index Date: Thu, 19 Jun 2014 12:42:26 +0100 Message-ID: <53A2CCA2.9020304@linaro.org> References: <1402935486-29136-1-git-send-email-julien.grall@linaro.org> <1402935486-29136-8-git-send-email-julien.grall@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Wxajf-0004Z3-HA for xen-devel@lists.xenproject.org; Thu, 19 Jun 2014 11:42:31 +0000 Received: by mail-wi0-f170.google.com with SMTP id cc10so9949494wib.3 for ; Thu, 19 Jun 2014 04:42:29 -0700 (PDT) In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: xen-devel@lists.xenproject.org, stefano.stabellini@citrix.com, ian.campbell@citrix.com, tim@xen.org List-Id: xen-devel@lists.xenproject.org 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 >> --- >> 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