From patchwork Sat Aug 13 16:14:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 3439 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5FE3524198 for ; Sat, 13 Aug 2011 16:01:03 +0000 (UTC) Received: from mail-ew0-f52.google.com (mail-ew0-f52.google.com [209.85.215.52]) by fiordland.canonical.com (Postfix) with ESMTP id 5191DA1837B for ; Sat, 13 Aug 2011 16:01:03 +0000 (UTC) Received: by mail-ew0-f52.google.com with SMTP id 28so2167074ewy.11 for ; Sat, 13 Aug 2011 09:01:03 -0700 (PDT) Received: by 10.213.32.131 with SMTP id c3mr138300ebd.94.1313251262264; Sat, 13 Aug 2011 09:01:02 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.213.102.5 with SMTP id e5cs22920ebo; Sat, 13 Aug 2011 09:01:02 -0700 (PDT) Received: from mr.google.com ([10.43.52.199]) by 10.43.52.199 with SMTP id vn7mr2639295icb.414.1313251261827 (num_hops = 1); Sat, 13 Aug 2011 09:01:01 -0700 (PDT) Received: by 10.43.52.199 with SMTP id vn7mr2181640icb.414.1313251260885; Sat, 13 Aug 2011 09:01:00 -0700 (PDT) Received: from mail-iy0-f170.google.com (mail-iy0-f170.google.com [209.85.210.170]) by mx.google.com with ESMTPS id md8si11039975icb.153.2011.08.13.09.01.00 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 13 Aug 2011 09:01:00 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.210.170 is neither permitted nor denied by best guess record for domain of shawn.guo@linaro.org) client-ip=209.85.210.170; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.170 is neither permitted nor denied by best guess record for domain of shawn.guo@linaro.org) smtp.mail=shawn.guo@linaro.org Received: by mail-iy0-f170.google.com with SMTP id 16so3848137iye.1 for ; Sat, 13 Aug 2011 09:01:00 -0700 (PDT) Received: by 10.42.155.70 with SMTP id t6mr1991603icw.117.1313251259377; Sat, 13 Aug 2011 09:00:59 -0700 (PDT) Received: from localhost.localdomain ([114.216.156.140]) by mx.google.com with ESMTPS id bv10sm1351925icb.1.2011.08.13.09.00.51 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 13 Aug 2011 09:00:58 -0700 (PDT) From: Shawn Guo To: linux-arm-kernel@lists.infradead.org Cc: Russell King - ARM Linux , Grant Likely , Sascha Hauer , Nicolas Pitre , patches@linaro.org, Shawn Guo Subject: [PATCH v2 3/8] gpio/mxc: add .to_irq for gpio chip Date: Sun, 14 Aug 2011 00:14:02 +0800 Message-Id: <1313252047-8820-4-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1313252047-8820-1-git-send-email-shawn.guo@linaro.org> References: <1313252047-8820-1-git-send-email-shawn.guo@linaro.org> It adds .to_irq support for gpio chip, so that __gpio_to_irq in gpiolib becomes usable. Signed-off-by: Shawn Guo --- drivers/gpio/gpio-mxc.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c index 4340aca..64aff20 100644 --- a/drivers/gpio/gpio-mxc.c +++ b/drivers/gpio/gpio-mxc.c @@ -337,6 +337,15 @@ static void __devinit mxc_gpio_get_hw(struct platform_device *pdev) mxc_gpio_hwtype = hwtype; } +static int mxc_gpio_to_irq(struct gpio_chip *gc, unsigned offset) +{ + struct bgpio_chip *bgc = to_bgpio_chip(gc); + struct mxc_gpio_port *port = + container_of(bgc, struct mxc_gpio_port, bgc); + + return port->virtual_irq_start + offset; +} + static int __devinit mxc_gpio_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -403,6 +412,7 @@ static int __devinit mxc_gpio_probe(struct platform_device *pdev) if (err) goto out_iounmap; + port->bgc.gc.to_irq = mxc_gpio_to_irq; port->bgc.gc.base = pdev->id * 32; port->bgc.dir = port->bgc.read_reg(port->bgc.reg_dir); port->bgc.data = port->bgc.read_reg(port->bgc.reg_set);