From patchwork Thu Jul 31 15:00:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 34674 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B594920540 for ; Thu, 31 Jul 2014 15:03:10 +0000 (UTC) Received: by mail-wg0-f70.google.com with SMTP id l18sf1880236wgh.5 for ; Thu, 31 Jul 2014 08:03:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :list-archive:content-type:content-transfer-encoding; bh=sERl06aaB6OFP8XxGI5PSGJuWriHPXi3khY4HGrnNcs=; b=W6hmZ/CZ0BsRMMuQYEW/CbuL13ak6mXKScGEwnw+l12yo3vnKf2PpATB3y2YCIMztd YOEsoKSpWatfEQdYzfoJxTtaeqfjxP9/z0EHSkY2q5/mnWZ+GjZ5mf1i3NIrHdPYXzvb XsjH6mk4aNeU5B6TVqT9JiaOSjKvXMc4WSELyid/rioUEUlMtD0W/gzKMl66GOLPkhQ9 lzBMRaYrfoVQAOfBhLwwgG3Y0xg5VGcSEBo1fbw7N0VNNdwx7lN2eaQa0bBffWndCHtQ 5NGU2zrLEZFPZUXzTMHJS4+rwKhE/peq2x0oLrA15SpcxjLRi1G6iNixqSeKLiFmw3Cg RN2Q== X-Gm-Message-State: ALoCoQn+4fR71rdv2tVBXCMxeP2r25wpUUmrOQDcQis/NXzXWx3AXirJupU12CSvfdzLhNVltLkk X-Received: by 10.112.137.168 with SMTP id qj8mr1208040lbb.4.1406818988120; Thu, 31 Jul 2014 08:03:08 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.36.37 with SMTP id o34ls1008708qgo.67.gmail; Thu, 31 Jul 2014 08:03:08 -0700 (PDT) X-Received: by 10.52.12.229 with SMTP id b5mr15451399vdc.52.1406818988001; Thu, 31 Jul 2014 08:03:08 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id sx2si4615581vec.81.2014.07.31.08.03.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 31 Jul 2014 08:03:04 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id la4so4462045vcb.19 for ; Thu, 31 Jul 2014 08:03:04 -0700 (PDT) X-Received: by 10.52.129.165 with SMTP id nx5mr15437195vdb.25.1406818983798; Thu, 31 Jul 2014 08:03:03 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp25129vcb; Thu, 31 Jul 2014 08:03:03 -0700 (PDT) X-Received: by 10.50.39.8 with SMTP id l8mr19795108igk.13.1406818982264; Thu, 31 Jul 2014 08:03:02 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id o11si14830499icd.103.2014.07.31.08.03.01 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 31 Jul 2014 08:03:02 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XCrr6-0000fr-5D; Thu, 31 Jul 2014 15:01:20 +0000 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: from [85.158.137.68:42293] by server-10.bemta-3.messagelabs.com id 1F/2B-28313-D3A5AD35; Thu, 31 Jul 2014 15:01:17 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-8.tower-31.messagelabs.com!1406818876!11134972!1 X-Originating-IP: [74.125.82.44] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10175 invoked from network); 31 Jul 2014 15:01:16 -0000 Received: from mail-wg0-f44.google.com (HELO mail-wg0-f44.google.com) (74.125.82.44) by server-8.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 31 Jul 2014 15:01:16 -0000 Received: by mail-wg0-f44.google.com with SMTP id m15so2865313wgh.27 for ; Thu, 31 Jul 2014 08:01:16 -0700 (PDT) X-Received: by 10.180.211.19 with SMTP id my19mr16790709wic.2.1406818875700; Thu, 31 Jul 2014 08:01:15 -0700 (PDT) Received: from belegaer.uk.xensource.com ([185.25.64.249]) by mx.google.com with ESMTPSA id r20sm67128337wik.0.2014.07.31.08.01.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Jul 2014 08:01:15 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Thu, 31 Jul 2014 16:00:42 +0100 Message-Id: <1406818852-31856-12-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1406818852-31856-1-git-send-email-julien.grall@linaro.org> References: <1406818852-31856-1-git-send-email-julien.grall@linaro.org> Cc: stefano.stabellini@citrix.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com Subject: [Xen-devel] [PATCH v2 11/21] xen/dts: Use unsigned int for MMIO and IRQ index X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: 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 Acked-by: Stefano Stabellini --- 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); /**