From patchwork Thu Oct 19 20:06:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Masney X-Patchwork-Id: 10018261 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 72A5D60224 for ; Thu, 19 Oct 2017 20:09:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F185C28767 for ; Thu, 19 Oct 2017 20:09:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E652B28787; Thu, 19 Oct 2017 20:09:37 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable 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 91FB028767 for ; Thu, 19 Oct 2017 20:09:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753830AbdJSUJS (ORCPT ); Thu, 19 Oct 2017 16:09:18 -0400 Received: from onstation.org ([52.200.56.107]:54068 "EHLO onstation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752454AbdJSUGj (ORCPT ); Thu, 19 Oct 2017 16:06:39 -0400 Received: from localhost.localdomain (c-98-236-77-125.hsd1.wv.comcast.net [98.236.77.125]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: masneyb) by onstation.org (Postfix) with ESMTPSA id 1DFCD1FBE; Thu, 19 Oct 2017 20:06:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=onstation.org; s=default; t=1508443598; bh=m8Pszbz/VqWUYiqqfu5bcOWoGePJ1nPV2qVXXubsrb4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dhswv8Wb0cpPLJchxeq+PaCFYe7b/tBP3RPNxy9r5FxL2AjxCb4+1eISoQ9OGbf6h gTMypR29L550OkojY8cqN8hnaDqKGO+uj9dq+C0JdMQ+dxihfYC6cXqb9E9raVfrtz 38Yj6DeEETwBXvVs0Hl2MHJ7QSCzJ2C/JiQOC8qI= From: Brian Masney To: jic23@kernel.org, linux-iio@vger.kernel.org Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, linux-kernel@vger.kernel.org, Jon.Brenner@ams.com Subject: [PATCH 06/13] staging: iio: tsl2x7x: convert in_proximity0_calibscale_available to use IIO_CONST_ATTR Date: Thu, 19 Oct 2017 16:06:25 -0400 Message-Id: <20171019200632.25820-7-masneyb@onstation.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171019200632.25820-1-masneyb@onstation.org> References: <20171019200632.25820-1-masneyb@onstation.org> 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 sysfs attribute in_proximity0_calibscale_available is currently created by using DEVICE_ATTR_RO(). Convert this over to use IIO_CONST_ATTR(). Signed-off-by: Brian Masney --- drivers/staging/iio/light/tsl2x7x.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/staging/iio/light/tsl2x7x.c b/drivers/staging/iio/light/tsl2x7x.c index 3a3340aadc1a..80968dd456a0 100644 --- a/drivers/staging/iio/light/tsl2x7x.c +++ b/drivers/staging/iio/light/tsl2x7x.c @@ -886,12 +886,7 @@ static ssize_t in_illuminance0_calibscale_available_show(struct device *dev, return snprintf(buf, PAGE_SIZE, "%s\n", "1 8 16 120"); } -static ssize_t in_proximity0_calibscale_available_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - return snprintf(buf, PAGE_SIZE, "%s\n", "1 2 4 8"); -} +static IIO_CONST_ATTR(in_proximity0_calibscale_available, "1 2 4 8"); static IIO_CONST_ATTR(in_illuminance0_integration_time_available, ".00272 - .696"); @@ -1371,8 +1366,6 @@ static int tsl2x7x_write_raw(struct iio_dev *indio_dev, return tsl2x7x_invoke_change(indio_dev); } -static DEVICE_ATTR_RO(in_proximity0_calibscale_available); - static DEVICE_ATTR_RO(in_illuminance0_calibscale_available); static DEVICE_ATTR_RW(in_illuminance0_target_input); @@ -1468,13 +1461,13 @@ static struct attribute *tsl2x7x_ALSPRX_device_attrs[] = { &dev_attr_in_illuminance0_target_input.attr, &dev_attr_in_illuminance0_calibrate.attr, &dev_attr_in_illuminance0_lux_table.attr, - &dev_attr_in_proximity0_calibrate.attr, + &iio_const_attr_in_proximity0_calibscale_available.dev_attr.attr, NULL }; static struct attribute *tsl2x7x_PRX2_device_attrs[] = { &dev_attr_in_proximity0_calibrate.attr, - &dev_attr_in_proximity0_calibscale_available.attr, + &iio_const_attr_in_proximity0_calibscale_available.dev_attr.attr, NULL }; @@ -1485,7 +1478,7 @@ static struct attribute *tsl2x7x_ALSPRX2_device_attrs[] = { &dev_attr_in_illuminance0_calibrate.attr, &dev_attr_in_illuminance0_lux_table.attr, &dev_attr_in_proximity0_calibrate.attr, - &dev_attr_in_proximity0_calibscale_available.attr, + &iio_const_attr_in_proximity0_calibscale_available.dev_attr.attr, NULL };