From patchwork Sat Mar 23 17:28:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Rojek X-Patchwork-Id: 10866885 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C2CB0139A for ; Sat, 23 Mar 2019 17:28:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A817F29E87 for ; Sat, 23 Mar 2019 17:28:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9963A29EBF; Sat, 23 Mar 2019 17:28:31 +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.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 4252029E87 for ; Sat, 23 Mar 2019 17:28:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728039AbfCWR2a (ORCPT ); Sat, 23 Mar 2019 13:28:30 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:41839 "EHLO relay12.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727945AbfCWR2a (ORCPT ); Sat, 23 Mar 2019 13:28:30 -0400 Received: from pc.localdomain (unknown [91.192.165.7]) (Authenticated sender: contact@artur-rojek.eu) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 7334D200008; Sat, 23 Mar 2019 17:28:27 +0000 (UTC) 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 , Artur Rojek Subject: [PATCH v2 2/4] iio: inkern: Convert iio_read_avail_channel_raw into a wrapper Date: Sat, 23 Mar 2019 18:28:07 +0100 Message-Id: <20190323172809.14407-2-contact@artur-rojek.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190323172809.14407-1-contact@artur-rojek.eu> References: <20190323172809.14407-1-contact@artur-rojek.eu> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Convert "iio_read_avail_channel_raw" over to a wrapper around "iio_read_avail_channel_attribute". With the introduction of "iio_read_avail_channel_attribute", the necessity of having a separate call to read raw channel values became redundant. Signed-off-by: Artur Rojek Acked-by: Jonathan Cameron --- Changes: v2: new patch drivers/iio/inkern.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index f19dbde3c945..4a5eff3f18bc 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c @@ -759,16 +759,8 @@ int iio_read_avail_channel_raw(struct iio_channel *chan, int ret; int type; - 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, IIO_CHAN_INFO_RAW); -err_unlock: - mutex_unlock(&chan->indio_dev->info_exist_lock); + ret = iio_read_avail_channel_attribute(chan, vals, &type, length, + IIO_CHAN_INFO_RAW); if (ret >= 0 && type != IIO_VAL_INT) /* raw values are assumed to be IIO_VAL_INT */