From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: [PATCH v2 11/21] xen/dts: Use unsigned int for MMIO and IRQ index Date: Thu, 31 Jul 2014 16:00:42 +0100 Message-ID: <1406818852-31856-12-git-send-email-julien.grall@linaro.org> References: <1406818852-31856-1-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 1XCrr4-0000d8-Ec for xen-devel@lists.xenproject.org; Thu, 31 Jul 2014 15:01:18 +0000 Received: by mail-wg0-f44.google.com with SMTP id m15so2865313wgh.27 for ; Thu, 31 Jul 2014 08:01:16 -0700 (PDT) In-Reply-To: <1406818852-31856-1-git-send-email-julien.grall@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: stefano.stabellini@citrix.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com List-Id: xen-devel@lists.xenproject.org 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 --- Changes in v2: - Use unsigned int instead fancy one like unsigned or uint32_t --- xen/common/device_tree.c | 11 ++++++----- xen/include/xen/device_tree.h | 7 ++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c index f72b2e9..315b62a 100644 --- a/xen/common/device_tree.c +++ b/xen/common/device_tree.c @@ -496,7 +496,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 int index, u64 *size, unsigned int *flags) { const __be32 *prop; @@ -683,7 +683,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; @@ -1006,7 +1006,8 @@ 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, + unsigned int index, struct dt_raw_irq *out_irq) { const struct dt_device_node *p; @@ -1014,7 +1015,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 */ @@ -1065,7 +1066,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, unsigned int index, struct dt_irq *out_irq) { struct dt_raw_irq raw; diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h index 08db8bc..2115a0c 100644 --- a/xen/include/xen/device_tree.h +++ b/xen/include/xen/device_tree.h @@ -460,7 +460,7 @@ const struct dt_device_node *dt_get_parent(const struct dt_device_node *node); * This function resolves an address, walking the tree, for a give * device-tree node. It returns 0 on success. */ -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); /** @@ -490,7 +490,7 @@ unsigned int dt_number_of_address(const struct dt_device_node *device); * This function resolves an interrupt, walking the tree, for a given * device-tree node. It's the high level pendant to dt_device_get_raw_irq(). */ -int dt_device_get_irq(const struct dt_device_node *device, int index, +int dt_device_get_irq(const struct dt_device_node *device, unsigned int index, struct dt_irq *irq); /** @@ -502,7 +502,8 @@ int dt_device_get_irq(const struct dt_device_node *device, int index, * This function resolves an interrupt for a device, no translation is * made. dt_irq_translate can be called after. */ -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, + unsigned int index, struct dt_raw_irq *irq); /** -- 1.7.10.4