From patchwork Fri Aug 9 09:17:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuno Sa via B4 Relay X-Patchwork-Id: 13758579 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C076F19148A for ; Fri, 9 Aug 2024 09:17:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723195074; cv=none; b=Ahjsj/Novgx1oITCzvwcKK4Kc4t342XxmlTL1uYPw0QUCKGjKGn0XyWiri3PHZPZ2c1Sv1vlQnx1GzJ86cbPwgt+HRB8bBEUjHoSXS0ScOGE1JPSzV5LQaZRGc+TULKoatlad1jnWfFCpO/n0cx0YMXM+vc9SpWCo0aKv4RSo2Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723195074; c=relaxed/simple; bh=Mn7RjGGWuvjkQHt2ztipxFe9+BNo9MPHRP/CXFbiDRc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lZ4jQjJfct91s028j066lj/pqi/OFfSJvOV6OFwe30oPeeCboYsvihSXjP0Ssabwc0FlJ5bef/ZA+YI3bqJmkqZAyUw7GePlW4WSK1W56dsht7A8nW2qyJV/aK0fWElGXtyEFDMOg1/mEgHOCgCezLmP54FsRTh4jXe1M8geqmk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LKyFZhZx; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LKyFZhZx" Received: by smtp.kernel.org (Postfix) with ESMTPS id 658CCC4AF0D; Fri, 9 Aug 2024 09:17:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723195074; bh=Mn7RjGGWuvjkQHt2ztipxFe9+BNo9MPHRP/CXFbiDRc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=LKyFZhZxuXxfPlPNbJBlSlcZoVgimkNaoiVfH34fXhyZMsHwTg5CcJQ5KXGXA1S6F fAvbhlS3eaSO6iOSF4xfaju+kTwKV0ETvIJfgZ30aTtzfaEtvlCfkI79JmkQgqY9cD xPvr8cggcX5fsw8yK1Q3m4GiBq/KrlhHQdCI+9PD0wIlJtXH++boTVe07I3YL8mBUx GXw8xJzG8IhNOSq349/KdvKiH4GF4EMV+5xgjdWA7qI9UgUzujcU2nqXGK3YLuhCmU Ynds82TBJB8n7oOoQjBdfXvYx1KXqBif4U8ZPK5C43HsX3qoDZMVGk98Rby66oJP+Z YVrdj7dSt5k1g== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FE09C52D7F; Fri, 9 Aug 2024 09:17:54 +0000 (UTC) From: Nuno Sa via B4 Relay Date: Fri, 09 Aug 2024 11:17:06 +0200 Subject: [PATCH 1/4] iio: imu: adis16475: drop ifdef around CONFIG_DEBUG_FS Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240809-dev-adis-debugfs-improv-v1-1-d3adb6996518@analog.com> References: <20240809-dev-adis-debugfs-improv-v1-0-d3adb6996518@analog.com> In-Reply-To: <20240809-dev-adis-debugfs-improv-v1-0-d3adb6996518@analog.com> To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Dragos Bogdan X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1723195072; l=1666; i=nuno.sa@analog.com; s=20231116; h=from:subject:message-id; bh=a5jhUJNFvPeDN03HbwrRCzHfwF3/Z8tIkW6EAXbSqz8=; b=Xf2EZl8ZhihDhXkPLoO9pg0SjU/BW6E5MMPYQqoMU4FMYH4udPeTVUwKPv49DtCjA7308aac2 othDecAsrIqCBPPhcPVH9yEEjBUNfzM/9PyruT06sELDL1zpXwDzT0e X-Developer-Key: i=nuno.sa@analog.com; a=ed25519; pk=3NQwYA013OUYZsmDFBf8rmyyr5iQlxV/9H4/Df83o1E= X-Endpoint-Received: by B4 Relay for nuno.sa@analog.com/20231116 with auth_id=100 X-Original-From: Nuno Sa Reply-To: nuno.sa@analog.com From: Nuno Sa Use IS_ENABLED(CONFIG_DEBUG_FS) to return early in case debugfs is not present. Since this is known at compile time, it allows the compiler to drop any unused code. Therefore no need to wrap the code with #ifdef. Signed-off-by: Nuno Sa --- drivers/iio/imu/adis16475.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/iio/imu/adis16475.c b/drivers/iio/imu/adis16475.c index c094ae4ffcb2..88efe728b61b 100644 --- a/drivers/iio/imu/adis16475.c +++ b/drivers/iio/imu/adis16475.c @@ -164,7 +164,6 @@ module_param(low_rate_allow, bool, 0444); MODULE_PARM_DESC(low_rate_allow, "Allow IMU rates below the minimum advisable when external clk is used in SCALED mode (default: N)"); -#ifdef CONFIG_DEBUG_FS static ssize_t adis16475_show_firmware_revision(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) @@ -279,6 +278,9 @@ static void adis16475_debugfs_init(struct iio_dev *indio_dev) struct adis16475 *st = iio_priv(indio_dev); struct dentry *d = iio_get_debugfs_dentry(indio_dev); + if (!IS_ENABLED(CONFIG_DEBUG_FS)) + return; + debugfs_create_file_unsafe("serial_number", 0400, d, st, &adis16475_serial_number_fops); debugfs_create_file_unsafe("product_id", 0400, @@ -290,11 +292,6 @@ static void adis16475_debugfs_init(struct iio_dev *indio_dev) debugfs_create_file("firmware_date", 0400, d, st, &adis16475_firmware_date_fops); } -#else -static void adis16475_debugfs_init(struct iio_dev *indio_dev) -{ -} -#endif static int adis16475_get_freq(struct adis16475 *st, u32 *freq) { From patchwork Fri Aug 9 09:17:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuno Sa via B4 Relay X-Patchwork-Id: 13758578 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C0724190667 for ; Fri, 9 Aug 2024 09:17:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723195074; cv=none; b=Q5aMwhZ342NxDNCNt3/CPsMyqtX+fw6AvoTBb2CLfFhdoYxShQeWQDkJWxxw7pVzGYiDciaDdKdnJBiTfLoijG5ofSBWElQoYZUojGDv75CHpsZxKaceGCpeH3JXjZmkdiqF+qOVjCTibjoTqkDo1EkPNJMfE3JweRc5qBOf8Fs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723195074; c=relaxed/simple; bh=k9XeVU+Qz+5SqWg/rg+fJVsVyn38I2pXzjxtsY7aaBQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cNDYGtOp/EtshPypWYsQlhwJ6MKuB+GqyEBuHpoA1dOC23gj7aW/xFsUoZDAHjC9XE68cT01HRCI2mcVocCn/hByJo07nQbKMxGtQFoU4bpdZdfxNalAwKt1gXRj500Pt97xuKUG5OdqUKphXMyfxBWLxWNHdW8J9FoFQBgPjDw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=D4sZQ4pw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="D4sZQ4pw" Received: by smtp.kernel.org (Postfix) with ESMTPS id 6A06CC4AF09; Fri, 9 Aug 2024 09:17:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723195074; bh=k9XeVU+Qz+5SqWg/rg+fJVsVyn38I2pXzjxtsY7aaBQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=D4sZQ4pwnflYX4tzUGB5o9aEtdV3SnTJcsGNQpxCSAeD7FIKblRcZFHbW0RB9LxPZ 4lP2m26frpQwS8+LW8SKSa8OpjE/AEjHn1G0TO1k4UxFem5ldw5El+Gco3V2se4OgF ANheDZLM2vWmNeAstVfM8Abohtae1daP0JQ0Ch69fIDjzzPwTy9Im7gD1DE4R8VOlT gZjhfWeY09K6tbyxkNUc2bSmqUAl/rphtFe7ahi5mfuBUxIEmexNoUiAhRBiyYZ5tY yyYuYsQem27JXL8NGWogH/f9wMjlF+do4QKOiyIQeI3G7qdeFXgvh0KfmeNuahA/jG fVTIBOk/kv4Mg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A48FC3DA4A; Fri, 9 Aug 2024 09:17:54 +0000 (UTC) From: Nuno Sa via B4 Relay Date: Fri, 09 Aug 2024 11:17:07 +0200 Subject: [PATCH 2/4] iio: imu: adis16480: drop ifdef around CONFIG_DEBUG_FS Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240809-dev-adis-debugfs-improv-v1-2-d3adb6996518@analog.com> References: <20240809-dev-adis-debugfs-improv-v1-0-d3adb6996518@analog.com> In-Reply-To: <20240809-dev-adis-debugfs-improv-v1-0-d3adb6996518@analog.com> To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Dragos Bogdan X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1723195072; l=2149; i=nuno.sa@analog.com; s=20231116; h=from:subject:message-id; bh=INFkT1lRAs5IyvgBIQdTgiDQKkEI3o5fQR1S25bTHBw=; b=6828GMXZGnzXAeFZtJBinSMrhhGokbIYSPO3VCzNOvrTsjgZWX/o1N3YM4xhXNtryjdeBSeYM nN/j0EloDTlAy718KiYB4IyUjuC1t1SdXHE9AwMK7g6RxOEvZGIHVpV X-Developer-Key: i=nuno.sa@analog.com; a=ed25519; pk=3NQwYA013OUYZsmDFBf8rmyyr5iQlxV/9H4/Df83o1E= X-Endpoint-Received: by B4 Relay for nuno.sa@analog.com/20231116 with auth_id=100 X-Original-From: Nuno Sa Reply-To: nuno.sa@analog.com From: Nuno Sa Use IS_ENABLED(CONFIG_DEBUG_FS) to return in case debugfs is not present. Since this is known at compile time, it allows the compiler to drop any unused code. Therefore no need to wrap the code with #ifdef. While at it make adis16480_debugfs_init() void as the return code is ignored. Signed-off-by: Nuno Sa --- drivers/iio/imu/adis16480.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c index 4e31503d512e..294181f2fcb3 100644 --- a/drivers/iio/imu/adis16480.c +++ b/drivers/iio/imu/adis16480.c @@ -193,8 +193,6 @@ module_param(low_rate_allow, bool, 0444); MODULE_PARM_DESC(low_rate_allow, "Allow IMU rates below the minimum advisable when external clk is used in PPS mode (default: N)"); -#ifdef CONFIG_DEBUG_FS - static ssize_t adis16480_show_firmware_revision(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { @@ -304,11 +302,14 @@ static int adis16480_show_flash_count(void *arg, u64 *val) DEFINE_DEBUGFS_ATTRIBUTE(adis16480_flash_count_fops, adis16480_show_flash_count, NULL, "%lld\n"); -static int adis16480_debugfs_init(struct iio_dev *indio_dev) +static void adis16480_debugfs_init(struct iio_dev *indio_dev) { struct adis16480 *adis16480 = iio_priv(indio_dev); struct dentry *d = iio_get_debugfs_dentry(indio_dev); + if (!IS_ENABLED(CONFIG_DEBUG_FS)) + return; + debugfs_create_file_unsafe("firmware_revision", 0400, d, adis16480, &adis16480_firmware_revision_fops); debugfs_create_file_unsafe("firmware_date", 0400, @@ -319,19 +320,8 @@ static int adis16480_debugfs_init(struct iio_dev *indio_dev) d, adis16480, &adis16480_product_id_fops); debugfs_create_file_unsafe("flash_count", 0400, d, adis16480, &adis16480_flash_count_fops); - - return 0; } -#else - -static int adis16480_debugfs_init(struct iio_dev *indio_dev) -{ - return 0; -} - -#endif - static int adis16480_set_freq(struct iio_dev *indio_dev, int val, int val2) { struct adis16480 *st = iio_priv(indio_dev); From patchwork Fri Aug 9 09:17:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuno Sa via B4 Relay X-Patchwork-Id: 13758577 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9ED2518E77E for ; Fri, 9 Aug 2024 09:17:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723195074; cv=none; b=fJyp5ByRfLT7VrcPfMm4Yvo7xJUVJvhoP4v7SN37QA9FStr9gae55mf4ChTYcN1NSu339NFkHAkPXeYDjDA5jdk55ogkGlPcLqPRFdaX4KbJOdfMiNK2zIyKOJsIqBZ47NhXQWX53yLmb2pW1TfxfoYUZWqrfeG57KzLOxj9K1U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723195074; c=relaxed/simple; bh=ywvSYruu5A8rEsAGlzTFsi9xFpwfkvf469P5az4k1yw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RA590Cq6r28yuT0HFcK9QwN11YAImsPw7aB7ElE4xz/1qM1RxnsH09jBG6ZuV9qJo23oO5cAWlNwuMShzhOJlTN8AW+0MezFnpmxymP8KdMX8y3MErKeTVc/qLtHv+NSCq8worwBXe2u/KCySucckLRjO4VY1LKCZ7XtyB6tO6Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ozGCJuPF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ozGCJuPF" Received: by smtp.kernel.org (Postfix) with ESMTPS id 75284C4AF0E; Fri, 9 Aug 2024 09:17:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723195074; bh=ywvSYruu5A8rEsAGlzTFsi9xFpwfkvf469P5az4k1yw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=ozGCJuPF9VTxbXnNN1k0muhO2FbBd15cyY+YqgAIEg2XSxOeYyEp1eryRfjeqkJAu BUUeF4rJd9P7/xmnQqeo5Ihb60ydcSfdq0I6gNC+VB7K47ZbZxXlbYd4Nx6hThKWGD qssxCcoJ+OeQKE9PJY1CTD4ZIkeHXTKCOTn4Re6JG06n4LNk+dgd9hLhTdYw9izbs5 TDLi39AwXvjkf2bDEhpCOg1RBIfdcfYX+m5DzJLTQyKKlnqXJk/1Z+T7sVriXirXXF VALeRFZoOPNlEbjaO5Qlhi6K1LpgXws0YI4u+/ZRx2tXVLfnG+QoHUBTuvKpVlhBAz wDJkdRG/Lhtag== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65BD8C531DB; Fri, 9 Aug 2024 09:17:54 +0000 (UTC) From: Nuno Sa via B4 Relay Date: Fri, 09 Aug 2024 11:17:08 +0200 Subject: [PATCH 3/4] iio: imu: adis16400: drop ifdef around CONFIG_DEBUG_FS Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240809-dev-adis-debugfs-improv-v1-3-d3adb6996518@analog.com> References: <20240809-dev-adis-debugfs-improv-v1-0-d3adb6996518@analog.com> In-Reply-To: <20240809-dev-adis-debugfs-improv-v1-0-d3adb6996518@analog.com> To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Dragos Bogdan X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1723195072; l=1916; i=nuno.sa@analog.com; s=20231116; h=from:subject:message-id; bh=6Q00KFDp8vSfMOy9SOdSB2hurveB/47INrxlbxbqT6k=; b=MOe2m3mRxxYVT4dKXrTL7w9TeT5oxgHTj8VgX43Gt9YlBbwhopa21a5uQF45NtrIp2p6KBmTo xIZDDiTEo38CYmW1+rCWg6QmF2GTb/WqFoYp+BfYarWftjWPX1Z5PdA X-Developer-Key: i=nuno.sa@analog.com; a=ed25519; pk=3NQwYA013OUYZsmDFBf8rmyyr5iQlxV/9H4/Df83o1E= X-Endpoint-Received: by B4 Relay for nuno.sa@analog.com/20231116 with auth_id=100 X-Original-From: Nuno Sa Reply-To: nuno.sa@analog.com From: Nuno Sa Use IS_ENABLED(CONFIG_DEBUG_FS) to return in case debugfs is not present. Since this is known at compile time, it allows the compiler to drop any unused code. Therefore no need to wrap the code with #ifdef. While at it make adis16400_debugfs_init() void as the return code is ignored. Signed-off-by: Nuno Sa --- drivers/iio/imu/adis16400.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/iio/imu/adis16400.c b/drivers/iio/imu/adis16400.c index 0bfd6205f5f6..6484ab8aff55 100644 --- a/drivers/iio/imu/adis16400.c +++ b/drivers/iio/imu/adis16400.c @@ -202,8 +202,6 @@ enum { ADIS16400_SCAN_TIMESTAMP, }; -#ifdef CONFIG_DEBUG_FS - static ssize_t adis16400_show_serial_number(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { @@ -273,11 +271,14 @@ static int adis16400_show_flash_count(void *arg, u64 *val) DEFINE_DEBUGFS_ATTRIBUTE(adis16400_flash_count_fops, adis16400_show_flash_count, NULL, "%lld\n"); -static int adis16400_debugfs_init(struct iio_dev *indio_dev) +static void adis16400_debugfs_init(struct iio_dev *indio_dev) { struct adis16400_state *st = iio_priv(indio_dev); struct dentry *d = iio_get_debugfs_dentry(indio_dev); + if (!IS_ENABLED(CONFIG_DEBUG_FS)) + return; + if (st->variant->flags & ADIS16400_HAS_SERIAL_NUMBER) debugfs_create_file_unsafe("serial_number", 0400, d, st, &adis16400_serial_number_fops); @@ -286,19 +287,8 @@ static int adis16400_debugfs_init(struct iio_dev *indio_dev) d, st, &adis16400_product_id_fops); debugfs_create_file_unsafe("flash_count", 0400, d, st, &adis16400_flash_count_fops); - - return 0; } -#else - -static int adis16400_debugfs_init(struct iio_dev *indio_dev) -{ - return 0; -} - -#endif - enum adis16400_chip_variant { ADIS16300, ADIS16334, From patchwork Fri Aug 9 09:17:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuno Sa via B4 Relay X-Patchwork-Id: 13758580 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E27681917C8 for ; Fri, 9 Aug 2024 09:17:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723195075; cv=none; b=F5QLMEOB1FAiAt/8U/6tc5iAoFwJ77GjiIXs1sKPVHcflPKx+ZSk6EhARFFyh8uwjhZp7mxf46gjK6Ik3bStHGr1je+JSQWPzn/Ub3P8hy8XCQoUgAuwrzIYn7DhbMLOX99iezeRwLqpmMlZEHmlaLXF/LRzdMPrE3XGQlvaPDc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723195075; c=relaxed/simple; bh=O3PAu0KPnew2Lsasy7spSd9UaaYSvDcIXFjbnnwYTtY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IbTwB0w90z4ekP1uBAmJ88gFL/zqLUSUQa9LcJtJvmya/wnNNdROC9I7X+Yq7ZOS0FULvHjhaMOvPPmwebGXG+mrY/Dq4yUD+D7p8aoTneHEG2P6NfqBCvkXM5gIP5VpVrubgDT+0iwtskfJd0ahy8UGYEqwc5VjnSPBscuR8tA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LY7HJeQJ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LY7HJeQJ" Received: by smtp.kernel.org (Postfix) with ESMTPS id 7F6D0C4AF10; Fri, 9 Aug 2024 09:17:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723195074; bh=O3PAu0KPnew2Lsasy7spSd9UaaYSvDcIXFjbnnwYTtY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=LY7HJeQJou/vkZ03InvMHQIAJDgDy//KYWFliDilaMCxPx4oDRr7URFKhF0gEarqk +8c5NdYZzFMPJMDFObwbSZtB34v1L3EIJAI6oA+Q30ypuC7oeXWQTQGCVkUUKPJViM Op2mLOJw0hpHQWkTP7G8yl3FeD72XCehjUKgsqPz2xYNTTn/f+0bERF9DyMoRidrbu xIpIyfJ3Us+oaTOIf+rBsO25tJdNsWY7xRCUaFiqHPEUmKuo4ggb9y8fTjXUb6/jSG w7QpVINJEEVipU66GOb4uMq1WCDZAe8Msp739R4GMyiVzkaQZ8+Bj0RJgRcLzh7C4b xBYCY0EQygyWA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73688C531DA; Fri, 9 Aug 2024 09:17:54 +0000 (UTC) From: Nuno Sa via B4 Relay Date: Fri, 09 Aug 2024 11:17:09 +0200 Subject: [PATCH 4/4] iio: imu: adis16460: drop ifdef around CONFIG_DEBUG_FS Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240809-dev-adis-debugfs-improv-v1-4-d3adb6996518@analog.com> References: <20240809-dev-adis-debugfs-improv-v1-0-d3adb6996518@analog.com> In-Reply-To: <20240809-dev-adis-debugfs-improv-v1-0-d3adb6996518@analog.com> To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Dragos Bogdan X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1723195072; l=1899; i=nuno.sa@analog.com; s=20231116; h=from:subject:message-id; bh=n1Jglfa5iy92BkrwrPeTAXoPaCMzOj6zVbu4oTIXimA=; b=YfrAyimaJSeHI23eRNfs1lZQ0nIiSOL9ap+I5hl9chdkqZ/VbhqCiSUyTIf/q+ZA1gNUvTKyK /NjwlK4wDF9DL3kuBfA3BzQrjMedsxEXNFhQXG0qzhn8CRRoP5ZMWLw X-Developer-Key: i=nuno.sa@analog.com; a=ed25519; pk=3NQwYA013OUYZsmDFBf8rmyyr5iQlxV/9H4/Df83o1E= X-Endpoint-Received: by B4 Relay for nuno.sa@analog.com/20231116 with auth_id=100 X-Original-From: Nuno Sa Reply-To: nuno.sa@analog.com From: Nuno Sa Use IS_ENABLED(CONFIG_DEBUG_FS) to return in case debugfs is not present. Since this is known at compile time, it allows the compiler to drop any unused code. Therefore no need to wrap the code with #ifdef. While at it make adis16460_debugfs_init() void as the return code is ignored. Signed-off-by: Nuno Sa --- drivers/iio/imu/adis16460.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/iio/imu/adis16460.c b/drivers/iio/imu/adis16460.c index 69facd72bd7d..eaa38dd6201f 100644 --- a/drivers/iio/imu/adis16460.c +++ b/drivers/iio/imu/adis16460.c @@ -69,8 +69,6 @@ struct adis16460 { struct adis adis; }; -#ifdef CONFIG_DEBUG_FS - static int adis16460_show_serial_number(void *arg, u64 *val) { struct adis16460 *adis16460 = arg; @@ -125,30 +123,22 @@ static int adis16460_show_flash_count(void *arg, u64 *val) DEFINE_DEBUGFS_ATTRIBUTE(adis16460_flash_count_fops, adis16460_show_flash_count, NULL, "%lld\n"); -static int adis16460_debugfs_init(struct iio_dev *indio_dev) +static void adis16460_debugfs_init(struct iio_dev *indio_dev) { struct adis16460 *adis16460 = iio_priv(indio_dev); struct dentry *d = iio_get_debugfs_dentry(indio_dev); + if (!IS_ENABLED(CONFIG_DEBUG_FS)) + return; + debugfs_create_file_unsafe("serial_number", 0400, d, adis16460, &adis16460_serial_number_fops); debugfs_create_file_unsafe("product_id", 0400, d, adis16460, &adis16460_product_id_fops); debugfs_create_file_unsafe("flash_count", 0400, d, adis16460, &adis16460_flash_count_fops); - - return 0; } -#else - -static int adis16460_debugfs_init(struct iio_dev *indio_dev) -{ - return 0; -} - -#endif - static int adis16460_set_freq(struct iio_dev *indio_dev, int val, int val2) { struct adis16460 *st = iio_priv(indio_dev);