From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64E6BC43381 for ; Sun, 24 Mar 2019 15:27:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2C4E220700 for ; Sun, 24 Mar 2019 15:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553441257; bh=78Lv0vG8xWZ2J06Yt+iHM5Ufj+d+gA9U2JoTpxDcE3Y=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=IG4H3n2GB+uvflqv1Qf5schKIbJ05+SddCbrlZwalwPzAVCUlR8VzRhj8Vg9egtAq F8okrrWtSNXsjgYzbsw/xP17HtWI2Fvv8b7d9lO+OtLLIn8Fxw50GHkhqvgn805Ga4 vT50wzSSeDF3bQEfa5Hle9xJnp1azLrmtmtHsV5o= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727728AbfCXP1c (ORCPT ); Sun, 24 Mar 2019 11:27:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:59060 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726317AbfCXP1b (ORCPT ); Sun, 24 Mar 2019 11:27:31 -0400 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6681120700; Sun, 24 Mar 2019 15:27:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553441250; bh=78Lv0vG8xWZ2J06Yt+iHM5Ufj+d+gA9U2JoTpxDcE3Y=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Kenu0w6vZPIqYRoOmaw34mFonyETC7pJE40r6mKjDAkcGbY1NARQpPUi68o99kH1N R6cP3eBh5RcPzAmALiikDk9Rzi2OkKl892sRHie6VO/5TEe0iDTXNYVUJh5ouplYmp J0Mu+Wc1PscbHtOvDr+j9CgHz1sRAmuklBuUCJ9Q= Date: Sun, 24 Mar 2019 15:27:25 +0000 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: <20190324152725.35fed317@archlinux> In-Reply-To: <20190323172809.14407-1-contact@artur-rojek.eu> References: <20190323172809.14407-1-contact@artur-rojek.eu> 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-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org 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 > --- > > 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.