From patchwork Mon Oct 3 08:13:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 12997147 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF52BC433F5 for ; Mon, 3 Oct 2022 08:39:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229842AbiJCIj1 (ORCPT ); Mon, 3 Oct 2022 04:39:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230381AbiJCIi4 (ORCPT ); Mon, 3 Oct 2022 04:38:56 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB1B15809C; Mon, 3 Oct 2022 01:13:17 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id j16so15477703lfg.1; Mon, 03 Oct 2022 01:13:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=Tekt/RnJ+zIgFhpYKf/cWAp1pjbrAJzGXVEGdH+XotQ=; b=XvDd2wQDa9wGCTlOXwSZgSlQyMeuu2qRFeDZjqC6hyQTZ14j6aPw0wOPW508aU4zXl fucA/vz+WYkwNR+ImdTWUKH54YhVWlXwnXvQowVu/6WUX0x7PH7kLYRX2+X/oMdTHG8n 4TJrHsqL8jBLKjzjSrSjMYVbsj5i/q3FP6KfSc0nE5s9zGnfe9vI1uNEZNg/QzIM96BY FjzCq4Z3MOwv9Xrj8wkjzcedyDhhU1/ThwiVYqaPRkFEgwxsVPSb28oPQR5eAd7vz6G5 kuKCDWXjHUh7XTO5sGdtAh0nLMKWCVwu76qaj+K4YRjrsbe2g2Zp/o/6bYhEPecaD1N2 VDAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=Tekt/RnJ+zIgFhpYKf/cWAp1pjbrAJzGXVEGdH+XotQ=; b=6Dihwx2Hc7skq17VVzyvp6jZ2ewIs56RNayZ2MzvU6UU+4bpr0GzNKT3LPrIH4XbBR o3e6pKJil93LakMI7LhLmMOxsJNzczOCVOeK0URUiFoLcad1rPGYYE2oehv991CH1bLE hZyITT7ETLmG1yqPWk4LI04jO67bsNmZWgb7jdhUHnaynxUUiRow37aTE7b06GHtRM81 RJ5wnHcp6Akl7aLhCuTffiNI3/feFRVkxkdBBzsZxf811DIu4iyy1FostP3VKDBN1OEM Foi/UO/Xz8js2iwrNLfOuVpKTaTbo6T1syn5zCW3JCsxnu3HlYATcoS1Pci8lVYrrOY6 XejA== X-Gm-Message-State: ACrzQf1M2hJU1eSprV9JybZuzecIKmaZnCcrQvZw9shrBc/xxnX3H3OT UqYecAUjUgdmpvDIiSgWNRU= X-Google-Smtp-Source: AMsMyM6tM7WUp1ADznzqSBkE1K+34Y2IKArp0i6WbRGSGJRfEJo+qF9FUnSCGm7si0/5OkcASgLvOQ== X-Received: by 2002:a05:6512:3f1c:b0:4a1:d76f:ff4 with SMTP id y28-20020a0565123f1c00b004a1d76f0ff4mr7376248lfa.292.1664784796120; Mon, 03 Oct 2022 01:13:16 -0700 (PDT) Received: from dc75zzyyyyyyyyyyyyyyt-3.rev.dnainternet.fi (dc75zzyyyyyyyyyyyyyyt-3.rev.dnainternet.fi. [2001:14ba:16f3:4a00::1]) by smtp.gmail.com with ESMTPSA id g14-20020a056512118e00b0049e9122bd1bsm1361635lfr.164.2022.10.03.01.13.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Oct 2022 01:13:15 -0700 (PDT) Date: Mon, 3 Oct 2022 11:13:10 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Jonathan Cameron , Lars-Peter Clausen , Matti Vaittinen , Alexandru Ardelean , Uwe =?iso-8859-1?q?Klei?= =?iso-8859-1?q?ne-K=F6nig?= , Srinivas Pandruvada , Miquel Raynal , Miaoqian Lin , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 08/10] iio: bmc150-accel-core: Use IIO_STATIC_CONST_DEVICE_ATTR() Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Slightly simplify by dropping open-coded constant data iio_dev_attr functions and using the IIO_STATIC_CONST_DEVICE_ATTR() instead. Signed-off-by: Matti Vaittinen --- drivers/iio/accel/bmc150-accel-core.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c index 92f8b139acce..b4a077944896 100644 --- a/drivers/iio/accel/bmc150-accel-core.c +++ b/drivers/iio/accel/bmc150-accel-core.c @@ -925,22 +925,9 @@ static const struct iio_chan_spec_ext_info bmc150_accel_ext_info[] = { { } }; -static ssize_t hwfifo_watermark_min_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - return sysfs_emit(buf, "%s\n", "1"); -} - -static ssize_t hwfifo_watermark_max_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - return sysfs_emit(buf, "%s\n", __stringify(BMC150_ACCEL_FIFO_LENGTH)); -} - -static IIO_DEVICE_ATTR_RO(hwfifo_watermark_min, 0); -static IIO_DEVICE_ATTR_RO(hwfifo_watermark_max, 0); +IIO_STATIC_CONST_DEVICE_ATTR(hwfifo_watermark_min, "1"); +IIO_STATIC_CONST_DEVICE_ATTR(hwfifo_watermark_max, + __stringify(BMC150_ACCEL_FIFO_LENGTH)); static IIO_DEVICE_ATTR(hwfifo_enabled, S_IRUGO, bmc150_accel_get_fifo_state, NULL, 0); static IIO_DEVICE_ATTR(hwfifo_watermark, S_IRUGO,