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,