From nobody Fri Dec 19 09:46:08 2025 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (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 16F7B481AA for ; Sun, 17 Dec 2023 19:31:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rEwrg-0007Ge-RU; Sun, 17 Dec 2023 20:31:52 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rEwrg-00GXTk-9S; Sun, 17 Dec 2023 20:31:52 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rEwrg-004ow4-0B; Sun, 17 Dec 2023 20:31:52 +0100 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= To: Santosh Shilimkar , Krzysztof Kozlowski Cc: kernel@pengutronix.de, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] memory: emif: Simplify code handling CONFIG_DEBUG_FS Date: Sun, 17 Dec 2023 20:31:31 +0100 Message-ID: <2c7dd66d4a101b74b16e7e1839e30f3c88510c33.1702829744.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Developer-Signature: v=1; a=openpgp-sha256; l=2299; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=cNuwKEMd45aqzupPi2qb5vZR8pJEhJctqL+QHzyhSEI=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlf0yWF5TzdWoQllzg7+AC3DhtgKGmIgXjLgmM2 nhM6Lyqop2JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZX9MlgAKCRCPgPtYfRL+ TnL/CACL53V7d3OibbYPPfpyRIZAN/rX79i1zHBITtLob3jyamjbQGQsed30mABSa9VnIaUJS7j ne4+gx7tcKMm26iiEpRPRa26zpgYdbk5rKMuuELqVlX0dBCOrZJn3tvC49m28hOr8BhlWnA5yMa EUl4kblSnepsLENREKrwRn2qjJPbuuwVe1i+xD6DVFQKhuOKlfEq1t2Z0lhNcqAsMwmrZUVDJzP KVCTVBwPYKK0TgKD7/GOPB6lfb60rdGwi/+E9Ur5euJnPRMFYBoEp4RE5dIAvFTk7cZHs39YsaR 7U6CMcIk9uQbqtvF0u4eg3KseftHaYvqRzvIiF3WWRnY4XXD X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Instead of using #ifdef make use of IS_ENABLED(). According to bloat-o-meter this patch doesn't change code sizes with CONFIG_DEBUG_FS=3Dn. Also change emif_debugfs_init() to return void. The only caller doesn't check the return value anyhow. Signed-off-by: Uwe Kleine-K=C3=B6nig --- drivers/memory/emif.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c index f305643209f0..dd1d87f8fdc8 100644 --- a/drivers/memory/emif.c +++ b/drivers/memory/emif.c @@ -72,7 +72,6 @@ static DEFINE_SPINLOCK(emif_lock); static unsigned long irq_state; static LIST_HEAD(device_list); =20 -#ifdef CONFIG_DEBUG_FS static void do_emif_regdump_show(struct seq_file *s, struct emif_data *emi= f, struct emif_regs *regs) { @@ -140,31 +139,24 @@ static int emif_mr4_show(struct seq_file *s, void *un= used) =20 DEFINE_SHOW_ATTRIBUTE(emif_mr4); =20 -static int __init_or_module emif_debugfs_init(struct emif_data *emif) +static void __init_or_module emif_debugfs_init(struct emif_data *emif) { - emif->debugfs_root =3D debugfs_create_dir(dev_name(emif->dev), NULL); - debugfs_create_file("regcache_dump", S_IRUGO, emif->debugfs_root, emif, - &emif_regdump_fops); - debugfs_create_file("mr4", S_IRUGO, emif->debugfs_root, emif, - &emif_mr4_fops); - return 0; + if (IS_ENABLED(CONFIG_DEBUG_FS)) { + emif->debugfs_root =3D debugfs_create_dir(dev_name(emif->dev), NULL); + debugfs_create_file("regcache_dump", S_IRUGO, emif->debugfs_root, emif, + &emif_regdump_fops); + debugfs_create_file("mr4", S_IRUGO, emif->debugfs_root, emif, + &emif_mr4_fops); + } } =20 static void __exit emif_debugfs_exit(struct emif_data *emif) { - debugfs_remove_recursive(emif->debugfs_root); - emif->debugfs_root =3D NULL; + if (IS_ENABLED(CONFIG_DEBUG_FS)) { + debugfs_remove_recursive(emif->debugfs_root); + emif->debugfs_root =3D NULL; + } } -#else -static inline int __init_or_module emif_debugfs_init(struct emif_data *emi= f) -{ - return 0; -} - -static inline void __exit emif_debugfs_exit(struct emif_data *emif) -{ -} -#endif =20 /* * Get bus width used by EMIF. Note that this may be different from the --=20 2.42.0