Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1551170imj; Sun, 17 Feb 2019 08:28:25 -0800 (PST) X-Google-Smtp-Source: AHgI3IYTD1nZ0BzbKX9rB41nbI82fU3movE9yw1wu+cxPgoGVar7TcgnCD0aZkGd8t7SxO9jRqch X-Received: by 2002:a63:8341:: with SMTP id h62mr18927620pge.254.1550420905808; Sun, 17 Feb 2019 08:28:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550420905; cv=none; d=google.com; s=arc-20160816; b=RF5Rk5HvCH3MymWDtW6yfcFZan+onmhVmEVvPy8ZeR/dKqOtqWSUHBcKeHaUpwjgyv R6eswH7/hHn/Pq24Gq9tBxToLryjHDcUVT4JX8BpS9W0jvzvF67MN3No8raYFrPkyaBA HXxXzBMaewXJfRfzulPrPU8CRKQAzD/wdsjaVX10T3Q4utMMMDaSpYUjxqi0xX5EGh7D Bh9E2aSUqm3T/lPQEFQOSYGTOeYIYzx3sm6Ol3zdwVDzkj04C8pigtmXwys3sgLvW4Lv UPdp3kw0VVUlBzdoapIOjY9nFivefGSX6sUPnioLXXtDD/VZakFycnkLqqvQqCWbi/oL 1F/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version; bh=7rnLWcHSjReL/dh8rMW9MMQmqn28uowOZaESIwsaDD4=; b=iclwDVe1GW6LhjypbXHkqUDqkqtY8QhYne3cPAoTHkHGM3uM6O1vO4nSaBXC4heQ4B Zd3I2+yokc3yOVDwylI6U9ifrSDxdDKCbD1bo1SszWGQzJiTUhw6wbROeAVzhldsQycx bWs3xYMhgm5Ek694X730B2PDVyhsoKKfooliqOT4+sGAWhMDvlKPiQHYKuKcOVLaG6Df z82isx+Cnt4JR7LljvsMTD0uLZyjN8G80MG8UbXLhfn6La/fyWV3YN3t9LKtL0N40ptS 2pFs4KCzSnf7jWXCLt+wbk71p7P/JLmmaYsOqHD1H82egJA4i1mRdbg51OidbRZPJfyT fkyw== 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 i186si11458308pfb.108.2019.02.17.08.28.09; Sun, 17 Feb 2019 08:28:25 -0800 (PST) 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 S1726583AbfBQOiC (ORCPT + 99 others); Sun, 17 Feb 2019 09:38:02 -0500 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:34829 "EHLO relay6-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725795AbfBQOiC (ORCPT ); Sun, 17 Feb 2019 09:38:02 -0500 Received: from webmail.gandi.net (webmail6.sd4.0x35.net [10.200.201.6]) (Authenticated sender: contact@artur-rojek.eu) by relay6-d.mail.gandi.net (Postfix) with ESMTPA id 6C4FAC0005; Sun, 17 Feb 2019 14:37:58 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 17 Feb 2019 15:37:58 +0100 From: Artur Rojek To: Sebastian Reichel , Jonathan Cameron , Rob Herring , Mark Rutland Cc: linux-pm@vger.kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil Subject: Re: [PATCH 1/7] iio: inkern: API for reading available iio channel attribute values In-Reply-To: <20190217142914.17433-1-contact@artur-rojek.eu> References: <20190217142914.17433-1-contact@artur-rojek.eu> Message-ID: <0fb5a3fef7c4a790b208cf0f3651c059@artur-rojek.eu> X-Sender: contact@artur-rojek.eu User-Agent: Roundcube Webmail/1.1.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, This patchset is supposed to contain 5 patches, not 7. So this patch is actually 1/5. My apologies for the mistake. Artur On 2019-02-17 15:29, Artur Rojek wrote: > Extend the inkern API with a function for reading available > attribute values of iio channels. > > Signed-off-by: Artur Rojek > --- > 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.