From patchwork Mon Oct 3 08:13:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 12997131 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BBF98C433FE for ; Mon, 3 Oct 2022 08:14:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OdoovWW+GNwa4Zp+pPru1BKQ0CgGzlOl60mkz48Wark=; b=sAcalJLP/MowBUgBX29K9ayxm5 J+qXa4vMe6oNVSfqd/0nAAR9he0/dCck8UKviHVAt6T8YYxd7u6k2BwjMfz9EKJZ5UdXs++Zwb9UW VTY9k+f+xJKdC6kaGSlWLSjbQX8FL2j+o8c8+LZnz1xLYMAhaibM83s+0ihjAOEFFwZaZwkKHi7kz v+3HPym2ALZSF6dyKrysaiJo2sAxs8YCkSWdeCg2acFpZtqzAifEwHsnS7oFrmb+rp1CIwMYwKjW1 VhIk5LHGFgCWl9SXFSgIoW8k5Y2bh8TpMhANtiQ+KZ1m5xj6TljQQfmpfL8KZj+g3CUWj2OvOr9NS 704L4aGg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ofGaI-004dRW-Mh; Mon, 03 Oct 2022 08:13:54 +0000 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ofGaF-004dLD-Ar for linux-arm-kernel@lists.infradead.org; Mon, 03 Oct 2022 08:13:52 +0000 Received: by mail-lj1-x22c.google.com with SMTP id a12so895696ljr.7 for ; Mon, 03 Oct 2022 01:13:38 -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=ozJi7bas0K7OL0m/OlaE7Db/H8qeB+9gBWikgiBjNdA=; b=AY3EwZCkUfoCgnmJKPHFE/JaPiyO4ZsN2ZD1VaZZ8NACu+v0YePbkc4falbnv23QtE zsFDgeGk/L7z0oEuC6SkJUr4OfNzt6K0Lt4bGALj6WsqeeVaFK5XC4jcWW2RXRse9mqZ RZHaeth/4DyJeSZktk/RLOoogCe7kLchTDUIAiTc/jr8I+Y+56ybzZET4lz9FL2cquZC MN7BwPqeIZJhOfJVptdX7EeA+nDTlDR6HhEvHlNC2s5HMiycoJ8oAIm8NCg5oLkD71dl 3xKfUWGZmk0P/YO3b9T1SXuL+8BISEZy2VJj9e2vLbjtUgmbFGpEbBnYA9L58ZB9kzYG JM+w== 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=ozJi7bas0K7OL0m/OlaE7Db/H8qeB+9gBWikgiBjNdA=; b=Asb5hqTEtxbFuQAjjXDg/K+i6VJhwDkq6qhC1DUkaYhRG61OoxNLY9aSACI7YqI1+A 1jgQ9mqGnuLpvxZH/dVgGvWqKzAtLj3GscirFcY2Hur96vDi/tzxmqJIjaWBX5cbbYzY 7VTxz/ISoNXbOV70HzT6/kTrweWdebPrJuL3UosEY6nwipR97qWbh35KxM4cHEli9Pg9 cj5y2B1U8zun7OyUr8v5cQ+sE05L3k64FMpzT5olZ7YDVvUfbX8XjrnjC0+8YQ0ODswn p5jQzaoq/QX1M0m7PY0h8KGq2G3XCSp4k+Q/2jm2j4hcGu+U+39xOOXrQJab4XpBmq3e a5wg== X-Gm-Message-State: ACrzQf0P/5GlFO5ETHmTa/2Ip5R5bGpcmbzAl6Eck6UJsyOpslQgtRQO mGasvuBwnV+NBDV2Ubel0MI= X-Google-Smtp-Source: AMsMyM7F1g9zUs46xXqRuvQk06G1LfAvpgeb3ufEV0bYD5xWTKuboqXMYNUj8G9BX1ykdwlX4Oc1DA== X-Received: by 2002:a05:651c:1a26:b0:26c:4c0d:b10a with SMTP id by38-20020a05651c1a2600b0026c4c0db10amr5760102ljb.415.1664784816913; Mon, 03 Oct 2022 01:13:36 -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 m1-20020a2ea881000000b0026c423959desm822084ljq.25.2022.10.03.01.13.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Oct 2022 01:13:36 -0700 (PDT) Date: Mon, 3 Oct 2022 11:13:31 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Subject: [PATCH v3 09/10] iio: at91-sama5d2_adc: Use IIO_STATIC_CONST_DEVICE_ATTR() Message-ID: <4476a4ce852febb3eb863878e66751c787195b18.1664782676.git.mazziesaccount@gmail.com> References: MIME-Version: 1.0 In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221003_011351_393640_90F07692 X-CRM114-Status: GOOD ( 11.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Eugen Hristev , Claudiu Beznea , Jonathan Cameron Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 Tested-by: Claudiu Beznea --- drivers/iio/adc/at91-sama5d2_adc.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index 6e3f9fa93cee..dca014d1108f 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -1841,26 +1841,13 @@ static ssize_t at91_adc_get_watermark(struct device *dev, return scnprintf(buf, PAGE_SIZE, "%d\n", st->dma_st.watermark); } -static ssize_t hwfifo_watermark_min_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - return sysfs_emit(buf, "%s\n", "2"); -} - -static ssize_t hwfifo_watermark_max_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - return sysfs_emit(buf, "%s\n", AT91_HWFIFO_MAX_SIZE_STR); -} - static IIO_DEVICE_ATTR(hwfifo_enabled, 0444, at91_adc_get_fifo_state, NULL, 0); static IIO_DEVICE_ATTR(hwfifo_watermark, 0444, at91_adc_get_watermark, NULL, 0); -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, "2"); +IIO_STATIC_CONST_DEVICE_ATTR(hwfifo_watermark_max, AT91_HWFIFO_MAX_SIZE_STR); static IIO_CONST_ATTR(oversampling_ratio_available, __stringify(AT91_OSR_1SAMPLES) " "