From patchwork Wed Mar 2 07:34:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 8478421 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 BC3E89F38C for ; Wed, 2 Mar 2016 07:38:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CFCF720382 for ; Wed, 2 Mar 2016 07:38:26 +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 778852038A for ; Wed, 2 Mar 2016 07:38:25 +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 1ab1Kl-00059Q-CM; Wed, 02 Mar 2016 07:36:35 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1ab1Kk-00057y-96 for xen-devel@lists.xen.org; Wed, 02 Mar 2016 07:36:34 +0000 Received: from [85.158.137.68] by server-1.bemta-3.messagelabs.com id 97/AE-03306-10896D65; Wed, 02 Mar 2016 07:36:33 +0000 X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-15.tower-31.messagelabs.com!1456904190!25924415!1 X-Originating-IP: [119.145.14.66] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTE5LjE0NS4xNC42NiA9PiA4NTI3\n X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 33528 invoked from network); 2 Mar 2016 07:36:32 -0000 Received: from szxga03-in.huawei.com (HELO szxga03-in.huawei.com) (119.145.14.66) by server-15.tower-31.messagelabs.com with SMTP; 2 Mar 2016 07:36:32 -0000 Received: from 172.24.1.47 (EHLO SZXEML424-HUB.china.huawei.com) ([172.24.1.47]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BXB04008; Wed, 02 Mar 2016 15:35:41 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by SZXEML424-HUB.china.huawei.com (10.82.67.153) with Microsoft SMTP Server id 14.3.235.1; Wed, 2 Mar 2016 15:35:23 +0800 From: Shannon Zhao To: Date: Wed, 2 Mar 2016 15:34:39 +0800 Message-ID: <1456904083-13168-14-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1456904083-13168-1-git-send-email-zhaoshenglong@huawei.com> References: <1456904083-13168-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.0A020206.56D697CD.010F, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 868ac6e14a030ac9ef397a1229f32992 Cc: zhaoshenglong@huawei.com, stefano.stabellini@citrix.com, ian.campbell@citrix.com, shannon.zhao@linaro.org Subject: [Xen-devel] [PATCH v8 13/17] 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);