From patchwork Fri Sep 28 21:36:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11861 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 323CC23E42 for ; Fri, 28 Sep 2012 21:36:30 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id C7053A180DC for ; Fri, 28 Sep 2012 21:36:29 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so8011632iej.11 for ; Fri, 28 Sep 2012 14:36:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-provags-id:x-gm-message-state; bh=nDoPUvPfqICpYHDcre9hhpjlJXiC2PGLWOEAmcC7FpQ=; b=RfwAD/Nd30GqGgi34rmDvv7UDkq3sg5tYpjBYw+lut06V/+YOvf1D0mgwvMMIc+W8j 3OIQ8JRNmxt3k8sgiBSUrSdBLH4Oz5oRZdFOu116t+VJY30n5sj5cKnaRd0TD5AbJIhR 2Y6i2LfPzPeb4hpJml1EneDva6L8jDvCYQQ2VRga6oKSEneSgfwlybBh4wxt3aYSoGsz GwQwYRqybRUV6E9slXYvarJdevDWsJVqBY0tCM4BVylyshCPg6q0GBzU52Mgo5uSHpV/ uZ9jijQ4EitgGp40B3BMSVohHmYZiejS8QnsqccVQE4cSl5si4sYPkvRHNu+JhTe8tCV RJ+Q== Received: by 10.50.160.165 with SMTP id xl5mr71214igb.0.1348868189193; Fri, 28 Sep 2012 14:36:29 -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.50.184.232 with SMTP id ex8csp494989igc; Fri, 28 Sep 2012 14:36:28 -0700 (PDT) Received: by 10.216.85.212 with SMTP id u62mr4265732wee.185.1348868187494; Fri, 28 Sep 2012 14:36:27 -0700 (PDT) Received: from moutng.kundenserver.de (moutng.kundenserver.de. [212.227.126.186]) by mx.google.com with ESMTPS id u8si1922110wiw.9.2012.09.28.14.36.27 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 28 Sep 2012 14:36:27 -0700 (PDT) Received-SPF: neutral (google.com: 212.227.126.186 is neither permitted nor denied by best guess record for domain of arnd@arndb.de) client-ip=212.227.126.186; Authentication-Results: mx.google.com; spf=neutral (google.com: 212.227.126.186 is neither permitted nor denied by best guess record for domain of arnd@arndb.de) smtp.mail=arnd@arndb.de Received: from localhost.localdomain (HSI-KBW-149-172-5-253.hsi13.kabel-badenwuerttemberg.de [149.172.5.253]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0LiJAx-1TmOUI0vml-00mo9I; Fri, 28 Sep 2012 23:36:21 +0200 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, arm@kernel.org, Arnd Bergmann , Lars-Peter Clausen , Jonathan Cameron , Greg Kroah-Hartman Subject: [PATCH 07/12] staging/iio/lis3l02dq: fix building without irq_to_gpio Date: Fri, 28 Sep 2012 23:36:12 +0200 Message-Id: <1348868177-21205-8-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1348868177-21205-1-git-send-email-arnd@arndb.de> References: <1348868177-21205-1-git-send-email-arnd@arndb.de> X-Provags-ID: V02:K0:C76e+5/7KkLhmDCy42xx+CCBr6jhJyc2PSAu04CdD+e SzOjikNKjeKGezwsnfWctcq9Erb+u91Y3fOQlW2LPdOiltX7XX EMvdPDsKWf5YuJ5AyYT9UylPLnV6JNK1GvxWgNIg31F4XvnDCu yjvIECys2pP4ZOeHS96tDLZbMPCODoAxIW0ZoduIGw9lnQJQ7S aywmInVq3PHdJp/28ixNEj8yHGU5nvVM42+a+tU1zo234rWa/f iTcMBj+4iWpiY/ZrE1Zb5SsMdXuG+MMxOJwre5lNy/nC5O6nHi ZrMNh2xCW2loxORajJyRbm1Iq51a/iJmNmq4fDFp9Egg26GAJT 9YDTBt5QYweIbjX5QxanBzLJJY3+M0qR7iHgBpecApdA1MqMyx msuu3AcHAml/w== X-Gm-Message-State: ALoCoQkNvrtCenTggi4C0v6CbkwYNeZ2eNbwYx8jiSyOhTuVM9drSTCNfXXW2+KDDwrnGrDW09sI The driver has not been building for some time after the irq_to_gpio function has been removed from the kernel. The only board in the upstream kernel that provides this device is the "Stargate 2", which is also maintained by Jonathan Cameron. Rather than working around the problem by adding new platform data for this driver, this patch uses the of_gpio framework to get to the gpio number. However, the stargate2 code does not (yet) use DT based probing, so it is still broken, but at least building allyesconfig works again. Signed-off-by: Arnd Bergmann Cc: Lars-Peter Clausen Cc: Jonathan Cameron Cc: Greg Kroah-Hartman --- drivers/staging/iio/accel/lis3l02dq.h | 1 + drivers/staging/iio/accel/lis3l02dq_core.c | 10 ++++++---- drivers/staging/iio/accel/lis3l02dq_ring.c | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/staging/iio/accel/lis3l02dq.h b/drivers/staging/iio/accel/lis3l02dq.h index f9bcd41..2bac722 100644 --- a/drivers/staging/iio/accel/lis3l02dq.h +++ b/drivers/staging/iio/accel/lis3l02dq.h @@ -158,6 +158,7 @@ struct lis3l02dq_state { struct spi_device *us; struct iio_trigger *trig; struct mutex buf_lock; + int gpio; bool trigger_on; u8 tx[LIS3L02DQ_MAX_RX] ____cacheline_aligned; diff --git a/drivers/staging/iio/accel/lis3l02dq_core.c b/drivers/staging/iio/accel/lis3l02dq_core.c index 21b0469..d13c7e9 100644 --- a/drivers/staging/iio/accel/lis3l02dq_core.c +++ b/drivers/staging/iio/accel/lis3l02dq_core.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -690,6 +691,7 @@ static int __devinit lis3l02dq_probe(struct spi_device *spi) spi_set_drvdata(spi, indio_dev); st->us = spi; + st->gpio = of_get_gpio(spi->dev.of_node, 0); mutex_init(&st->buf_lock); indio_dev->name = spi->dev.driver->name; indio_dev->dev.parent = &spi->dev; @@ -711,7 +713,7 @@ static int __devinit lis3l02dq_probe(struct spi_device *spi) goto error_unreg_buffer_funcs; } - if (spi->irq && gpio_is_valid(irq_to_gpio(spi->irq)) > 0) { + if (spi->irq) { ret = request_threaded_irq(st->us->irq, &lis3l02dq_th, &lis3l02dq_event_handler, @@ -738,10 +740,10 @@ static int __devinit lis3l02dq_probe(struct spi_device *spi) return 0; error_remove_trigger: - if (spi->irq && gpio_is_valid(irq_to_gpio(spi->irq))) + if (spi->irq) lis3l02dq_remove_trigger(indio_dev); error_free_interrupt: - if (spi->irq && gpio_is_valid(irq_to_gpio(spi->irq)) > 0) + if (spi->irq) free_irq(st->us->irq, indio_dev); error_uninitialize_buffer: iio_buffer_unregister(indio_dev); @@ -790,7 +792,7 @@ static int __devexit lis3l02dq_remove(struct spi_device *spi) lis3l02dq_disable_all_events(indio_dev); lis3l02dq_stop_device(indio_dev); - if (spi->irq && gpio_is_valid(irq_to_gpio(spi->irq)) > 0) + if (spi->irq) free_irq(st->us->irq, indio_dev); lis3l02dq_remove_trigger(indio_dev); diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c index fa4190d..13c0b4b 100644 --- a/drivers/staging/iio/accel/lis3l02dq_ring.c +++ b/drivers/staging/iio/accel/lis3l02dq_ring.c @@ -263,7 +263,7 @@ static int lis3l02dq_trig_try_reen(struct iio_trigger *trig) /* If gpio still high (or high again) * In theory possible we will need to do this several times */ for (i = 0; i < 5; i++) - if (gpio_get_value(irq_to_gpio(st->us->irq))) + if (gpio_get_value(st->gpio)) lis3l02dq_read_all(indio_dev, NULL); else break;