From patchwork Thu Dec 16 18:52:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 12682373 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 E99D8C4167B for ; Thu, 16 Dec 2021 18:52:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236394AbhLPSw1 (ORCPT ); Thu, 16 Dec 2021 13:52:27 -0500 Received: from www381.your-server.de ([78.46.137.84]:47648 "EHLO www381.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236396AbhLPSwY (ORCPT ); Thu, 16 Dec 2021 13:52:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metafoo.de; s=default2002; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=r+U1xhyssSTBOXzzkSA+bcC9nDbJhc561YC9ShPSarQ=; b=MuH/a/p7z3BiS9KtQbEo8op+fD P+QGbyyQOIxWgC4wSp5Xu8QwutcdfTAo/OOq1APqlqI+hE409k9WWqJI9tSz9jpRc8P8QU3tOCIrW ++3UUsdeVmrtcgNcTEBZ3/wkhk6X3AZEFb4K2R6qaqPzg86pymPJzU8MbJ4wSPXeuuT6g8vRcEK+N Oq1iNOxh4NQdqIMrVBE2Imd331jDhRcWCuwvvEGCTJKEfBXXt+1EKSa1eSrkRP8atQoOg891+IiyP WPXZckZkMBbO75rsLsBL3De5COHnX1Q495EI/qvCfSTpC+1zOeDdndHkTwNN4RcGuo0pFtXCSfBge vgo3PBYg==; Received: from sslproxy06.your-server.de ([78.46.172.3]) by www381.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1mxvra-000ARw-6p; Thu, 16 Dec 2021 19:52:22 +0100 Received: from [2001:a61:2bc8:8501:9e5c:8eff:fe01:8578] (helo=lars-desktop.fritz.box) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mxvrZ-000HSt-Sj; Thu, 16 Dec 2021 19:52:21 +0100 From: Lars-Peter Clausen To: Jonathan Cameron Cc: Michael Hennerich , Alexandru Tachici , Roan van Dijk , Tomasz Duszynski , Marc Titinger , Matt Ranostay , Johan Hovold , Paresh Chaudhary , Navin Sankar Velliangiri , Jacopo Mondi , Ludovic Tancerel , linux-iio@vger.kernel.org, Lars-Peter Clausen Subject: [PATCH 01/13] iio: core: Use sysfs_emit() Date: Thu, 16 Dec 2021 19:52:05 +0100 Message-Id: <20211216185217.1054495-2-lars@metafoo.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211216185217.1054495-1-lars@metafoo.de> References: <20211216185217.1054495-1-lars@metafoo.de> MIME-Version: 1.0 X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.103.3/26389/Thu Dec 16 07:02:49 2021) Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in checks for size and alignment. This patch converts the places in the IIO core that follow the pattern of return s*printf(...) to return sysfs_emit(...) This covers the new places that have been introduced where sprintf() is used for formatting sysfs output since the last time this was done in commit 83ca56b663cf ("iio: core: Use sysfs_emit() (trivial bits)"). Signed-off-by: Lars-Peter Clausen --- drivers/iio/industrialio-buffer.c | 4 ++-- drivers/iio/industrialio-core.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index 94eb9f6cf128..f7721553a938 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -1383,9 +1383,9 @@ static ssize_t direction_show(struct device *dev, switch (buffer->direction) { case IIO_BUFFER_DIRECTION_IN: - return sprintf(buf, "in\n"); + return sysfs_emit(buf, "in\n"); case IIO_BUFFER_DIRECTION_OUT: - return sprintf(buf, "out\n"); + return sysfs_emit(buf, "out\n"); default: return -EINVAL; } diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 20d5178ca073..25144383865c 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -747,7 +747,7 @@ static ssize_t iio_read_channel_label(struct device *dev, return indio_dev->info->read_label(indio_dev, this_attr->c, buf); if (this_attr->c->extend_name) - return sprintf(buf, "%s\n", this_attr->c->extend_name); + return sysfs_emit(buf, "%s\n", this_attr->c->extend_name); return -EINVAL; } From patchwork Thu Dec 16 18:52:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 12682371 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 5D38BC43217 for ; Thu, 16 Dec 2021 18:52:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236380AbhLPSw0 (ORCPT ); Thu, 16 Dec 2021 13:52:26 -0500 Received: from www381.your-server.de ([78.46.137.84]:47628 "EHLO www381.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236385AbhLPSwY (ORCPT ); Thu, 16 Dec 2021 13:52:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metafoo.de; s=default2002; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=GFyGAv7LQyFMd2HAlFFETsDhdGkHMScKSBM1Bu+lxnc=; b=K68mkzRyZyz4PTZQEmSrDwTJgN WCoXQjUpJGJWyziO2+DKPeddGM069FNuCpHvqm5JCR2Sh1K90aT6bI378l3s1n5fuOaj8M9O6GoeZ ngvugPj+0qo2jjU4T2pmd1wHIt/Kw5U3FXk5yMdZtQMksIvw3xjwLZXAmOpuM50XeDMZCpiaxyzkw j17gp9DVIcE9R/kfev1lR17F4ZzOB/mqd1U8ImLEm7LZUaQqBVZZyskDgmn2C3CQM0pUqFtamhDNp BLrTTvLtPWPHqyOIwv9ownx8fK79vUMkzXFevgslowmoCyWoFCVzMIgkqZ6zFcrf1eTJ8JBoa1VXU 5NgZzxLg==; Received: from sslproxy06.your-server.de ([78.46.172.3]) by www381.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1mxvra-000ARz-F1; Thu, 16 Dec 2021 19:52:22 +0100 Received: from [2001:a61:2bc8:8501:9e5c:8eff:fe01:8578] (helo=lars-desktop.fritz.box) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mxvra-000HSt-3u; Thu, 16 Dec 2021 19:52:22 +0100 From: Lars-Peter Clausen To: Jonathan Cameron Cc: Michael Hennerich , Alexandru Tachici , Roan van Dijk , Tomasz Duszynski , Marc Titinger , Matt Ranostay , Johan Hovold , Paresh Chaudhary , Navin Sankar Velliangiri , Jacopo Mondi , Ludovic Tancerel , linux-iio@vger.kernel.org, Lars-Peter Clausen Subject: [PATCH 02/13] iio: dmaengine-buffer: Use sysfs_emit() Date: Thu, 16 Dec 2021 19:52:06 +0100 Message-Id: <20211216185217.1054495-3-lars@metafoo.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211216185217.1054495-1-lars@metafoo.de> References: <20211216185217.1054495-1-lars@metafoo.de> MIME-Version: 1.0 X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.103.3/26389/Thu Dec 16 07:02:49 2021) Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in checks for size and alignment. Use sysfs_emit() for the `length_align_bytes` buffer attribute. Signed-off-by: Lars-Peter Clausen --- drivers/iio/buffer/industrialio-buffer-dmaengine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/buffer/industrialio-buffer-dmaengine.c b/drivers/iio/buffer/industrialio-buffer-dmaengine.c index f8ce26a24c57..f744b62a636a 100644 --- a/drivers/iio/buffer/industrialio-buffer-dmaengine.c +++ b/drivers/iio/buffer/industrialio-buffer-dmaengine.c @@ -136,7 +136,7 @@ static ssize_t iio_dmaengine_buffer_get_length_align(struct device *dev, struct dmaengine_buffer *dmaengine_buffer = iio_buffer_to_dmaengine_buffer(buffer); - return sprintf(buf, "%zu\n", dmaengine_buffer->align); + return sysfs_emit(buf, "%zu\n", dmaengine_buffer->align); } static IIO_DEVICE_ATTR(length_align_bytes, 0444, From patchwork Thu Dec 16 18:52:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 12682363 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 6295DC433FE for ; Thu, 16 Dec 2021 18:52:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236376AbhLPSwZ (ORCPT ); Thu, 16 Dec 2021 13:52:25 -0500 Received: from www381.your-server.de ([78.46.137.84]:47624 "EHLO www381.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236343AbhLPSwY (ORCPT ); Thu, 16 Dec 2021 13:52:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metafoo.de; s=default2002; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=4kuUEpQU78qLO/yQEkNwNzCVPsFNFf8sfMxWcmFuQjQ=; b=YQc9Xgc5V2Lgzp7upm2tKDC29x FlUx93KB62UBcHeOdmNJ6j1bSQ6dNYrQC1u431LluJAh7H1kHxjX1beCi533K56wz2MkIeyhJEqd4 Ljnvrx21wc5631RRPK8lmmtJHvPEFtCd47fzSMACFOklN26XTUOhtU4mve92o8CAe3qwerJV+Kd6P qXHOIuFQuJuhduGtrBrxtLFdRXYiNMPEFo09Oz55BWHd7G7x6+umsJJjXwfNzmcyLpdqk2M8J4fM8 vy9vDYU+AJfhsM7w4a/uq+zrKxgXIdeK74mFdVicA8dRJRTz3D2YMCoaZhOtJCR0+jW4eU2g8NejF N/xjq+/w==; Received: from sslproxy06.your-server.de ([78.46.172.3]) by www381.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1mxvra-000AS4-Lp; Thu, 16 Dec 2021 19:52:22 +0100 Received: from [2001:a61:2bc8:8501:9e5c:8eff:fe01:8578] (helo=lars-desktop.fritz.box) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mxvra-000HSt-BE; Thu, 16 Dec 2021 19:52:22 +0100 From: Lars-Peter Clausen To: Jonathan Cameron Cc: Michael Hennerich , Alexandru Tachici , Roan van Dijk , Tomasz Duszynski , Marc Titinger , Matt Ranostay , Johan Hovold , Paresh Chaudhary , Navin Sankar Velliangiri , Jacopo Mondi , Ludovic Tancerel , linux-iio@vger.kernel.org, Lars-Peter Clausen Subject: [PATCH 03/13] iio: ad7192: Use sysfs_emit() Date: Thu, 16 Dec 2021 19:52:07 +0100 Message-Id: <20211216185217.1054495-4-lars@metafoo.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211216185217.1054495-1-lars@metafoo.de> References: <20211216185217.1054495-1-lars@metafoo.de> MIME-Version: 1.0 X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.103.3/26389/Thu Dec 16 07:02:49 2021) Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in checks for size and alignment. Use sysfs_emit() to format the custom `ac_excication` and `bridge_swtich` attributes of the ad7192 driver. Signed-off-by: Lars-Peter Clausen --- drivers/iio/adc/ad7192.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c index cc990205f306..47d3f56edcbc 100644 --- a/drivers/iio/adc/ad7192.c +++ b/drivers/iio/adc/ad7192.c @@ -433,7 +433,7 @@ static ssize_t ad7192_show_ac_excitation(struct device *dev, struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad7192_state *st = iio_priv(indio_dev); - return sprintf(buf, "%d\n", !!(st->mode & AD7192_MODE_ACX)); + return sysfs_emit(buf, "%d\n", !!(st->mode & AD7192_MODE_ACX)); } static ssize_t ad7192_show_bridge_switch(struct device *dev, @@ -443,7 +443,7 @@ static ssize_t ad7192_show_bridge_switch(struct device *dev, struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad7192_state *st = iio_priv(indio_dev); - return sprintf(buf, "%d\n", !!(st->gpocon & AD7192_GPOCON_BPDSW)); + return sysfs_emit(buf, "%d\n", !!(st->gpocon & AD7192_GPOCON_BPDSW)); } static ssize_t ad7192_set(struct device *dev, From patchwork Thu Dec 16 18:52:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 12682377 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 33D93C4321E for ; Thu, 16 Dec 2021 18:52:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236428AbhLPSw1 (ORCPT ); Thu, 16 Dec 2021 13:52:27 -0500 Received: from www381.your-server.de ([78.46.137.84]:47646 "EHLO www381.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236404AbhLPSwY (ORCPT ); Thu, 16 Dec 2021 13:52:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metafoo.de; s=default2002; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=BBaC//QzMa0MkeC/oNIh9AeCy5tSskx0B8Tv7sgSUEo=; b=S2WVY1Vy7o/+sC4cDnD+6yljpW 9Em50yTymWGtqvaOcaYI/L/RXQeyOLDE3sJDW1Y17aNQlQn53vfbLLtBFbmqZycTNk2/UFQeXP2QC QEBej5MPa8BmWQPenABToQRuehZd3u7Cmq7t5sMg7xQ6mT9mUHgwqyq12mFz/geRKZjH/MtSLmMhU AJqcIRirsd/ylMif2C/tHYgoHNfxbx0Tn6cllcqWOOohFSpLl0AMNdRcXVk9sijP285MW3aKKgy60 R7GqRGO7vTiW99HnwPZtj2H4DZLLzBJ221buPqvRbRLFyJ5LxSYvn0BX9SPt3sPPwpUxBGcq1+mU7 tbT2lGmw==; Received: from sslproxy06.your-server.de ([78.46.172.3]) by www381.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1mxvra-000AS7-T5; Thu, 16 Dec 2021 19:52:22 +0100 Received: from [2001:a61:2bc8:8501:9e5c:8eff:fe01:8578] (helo=lars-desktop.fritz.box) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mxvra-000HSt-IY; Thu, 16 Dec 2021 19:52:22 +0100 From: Lars-Peter Clausen To: Jonathan Cameron Cc: Michael Hennerich , Alexandru Tachici , Roan van Dijk , Tomasz Duszynski , Marc Titinger , Matt Ranostay , Johan Hovold , Paresh Chaudhary , Navin Sankar Velliangiri , Jacopo Mondi , Ludovic Tancerel , linux-iio@vger.kernel.org, Lars-Peter Clausen Subject: [PATCH 04/13] iio: ad9523: Use sysfs_emit() Date: Thu, 16 Dec 2021 19:52:08 +0100 Message-Id: <20211216185217.1054495-5-lars@metafoo.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211216185217.1054495-1-lars@metafoo.de> References: <20211216185217.1054495-1-lars@metafoo.de> MIME-Version: 1.0 X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.103.3/26389/Thu Dec 16 07:02:49 2021) Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in checks for size and alignment. Use sysfs_emit() to format the custom device attributes of the ad9523 driver. Signed-off-by: Lars-Peter Clausen --- drivers/iio/frequency/ad9523.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/frequency/ad9523.c b/drivers/iio/frequency/ad9523.c index bdb0bc3b12dd..a0f92c336fc4 100644 --- a/drivers/iio/frequency/ad9523.c +++ b/drivers/iio/frequency/ad9523.c @@ -551,7 +551,7 @@ static ssize_t ad9523_show(struct device *dev, mutex_lock(&st->lock); ret = ad9523_read(indio_dev, AD9523_READBACK_0); if (ret >= 0) { - ret = sprintf(buf, "%d\n", !!(ret & (1 << + ret = sysfs_emit(buf, "%d\n", !!(ret & (1 << (u32)this_attr->address))); } mutex_unlock(&st->lock); From patchwork Thu Dec 16 18:52:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 12682369 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 88702C4332F for ; Thu, 16 Dec 2021 18:52:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236343AbhLPSw0 (ORCPT ); Thu, 16 Dec 2021 13:52:26 -0500 Received: from www381.your-server.de ([78.46.137.84]:47620 "EHLO www381.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236342AbhLPSwY (ORCPT ); Thu, 16 Dec 2021 13:52:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metafoo.de; s=default2002; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=nJGvWbNUcwqrAcL+2UrBy97HSgqPc1NpffgPID/0Ow4=; b=jj1EjfKegetCxKd1AyWrjTO9cn bbIW1YZWJHmWKScx97HfvBCw3Sj+vAdJgHUWRMgmT+70/b1vyzhevGhTNgfv+i4qffwA6DUGI2YyI c/Ih0WZAnDiLkeFWcxmL3pY2GF99atS8dk0mW3kIPQHsf5++hpVHXoQOTISRPE60bFcq3GOjAjehW 8jMJdqnsqpUkx3bw4I4NcBQuNZiS60Wn5Zu5YmeEH6mvNlHUcTxHOS77HbEOmXWIZ23BaAHu+L/nD MG51qDVt5ZrQzoWK+K2iLMcBEp5Mrr7w+/znG5GbhamK9WZj6QqO7DfVW8DzM1Ndnrs10Wc2BxwrH sMKARj9g==; Received: from sslproxy06.your-server.de ([78.46.172.3]) by www381.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1mxvrb-000ASC-3V; Thu, 16 Dec 2021 19:52:23 +0100 Received: from [2001:a61:2bc8:8501:9e5c:8eff:fe01:8578] (helo=lars-desktop.fritz.box) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mxvra-000HSt-Py; Thu, 16 Dec 2021 19:52:22 +0100 From: Lars-Peter Clausen To: Jonathan Cameron Cc: Michael Hennerich , Alexandru Tachici , Roan van Dijk , Tomasz Duszynski , Marc Titinger , Matt Ranostay , Johan Hovold , Paresh Chaudhary , Navin Sankar Velliangiri , Jacopo Mondi , Ludovic Tancerel , linux-iio@vger.kernel.org, Lars-Peter Clausen Subject: [PATCH 05/13] iio: as3935: Use sysfs_emit() Date: Thu, 16 Dec 2021 19:52:09 +0100 Message-Id: <20211216185217.1054495-6-lars@metafoo.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211216185217.1054495-1-lars@metafoo.de> References: <20211216185217.1054495-1-lars@metafoo.de> MIME-Version: 1.0 X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.103.3/26389/Thu Dec 16 07:02:49 2021) Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in checks for size and alignment. Use sysfs_emit() to format the custom `noise_level_tripped` device attribute of the as3935 driver. Signed-off-by: Lars-Peter Clausen --- drivers/iio/proximity/as3935.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c index d62766b6b39e..3eb40aa0b1e0 100644 --- a/drivers/iio/proximity/as3935.c +++ b/drivers/iio/proximity/as3935.c @@ -122,7 +122,7 @@ static ssize_t as3935_sensor_sensitivity_show(struct device *dev, return ret; val = (val & AS3935_AFE_MASK) >> 1; - return sprintf(buf, "%d\n", val); + return sysfs_emit(buf, "%d\n", val); } static ssize_t as3935_sensor_sensitivity_store(struct device *dev, @@ -153,7 +153,7 @@ static ssize_t as3935_noise_level_tripped_show(struct device *dev, int ret; mutex_lock(&st->lock); - ret = sprintf(buf, "%d\n", !time_after(jiffies, st->noise_tripped + HZ)); + ret = sysfs_emit(buf, "%d\n", !time_after(jiffies, st->noise_tripped + HZ)); mutex_unlock(&st->lock); return ret; From patchwork Thu Dec 16 18:52:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 12682365 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 446E6C433EF for ; Thu, 16 Dec 2021 18:52:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236420AbhLPSwZ (ORCPT ); Thu, 16 Dec 2021 13:52:25 -0500 Received: from www381.your-server.de ([78.46.137.84]:47632 "EHLO www381.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236376AbhLPSwY (ORCPT ); Thu, 16 Dec 2021 13:52:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metafoo.de; s=default2002; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=7cvx790pwuy2FZQtM7URaUvK+FVvl+IqKyJYUudlEag=; b=m1iLy2mq5oavWPAck6ba4rQVpd jqu5gNf1+ZWBr6AueB3PsWirKTVjuLL8MGPhcvR1YQWCDx64QdeBr+4yoOfbbTSTGEzR51tG2w+cV ef9wtL4y2xct5Vu2GvWdUOA6jsfk9uxQszjR37+bNmpbCb9byuygZG6Bg/pZRRT2dmktWNL74ABQd Q9osM0ee4Pf2ip9Kk8PuMHjFng01DfPIF/hCmzjMGXbAJskNHDRG06/4qttu14gghC+/PH4eLUmTV xt59Se1q9H0Bqc9NkUY3sP7qNiOeCLk5dtcffp5iwFB6QAiOP7P+IUignmPzTeHGaZflpsxRrMyCi ln6J5Kog==; Received: from sslproxy06.your-server.de ([78.46.172.3]) by www381.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1mxvrb-000ASF-As; Thu, 16 Dec 2021 19:52:23 +0100 Received: from [2001:a61:2bc8:8501:9e5c:8eff:fe01:8578] (helo=lars-desktop.fritz.box) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mxvrb-000HSt-1R; Thu, 16 Dec 2021 19:52:23 +0100 From: Lars-Peter Clausen To: Jonathan Cameron Cc: Michael Hennerich , Alexandru Tachici , Roan van Dijk , Tomasz Duszynski , Marc Titinger , Matt Ranostay , Johan Hovold , Paresh Chaudhary , Navin Sankar Velliangiri , Jacopo Mondi , Ludovic Tancerel , linux-iio@vger.kernel.org, Lars-Peter Clausen Subject: [PATCH 06/13] iio: ina2xx-adc: sysfs_emit() Date: Thu, 16 Dec 2021 19:52:10 +0100 Message-Id: <20211216185217.1054495-7-lars@metafoo.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211216185217.1054495-1-lars@metafoo.de> References: <20211216185217.1054495-1-lars@metafoo.de> MIME-Version: 1.0 X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.103.3/26389/Thu Dec 16 07:02:49 2021) Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in checks for size and alignment. Use sysfs_emit() to format the custom `in_allow_async_readout` device attribute of the ina2xx-adc driver. Signed-off-by: Lars-Peter Clausen --- drivers/iio/adc/ina2xx-adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c index 352f27657238..4e66473b0821 100644 --- a/drivers/iio/adc/ina2xx-adc.c +++ b/drivers/iio/adc/ina2xx-adc.c @@ -539,7 +539,7 @@ static ssize_t ina2xx_allow_async_readout_show(struct device *dev, { struct ina2xx_chip_info *chip = iio_priv(dev_to_iio_dev(dev)); - return sprintf(buf, "%d\n", chip->allow_async_readout); + return sysfs_emit(buf, "%d\n", chip->allow_async_readout); } static ssize_t ina2xx_allow_async_readout_store(struct device *dev, From patchwork Thu Dec 16 18:52:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 12682367 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 193F5C433F5 for ; Thu, 16 Dec 2021 18:52:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236342AbhLPSw0 (ORCPT ); Thu, 16 Dec 2021 13:52:26 -0500 Received: from www381.your-server.de ([78.46.137.84]:47636 "EHLO www381.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236380AbhLPSwY (ORCPT ); Thu, 16 Dec 2021 13:52:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metafoo.de; s=default2002; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=BCf6rL7suy31qtSRmW0qJcAFOKEchD2zVJwybYzJx8A=; b=ltUcjVN689OMn6JFtiV4KH7mdE ZZ5Wk+U4r7JYgfdnbUuy4IefAyMB7YYesMDKhCfe/b+6uWVKV6h9ukxN3ei3vvUAFmVJzKONXPMEU BdXd9NRvMy33MXiIibkZuyiOwxxxZD7I+5TI7aOVU3K7x0w+UY0lwhUwWkDG2WWn8qXt+q0ODU9fB 3mSficbg+EkoA0lD9CMxblghyi+Tt/QMczqc8nwIB6buGb0tO08FDc8H4b2f/GLS54vIprlC72vzA beEeCIvZmyZupSbb4CaIzz2Y8YRfwFaJ85JxspvddvW2JOae1iwVerh+f00VpJj5gs4TBBdkuAllP R0xJ4Rtw==; Received: from sslproxy06.your-server.de ([78.46.172.3]) by www381.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1mxvrb-000ASJ-J4; Thu, 16 Dec 2021 19:52:23 +0100 Received: from [2001:a61:2bc8:8501:9e5c:8eff:fe01:8578] (helo=lars-desktop.fritz.box) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mxvrb-000HSt-9B; Thu, 16 Dec 2021 19:52:23 +0100 From: Lars-Peter Clausen To: Jonathan Cameron Cc: Michael Hennerich , Alexandru Tachici , Roan van Dijk , Tomasz Duszynski , Marc Titinger , Matt Ranostay , Johan Hovold , Paresh Chaudhary , Navin Sankar Velliangiri , Jacopo Mondi , Ludovic Tancerel , linux-iio@vger.kernel.org, Lars-Peter Clausen Subject: [PATCH 07/13] iio: lm3533: Use sysfs_emit() Date: Thu, 16 Dec 2021 19:52:11 +0100 Message-Id: <20211216185217.1054495-8-lars@metafoo.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211216185217.1054495-1-lars@metafoo.de> References: <20211216185217.1054495-1-lars@metafoo.de> MIME-Version: 1.0 X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.103.3/26389/Thu Dec 16 07:02:49 2021) Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in checks for size and alignment. Use sysfs_emit() to format the custom device attributes of the lm3533 driver. Signed-off-by: Lars-Peter Clausen Reviewed-by: Johan Hovold --- drivers/iio/light/lm3533-als.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/light/lm3533-als.c b/drivers/iio/light/lm3533-als.c index 8a621244dd01..827bc25269e9 100644 --- a/drivers/iio/light/lm3533-als.c +++ b/drivers/iio/light/lm3533-als.c @@ -417,7 +417,7 @@ static ssize_t show_thresh_either_en(struct device *dev, enable = 0; } - return scnprintf(buf, PAGE_SIZE, "%u\n", enable); + return sysfs_emit(buf, "%u\n", enable); } static ssize_t store_thresh_either_en(struct device *dev, @@ -474,7 +474,7 @@ static ssize_t show_zone(struct device *dev, if (ret) return ret; - return scnprintf(buf, PAGE_SIZE, "%u\n", zone); + return sysfs_emit(buf, "%u\n", zone); } enum lm3533_als_attribute_type { @@ -530,7 +530,7 @@ static ssize_t show_als_attr(struct device *dev, if (ret) return ret; - return scnprintf(buf, PAGE_SIZE, "%u\n", val); + return sysfs_emit(buf, "%u\n", val); } static ssize_t store_als_attr(struct device *dev, From patchwork Thu Dec 16 18:52:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 12682389 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 BB91EC433F5 for ; Thu, 16 Dec 2021 19:16:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240874AbhLPTQp (ORCPT ); Thu, 16 Dec 2021 14:16:45 -0500 Received: from www381.your-server.de ([78.46.137.84]:41010 "EHLO www381.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236663AbhLPTQp (ORCPT ); Thu, 16 Dec 2021 14:16:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metafoo.de; s=default2002; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=X++iCdBS50OaaRw4Xu8ZE8fyHUbGoahACDxJ47nJRZw=; b=et2w3cXnSsk1wl+LgLzm4CnREg AXV7nbprNO2TnxFHeSoqZf42aar9e+rvayQ0erTwSftI552K9T6o/itqcS7Ey78avyPNuM+deM4Bl Cunyx0/jG7wfgGTO1zhTbaseLAJ/J8gnw9xoCY+0yZsvUkZuVccxo3V4qDczFbWOtSWEtwNpH1RTt b5CchIddW5Z0w/hb+8fKeOKjU3y9XqvdBI+75kTgKdCGOSm62viZ5OhHBmbhANf6CGKXeAP3jeQ7C mxWFKnBEz+SE1hyInfqgVjZAHRUQuaiKB7XjncC8xWPATSsThUjMaqCxRMnHrDupJypMn5XrHlK9f JPKTphiA==; Received: from sslproxy06.your-server.de ([78.46.172.3]) by www381.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1mxvrb-000ASL-Qg; Thu, 16 Dec 2021 19:52:23 +0100 Received: from [2001:a61:2bc8:8501:9e5c:8eff:fe01:8578] (helo=lars-desktop.fritz.box) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mxvrb-000HSt-Gc; Thu, 16 Dec 2021 19:52:23 +0100 From: Lars-Peter Clausen To: Jonathan Cameron Cc: Michael Hennerich , Alexandru Tachici , Roan van Dijk , Tomasz Duszynski , Marc Titinger , Matt Ranostay , Johan Hovold , Paresh Chaudhary , Navin Sankar Velliangiri , Jacopo Mondi , Ludovic Tancerel , linux-iio@vger.kernel.org, Lars-Peter Clausen Subject: [PATCH 08/13] iio: max31856: Use sysfs_emit() Date: Thu, 16 Dec 2021 19:52:12 +0100 Message-Id: <20211216185217.1054495-9-lars@metafoo.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211216185217.1054495-1-lars@metafoo.de> References: <20211216185217.1054495-1-lars@metafoo.de> MIME-Version: 1.0 X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.103.3/26389/Thu Dec 16 07:02:49 2021) Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in checks for size and alignment. Use sysfs_emit() to format the custom `fault_ovuv`, `fault_oc` and `in_temp_filter_notch_center_frequency` device attributes of the max31856 driver. Signed-off-by: Lars-Peter Clausen --- drivers/iio/temperature/max31856.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/temperature/max31856.c b/drivers/iio/temperature/max31856.c index 1954322e43be..54840881259a 100644 --- a/drivers/iio/temperature/max31856.c +++ b/drivers/iio/temperature/max31856.c @@ -320,7 +320,7 @@ static ssize_t show_fault(struct device *dev, u8 faultbit, char *buf) fault = reg_val & faultbit; - return sprintf(buf, "%d\n", fault); + return sysfs_emit(buf, "%d\n", fault); } static ssize_t show_fault_ovuv(struct device *dev, @@ -344,7 +344,7 @@ static ssize_t show_filter(struct device *dev, struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct max31856_data *data = iio_priv(indio_dev); - return sprintf(buf, "%d\n", data->filter_50hz ? 50 : 60); + return sysfs_emit(buf, "%d\n", data->filter_50hz ? 50 : 60); } static ssize_t set_filter(struct device *dev, From patchwork Thu Dec 16 18:52:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 12682391 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 4CEDCC433EF for ; Thu, 16 Dec 2021 19:17:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240882AbhLPTRB (ORCPT ); Thu, 16 Dec 2021 14:17:01 -0500 Received: from www381.your-server.de ([78.46.137.84]:41548 "EHLO www381.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236663AbhLPTRB (ORCPT ); Thu, 16 Dec 2021 14:17:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metafoo.de; s=default2002; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=zg3tGTdZa0eTLdicXi6mF8GgXF1bZQHxWij19C9BLPE=; b=Au2RVtCfOwh2qxG05Z4dN1qj7C WQikeeinV6eckyCCmWpb+OZI/+Oh6wmXqg0s8j1hbFXgok3EAdSvY+FEqdW0MStxl5CLlpvoVGgnj udLyyn90PhKwmzpwiQqhC2Z400Mnu36ENVK6pX7nr8UqVmLm83gO8SRf3ZeqvclkmbU6cHUEnEUzW eKk8TZ9oyNGiOKRHjtDB4N3OUzlhQ7C1lq7YcWCTT9jkZ8M+4wXcL1JBW/2e2yhNFzK9gs9j0SSQq rotllZATLg/KIR09+F6dgLPRU4OcgsMkpBdwE0JsoKC+dipRb2Y/peGVXbU8/ScZnpyBMnukcQMKw 8iezThuA==; Received: from sslproxy06.your-server.de ([78.46.172.3]) by www381.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1mxvrc-000ASO-2s; Thu, 16 Dec 2021 19:52:24 +0100 Received: from [2001:a61:2bc8:8501:9e5c:8eff:fe01:8578] (helo=lars-desktop.fritz.box) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mxvrb-000HSt-Nx; Thu, 16 Dec 2021 19:52:23 +0100 From: Lars-Peter Clausen To: Jonathan Cameron Cc: Michael Hennerich , Alexandru Tachici , Roan van Dijk , Tomasz Duszynski , Marc Titinger , Matt Ranostay , Johan Hovold , Paresh Chaudhary , Navin Sankar Velliangiri , Jacopo Mondi , Ludovic Tancerel , linux-iio@vger.kernel.org, Lars-Peter Clausen Subject: [PATCH 09/13] iio: max31865: Use sysfs_emit() Date: Thu, 16 Dec 2021 19:52:13 +0100 Message-Id: <20211216185217.1054495-10-lars@metafoo.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211216185217.1054495-1-lars@metafoo.de> References: <20211216185217.1054495-1-lars@metafoo.de> MIME-Version: 1.0 X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.103.3/26389/Thu Dec 16 07:02:49 2021) Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in checks for size and alignment. Use sysfs_emit() to format the custom ``in_filter_notch_center_frequency` and fault_ovuv` device attributes of the max31865 driver. Signed-off-by: Lars-Peter Clausen --- drivers/iio/temperature/max31865.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/temperature/max31865.c b/drivers/iio/temperature/max31865.c index 4c8d6e6cf677..86c3f3509a26 100644 --- a/drivers/iio/temperature/max31865.c +++ b/drivers/iio/temperature/max31865.c @@ -208,7 +208,7 @@ static ssize_t show_fault(struct device *dev, u8 faultbit, char *buf) fault = data->buf[0] & faultbit; - return sprintf(buf, "%d\n", fault); + return sysfs_emit(buf, "%d\n", fault); } static ssize_t show_fault_ovuv(struct device *dev, @@ -225,7 +225,7 @@ static ssize_t show_filter(struct device *dev, struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct max31865_data *data = iio_priv(indio_dev); - return sprintf(buf, "%d\n", data->filter_50hz ? 50 : 60); + return sysfs_emit(buf, "%d\n", data->filter_50hz ? 50 : 60); } static ssize_t set_filter(struct device *dev, From patchwork Thu Dec 16 18:52:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 12682383 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 F3F3EC433FE for ; Thu, 16 Dec 2021 19:15:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231803AbhLPTPn (ORCPT ); Thu, 16 Dec 2021 14:15:43 -0500 Received: from www381.your-server.de ([78.46.137.84]:39184 "EHLO www381.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236663AbhLPTPl (ORCPT ); Thu, 16 Dec 2021 14:15:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metafoo.de; s=default2002; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=NsESHsiHZuN8vLUVrZ63+kq3wwZwkkjh1Z2xl6xc0Zo=; b=KqZX4RrTQDu7lyOPI5q7LupG/S LVfLG7o1FU1XKLjEzT5qwDEuIb3r5hCR3TXu3I53XOVdfUVRtOnmoHWw3SV9yhs3J+181YcnEmgPp X8xn7G/WHJZJIWC17QzqMpOcp2vC7JlRiKFdS87NWcwAx3b4Gt9qrubxv5+V4vVq9/CLkvdlL0k89 tU/HCbpZG82r853b3T1lYPOJE8Ci5VsLU59Xg8qQKy8vcoKydeEYFfHEEiC8tWue3x+lE+6fF1zdq 3UWHgameegDizoDYVtruVcAtc1QE6s8eHNYkqyERZ5/76yYbDH1eUNpv+aaOWNmONXndIcSNl65fw ALi0Y6aQ==; Received: from sslproxy06.your-server.de ([78.46.172.3]) by www381.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1mxvuk-000B4Y-5t; Thu, 16 Dec 2021 19:55:38 +0100 Received: from [2001:a61:2bc8:8501:9e5c:8eff:fe01:8578] (helo=lars-desktop.fritz.box) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mxvrb-000HSt-VI; Thu, 16 Dec 2021 19:52:23 +0100 From: Lars-Peter Clausen To: Jonathan Cameron Cc: Michael Hennerich , Alexandru Tachici , Roan van Dijk , Tomasz Duszynski , Marc Titinger , Matt Ranostay , Johan Hovold , Paresh Chaudhary , Navin Sankar Velliangiri , Jacopo Mondi , Ludovic Tancerel , linux-iio@vger.kernel.org, Lars-Peter Clausen Subject: [PATCH 10/13] iio: max9611: Use sysfs_emit() Date: Thu, 16 Dec 2021 19:52:14 +0100 Message-Id: <20211216185217.1054495-11-lars@metafoo.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211216185217.1054495-1-lars@metafoo.de> References: <20211216185217.1054495-1-lars@metafoo.de> MIME-Version: 1.0 X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.103.3/26389/Thu Dec 16 07:02:49 2021) Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in checks for size and alignment. Use sysfs_emit() to format the custom `in_power_shunt_resistor` and `in_current_shunt_resistor` device attributes of the max9611 driver. Signed-off-by: Lars-Peter Clausen Reviewed-by: Jacopo Mondi --- drivers/iio/adc/max9611.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/max9611.c b/drivers/iio/adc/max9611.c index 01a4275e9c46..f982f00303dc 100644 --- a/drivers/iio/adc/max9611.c +++ b/drivers/iio/adc/max9611.c @@ -429,7 +429,7 @@ static ssize_t max9611_shunt_resistor_show(struct device *dev, i = max9611->shunt_resistor_uohm / 1000000; r = max9611->shunt_resistor_uohm % 1000000; - return sprintf(buf, "%u.%06u\n", i, r); + return sysfs_emit(buf, "%u.%06u\n", i, r); } static IIO_DEVICE_ATTR(in_power_shunt_resistor, 0444, From patchwork Thu Dec 16 18:52:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 12682387 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 C32B1C433EF for ; Thu, 16 Dec 2021 19:16:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240851AbhLPTQQ (ORCPT ); Thu, 16 Dec 2021 14:16:16 -0500 Received: from www381.your-server.de ([78.46.137.84]:40196 "EHLO www381.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236663AbhLPTQQ (ORCPT ); Thu, 16 Dec 2021 14:16:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metafoo.de; s=default2002; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=vdl9zE0bwtgAURW1zwHQzGevj3ka6TrGrNg4I0Y0ZSM=; b=Y7cISdTn6ydeFMLa25QmPtvXsW W55dXN3VA5WMMyR4MXLLKuohy4CbfQjMMg8lI44omJFtEkMHA/9mhAhTo4zcw5Qw7saOES83u0601 NCRGdVMQFFY4TiCtm6QzSW+73+Iur2OyL25liRk9U2Gs5wdR+8C/ftX+/ndBbgINkVwF4HqeITgC2 9HBqTFWKsYFd6sqe0MnhrR2AUlneeygBi0HoGJE4q21yoBaucMtEYwPyvm00fiNKtyA5m84o93sMw i6Q+Rq+/OUgSZWFsBZta3kne/MoL8zoQlyZHF6lZCnronweaxlJAlcryOB+H1SUjgJjbBunWF6L8P BA05jqog==; Received: from sslproxy06.your-server.de ([78.46.172.3]) by www381.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1mxvuk-000B4m-T4; Thu, 16 Dec 2021 19:55:38 +0100 Received: from [2001:a61:2bc8:8501:9e5c:8eff:fe01:8578] (helo=lars-desktop.fritz.box) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mxvrc-000HSt-6N; Thu, 16 Dec 2021 19:52:24 +0100 From: Lars-Peter Clausen To: Jonathan Cameron Cc: Michael Hennerich , Alexandru Tachici , Roan van Dijk , Tomasz Duszynski , Marc Titinger , Matt Ranostay , Johan Hovold , Paresh Chaudhary , Navin Sankar Velliangiri , Jacopo Mondi , Ludovic Tancerel , linux-iio@vger.kernel.org, Lars-Peter Clausen Subject: [PATCH 11/13] iio: ms_sensors: Use sysfs_emit() Date: Thu, 16 Dec 2021 19:52:15 +0100 Message-Id: <20211216185217.1054495-12-lars@metafoo.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211216185217.1054495-1-lars@metafoo.de> References: <20211216185217.1054495-1-lars@metafoo.de> MIME-Version: 1.0 X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.103.3/26389/Thu Dec 16 07:02:49 2021) Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in checks for size and alignment. Use sysfs_emit() to format the custom `battery_low` and `heater_enable` device attributes of the ms_sensors driver shared code. Signed-off-by: Lars-Peter Clausen --- drivers/iio/common/ms_sensors/ms_sensors_i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/common/ms_sensors/ms_sensors_i2c.c b/drivers/iio/common/ms_sensors/ms_sensors_i2c.c index 16ea697e945c..3eb790aec4b2 100644 --- a/drivers/iio/common/ms_sensors/ms_sensors_i2c.c +++ b/drivers/iio/common/ms_sensors/ms_sensors_i2c.c @@ -324,7 +324,7 @@ ssize_t ms_sensors_show_battery_low(struct ms_ht_dev *dev_data, if (ret) return ret; - return sprintf(buf, "%d\n", (config_reg & 0x40) >> 6); + return sysfs_emit(buf, "%d\n", (config_reg & 0x40) >> 6); } EXPORT_SYMBOL(ms_sensors_show_battery_low); @@ -351,7 +351,7 @@ ssize_t ms_sensors_show_heater(struct ms_ht_dev *dev_data, if (ret) return ret; - return sprintf(buf, "%d\n", (config_reg & 0x4) >> 2); + return sysfs_emit(buf, "%d\n", (config_reg & 0x4) >> 2); } EXPORT_SYMBOL(ms_sensors_show_heater); From patchwork Thu Dec 16 18:52:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 12682393 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 306C2C433F5 for ; Thu, 16 Dec 2021 19:17:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240895AbhLPTRR (ORCPT ); Thu, 16 Dec 2021 14:17:17 -0500 Received: from www381.your-server.de ([78.46.137.84]:42130 "EHLO www381.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240892AbhLPTRR (ORCPT ); Thu, 16 Dec 2021 14:17:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metafoo.de; s=default2002; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=hCRseAsLnOW9qZ6QMybhImyCcn6O1pSm39G2tEkDXdE=; b=PBjI+V+O8rNfdC/l9O9bwD6d0y 8EZbP+yfm381/QAEOVOvaLuEw/kMC3nNSE9J6+yuEKlc9zFlikh6vtLVu4d3TqbS9Iub+HYcSt2do 81uX0gQ/0D6ytA2GOVbQbWPp/sPcpAnD41EYVXVgrS94zlC6gXR3OzGGkmU+0mXoPJ/LrhYh7b8sm WHQPVHXQyRfKyfYEkubACpW33fMV40sZLibfR0/eTlGcp7vgyIX3KBdkgajCIt7vfuVunGYzpcxNO vp46QcKGuI5Ye9K8hOSKJhY72u/D3YH8iYrLWNLO3BGBuJH6DsPzXKTBMgfS0cJ4sTjCdWorkQNmL w1sU5ljA==; Received: from sslproxy06.your-server.de ([78.46.172.3]) by www381.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1mxvul-000B4u-AV; Thu, 16 Dec 2021 19:55:39 +0100 Received: from [2001:a61:2bc8:8501:9e5c:8eff:fe01:8578] (helo=lars-desktop.fritz.box) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mxvrc-000HSt-Dz; Thu, 16 Dec 2021 19:52:24 +0100 From: Lars-Peter Clausen To: Jonathan Cameron Cc: Michael Hennerich , Alexandru Tachici , Roan van Dijk , Tomasz Duszynski , Marc Titinger , Matt Ranostay , Johan Hovold , Paresh Chaudhary , Navin Sankar Velliangiri , Jacopo Mondi , Ludovic Tancerel , linux-iio@vger.kernel.org, Lars-Peter Clausen Subject: [PATCH 12/13] iio: scd4x: Use sysfs_emit() Date: Thu, 16 Dec 2021 19:52:16 +0100 Message-Id: <20211216185217.1054495-13-lars@metafoo.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211216185217.1054495-1-lars@metafoo.de> References: <20211216185217.1054495-1-lars@metafoo.de> MIME-Version: 1.0 X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.103.3/26389/Thu Dec 16 07:02:49 2021) Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in checks for size and alignment. Use sysfs_emit() to format the custom `calibration_auto_enable` device attribute of the scd4x driver. Signed-off-by: Lars-Peter Clausen --- drivers/iio/chemical/scd4x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/chemical/scd4x.c b/drivers/iio/chemical/scd4x.c index 267bc3c05338..20d4e7584e92 100644 --- a/drivers/iio/chemical/scd4x.c +++ b/drivers/iio/chemical/scd4x.c @@ -423,7 +423,7 @@ static ssize_t calibration_auto_enable_show(struct device *dev, val = (be16_to_cpu(bval) & SCD4X_READY_MASK) ? 1 : 0; - return sprintf(buf, "%d\n", val); + return sysfs_emit(buf, "%d\n", val); } static ssize_t calibration_auto_enable_store(struct device *dev, From patchwork Thu Dec 16 18:52:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 12682385 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 7C48FC433F5 for ; Thu, 16 Dec 2021 19:15:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240833AbhLPTPw (ORCPT ); Thu, 16 Dec 2021 14:15:52 -0500 Received: from www381.your-server.de ([78.46.137.84]:39588 "EHLO www381.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240854AbhLPTPw (ORCPT ); Thu, 16 Dec 2021 14:15:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metafoo.de; s=default2002; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=CDPvn8b31egAz1HKjY5jFWPvVQkT7kY/I/1pE5AWPbw=; b=CgDfkpvYA/7vMKh7ezOfBsbDgO 11WAcKI6/vijaXY3k2zMZaS51GxqA8Hx38iewaaRIXUu5ECsmjHvNygHVZht3M89Etu5I9P/WrOvc HxK0Dm0UCuB8C2bEWXbd7YjZJOcEDXo1z5luQnokme3SziJbXfHx3YKy9byxC+gWFf7S9Jgbwag4m mnCmxp1Z259zeX65udaCJmaNBnVM6JssI9CoeVeZ6LpbsOIwcMhrU05RDx/RGmXIts12mcHEu615R p6v1EDiwAHOtwm4xQmtt+pN4JXQolUb2u83FQ7SBWjyjmEezt7fMI1sHima6tcGFjQYoS93F+9oXL gANwfjYA==; Received: from sslproxy06.your-server.de ([78.46.172.3]) by www381.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1mxvuk-000B4d-GL; Thu, 16 Dec 2021 19:55:38 +0100 Received: from [2001:a61:2bc8:8501:9e5c:8eff:fe01:8578] (helo=lars-desktop.fritz.box) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mxvrc-000HSt-Lc; Thu, 16 Dec 2021 19:52:24 +0100 From: Lars-Peter Clausen To: Jonathan Cameron Cc: Michael Hennerich , Alexandru Tachici , Roan van Dijk , Tomasz Duszynski , Marc Titinger , Matt Ranostay , Johan Hovold , Paresh Chaudhary , Navin Sankar Velliangiri , Jacopo Mondi , Ludovic Tancerel , linux-iio@vger.kernel.org, Lars-Peter Clausen Subject: [PATCH 13/13] iio: sps30: Use sysfs_emit() Date: Thu, 16 Dec 2021 19:52:17 +0100 Message-Id: <20211216185217.1054495-14-lars@metafoo.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211216185217.1054495-1-lars@metafoo.de> References: <20211216185217.1054495-1-lars@metafoo.de> MIME-Version: 1.0 X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.103.3/26389/Thu Dec 16 07:02:49 2021) Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in checks for size and alignment. Use sysfs_emit() to format the custom `cleaning_period` device attribute of the sps30 driver. Signed-off-by: Lars-Peter Clausen --- drivers/iio/chemical/sps30.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/chemical/sps30.c b/drivers/iio/chemical/sps30.c index d51314505115..abd67559e451 100644 --- a/drivers/iio/chemical/sps30.c +++ b/drivers/iio/chemical/sps30.c @@ -221,7 +221,7 @@ static ssize_t cleaning_period_show(struct device *dev, if (ret) return ret; - return sprintf(buf, "%d\n", be32_to_cpu(val)); + return sysfs_emit(buf, "%d\n", be32_to_cpu(val)); } static ssize_t cleaning_period_store(struct device *dev, struct device_attribute *attr,