From patchwork Fri Apr 17 08:55:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pranavkumar Sawargaonkar X-Patchwork-Id: 461991 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5837F1402C2 for ; Fri, 17 Apr 2015 18:59:52 +1000 (AEST) Received: from localhost ([::1]:40269 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yj27q-00022W-98 for incoming@patchwork.ozlabs.org; Fri, 17 Apr 2015 04:59:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yj23z-0002Ps-Uo for qemu-devel@nongnu.org; Fri, 17 Apr 2015 04:55:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yj23w-0006sf-4L for qemu-devel@nongnu.org; Fri, 17 Apr 2015 04:55:51 -0400 Received: from mail-pd0-f182.google.com ([209.85.192.182]:36329) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yj23v-0006sY-VC for qemu-devel@nongnu.org; Fri, 17 Apr 2015 04:55:48 -0400 Received: by pdea3 with SMTP id a3so121834284pde.3 for ; Fri, 17 Apr 2015 01:55:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1nrpqUd+MFszfp83n/5ucka5TSAfX1y1QhtRu/RnbEc=; b=m3BjxOnXUnXm1urUUPNuESSxAYWVR+uH1/A502oz63/g6nYMDwZII7G3Iypf2GiayA AwErbi/CIFSy4Q+hMLYlkyQ2dnOfjh4iv9MS+cphpbaTWXTYvh2aDP10lW9Hm3+IojfF 2Jl9yOURDveZV9DDhWqKnyzl1EB806LyIYxG7TEuZGAwh8RM4udziEtKlrBXRL6aR9WS 7kDknrfRMc1UxcVL8GnLIrQyraAAee3EHeBkVye+GVomX9+MeAWOdkpgUczzHkIEkZHK 1y16wAlH7dqSa4K5rsX/LGpyKrHHsntGJnqsURGr9dUcSuU6uUaaY+UKy7174F7lK1nA rYuA== X-Gm-Message-State: ALoCoQkA5KW0po16FfpVei33aRDDtd2g6Tyk2iHIPH+nSrH7lavNM2y+rOSPSspSDXCfubWjtqSw X-Received: by 10.66.66.166 with SMTP id g6mr3751693pat.88.1429260947434; Fri, 17 Apr 2015 01:55:47 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id za6sm9463127pac.48.2015.04.17.01.55.42 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Apr 2015 01:55:46 -0700 (PDT) From: Pranavkumar Sawargaonkar To: qemu-devel@nongnu.org Date: Fri, 17 Apr 2015 14:25:10 +0530 Message-Id: <1429260911-24021-2-git-send-email-pranavkumar@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1429260911-24021-1-git-send-email-pranavkumar@linaro.org> References: <1429260911-24021-1-git-send-email-pranavkumar@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.192.182 Cc: peter.maydell@linaro.org, patches@apm.com, agraf@suse.de, Tushar Jagad , pbonzini@redhat.com, christoffer.dall@linaro.org, Pranavkumar Sawargaonkar Subject: [Qemu-devel] [PATCH 1/2] hw: irq: Add API to get irq number from qemu_irq X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch adds a new function to get irq number from qemu irq. Signed-off-by: Pranavkumar Sawargaonkar Signed-off-by: Tushar Jagad --- hw/core/irq.c | 9 +++++++++ include/hw/irq.h | 1 + 2 files changed, 10 insertions(+) diff --git a/hw/core/irq.c b/hw/core/irq.c index 8a62a36..0eeffdf 100644 --- a/hw/core/irq.c +++ b/hw/core/irq.c @@ -35,6 +35,15 @@ struct IRQState { int n; }; +int qemu_get_irq_num(qemu_irq irq) +{ + if (!irq) { + return -1; + } + + return irq->n; +} + void qemu_set_irq(qemu_irq irq, int level) { if (!irq) diff --git a/include/hw/irq.h b/include/hw/irq.h index 4c4c2ea..dd5220c 100644 --- a/include/hw/irq.h +++ b/include/hw/irq.h @@ -9,6 +9,7 @@ typedef struct IRQState *qemu_irq; typedef void (*qemu_irq_handler)(void *opaque, int n, int level); +int qemu_get_irq_num(qemu_irq irq); void qemu_set_irq(qemu_irq irq, int level); static inline void qemu_irq_raise(qemu_irq irq)