Skip to contentSkip to conversation

nandsim: Define CONFIG_NANDSIM_MAX_PARTS and use it instead of MAX_MTD_DEVICES

PATCH In review Ben Hutchings 2 participants 4 messages Jan 12, 2010 – Jan 28, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 3/7 nandsim: Define CONFIG_NANDSIM_MAX_PARTS and use it instead of MAX_MTD_DEVICES

MAX_MTD_DEVICES is about to be removed.

---
 drivers/mtd/nand/nandsim.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
drivers/mtd/nand/nandsim.c +5 -2
index 7281000..58c255e 100644
@@ -80,6 +80,9 @@
 #ifndef CONFIG_NANDSIM_DBG
 #define CONFIG_NANDSIM_DBG        0
 #endif
+#ifndef CONFIG_NANDSIM_MAX_PARTS
+#define CONFIG_NANDSIM_MAX_PARTS  32
+#endif
 
 static uint first_id_byte  = CONFIG_NANDSIM_FIRST_ID_BYTE;
 static uint second_id_byte = CONFIG_NANDSIM_SECOND_ID_BYTE;
@@ -94,7 +97,7 @@ static uint bus_width      = CONFIG_NANDSIM_BUS_WIDTH;
 static uint do_delays      = CONFIG_NANDSIM_DO_DELAYS;
 static uint log            = CONFIG_NANDSIM_LOG;
 static uint dbg            = CONFIG_NANDSIM_DBG;
-static unsigned long parts[MAX_MTD_DEVICES];
+static unsigned long parts[CONFIG_NANDSIM_MAX_PARTS];
 static unsigned int parts_num;
 static char *badblocks = NULL;
 static char *weakblocks = NULL;
@@ -288,7 +291,7 @@ union ns_mem {
  * The structure which describes all the internal simulator data.
  */
 struct nandsim {
-	struct mtd_partition partitions[MAX_MTD_DEVICES];
+	struct mtd_partition partitions[CONFIG_NANDSIM_MAX_PARTS];
 	unsigned int nbparts;
 
 	uint busw;              /* flash chip bus width (8 or 16) */
Signature · 7 lines
1.5.5


-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#1 lore raw
Quoted 12 lines · Ben Hutchings

MAX_MTD_DEVICES is about to be removed.

---
 drivers/mtd/nand/nandsim.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
drivers/mtd/nand/nandsim.c +0 -0
index 7281000..58c255e 100644

drivers/mtd/nand/nandsim.c line 85

Quoted 6 lines
drivers/mtd/nand/nandsim.c +3 -0
@@ -80,6 +80,9 @@
 #ifndef CONFIG_NANDSIM_DBG
 #define CONFIG_NANDSIM_DBG        0
 #endif
+#ifndef CONFIG_NANDSIM_MAX_PARTS
+#define CONFIG_NANDSIM_MAX_PARTS  32
+#endif

Since this is not a Kconfig option, please, remove the CONFIG_ prefix.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
#2 lore raw
Quoted 8 lines · Artem Bityutskiy
Quoted 7 lines · Ben Hutchings

MAX_MTD_DEVICES is about to be removed.

---
 drivers/mtd/nand/nandsim.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
Quoted 13 lines

drivers/mtd/nand/nandsim.c line 85

Quoted 11 lines
drivers/mtd/nand/nandsim.c +3 -0
index 7281000..58c255e 100644
@@ -80,6 +80,9 @@
 #ifndef CONFIG_NANDSIM_DBG
 #define CONFIG_NANDSIM_DBG        0
 #endif
+#ifndef CONFIG_NANDSIM_MAX_PARTS
+#define CONFIG_NANDSIM_MAX_PARTS  32
+#endif

Since this is not a Kconfig option, please, remove the CONFIG_ prefix.

While I understand that CONFIG_* should be reserved to Kconfig, this is consistent with the existing build-time options in this file.

Ben.

Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#3 lore raw
Quoted 23 lines · Ben Hutchings
Quoted 8 lines · Artem Bityutskiy
Quoted 7 lines · Ben Hutchings

MAX_MTD_DEVICES is about to be removed.

---
 drivers/mtd/nand/nandsim.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
Quoted 13 lines

drivers/mtd/nand/nandsim.c line 85

Quoted 11 lines
drivers/mtd/nand/nandsim.c +3 -0
index 7281000..58c255e 100644
@@ -80,6 +80,9 @@
 #ifndef CONFIG_NANDSIM_DBG
 #define CONFIG_NANDSIM_DBG        0
 #endif
+#ifndef CONFIG_NANDSIM_MAX_PARTS
+#define CONFIG_NANDSIM_MAX_PARTS  32
+#endif

Since this is not a Kconfig option, please, remove the CONFIG_ prefix.

Quoted 2 lines

While I understand that CONFIG_* should be reserved to Kconfig, this is consistent with the existing build-time options in this file.

You are right. I remember long time ago that all were config options. Now this is not the case anymore, and that stuff needs some clean up. So I agree, it is fine to name it consistently.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)