From patchwork Sun Dec 17 19:31:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 180060 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp858594dyi; Sun, 17 Dec 2023 11:32:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IEvGhHLcLq2aYYY/FhUKtHozhVKLBVO2iOefZWHsn7amauvMGxLIhOIC4PW6Cw4jYl0WVUa X-Received: by 2002:a05:6808:3193:b0:3ba:34d:85f3 with SMTP id cd19-20020a056808319300b003ba034d85f3mr15895656oib.72.1702841559242; Sun, 17 Dec 2023 11:32:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702841559; cv=none; d=google.com; s=arc-20160816; b=eNMQqRPv09Hb8TBrtRbdV5sCGSoCWfme8QBXtWVe6co7OcnNMJ5DnpeEwepeVodubx xOUjg2DNqP+mKonHX3Q+jX4TXhrK/U71h0Bzi+1nnmqghhXeO1D0wG2URby0SExgdIPL V9N0uMs6vpXCwTnStabC1njfls8BZypeMQzuNuAhEZF/KuIrIzB4rZ9+/xFa265F+Sj1 YcSIYHFpfrcE5eo3S6GXkCAAY8QBgcwzRm+MOanhE4vpkFdT2U7MHWbko/yRW622LCtm EXWEWVoxeW9NNYe1XTkAj05KGvhZ8EMgNS+2nLdqWKDSNJ12jaG1LYucprv4eEu01N40 wCSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=BG5QOERLW5M4aNn630eRtDtXQsKO+0lmGJ6LcnUQd/8=; fh=lndhqhM/smUv/sqG9l62mCR6taeFpgcLIT7VIeds5fc=; b=ezT492UzQtKp52Qb1j4EfoHnOLyDB+Rm57r+Vh142K+qiAgglCFVeYpVGjONDHETWQ QJr7lLf2VN7ZFPaDzEwsCak4UR2jAagdigit8vKwyesO7ZhMf3E2pT1N2u8bDUx4tUIE sd+hGVbGskR5NeirhhiCTdpxLHjsR6b9GsRV8IoEK3aKOyt5+Y+ibmhXNnPGcEI7wnPI xbpEAR1zOi86mn0PVLKtJ8RGamn8uQhPnZlVggcqhiEUyyckNqegI8KfpJ8G3GMQJk79 YhEMQ1Wc6+PCQhmtsbHFNitPvItwHL/dU2vqwi2hoax2gIJyZs+eJ+bJulUi4PkZjxDx mIBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-2783-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2783-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id m63-20020a632642000000b005c5e2488c32si2657493pgm.405.2023.12.17.11.32.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 11:32:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2783-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-2783-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2783-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B014C282D63 for ; Sun, 17 Dec 2023 19:32:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 23EFD495CF; Sun, 17 Dec 2023 19:32:00 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org 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_Kleine-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 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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785558790790558245 X-GMAIL-MSGID: 1785558790790558245 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=n. Also change emif_debugfs_init() to return void. The only caller doesn't check the return value anyhow. Signed-off-by: Uwe Kleine-König --- 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); -#ifdef CONFIG_DEBUG_FS static void do_emif_regdump_show(struct seq_file *s, struct emif_data *emif, struct emif_regs *regs) { @@ -140,31 +139,24 @@ static int emif_mr4_show(struct seq_file *s, void *unused) DEFINE_SHOW_ATTRIBUTE(emif_mr4); -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 = 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 = 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); + } } static void __exit emif_debugfs_exit(struct emif_data *emif) { - debugfs_remove_recursive(emif->debugfs_root); - emif->debugfs_root = NULL; + if (IS_ENABLED(CONFIG_DEBUG_FS)) { + debugfs_remove_recursive(emif->debugfs_root); + emif->debugfs_root = NULL; + } } -#else -static inline int __init_or_module emif_debugfs_init(struct emif_data *emif) -{ - return 0; -} - -static inline void __exit emif_debugfs_exit(struct emif_data *emif) -{ -} -#endif /* * Get bus width used by EMIF. Note that this may be different from the From patchwork Sun Dec 17 19:31:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 180062 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp861208dyi; Sun, 17 Dec 2023 11:40:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IH7qbfqmiKHBBHXH9eG/yJvsTXjSY+lvti22tzZEhjd/mfhay2rlPYlyH0JyVgOWDkoDeug X-Received: by 2002:a05:6512:a8a:b0:50c:2254:9f5f with SMTP id m10-20020a0565120a8a00b0050c22549f5fmr5859581lfu.34.1702842053340; Sun, 17 Dec 2023 11:40:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702842053; cv=none; d=google.com; s=arc-20160816; b=t3rN5SVoWs7FtGqOGlx1cYp54nnq/oUHceHtR2edKL6CzOzDUaxcnjxaTpBQDH1i9j KzjiyzUgwaKUmf1NxhABGpuXJg5MIXoVQLfeDMzZBF6mTmG1yRcEDhUHjqbDhOCmL3gY oIqh2kPxPtgL89vYc6nqYxb2xviFaSNArhN6jnV9xB6IjuVgZeF565kQKByaX9lQUI+G LQHRm0t5renleN2OliTczHNW64nxwuRPEiTENMHOBvs0adn7T4Z6EmvLjwVAv5NKj6kY HOCyRQFitENiGMw39If5C3YTVeYS5aQH7TT5O2/rhMwQnbczOOrm+12iS3U8MBofgJkD UPxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=Ksvta4Y31qY4t6AR5q9nPejIZRte2NZlAYJes54T4k8=; fh=lndhqhM/smUv/sqG9l62mCR6taeFpgcLIT7VIeds5fc=; b=VbhWFSET5ix/TCtYfEZga2l38Asw2uiQi+tg4DJRPodMjcdjdHFRNY7q0aZaiZVRGI g8Nfbqtw9VShZcxlroLejDHVknkjQjJZD47w7zIX7B18EO+n2ppybAyWj8qP1M3cdfJj IELBDRxzkOVsCBR6rkMDqmJG4cliIKhUlP+tqekgMVmoLuRbKc1XgVURi2YZ8AkTsp3h k4yz8JvWGNE+NM2fAkvLGyCpouSBBki5N6h/0P+urffa6gbZQ4ysoT9+zQq3pOMTTgEz 5eZkEBgZUBYrMzlMvukr0uIU0veAhyxCoswJ+H40oNtMgDCMDaRA22TrbdMg0fdamlq4 FKow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-2782-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2782-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 18-20020a508e12000000b0054d9f540c4fsi9720905edw.551.2023.12.17.11.40.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 11:40:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2782-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-2782-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2782-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A901F1F22E31 for ; Sun, 17 Dec 2023 19:32:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B52A048CCB; Sun, 17 Dec 2023 19:31:59 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org 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 16F9A481AB 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 1rEwrh-0007Gf-0H; Sun, 17 Dec 2023 20:31:53 +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-00GXTn-If; 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-004owA-9V; Sun, 17 Dec 2023 20:31:52 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Santosh Shilimkar , Krzysztof Kozlowski Cc: kernel@pengutronix.de, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] memory: emif: Simplify code handling CONFIG_OF Date: Sun, 17 Dec 2023 20:31:32 +0100 Message-ID: <9d53683c34a730c8579a1468b643b11d1379106e.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 X-Developer-Signature: v=1; a=openpgp-sha256; l=1329; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=UHloRVwjjpUa4EBDR6pja+PDlmCiXF568S5ktJTQgoc=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlf0yXR76tMQcRZQjv60lpw/WVYuSOoAAM2PoLS ucd3JRLq7aJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZX9MlwAKCRCPgPtYfRL+ TsmeB/wM2bxYP6wMGCtl5hvyzR28sHfzThhCfKTnPAfEBBqUgqiKZkpzSO2CVcJhNgLVqV6cgQl wyyncvZe+Dv5+CIhpqlfsNUB8PGtCsN4HYlTa/kxGSgTulv53IzQtKPLiMVaetoMISHEpp2q/mR +N0eoiTwKf25+qC0YTaWuUV0qNt57I9KFRHYPGfcfFZk0oC+FATExB6NsHtog0veYBNSNmDvIVK OPpfiPojLpaBwXDHlZ/RmxSwbT20k0tBV7khG9kt+3+O/awc6q8TIYnSTV39O5Zry2eUfKSJEHL /5A3ZvMtySqt9Jfa2G6zZzsV+FsmGLKEYJyWDpuarMBn1PVk X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785559309081929114 X-GMAIL-MSGID: 1785559309081929114 The first thing that of_get_memory_device_details() does is calling of_parse_phandle(). With CONFIG_OF=n this returns NULL in a static inline function. So the compiler can determine that of_get_memory_device_details() also returns NULL. bloat-o-meter confirms that this patch has no effects on the size of the generated code for CONFIG_OF=n builds. Signed-off-by: Uwe Kleine-König --- drivers/memory/emif.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c index dd1d87f8fdc8..5a3194b9b3bc 100644 --- a/drivers/memory/emif.c +++ b/drivers/memory/emif.c @@ -826,7 +826,6 @@ static int is_custom_config_valid(struct emif_custom_configs *cust_cfgs, return valid; } -#if defined(CONFIG_OF) static void __init_or_module of_get_custom_configs(struct device_node *np_emif, struct emif_data *emif) { @@ -983,15 +982,6 @@ static struct emif_data * __init_or_module of_get_memory_device_details( return emif; } -#else - -static struct emif_data * __init_or_module of_get_memory_device_details( - struct device_node *np_emif, struct device *dev) -{ - return NULL; -} -#endif - static struct emif_data *__init_or_module get_device_details( struct platform_device *pdev) { From patchwork Sun Dec 17 19:31:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 180061 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp858669dyi; Sun, 17 Dec 2023 11:32:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IH7Q5hhvbTLu1x6smeS2wv7kqvZl6Qa4MsQ4A5fkB11xdG7cpvoJlZMnKhjfVKecvUegLsJ X-Received: by 2002:a05:6870:524b:b0:203:8105:570f with SMTP id o11-20020a056870524b00b002038105570fmr2979231oai.82.1702841571462; Sun, 17 Dec 2023 11:32:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702841571; cv=none; d=google.com; s=arc-20160816; b=S64XJ8XEDxWvW5mtPGy6ikvMKdrFAgGA+pjTMAoYbyX8abtocKIRUC+Jz4t+wk0x7j gL+4D2lRL5+LSxgAWbLp9T6dACWm6an4OqkmcxoVRMcvXhrsCjhPx6LKGAtdRMLx5YDk HHQLTEv9WBZZ9wt8UqRgU0lUzPTKMAYoIpUf1C22jqbmOZ0Y4wZH2m+SPrW5Sa39a/V/ eJEHU/uFL986CkWRA1Mz+Omfzo6Hu8ZIuWfvHUQ1eEiQJ+xX4sjeyBPkuQi34A6gpC8/ SPiWl8EugE6ebMOE0kMEB8BGI+SJC/2BratJZ/FYxukSwv/BoUOzSnhUBGT2LDUMWsoJ IMjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=DSj5OnRurqEQ1gxGqxQ3JRWeEoT8WqDfumHtSvmaiXs=; fh=lndhqhM/smUv/sqG9l62mCR6taeFpgcLIT7VIeds5fc=; b=hpL6Od5vAD6zp71vlFOizt7isD7j3PZ07lP2ZHxKZ5JogUsHYqQHHEXz80xfTPf/4l T/wxZjHWzO69X5Rd10rvexggZt0Hj4oRgXq8BPw6w1lWvWdVsnTirKdo751+/wHOIfyI xysmCHXmg9aGtKAfkpzC0LRpOuW416TtK4R2iOZhHF+zwzkNVOVU+BBnFMu9CbJ5eHwC u5Dsi0TSTxdwQKEtTBlBIAv/xJpFDnMd7I+t3Ijes5TGEgrkXKS0/BqM2G2BKnGUlMPU Jof59sZgIt1hNPt7NU9aS4AaLIEfIPRVwWhTQbALcTi/5jSvxsW1TPCkpY897sSW67Y1 n/ig== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-2785-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2785-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id gx20-20020a17090b125400b0028b3aac8222si3946975pjb.98.2023.12.17.11.32.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 11:32:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2785-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-2785-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2785-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A817A282D02 for ; Sun, 17 Dec 2023 19:32:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CCD6749F74; Sun, 17 Dec 2023 19:32:00 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org 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 16F4A481A8 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 1rEwrh-0007H4-9b; Sun, 17 Dec 2023 20:31:53 +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-00GXTq-Sp; 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-004owZ-Jj; Sun, 17 Dec 2023 20:31:52 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Santosh Shilimkar , Krzysztof Kozlowski Cc: kernel@pengutronix.de, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] memory: emif: Drop usage of platform_driver_probe() Date: Sun, 17 Dec 2023 20:31:33 +0100 Message-ID: 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 X-Developer-Signature: v=1; a=openpgp-sha256; l=4433; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=prMBQ2hUCtXqI31SUwr+YXxg/mNN8P06lT4SD94pU6Q=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlf0yYc5fPWSiK6VDZRTJfH4m+kxn7+7FcHt0ME LDhaHvRpGeJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZX9MmAAKCRCPgPtYfRL+ Tm+pB/4lbsjs55REpb7bJZRLG0pPcPE2zk0CeG2sMCR9za6KJzAGC7NtTR2Qvx0FdlBewfLEfxP wgUvxVVYjtGm07zqCLsobijBYxQFu4uSrwRVJCnQqA65frfiI90peK2VDkXWY9red6AwEoT7rNj Me/7erQ111NeAva0+VTE/vv5j3SBVV3a14c1dOz5Za2zgSvwzMt68OVYL//z67mTm2bN4BQCX1n raGrCTfJ1101R1AtDNL0t3SbsZjzH6srwIlybzTr5biu2n98Ed8hsDXOhoC49+v9mdNfxFaD4Sa NVlNF/BtjQyP/jtIlN0bR/Wm0/BELi4UiYXxUuUCcoEVBEii X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785558803556458554 X-GMAIL-MSGID: 1785558803556458554 There are considerations to drop platform_driver_probe() as a concept that isn't relevant any more today. It comes with an added complexity that makes many users hold it wrong. (E.g. this driver should have better used __init instead of __init_or_module to mark functions only relevant to .probe() and mark the driver struct with __refdata.) This fixes a W=1 build warning: WARNING: modpost: drivers/memory/emif: section mismatch in reference: emif_driver+0x4 (section: .data) -> emif_remove (section: .exit.text) Signed-off-by: Uwe Kleine-König --- drivers/memory/emif.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c index 5a3194b9b3bc..84973d7133f4 100644 --- a/drivers/memory/emif.c +++ b/drivers/memory/emif.c @@ -139,7 +139,7 @@ static int emif_mr4_show(struct seq_file *s, void *unused) DEFINE_SHOW_ATTRIBUTE(emif_mr4); -static void __init_or_module emif_debugfs_init(struct emif_data *emif) +static void emif_debugfs_init(struct emif_data *emif) { if (IS_ENABLED(CONFIG_DEBUG_FS)) { emif->debugfs_root = debugfs_create_dir(dev_name(emif->dev), NULL); @@ -150,7 +150,7 @@ static void __init_or_module emif_debugfs_init(struct emif_data *emif) } } -static void __exit emif_debugfs_exit(struct emif_data *emif) +static void emif_debugfs_exit(struct emif_data *emif) { if (IS_ENABLED(CONFIG_DEBUG_FS)) { debugfs_remove_recursive(emif->debugfs_root); @@ -671,7 +671,7 @@ static void disable_and_clear_all_interrupts(struct emif_data *emif) clear_all_interrupts(emif); } -static int __init_or_module setup_interrupts(struct emif_data *emif, u32 irq) +static int setup_interrupts(struct emif_data *emif, u32 irq) { u32 interrupts, type; void __iomem *base = emif->base; @@ -702,7 +702,7 @@ static int __init_or_module setup_interrupts(struct emif_data *emif, u32 irq) } -static void __init_or_module emif_onetime_settings(struct emif_data *emif) +static void emif_onetime_settings(struct emif_data *emif) { u32 pwr_mgmt_ctrl, zq, temp_alert_cfg; void __iomem *base = emif->base; @@ -826,7 +826,7 @@ static int is_custom_config_valid(struct emif_custom_configs *cust_cfgs, return valid; } -static void __init_or_module of_get_custom_configs(struct device_node *np_emif, +static void of_get_custom_configs(struct device_node *np_emif, struct emif_data *emif) { struct emif_custom_configs *cust_cfgs = NULL; @@ -875,7 +875,7 @@ static void __init_or_module of_get_custom_configs(struct device_node *np_emif, emif->plat_data->custom_configs = cust_cfgs; } -static void __init_or_module of_get_ddr_info(struct device_node *np_emif, +static void of_get_ddr_info(struct device_node *np_emif, struct device_node *np_ddr, struct ddr_device_info *dev_info) { @@ -909,7 +909,7 @@ static void __init_or_module of_get_ddr_info(struct device_node *np_emif, dev_info->io_width = __fls(io_width) - 1; } -static struct emif_data * __init_or_module of_get_memory_device_details( +static struct emif_data *of_get_memory_device_details( struct device_node *np_emif, struct device *dev) { struct emif_data *emif = NULL; @@ -1086,7 +1086,7 @@ static struct emif_data *__init_or_module get_device_details( return NULL; } -static int __init_or_module emif_probe(struct platform_device *pdev) +static int emif_probe(struct platform_device *pdev) { struct emif_data *emif; int irq, ret; @@ -1141,7 +1141,7 @@ static int __init_or_module emif_probe(struct platform_device *pdev) return -ENODEV; } -static int __exit emif_remove(struct platform_device *pdev) +static int emif_remove(struct platform_device *pdev) { struct emif_data *emif = platform_get_drvdata(pdev); @@ -1167,7 +1167,8 @@ MODULE_DEVICE_TABLE(of, emif_of_match); #endif static struct platform_driver emif_driver = { - .remove = __exit_p(emif_remove), + .probe = emif_probe, + .remove = emif_remove, .shutdown = emif_shutdown, .driver = { .name = "emif", @@ -1175,7 +1176,7 @@ static struct platform_driver emif_driver = { }, }; -module_platform_driver_probe(emif_driver, emif_probe); +module_platform_driver(emif_driver); MODULE_DESCRIPTION("TI EMIF SDRAM Controller Driver"); MODULE_LICENSE("GPL");