From mboxrd@z Thu Jan 1 00:00:00 1970 From: Manojkiran Eda Date: Tue, 19 Mar 2024 09:35:35 -0000 Subject: [PATCH v2 2/4] mtd: Replace module_init with subsys_initcall In-Reply-To: <20240319093405.39833-1-manojkiran.eda@gmail.com> References: <20240319093405.39833-1-manojkiran.eda@gmail.com> Message-ID: <20240319093405.39833-3-manojkiran.eda@gmail.com> List-Id: To: linux-aspeed@lists.ozlabs.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit While engaged in development on the espi kernel device driver[1], I noticed that the espi flash driver, utilizing the mtd subsystem, appears to initialize before the mtdcore subsystem registers the mtd_class. As a result, although the mtd device for espi is created, it does not populate within the /sys/class/mtd hierarchy. Given that mtd serves as a subsystem upon which numerous other drivers rely for infrastructure, it appears logical to adjust the module_init() call to an alternative priority initcall, subsys_initcall(), thereby ensuring that the mtd core subsystem is probed prior to the drivers utilizing its infrastructure. Although this adjustment alters the initialization ordering, there exists a slight risk of uncovering implicit initialization ordering issues. However, I believe it is preferable to prioritize it reasonably rather than having module_init() in order to maintain the exact old ordering. Link : [1] https://lore.kernel.org/openbmc/20240213-espi_driver-v1-1-92741c812843 at gmail.com Signed-off-by: Manojkiran Eda --- drivers/mtd/mtdcore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index e451b28840d5..cc51c9fb2c1e 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -2560,7 +2560,7 @@ static void __exit cleanup_mtd(void) idr_destroy(&mtd_idr); } -module_init(init_mtd); +subsys_initcall(init_mtd); module_exit(cleanup_mtd); MODULE_LICENSE("GPL"); -- 2.40.1 From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 908D9C54E68 for ; Tue, 19 Mar 2024 09:35:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kzkw4lki4Yq8zxA+XLO4vZzmiiewoIV0kSNxVwBzmAg=; b=xjjp7TKiIvYKFe 5Ivck1T4412qPPDVheudEBWy6ti/ie5pycpQL8LU2yJTcXzYRmXEcjmhQk0HTBCOp+1vTRWiKFzo/ +8CNvLVdzfmdAtLE7B5urLZPP58kathF2xRHmZAeSOgxTyDk2Fy8+ptHjjBtgz+oVNnc1RrtC92W+ DJHqmOFlvmITyIi1nawVN00ugrFqQsg5XcOW4bJda0nNfL9sgSQjxiNrzkYx/tVEUCZjr7YqO8sve iWhsIEMcSbdCJ0VbgFCygpM+G/BaEDlLDdKKPjGhteCLTLe0Q2HoHcjDsu+YP9Mxgsw4VNFeVmKJ5 +cWoc54SzwOBukQANvBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmVsx-0000000C766-10eB; Tue, 19 Mar 2024 09:35:55 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmVsb-0000000C6ro-0lWF; Tue, 19 Mar 2024 09:35:35 +0000 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1dc29f1956cso31368175ad.0; Tue, 19 Mar 2024 02:35:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710840932; x=1711445732; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e94g+9vzH11aUQZhgMcMoQcXNPU48KmdzBLfG1dsEIk=; b=HnzpqLePyEFWC3PPJZ5hRfareH75Wbhl/eFH/53gVisj2r1oT6Rp3392ZSdzknmLdI 9NkgCC1P01hGZYCuDyC5e993RHuNYMhlblYZUAxtFKPBcDM2LG5Z7gYJFNmfoXgKTkQ9 Ynr90WNf+L+92F8O8pP9wMMUIUCVvXZnM9G6tVU/MFlYNqPs8xrsyivT2qzIRQO5oEA0 0dK2MMBSNln1xiNN/UXUq5syh1NYeXfZrk2Nx0v64vD2Kam1rVSZV32rmq4isPe9ZO6y /+6hDRKrt7TraEIXDI0t8cd0ypKLa9I75thcZsnjeVdNpWtbECzhI5lKB9hzxSvVK2mv utjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710840932; x=1711445732; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e94g+9vzH11aUQZhgMcMoQcXNPU48KmdzBLfG1dsEIk=; b=FBslhEs0Zh7HXmdK44P5ty+DGRNaPIy3KGwRR0VkyDYD4g8cW4rkXSZNn7YtZV99Wh 0UE9r32HjdYp0JzBissNrXMh2T3ivZeq2GbhWS2lLkd/bBpGCR0Q/9xZH1aAnW7hgoob xh9NbzhKLB0BemNE6qTXZVoZooh4k9njB1go7wrcw5HrKIXCtw01f3DZi36bT1R3f0qg uM8tRie/jIT3fB8hxBf3OUzpQ1nOohCYJe+kMDlEKIm56hXkN7eWwty257aEb9hAx8OI 0nIp1/2U2zU9wq8KPfhZ+BNxPrqdSn0anzDayFSSIsTqRxqt2TX/To1YWyxUCnMxFPIu K5LA== X-Forwarded-Encrypted: i=1; AJvYcCXVveUtB1iH5y/jpM9L8xEgwGdhgrgKaPqhOLPnZgqpFpHS7VvkVM7joC1jygkErMjMUU7QVCE3IMCIf6zOyvG1Snl5VlFZeEE5VkT9wJhs6yirkv4SMBNtADUQSZG9giS0RSJ0h0bK9AwD/CosVMHH7jXA X-Gm-Message-State: AOJu0Yw/pV6Hwmev8dKzDW7DaODr7u1PhmyzLLXbUsQXc0DVlKzvrFqc sD7GFpiyPgGQPhcceiHMx57w9Z8ZWjeYx+WK1tSVqB8d0MDIOSji X-Google-Smtp-Source: AGHT+IGRQerkxhBoo9SgQmB9rahSKXo6Kh9y5bn7m0LW33X3wWAr2V/9ZSigvft5pwucY8WqXpU8Zg== X-Received: by 2002:a17:902:ea08:b0:1db:55cc:d226 with SMTP id s8-20020a170902ea0800b001db55ccd226mr12398549plg.66.1710840932208; Tue, 19 Mar 2024 02:35:32 -0700 (PDT) Received: from localhost.localdomain ([129.41.58.3]) by smtp.gmail.com with ESMTPSA id n5-20020a170903110500b001ddc0bc5934sm10942432plh.249.2024.03.19.02.35.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 02:35:31 -0700 (PDT) From: Manojkiran Eda To: patrick.rudolph@9elements.com, chiawei_wang@aspeedtech.com, ryan_chen@aspeedtech.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org Cc: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, joel@jms.id.au, andrew@codeconstruct.com.au, miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, manojkiran.eda@gmail.com, jk@codeconstruct.com.au, openbmc@lists.ozlabs.org Subject: [PATCH v2 2/4] mtd: Replace module_init with subsys_initcall Date: Tue, 19 Mar 2024 15:04:03 +0530 Message-Id: <20240319093405.39833-3-manojkiran.eda@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240319093405.39833-1-manojkiran.eda@gmail.com> References: <20240319093405.39833-1-manojkiran.eda@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240319_023533_264266_F1812864 X-CRM114-Status: GOOD ( 12.98 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org While engaged in development on the espi kernel device driver[1], I noticed that the espi flash driver, utilizing the mtd subsystem, appears to initialize before the mtdcore subsystem registers the mtd_class. As a result, although the mtd device for espi is created, it does not populate within the /sys/class/mtd hierarchy. Given that mtd serves as a subsystem upon which numerous other drivers rely for infrastructure, it appears logical to adjust the module_init() call to an alternative priority initcall, subsys_initcall(), thereby ensuring that the mtd core subsystem is probed prior to the drivers utilizing its infrastructure. Although this adjustment alters the initialization ordering, there exists a slight risk of uncovering implicit initialization ordering issues. However, I believe it is preferable to prioritize it reasonably rather than having module_init() in order to maintain the exact old ordering. Link : [1] https://lore.kernel.org/openbmc/20240213-espi_driver-v1-1-92741c812843@gmail.com Signed-off-by: Manojkiran Eda --- drivers/mtd/mtdcore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index e451b28840d5..cc51c9fb2c1e 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -2560,7 +2560,7 @@ static void __exit cleanup_mtd(void) idr_destroy(&mtd_idr); } -module_init(init_mtd); +subsys_initcall(init_mtd); module_exit(cleanup_mtd); MODULE_LICENSE("GPL"); -- 2.40.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ From mboxrd@z Thu Jan 1 00:00:00 1970 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2B30CC54E60 for ; Tue, 19 Mar 2024 09:38:19 +0000 (UTC) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=X+P2uMOt; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4TzRVK5rJ7z3vX5 for ; Tue, 19 Mar 2024 20:38:17 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=X+P2uMOt; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::62a; helo=mail-pl1-x62a.google.com; envelope-from=manojkiran.eda@gmail.com; receiver=lists.ozlabs.org) Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4TzRRC1cRmz3dRm; Tue, 19 Mar 2024 20:35:35 +1100 (AEDT) Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1dddaa02d22so26716015ad.2; Tue, 19 Mar 2024 02:35:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710840932; x=1711445732; darn=lists.ozlabs.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e94g+9vzH11aUQZhgMcMoQcXNPU48KmdzBLfG1dsEIk=; b=X+P2uMOtYEBltQxF/tmDLp9XzQywUfZPx5b3C/Z0ZCQdCjhQqAtKZJVaKVF/Qp8Oj8 wMNLeETMetK++FDMAzD7DMTugFnXGN+iiQTbnIpFEtXG4YlQnuLHhQ2Sx3+2Ng7vRJ2C jKf4AVgkOfhXnb+4QYZfbrEDpigkRkLB0bqNNRKt/7gJLmhrK2fkfGZIuMJsE663TRHK ZelZj/ulMWpv40Ob44W1OLcxx8SteQQ0sSYNoOFZ83DMA6DKNop/tSXEsGQMXDNRT4Xy RcDYjJMk/mBfaV2Jkp4UGc6PkuAJyziwAHMtRoWl73EpzOpzES2bCgs5DJsoUqWr5c/E tE5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710840932; x=1711445732; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e94g+9vzH11aUQZhgMcMoQcXNPU48KmdzBLfG1dsEIk=; b=wwHeQBRAzMQNgLjV+iNRGCphkm6h4fUgJD8v6C8s25g14I8YiNj7SUbTLXa8qi+44/ GEYNE7pWwGZ8+fSUTFzUkEBlYR8Ix4GKgYbK58PmiskCVZe34J70drDFrnvvkbh68J// kxDm009EwgV67EOImoGsGo7QMfpyfnvjL3rPBhc7t8GeMPtTQjNJyg6EGSgcQNK1c5zf 1xRhyG7VucjnnXKx4M1CLJHWkfoF7mM0UDcDgIg3aBEps9t2eidlyrV58EWqdXIhrf9h rabletGkt9FQyPfIXP/jqOJABLKJEjyxJqyPa+73klOpgKOvFdOpP7nGZuT4MCh5E9OT uwvw== X-Forwarded-Encrypted: i=1; AJvYcCUvJYnxZxsMUYvXHm6OjQho930wgMnxGBrvxUCXW4HXvuLe8TcDMpL/mujC8PrZjJwD/YMFO6CrgqOFtvYmhJdw1thxwbea8u+12lM0FIVIZdICmLHrSGOR/3EYpDG9TxPUid6PtKFZ X-Gm-Message-State: AOJu0YwgLe3dQcvixq3QtPOVVbJxF1hD5P/2MNsPy2727taCYLUxAvb6 pA9skA6VgY8e/88WoEg9yeYj4LOJu/4FqpIUdFoc8Ob/yKp02T+X X-Google-Smtp-Source: AGHT+IGRQerkxhBoo9SgQmB9rahSKXo6Kh9y5bn7m0LW33X3wWAr2V/9ZSigvft5pwucY8WqXpU8Zg== X-Received: by 2002:a17:902:ea08:b0:1db:55cc:d226 with SMTP id s8-20020a170902ea0800b001db55ccd226mr12398549plg.66.1710840932208; Tue, 19 Mar 2024 02:35:32 -0700 (PDT) Received: from localhost.localdomain ([129.41.58.3]) by smtp.gmail.com with ESMTPSA id n5-20020a170903110500b001ddc0bc5934sm10942432plh.249.2024.03.19.02.35.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 02:35:31 -0700 (PDT) From: Manojkiran Eda To: patrick.rudolph@9elements.com, chiawei_wang@aspeedtech.com, ryan_chen@aspeedtech.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org Subject: [PATCH v2 2/4] mtd: Replace module_init with subsys_initcall Date: Tue, 19 Mar 2024 15:04:03 +0530 Message-Id: <20240319093405.39833-3-manojkiran.eda@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240319093405.39833-1-manojkiran.eda@gmail.com> References: <20240319093405.39833-1-manojkiran.eda@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: conor+dt@kernel.org, vigneshr@ti.com, richard@nod.at, openbmc@lists.ozlabs.org, robh+dt@kernel.org, joel@jms.id.au, krzysztof.kozlowski+dt@linaro.org, miquel.raynal@bootlin.com, jk@codeconstruct.com.au, manojkiran.eda@gmail.com Errors-To: openbmc-bounces+openbmc=archiver.kernel.org@lists.ozlabs.org Sender: "openbmc" While engaged in development on the espi kernel device driver[1], I noticed that the espi flash driver, utilizing the mtd subsystem, appears to initialize before the mtdcore subsystem registers the mtd_class. As a result, although the mtd device for espi is created, it does not populate within the /sys/class/mtd hierarchy. Given that mtd serves as a subsystem upon which numerous other drivers rely for infrastructure, it appears logical to adjust the module_init() call to an alternative priority initcall, subsys_initcall(), thereby ensuring that the mtd core subsystem is probed prior to the drivers utilizing its infrastructure. Although this adjustment alters the initialization ordering, there exists a slight risk of uncovering implicit initialization ordering issues. However, I believe it is preferable to prioritize it reasonably rather than having module_init() in order to maintain the exact old ordering. Link : [1] https://lore.kernel.org/openbmc/20240213-espi_driver-v1-1-92741c812843@gmail.com Signed-off-by: Manojkiran Eda --- drivers/mtd/mtdcore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index e451b28840d5..cc51c9fb2c1e 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -2560,7 +2560,7 @@ static void __exit cleanup_mtd(void) idr_destroy(&mtd_idr); } -module_init(init_mtd); +subsys_initcall(init_mtd); module_exit(cleanup_mtd); MODULE_LICENSE("GPL"); -- 2.40.1 From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 897F3C54E68 for ; Tue, 19 Mar 2024 09:36:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IYWerw/f7j3hP24vEC4TwjjyH2dzF3pHY7vbl7ABBYY=; b=ecZUmdJ1ERqyNY D5yOSiApV2QgVAK5U+MvrKeXwIVuYK2fq/llT2WGcx29I7ymjElVlmeqsuZzIIj7E9nChWrsllNC/ rwfi7lw2y9+5OImBHOvyqBsP4wcnXSoA2HaURKBFBmA/pSp8l/XKQ4erhNzFq171TFUg0rtZiMwA3 YuPRd04GxEidNNDj/TjwHY3D64HelUs6rg8I2Cnlectgmzi4UyiVwDu5fbrvesmdnSCsmGkvAFZPv yNYl0D6uEMgsdOzGZ5WAx8+ud8QLcT+4eZAWe06Z75dIUjsDK44aAUh8eER1YCFY8ghHv7zVjM1zR lThfzIpmtbBgITEBedUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmVst-0000000C743-0bmr; Tue, 19 Mar 2024 09:35:51 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmVsb-0000000C6ro-0lWF; Tue, 19 Mar 2024 09:35:35 +0000 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1dc29f1956cso31368175ad.0; Tue, 19 Mar 2024 02:35:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710840932; x=1711445732; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e94g+9vzH11aUQZhgMcMoQcXNPU48KmdzBLfG1dsEIk=; b=HnzpqLePyEFWC3PPJZ5hRfareH75Wbhl/eFH/53gVisj2r1oT6Rp3392ZSdzknmLdI 9NkgCC1P01hGZYCuDyC5e993RHuNYMhlblYZUAxtFKPBcDM2LG5Z7gYJFNmfoXgKTkQ9 Ynr90WNf+L+92F8O8pP9wMMUIUCVvXZnM9G6tVU/MFlYNqPs8xrsyivT2qzIRQO5oEA0 0dK2MMBSNln1xiNN/UXUq5syh1NYeXfZrk2Nx0v64vD2Kam1rVSZV32rmq4isPe9ZO6y /+6hDRKrt7TraEIXDI0t8cd0ypKLa9I75thcZsnjeVdNpWtbECzhI5lKB9hzxSvVK2mv utjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710840932; x=1711445732; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e94g+9vzH11aUQZhgMcMoQcXNPU48KmdzBLfG1dsEIk=; b=FBslhEs0Zh7HXmdK44P5ty+DGRNaPIy3KGwRR0VkyDYD4g8cW4rkXSZNn7YtZV99Wh 0UE9r32HjdYp0JzBissNrXMh2T3ivZeq2GbhWS2lLkd/bBpGCR0Q/9xZH1aAnW7hgoob xh9NbzhKLB0BemNE6qTXZVoZooh4k9njB1go7wrcw5HrKIXCtw01f3DZi36bT1R3f0qg uM8tRie/jIT3fB8hxBf3OUzpQ1nOohCYJe+kMDlEKIm56hXkN7eWwty257aEb9hAx8OI 0nIp1/2U2zU9wq8KPfhZ+BNxPrqdSn0anzDayFSSIsTqRxqt2TX/To1YWyxUCnMxFPIu K5LA== X-Forwarded-Encrypted: i=1; AJvYcCXVveUtB1iH5y/jpM9L8xEgwGdhgrgKaPqhOLPnZgqpFpHS7VvkVM7joC1jygkErMjMUU7QVCE3IMCIf6zOyvG1Snl5VlFZeEE5VkT9wJhs6yirkv4SMBNtADUQSZG9giS0RSJ0h0bK9AwD/CosVMHH7jXA X-Gm-Message-State: AOJu0Yw/pV6Hwmev8dKzDW7DaODr7u1PhmyzLLXbUsQXc0DVlKzvrFqc sD7GFpiyPgGQPhcceiHMx57w9Z8ZWjeYx+WK1tSVqB8d0MDIOSji X-Google-Smtp-Source: AGHT+IGRQerkxhBoo9SgQmB9rahSKXo6Kh9y5bn7m0LW33X3wWAr2V/9ZSigvft5pwucY8WqXpU8Zg== X-Received: by 2002:a17:902:ea08:b0:1db:55cc:d226 with SMTP id s8-20020a170902ea0800b001db55ccd226mr12398549plg.66.1710840932208; Tue, 19 Mar 2024 02:35:32 -0700 (PDT) Received: from localhost.localdomain ([129.41.58.3]) by smtp.gmail.com with ESMTPSA id n5-20020a170903110500b001ddc0bc5934sm10942432plh.249.2024.03.19.02.35.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 02:35:31 -0700 (PDT) From: Manojkiran Eda To: patrick.rudolph@9elements.com, chiawei_wang@aspeedtech.com, ryan_chen@aspeedtech.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org Cc: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, joel@jms.id.au, andrew@codeconstruct.com.au, miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, manojkiran.eda@gmail.com, jk@codeconstruct.com.au, openbmc@lists.ozlabs.org Subject: [PATCH v2 2/4] mtd: Replace module_init with subsys_initcall Date: Tue, 19 Mar 2024 15:04:03 +0530 Message-Id: <20240319093405.39833-3-manojkiran.eda@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240319093405.39833-1-manojkiran.eda@gmail.com> References: <20240319093405.39833-1-manojkiran.eda@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240319_023533_264266_F1812864 X-CRM114-Status: GOOD ( 12.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org While engaged in development on the espi kernel device driver[1], I noticed that the espi flash driver, utilizing the mtd subsystem, appears to initialize before the mtdcore subsystem registers the mtd_class. As a result, although the mtd device for espi is created, it does not populate within the /sys/class/mtd hierarchy. Given that mtd serves as a subsystem upon which numerous other drivers rely for infrastructure, it appears logical to adjust the module_init() call to an alternative priority initcall, subsys_initcall(), thereby ensuring that the mtd core subsystem is probed prior to the drivers utilizing its infrastructure. Although this adjustment alters the initialization ordering, there exists a slight risk of uncovering implicit initialization ordering issues. However, I believe it is preferable to prioritize it reasonably rather than having module_init() in order to maintain the exact old ordering. Link : [1] https://lore.kernel.org/openbmc/20240213-espi_driver-v1-1-92741c812843@gmail.com Signed-off-by: Manojkiran Eda --- drivers/mtd/mtdcore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index e451b28840d5..cc51c9fb2c1e 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -2560,7 +2560,7 @@ static void __exit cleanup_mtd(void) idr_destroy(&mtd_idr); } -module_init(init_mtd); +subsys_initcall(init_mtd); module_exit(cleanup_mtd); MODULE_LICENSE("GPL"); -- 2.40.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 272A17E0E5; Tue, 19 Mar 2024 09:35:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710840934; cv=none; b=roiLtkZ+j78ovhhInCH/6WSPXe6WHMccX2raR0K3k7N/53FvXEIi2naJr6OGwe7zzvA8KM438cggVMBG2W04ZgzeXu8q5Vp33+wn7pW5RCQ11roWOfmVGC1SrnYt/EvUeLFL3OLrjKtvUF50XSCZuGGwhTVFf9X2VnsYkVdZ3YM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710840934; c=relaxed/simple; bh=B2St2jdTzgdL5ciZ8vjLkpMdfiPTA/dDEh0pYWYDhWg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=n+s1tyGpMTIIzbByrLDE/oX9fRN+DxUGCyE8yFJCk5pZTyk85l1PomJCxIGfdDc99bEuUM9lRu+muRkZ4QaFBC06p3m+boZs+amwGsRPNm+2LEixWt21z8+bmcUVTC9tdznsQ2Z7aRBiIc+dM325pLMYOBnDOzuYJnfL30GPn0o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=m8NiiWkI; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="m8NiiWkI" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1dc29f1956cso31368165ad.0; Tue, 19 Mar 2024 02:35:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710840932; x=1711445732; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e94g+9vzH11aUQZhgMcMoQcXNPU48KmdzBLfG1dsEIk=; b=m8NiiWkIy9FQNnpzEhNvUNT4sTDXjRFnx17WYU+/Zz6/c3ZzjkeIjmDDfOARXfDlLG 6df+ejgLELUpHmvBgjjJVm+XKkNved96FYPdHtD3vgDHTdfqA18ozHlDEiVqR20jvYAU ItueJwn2HbbLDv9UiFWBHQ47VplJYvdtkeq+yTyjJcTbOi27ay1Jpuvlb6XD15OAgL5s voWiZnHuJWa4DzkxGRn40KrVfpRX6JjtEweYQpQe9Ou7eP6Egevti28xZA0Lm/mgWG1Q j5L/0UYG8522v4sE8lxYzQWO8tSUxzN1lcdw08TC0dpvtHKkr2HHeieXEH5hKBu0Q0yI zybg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710840932; x=1711445732; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e94g+9vzH11aUQZhgMcMoQcXNPU48KmdzBLfG1dsEIk=; b=H0+syFwKuaIFV2BLtCDfe4+I56XQAt8up6OymKyrMtT3HAUI4oTeNLiZUr6tWd7Zhw QUbx0cV6+jCYWQfcWDawbzGzkn4TA+5noKTj+KALcyZdYFGbVC5nsDSM6+MnFg2PlXNo QY3T7xExFHxQr9rImV8t4tTtgNw4crYGL9CHSbAeDK+2rQ78yP74J8fhXa60jXrOsO4J JGEhBhw/PFsn+QQH6MX1CPDAmdqz+Uj1R/poig3ZABp2Pe5LRM3G8rfhIy22ppIEbJFk LLB7G+UaIGyehHd8eNnmmmgYDVpN+FdbpNrCNbw3W3e5isk3RDeLq8e22rti/AQ25q1/ sbrQ== X-Forwarded-Encrypted: i=1; AJvYcCVXr5aWFxlQzbhhlM6ei0oMflMcjRoAgeFr3W7pV1rskTqv9YOPfZDflJqV2W6ri76kBMi+Z3FyUiQtsxhBVNKXeakf7iqgPJZ0K9e6P/5B1luzQ5YZtoe/t/IDBLyt1WoHpTnmIhc9kg== X-Gm-Message-State: AOJu0Yy2HZOYP3+XgMc9xZ20WeOdYzU/pVvd0kcPJAuN+3SDPUq1omta 8aMpZ7cNEAyIGCVWTWH+axuUhcjJ7yJ4WX/AFD2jlFTRiDI/h+hrqBdwOH2g00Y= X-Google-Smtp-Source: AGHT+IGRQerkxhBoo9SgQmB9rahSKXo6Kh9y5bn7m0LW33X3wWAr2V/9ZSigvft5pwucY8WqXpU8Zg== X-Received: by 2002:a17:902:ea08:b0:1db:55cc:d226 with SMTP id s8-20020a170902ea0800b001db55ccd226mr12398549plg.66.1710840932208; Tue, 19 Mar 2024 02:35:32 -0700 (PDT) Received: from localhost.localdomain ([129.41.58.3]) by smtp.gmail.com with ESMTPSA id n5-20020a170903110500b001ddc0bc5934sm10942432plh.249.2024.03.19.02.35.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 02:35:31 -0700 (PDT) From: Manojkiran Eda To: patrick.rudolph@9elements.com, chiawei_wang@aspeedtech.com, ryan_chen@aspeedtech.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org Cc: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, joel@jms.id.au, andrew@codeconstruct.com.au, miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, manojkiran.eda@gmail.com, jk@codeconstruct.com.au, openbmc@lists.ozlabs.org Subject: [PATCH v2 2/4] mtd: Replace module_init with subsys_initcall Date: Tue, 19 Mar 2024 15:04:03 +0530 Message-Id: <20240319093405.39833-3-manojkiran.eda@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240319093405.39833-1-manojkiran.eda@gmail.com> References: <20240319093405.39833-1-manojkiran.eda@gmail.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit While engaged in development on the espi kernel device driver[1], I noticed that the espi flash driver, utilizing the mtd subsystem, appears to initialize before the mtdcore subsystem registers the mtd_class. As a result, although the mtd device for espi is created, it does not populate within the /sys/class/mtd hierarchy. Given that mtd serves as a subsystem upon which numerous other drivers rely for infrastructure, it appears logical to adjust the module_init() call to an alternative priority initcall, subsys_initcall(), thereby ensuring that the mtd core subsystem is probed prior to the drivers utilizing its infrastructure. Although this adjustment alters the initialization ordering, there exists a slight risk of uncovering implicit initialization ordering issues. However, I believe it is preferable to prioritize it reasonably rather than having module_init() in order to maintain the exact old ordering. Link : [1] https://lore.kernel.org/openbmc/20240213-espi_driver-v1-1-92741c812843@gmail.com Signed-off-by: Manojkiran Eda --- drivers/mtd/mtdcore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index e451b28840d5..cc51c9fb2c1e 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -2560,7 +2560,7 @@ static void __exit cleanup_mtd(void) idr_destroy(&mtd_idr); } -module_init(init_mtd); +subsys_initcall(init_mtd); module_exit(cleanup_mtd); MODULE_LICENSE("GPL"); -- 2.40.1