From patchwork Fri May 18 18:21:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Veenstra X-Patchwork-Id: 10411795 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0C32E602C2 for ; Fri, 18 May 2018 18:22:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EDEBB28A80 for ; Fri, 18 May 2018 18:22:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2BD828A82; Fri, 18 May 2018 18:22:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8495A28A80 for ; Fri, 18 May 2018 18:22:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752191AbeERSWB (ORCPT ); Fri, 18 May 2018 14:22:01 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:38957 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751943AbeERSWA (ORCPT ); Fri, 18 May 2018 14:22:00 -0400 Received: by mail-wm0-f67.google.com with SMTP id f8-v6so16818448wmc.4; Fri, 18 May 2018 11:22:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=wGaUkvEmfm/uiSTelqm+BsDvIWBBA+JSj/EoGq8sdzc=; b=QgAeYec3MsKS18pM8ePAEqI0SX/Sc6MPN/LSEwtK5Kdd2HUk+qTbZBB7JSifrsqLmu GQHULZT1UeDPe4sOr1gU7eEj6HbPP7NURi0GtYXkIDMJDqn91X11IJDLdCzUfe9Z/nTA Oj1Zrtc1UtEXKRW27l/fnm1zTD+l5xE+0tQWGmPQIr4ADtRe1ayyI61Kb3U+QgLmcD0R UFDuol9ha3MJIZspeBg5FI5oYJhpGaiUWJS8j0U3H0NerQP0XLXYbOnc9cgj3JTeYzqr ieiyzg8pqtEXeyRiQstYt+ytOTJSEA3/+STunyl3BPcUaiz4WALXcNyl0bT8ywBuNzU7 s9cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=wGaUkvEmfm/uiSTelqm+BsDvIWBBA+JSj/EoGq8sdzc=; b=aS5QgRoAEreVp1CblR4ho/D/ypEiXAyRgk2gsHiPjPME4uxuLPrCgGjb1PiKgz70AE J3lVLYOHXzWo78BG42LQS1Rk119q5Bz+TzuZwfhaZ4epOQ5E7kxHsu9OSAEg3ugjpUBU M3EKe6ZYmxfTEYXnNLHma9cHDlmB8uaK9lC1EWj3t8DfYBuO+gemMVCbRREiqnvXiSoa dLNlN59rtbvwrS6+MzKlI6Hycw1CAtp3Gd6kVJ9E+jT9QKUsseCobBjm53VB6JdhTKIk TaHHZfxTSH3y4JH7B9LKR+sALz5rl9BpgMMRrt8lc7AONyWHuPA3omxTRlzeUcxZbKFR uNlg== X-Gm-Message-State: ALKqPwf3VjW771oKc6CR6Jp0rVMBzuJaP4CoSq4nbGMpuvrciCg3am1j HD1ez2BngFok13HJz+AI+lg= X-Google-Smtp-Source: AB8JxZp0JJNdnKsJso1ETs6o+IZReGqe3EUNt38D+nEa5Q6AeIF9n2j4U9MXyh1asTayRlmYCUVAqw== X-Received: by 2002:a50:8307:: with SMTP id 7-v6mr12916223edh.263.1526667719551; Fri, 18 May 2018 11:21:59 -0700 (PDT) Received: from zenbook-arch (s559434a1.adsl.online.nl. [85.148.52.161]) by smtp.gmail.com with ESMTPSA id c35-v6sm3987881edb.61.2018.05.18.11.21.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 May 2018 11:21:59 -0700 (PDT) Date: Fri, 18 May 2018 20:21:56 +0200 From: David Veenstra To: jic23@kernel.org, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org Cc: Michael.Hennerich@analog.com, knaack.h@gmx.de, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, devicetree@vger.kernel.org Subject: [PATCH v4 05/12] staging: iio: ad2s1200: Replace legacy gpio API with modern API Message-ID: <78bc9c09403ac1fa08d610a86505416b85edb306.1526667118.git.davidjulianveenstra@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The legacy, integer based gpio API is replaced with the modern descriptor based API. Signed-off-by: David Veenstra --- drivers/staging/iio/resolver/ad2s1200.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/staging/iio/resolver/ad2s1200.c b/drivers/staging/iio/resolver/ad2s1200.c index 430cc62591fe..b2c46a8c6b77 100644 --- a/drivers/staging/iio/resolver/ad2s1200.c +++ b/drivers/staging/iio/resolver/ad2s1200.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -43,8 +44,8 @@ struct ad2s1200_state { struct mutex lock; struct spi_device *sdev; - int sample; - int rdvel; + struct gpio_desc *sample; + struct gpio_desc *rdvel; __be16 rx ____cacheline_aligned; }; @@ -58,12 +59,12 @@ static int ad2s1200_read_raw(struct iio_dev *indio_dev, int ret; mutex_lock(&st->lock); - gpio_set_value(st->sample, 0); + gpiod_set_value(st->sample, 0); /* delay (6 * AD2S1200_TSCLK + 20) nano seconds */ udelay(1); - gpio_set_value(st->sample, 1); - gpio_set_value(st->rdvel, !!(chan->type == IIO_ANGL)); + gpiod_set_value(st->sample, 1); + gpiod_set_value(st->rdvel, !!(chan->type == IIO_ANGL)); ret = spi_read(st->sdev, &st->rx, 2); if (ret < 0) { @@ -133,8 +134,8 @@ static int ad2s1200_probe(struct spi_device *spi) st = iio_priv(indio_dev); mutex_init(&st->lock); st->sdev = spi; - st->sample = pins[0]; - st->rdvel = pins[1]; + st->sample = gpio_to_desc(pins[0]); + st->rdvel = gpio_to_desc(pins[1]); indio_dev->dev.parent = &spi->dev; indio_dev->info = &ad2s1200_info;