Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1203231yba; Sun, 14 Apr 2019 03:35:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqwLldEW/pVe6i55gN9xvGSzXw1TCO6cENzzBVzK8yUB3ya/tnfC2RNllgKnPU6eafhWer+3 X-Received: by 2002:a17:902:28ab:: with SMTP id f40mr47784742plb.297.1555238154675; Sun, 14 Apr 2019 03:35:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555238154; cv=none; d=google.com; s=arc-20160816; b=RE3dOmEGT0XRY5ioS0sVgg7L7l8ACuFuftetSIWDopQVWri+Ebtv82WT5XkDFSkyh9 6jAVgn/ayT3cMpXXe3uv7gcZvbw2l0DwNbkRImr/TW1eHs/EcsPfPgn3jdsNwjiw07X+ Jvvqvq3TPx5B3qWUWRYL0WqLPqoflVy+pUvMXhO5wJFoZ+piceP5fnYHj7cCAqFYpmVX jnt77OhP+XK2nXRimXwS9TF0nMvjUgncLZWUflK9KdCr8jElJIewAPq00sptg2Xex9Cu SAOqSC2VW5NpFagLfs7xC6U5PvhDZojqvN7FCEhLEJHZB4qEAayrZ8el5JwR9MxB6hkc bJbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=KoWWNp4EgEFCBQx1XJhM91+cHphJZbdKpzLss4Pvpow=; b=WozTDtzpAEFLvtpZs0ObrgSR1yTQ32PO+r4glzyLuMTJowo9H/sSMk3IgoeruUBdQd cpQtEBdOQiWLl8XTjnuGvnapqnCikZm7slVA3OJK+ipcWEE9QwazMknGtFr6QT0n9PBF Rbq8/RpkcpfmtocHtrY4z5ogl/fb3xJdInQLrW2KGFHobDFTExyu491071OmPIH0oep9 SmQDoAaw3GtHpQuPB8feYApQ2eD/xd3e9icTHF/2TDU82jNnnU1Z3ihvcOdSIf1D8zI9 z4RgCxbx1+ITHZf0RE76eu85wkTpQw+rA3Zc8dqRUDJRYE5nmZszQRrllyYFZxcrsqRV VUOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q13si41746118pls.284.2019.04.14.03.35.35; Sun, 14 Apr 2019 03:35:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726533AbfDNKe7 (ORCPT + 99 others); Sun, 14 Apr 2019 06:34:59 -0400 Received: from saturn.retrosnub.co.uk ([46.235.226.198]:45428 "EHLO saturn.retrosnub.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725807AbfDNKe7 (ORCPT ); Sun, 14 Apr 2019 06:34:59 -0400 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) by saturn.retrosnub.co.uk (Postfix; Retrosnub mail submission) with ESMTPSA id 709989E75AC; Sun, 14 Apr 2019 11:34:56 +0100 (BST) Date: Sun, 14 Apr 2019 11:34:54 +0100 From: Jonathan Cameron To: Artur Rojek Cc: Sebastian Reichel , Rob Herring , Mark Rutland , linux-pm@vger.kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil Subject: Re: [PATCH v2 1/4] iio: inkern: API for reading available iio channel attribute values Message-ID: <20190414113454.53087ca6@archlinux> In-Reply-To: <20190324152725.35fed317@archlinux> References: <20190323172809.14407-1-contact@artur-rojek.eu> <20190324152725.35fed317@archlinux> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 24 Mar 2019 15:27:25 +0000 Jonathan Cameron wrote: > On Sat, 23 Mar 2019 18:28:06 +0100 > Artur Rojek wrote: > > > Extend the inkern API with a function for reading available > > attribute values of iio channels. > > > > Signed-off-by: Artur Rojek > If this goes through a route other than IIO (otherwise > I'll just add a signed-off-by...) > > Acked-by: Jonathan Cameron Applied to the ib-jz47xx-prereq branch of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git I'll merge that into the togreg branch as well shortly. Thanks, Jonathan > > > --- > > > > Changes: > > > > v2: no change > > > > drivers/iio/inkern.c | 20 ++++++++++++++++++++ > > include/linux/iio/consumer.h | 14 ++++++++++++++ > > 2 files changed, 34 insertions(+) > > > > diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c > > index 06ca3f7fcc44..f19dbde3c945 100644 > > --- a/drivers/iio/inkern.c > > +++ b/drivers/iio/inkern.c > > @@ -733,6 +733,26 @@ static int iio_channel_read_avail(struct iio_channel *chan, > > vals, type, length, info); > > } > > > > +int iio_read_avail_channel_attribute(struct iio_channel *chan, > > + const int **vals, int *type, int *length, > > + enum iio_chan_info_enum attribute) > > +{ > > + int ret; > > + > > + mutex_lock(&chan->indio_dev->info_exist_lock); > > + if (!chan->indio_dev->info) { > > + ret = -ENODEV; > > + goto err_unlock; > > + } > > + > > + ret = iio_channel_read_avail(chan, vals, type, length, attribute); > > +err_unlock: > > + mutex_unlock(&chan->indio_dev->info_exist_lock); > > + > > + return ret; > > +} > > +EXPORT_SYMBOL_GPL(iio_read_avail_channel_attribute); > > + > > int iio_read_avail_channel_raw(struct iio_channel *chan, > > const int **vals, int *length) > > { > > diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h > > index 9887f4f8e2a8..b2d34831ed7c 100644 > > --- a/include/linux/iio/consumer.h > > +++ b/include/linux/iio/consumer.h > > @@ -290,6 +290,20 @@ int iio_read_max_channel_raw(struct iio_channel *chan, int *val); > > int iio_read_avail_channel_raw(struct iio_channel *chan, > > const int **vals, int *length); > > > > +/** > > + * iio_read_avail_channel_attribute() - read available channel attribute values > > + * @chan: The channel being queried. > > + * @vals: Available values read back. > > + * @type: Type of values read back. > > + * @length: Number of entries in vals. > > + * @attribute: info attribute to be read back. > > + * > > + * Returns an error code, IIO_AVAIL_RANGE or IIO_AVAIL_LIST. > > + */ > > +int iio_read_avail_channel_attribute(struct iio_channel *chan, > > + const int **vals, int *type, int *length, > > + enum iio_chan_info_enum attribute); > > + > > /** > > * iio_get_channel_type() - get the type of a channel > > * @channel: The channel being queried. >