[U-Boot] [PATCH v5 2/3] mtd, nand: move common functions from cmd_nand.c to common place
Heiko Schocher
hs at denx.de
Thu Apr 23 13:12:10 CEST 2015
Hello Scott,
Am 23.04.2015 08:55, schrieb Scott Wood:
> On Thu, 2015-04-23 at 07:57 +0200, Heiko Schocher wrote:
>> Hello Scott,
>>
>> Am 23.04.2015 00:47, schrieb Scott Wood:
>>> On Mon, 2015-04-20 at 07:47 +0200, Heiko Schocher wrote:
>>>> @@ -322,7 +213,12 @@ int do_nand_env_oob(cmd_tbl_t *cmdtp, int argc, char *const argv[])
>>>> goto usage;
>>>>
>>>> /* We don't care about size, or maxsize. */
>>>> - if (arg_off(argv[2], &idx, &addr, &maxsize, &maxsize)) {
>>>> + if (arg_off(argv[2], &idx, &addr, &maxsize, &maxsize,
>>>> + MTD_DEV_TYPE_NAND, nand_info[idx].size)) {
>>>> + puts("Offset or partition name expected\n");
>>>> + return 1;
>>>> + }
>>>
>>> Use only one tab per indentation level.
>>
>> You mean the line "MTD_DEV_TYPE_NAND, nand_info[idx].size)) {" ?
>>
>> I have to move MTD_xx to the opening bracket to avoid checkpatch.pl
>> errors ...
>>
>> If you mean the "puts ..." line ... fixed.
>
> I meant the puts and return lines.
>
>>>> diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
>>>> index 8666413..2861af5 100644
>>>> --- a/include/linux/mtd/mtd.h
>>>> +++ b/include/linux/mtd/mtd.h
>>>> @@ -482,5 +482,12 @@ int add_mtd_device(struct mtd_info *mtd);
>>>> int del_mtd_device(struct mtd_info *mtd);
>>>> int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);
>>>> int del_mtd_partitions(struct mtd_info *);
>>>> +
>>>> +int str2off(const char *p, loff_t *num);
>>>> +int str2long(const char *p, ulong *num);
>>>
>>> These should be moved somewhere more generic, especially if they're no
>>> longer file-local.
>>
>> Hmm... the code is currently in "drivers/mtd/mtd_uboot.c" ... maybe
>> we add a "mtd_" prefix to them? I think these functions are mtd specific ...
>
> What is mtd-specific about them?
Hmm... I thought:
return *p != '\0' && *endptr == '\0';
is more or less mtd specific ... but you are right, it is not really
mtd specific ... so I move them to "./lib/vsprintf.c" ... Ok?
bye,
Heiko
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
More information about the U-Boot
mailing list