From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: "Mario J. Rugiero" <mrugiero@gmail.com>
Cc: linux-mtd@lists.infradead.org, computersforpeace@gmail.com,
marek.vasut@gmail.com, richard@nod.at,
cyrille.pitchen@wedev4u.fr
Subject: Re: [PATCH 2/3] mtd: nand: create a wrapper for mtd_device_register for NAND specific initialization.
Date: Sat, 20 May 2017 19:38:25 +0200 [thread overview]
Message-ID: <20170520193825.1cccc62d@bbrezillon> (raw)
In-Reply-To: <20170520152428.9184-3-mrugiero@gmail.com>
Le Sat, 20 May 2017 12:24:27 -0300,
"Mario J. Rugiero" <mrugiero@gmail.com> a écrit :
> Drivers are updated to use this wrapper.
Try to be a bit more verbose in your commit messages. Explain why you
want to add this wrapper.
BTW, you only update mtd_device_register() callers, not those who
call mtd_device_parse_register(), which is wrong.
This being said, I wonder if we shouldn't have extra helpers to
assign default parts and part_parser_types and parser_data to a
nand_chip, and then have a nand_chip_register() which just takes
a nand_chip object and extract parts info from there.
Something like:
struct nand_parts_info {
const char * const *part_parsers;
struct mtd_part_parser_data *part_parser_data;
const struct mtd_partition *defparts;
int ndefparts;
};
struct nand_chip {
...
struct nand_parts_info parts_info;
...
};
void nand_chip_set_default_parts(struct nand_chip *chip,
const struct mtd_partition *parts,
int nparts)
{
chip->parts_info.defparts = parts;
chip->parts_info.ndefparts = nparts;
}
void nand_chip_set_part_parsers(struct nand_chip *chip,
const char * const *part_parsers)
{
chip->parts_info.part_parsers = part_parsers;
}
void nand_chip_set_part_parser_data(struct nand_chip *chip,
struct mtd_part_parser_data *data)
{
chip->parts_info.part_parser_data = part_parser_data;
}
int nand_chip_register(struct nand_chip *chip)
{
return mtd_device_parse_register(nand_to_mtd(chip),
chip->parts_info.part_parsers,
chip->parts_info.part_parser_data,
chip->parts_info.defparts,
chip->parts_info.ndefparts);
}
>
> Signed-off-by: Mario J. Rugiero <mrugiero@gmail.com>
> ---
[...]
> +/* Register the MTD device and allocate resources for the NAND device */
> +int nand_device_register(struct mtd_info *mtd,
> + const struct mtd_partition *defparts,
> + int defnr_parts);
> +
I prefer nand_chip_register(), I reserve the nand_device_ prefix for
other reworks I'm planning to do ;-).
BTW, where is the nand_chip_unregister() I suggested to add to keep the
API symetric?
> /* Unregister the MTD device and free resources held by the NAND device */
> void nand_release(struct mtd_info *mtd);
>
next prev parent reply other threads:[~2017-05-20 17:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-20 15:24 [PATCH 0/3] mtd: nand: allow force erasing of bad blocks through debugfs entry Mario J. Rugiero
2017-05-20 15:24 ` [PATCH 1/3] mtd: create per-device and module-scope debugfs entries Mario J. Rugiero
2017-05-20 15:24 ` [PATCH 2/3] mtd: nand: create a wrapper for mtd_device_register for NAND specific initialization Mario J. Rugiero
2017-05-20 15:24 ` [PATCH 3/3] mtd: nand: add option to ignore bad blocks when erasing, opt-in through debugfs Mario J. Rugiero
2017-05-20 17:54 ` Boris Brezillon
2017-05-20 17:38 ` Boris Brezillon [this message]
2017-05-20 17:44 ` [PATCH 2/3] mtd: nand: create a wrapper for mtd_device_register for NAND specific initialization Boris Brezillon
2017-05-20 17:46 ` Boris Brezillon
2017-05-20 17:56 ` Boris Brezillon
2017-05-20 16:21 ` [PATCH 1/3] mtd: create per-device and module-scope debugfs entries Boris Brezillon
2017-05-20 16:41 ` Mario Rugiero
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=20170520193825.1cccc62d@bbrezillon \
--to=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=cyrille.pitchen@wedev4u.fr \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=mrugiero@gmail.com \
--cc=richard@nod.at \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.