From patchwork Fri Aug 12 07:54:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 3401 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 C8F2923F41 for ; Fri, 12 Aug 2011 07:42:46 +0000 (UTC) Received: from mail-qw0-f52.google.com (mail-qw0-f52.google.com [209.85.216.52]) by fiordland.canonical.com (Postfix) with ESMTP id 90B02A18745 for ; Fri, 12 Aug 2011 07:42:46 +0000 (UTC) Received: by mail-qw0-f52.google.com with SMTP id 8so2136278qwb.11 for ; Fri, 12 Aug 2011 00:42:46 -0700 (PDT) Received: by 10.229.78.223 with SMTP id m31mr409768qck.98.1313134966332; Fri, 12 Aug 2011 00:42:46 -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.229.190.71 with SMTP id dh7cs140470qcb; Fri, 12 Aug 2011 00:42:46 -0700 (PDT) Received: from mr.google.com ([10.236.136.135]) by 10.236.136.135 with SMTP id w7mr2387347yhi.183.1313134966066 (num_hops = 1); Fri, 12 Aug 2011 00:42:46 -0700 (PDT) Received: by 10.236.136.135 with SMTP id w7mr1764698yhi.183.1313134965040; Fri, 12 Aug 2011 00:42:45 -0700 (PDT) Received: from mail-pz0-f45.google.com (mail-pz0-f45.google.com [209.85.210.45]) by mx.google.com with ESMTPS id x12si5999798wff.3.2011.08.12.00.42.44 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 12 Aug 2011 00:42:45 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.210.45 is neither permitted nor denied by best guess record for domain of shawn.guo@linaro.org) client-ip=209.85.210.45; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.45 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-pz0-f45.google.com with SMTP id 33so993892pzk.32 for ; Fri, 12 Aug 2011 00:42:44 -0700 (PDT) Received: by 10.143.96.35 with SMTP id y35mr346757wfl.237.1313134963946; Fri, 12 Aug 2011 00:42:43 -0700 (PDT) Received: from localhost.localdomain ([58.208.99.22]) by mx.google.com with ESMTPS id 14sm1379325wfl.5.2011.08.12.00.42.35 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 12 Aug 2011 00:42:43 -0700 (PDT) From: Shawn Guo To: linux-arm-kernel@lists.infradead.org Cc: Russell King - ARM Linux , Grant Likely , Nicolas Pitre , Sascha Hauer , patches@linaro.org, Shawn Guo Subject: [PATCH 3/6] gpio/mxc: add .to_irq for gpio chip Date: Fri, 12 Aug 2011 15:54:58 +0800 Message-Id: <1313135701-22456-4-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1313135701-22456-1-git-send-email-shawn.guo@linaro.org> References: <1313135701-22456-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 Cc: Grant Likely --- 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);