From patchwork Fri Feb 26 06:22:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 8431821 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DAD879F52D for ; Fri, 26 Feb 2016 06:26:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EF44920145 for ; Fri, 26 Feb 2016 06:26:43 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A22D220394 for ; Fri, 26 Feb 2016 06:26:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1aZBpL-0006JC-7f; Fri, 26 Feb 2016 06:24:35 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1aZBpJ-0006F9-Qc for xen-devel@lists.xen.org; Fri, 26 Feb 2016 06:24:33 +0000 Received: from [193.109.254.147] by server-4.bemta-14.messagelabs.com id E9/36-03301-1AFEFC65; Fri, 26 Feb 2016 06:24:33 +0000 X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-14.tower-27.messagelabs.com!1456467866!14667099!1 X-Originating-IP: [58.251.152.64] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 42077 invoked from network); 26 Feb 2016 06:24:31 -0000 Received: from szxga01-in.huawei.com (HELO szxga01-in.huawei.com) (58.251.152.64) by server-14.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 26 Feb 2016 06:24:31 -0000 Received: from 172.24.1.47 (EHLO SZXEML429-HUB.china.huawei.com) ([172.24.1.47]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DFG21620; Fri, 26 Feb 2016 14:24:12 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by SZXEML429-HUB.china.huawei.com (10.82.67.184) with Microsoft SMTP Server id 14.3.235.1; Fri, 26 Feb 2016 14:24:01 +0800 From: Shannon Zhao To: Date: Fri, 26 Feb 2016 14:22:54 +0800 Message-ID: <1456467780-8476-17-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1456467780-8476-1-git-send-email-zhaoshenglong@huawei.com> References: <1456467780-8476-1-git-send-email-zhaoshenglong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.56CFEF8D.0096, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 03a914f617910d1cc12554cd193af8d7 Cc: peter.huangpeng@huawei.com, stefano.stabellini@citrix.com, ian.campbell@citrix.com, shannon.zhao@linaro.org Subject: [Xen-devel] [PATCH v5 16/22] arm/irq: Add helper function for setting interrupt type X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Parth Dixit Add a helper function to set edge/level type information for an interrupt. Signed-off-by: Parth Dixit Signed-off-by: Shannon Zhao Acked-by: Stefano Stabellini --- xen/arch/arm/irq.c | 27 ++++++++++++++++----------- xen/include/asm-arm/irq.h | 2 ++ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c index 0ff5cbc..2f8af72 100644 --- a/xen/arch/arm/irq.c +++ b/xen/arch/arm/irq.c @@ -655,27 +655,32 @@ unlock: return ret; } +int irq_set_type(unsigned int irq, unsigned int type) +{ + int res; + + /* Setup the IRQ type */ + if ( irq < NR_LOCAL_IRQS ) + res = irq_local_set_type(irq, type); + else + res = irq_set_spi_type(irq, type); + + return res; +} + int platform_get_irq(const struct dt_device_node *device, int index) { struct dt_irq dt_irq; unsigned int type, irq; - int res; - res = dt_device_get_irq(device, index, &dt_irq); - if ( res ) + if ( dt_device_get_irq(device, index, &dt_irq) ) return -1; irq = dt_irq.irq; type = dt_irq.type; - /* Setup the IRQ type */ - if ( irq < NR_LOCAL_IRQS ) - res = irq_local_set_type(irq, type); - else - res = irq_set_spi_type(irq, type); - - if ( res ) - return -1; + if ( irq_set_type(irq, type) ) + return -1; return irq; } diff --git a/xen/include/asm-arm/irq.h b/xen/include/asm-arm/irq.h index f33c331..493773c 100644 --- a/xen/include/asm-arm/irq.h +++ b/xen/include/asm-arm/irq.h @@ -52,6 +52,8 @@ void arch_move_irqs(struct vcpu *v); /* Set IRQ type for an SPI */ int irq_set_spi_type(unsigned int spi, unsigned int type); +int irq_set_type(unsigned int irq, unsigned int type); + int platform_get_irq(const struct dt_device_node *device, int index); void irq_set_affinity(struct irq_desc *desc, const cpumask_t *cpu_mask);