From patchwork Mon Jun 16 16:17:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 31987 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5F3B820E7A for ; Mon, 16 Jun 2014 16:20:09 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id m1sf33590650oag.9 for ; Mon, 16 Jun 2014 09:20:09 -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=Lyw/HBiy3vzAQg1b8/tnkR/7GRfwzqJaLmKG4XpktSU=; b=CrIh5yL5pBD1mQoaHNsnGM3oF02AzAMIFaS1S0Q36cILZM4FrEhmxibP1P2p9Zsxa3 9klrRv7j8wqaq6JTIT+Sayehcww34phYY5JCwbxZFTwPmAFpDvUWNFCTBA5xZgTJNk2c MWvbSiuwZXYPfOcekbrXmtmTLpISXZgMDce4VmhQF2uGPs4cH9R/t5w/CbRT7hfY0cQ7 +1Yiko7XfgAJYGqNKA4wguZ6AIFVpba0CWFxcaL0UTs2I/aB/CC3r4RShdzOmuI3Wy3H 0Rd9tzRpDTdxBPEK58xHmQYhHbYnmQCqmQJnLl6H/5IQTlgeqrONy2htYlhP/LyR59ni 4EIQ== X-Gm-Message-State: ALoCoQlJYxfQezrlXMm/4WX94SeaX4V3nW/hLWMpi1711ajuTySg6XKNjkWBDLCBvy8Ne0PBXuC4 X-Received: by 10.50.138.194 with SMTP id qs2mr3657770igb.6.1402935608953; Mon, 16 Jun 2014 09:20:08 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.40.209 with SMTP id x75ls4278318qgx.46.gmail; Mon, 16 Jun 2014 09:20:08 -0700 (PDT) X-Received: by 10.52.190.138 with SMTP id gq10mr1399058vdc.47.1402935608817; Mon, 16 Jun 2014 09:20:08 -0700 (PDT) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id ty10si4274634vdc.73.2014.06.16.09.20.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Jun 2014 09:20:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.177 as permitted sender) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id i13so2631118veh.8 for ; Mon, 16 Jun 2014 09:20:08 -0700 (PDT) X-Received: by 10.58.186.207 with SMTP id fm15mr16859475vec.4.1402935608740; Mon, 16 Jun 2014 09:20:08 -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.54.6 with SMTP id vs6csp146180vcb; Mon, 16 Jun 2014 09:20:08 -0700 (PDT) X-Received: by 10.58.110.106 with SMTP id hz10mr2700669veb.30.1402935606740; Mon, 16 Jun 2014 09:20:06 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id 13si4270157vdg.106.2014.06.16.09.20.06 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 16 Jun 2014 09:20:06 -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 1WwZc4-0006kH-1o; Mon, 16 Jun 2014 16:18:28 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WwZc2-0006jS-Dy for xen-devel@lists.xenproject.org; Mon, 16 Jun 2014 16:18:26 +0000 Received: from [193.109.254.147:12552] by server-4.bemta-14.messagelabs.com id 00/D5-02781-1D81F935; Mon, 16 Jun 2014 16:18:25 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-4.tower-27.messagelabs.com!1402935505!11611125!1 X-Originating-IP: [209.85.212.178] 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 5079 invoked from network); 16 Jun 2014 16:18:25 -0000 Received: from mail-wi0-f178.google.com (HELO mail-wi0-f178.google.com) (209.85.212.178) by server-4.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 16 Jun 2014 16:18:25 -0000 Received: by mail-wi0-f178.google.com with SMTP id n15so4381059wiw.5 for ; Mon, 16 Jun 2014 09:18:25 -0700 (PDT) X-Received: by 10.180.14.40 with SMTP id m8mr28944126wic.50.1402935504923; Mon, 16 Jun 2014 09:18:24 -0700 (PDT) Received: from belegaer.uk.xensource.com ([185.25.64.249]) by mx.google.com with ESMTPSA id l45sm34836161eep.25.2014.06.16.09.18.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Jun 2014 09:18:24 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 16 Jun 2014 17:17:54 +0100 Message-Id: <1402935486-29136-8-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1402935486-29136-1-git-send-email-julien.grall@linaro.org> References: <1402935486-29136-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] [RFC 07/19] 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.128.177 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 --- 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, 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, 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, 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 25db076..e413447 100644 --- a/xen/include/xen/device_tree.h +++ b/xen/include/xen/device_tree.h @@ -502,7 +502,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); /** @@ -532,7 +532,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); /** @@ -544,7 +544,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); /**