Patchwork [resend] UBI: introduce MTD_PARAM_MAX_COUNT

login
register
mail settings
Submitter Richard Genoud
Date Aug. 21, 2012, 12:33 p.m.
Message ID <1345552402-25190-1-git-send-email-richard.genoud@gmail.com>
Download mbox | patch
Permalink /patch/179054/
State New
Headers show

Comments

Richard Genoud - Aug. 21, 2012, 12:33 p.m.
Here is the patch accidentally dropped.
I rebased it on linux-ubi/master (9baf0a2) and made sure the other ones:
* UBI: replace MTD_UBI_BEB_LIMIT with module parameter
* UBI: add ioctl for max_beb_per1024
* UBI: drop CONFIG_MTD_UBI_BEB_LIMIT

still apply correctly (and they still do, so I don't resend them).

Best regards,
Richard.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
 drivers/mtd/ubi/build.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
Artem Bityutskiy - Aug. 21, 2012, 1:33 p.m.
On Tue, 2012-08-21 at 14:33 +0200, Richard Genoud wrote:
> Here is the patch accidentally dropped.
> I rebased it on linux-ubi/master (9baf0a2) and made sure the other ones:
> * UBI: replace MTD_UBI_BEB_LIMIT with module parameter
> * UBI: add ioctl for max_beb_per1024
> * UBI: drop CONFIG_MTD_UBI_BEB_LIMIT
> 
> still apply correctly (and they still do, so I don't resend them).

Thanks Richard, I said that I returned it, but I forgot to push. Now I
actually pushed the changes out.

Patch

diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 8bbab23..0fe6356 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -46,6 +46,9 @@ 
 /* Maximum length of the 'mtd=' parameter */
 #define MTD_PARAM_LEN_MAX 64
 
+/* Maximum number of comma-separated items in the 'mtd=' parameter */
+#define MTD_PARAM_MAX_COUNT 2
+
 /* Maximum value for the number of bad PEBs per 1024 PEBs */
 #define MAX_MTD_UBI_BEB_LIMIT 768
 
@@ -1338,7 +1341,7 @@  static int __init ubi_mtd_param_parse(const char *val, struct kernel_param *kp)
 	struct mtd_dev_param *p;
 	char buf[MTD_PARAM_LEN_MAX];
 	char *pbuf = &buf[0];
-	char *tokens[2] = {NULL, NULL};
+	char *tokens[MTD_PARAM_MAX_COUNT];
 
 	if (!val)
 		return -EINVAL;
@@ -1368,7 +1371,7 @@  static int __init ubi_mtd_param_parse(const char *val, struct kernel_param *kp)
 	if (buf[len - 1] == '\n')
 		buf[len - 1] = '\0';
 
-	for (i = 0; i < 2; i++)
+	for (i = 0; i < MTD_PARAM_MAX_COUNT; i++)
 		tokens[i] = strsep(&pbuf, ",");
 
 	if (pbuf) {