mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/3] mtd: nand: make exec_op optional
Date: Fri, 14 Jun 2024 15:36:02 +0200	[thread overview]
Message-ID: <20240614133603.2452891-3-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20240614133603.2452891-1-s.hauer@pengutronix.de>

While exec_op is the way to go for new drivers, not all drivers use it
yet. Make support for it optional to safe a few bytes of binary space
when only drivers without exec_op are compiled in.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mtd/nand/raw/Kconfig     | 7 +++++++
 drivers/mtd/nand/raw/internals.h | 5 +++++
 2 files changed, 12 insertions(+)

diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
index a48670b190..e9d1b83706 100644
--- a/drivers/mtd/nand/raw/Kconfig
+++ b/drivers/mtd/nand/raw/Kconfig
@@ -32,12 +32,16 @@ config NAND_ALLOW_ERASE_BAD
 	  to '1' it will be allowed to erase bad blocks. This is a potientially
 	  dangerous operation, so if unsure say no to this option.
 
+config NAND_NEED_EXEC_OP
+	bool
+
 comment "Raw/parallel NAND flash controllers"
 
 config NAND_IMX
 	bool
 	prompt "i.MX21 to 53 NAND driver aka 'mxc', for NFC"
 	depends on ARCH_IMX
+	select NAND_NEED_EXEC_OP
 	help
 	  Support for NAND flash on Freescale/NXP i.MX devices.  This is for the
 	  "MXC" series:  i.MX21/25/27/31/35/51/53.
@@ -104,6 +108,7 @@ config NAND_STM32
 	select STM32_FMC2_EBI if ARCH_STM32MP
 	select RESET_CONTROLLER if ARCH_STM32MP
 	select RESET_SIMPLE if ARCH_STM32MP
+	select NAND_NEED_EXEC_OP
 	help
 	  Enables support for NAND Flash chips on SoCs containing the FMC2
 	  NAND controller. This controller is found on STM32MP SoCs.
@@ -114,6 +119,7 @@ config NAND_ATMEL
 	bool
 	prompt "Atmel (AT91SAM9xxx) NAND driver"
 	select GENERIC_ALLOCATOR if OFDEVICE
+	select NAND_NEED_EXEC_OP
 	depends on ARCH_AT91 || (OFDEVICE && COMPILE_TEST)
 
 config NAND_ATMEL_LEGACY
@@ -149,6 +155,7 @@ config MTD_NAND_NOMADIK
 config MTD_NAND_DENALI
 	tristate "Support Denali NAND controller"
 	depends on HAS_DMA
+	select NAND_NEED_EXEC_OP
 	help
 	  Enable support for the Denali NAND controller.  This should be
 	  combined with either the PCI or platform drivers to provide device
diff --git a/drivers/mtd/nand/raw/internals.h b/drivers/mtd/nand/raw/internals.h
index 6dab25ecab..191244801b 100644
--- a/drivers/mtd/nand/raw/internals.h
+++ b/drivers/mtd/nand/raw/internals.h
@@ -118,6 +118,11 @@ static inline bool nand_has_exec_op(struct nand_chip *chip)
 	    !chip->controller->ops->exec_op)
 		return false;
 
+	if (!IS_ENABLED(CONFIG_NAND_NEED_EXEC_OP)) {
+		pr_err("driver needs exec_op, but CONFIG_NAND_NEED_EXEC_OP is disabled\n");
+		return false;
+	}
+
 	return true;
 }
 
-- 
2.39.2




  parent reply	other threads:[~2024-06-14 14:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-14 13:36 [PATCH 0/3] mtd: nand: trim down NAND layer a bit Sascha Hauer
2024-06-14 13:36 ` [PATCH 1/3] mtd: nand: Kconfig: whitespace cleanups Sascha Hauer
2024-06-14 13:36 ` Sascha Hauer [this message]
2024-06-14 13:36 ` [PATCH 3/3] mtd: nand: make interleaved placement optional Sascha Hauer
2024-06-18  6:13 ` [PATCH 0/3] mtd: nand: trim down NAND layer a bit Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240614133603.2452891-3-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox