From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Marek Vasut <marek.vasut@gmail.com>
Cc: "Rafał Miłecki" <rafal@milecki.pl>,
"Rafał Miłecki" <zajec5@gmail.com>,
"David Woodhouse" <dwmw2@infradead.org>,
"Brian Norris" <computersforpeace@gmail.com>,
"Richard Weinberger" <richard@nod.at>,
"Cyrille Pitchen" <cyrille.pitchen@atmel.com>,
linux-mtd@lists.infradead.org,
"Hauke Mehrtens" <hauke@hauke-m.de>
Subject: Re: [PATCH V2 1/2] mtd: bcm47xxpart: move TRX parsing code to separated function
Date: Thu, 9 Feb 2017 20:11:22 +0100 [thread overview]
Message-ID: <20170209201122.21f4cf6e@bbrezillon> (raw)
In-Reply-To: <a595b27a-235c-1f11-db90-772e2a4bf2bd@gmail.com>
On Thu, 9 Feb 2017 19:21:03 +0100
Marek Vasut <marek.vasut@gmail.com> wrote:
> On 02/09/2017 07:05 PM, Rafał Miłecki wrote:
> > On 2017-02-09 18:28, Marek Vasut wrote:
> >> On 01/10/2017 11:15 PM, Rafał Miłecki wrote:
> >>> From: Rafał Miłecki <rafal@milecki.pl>
> >>>
> >>> This change simplifies main parsing loop logic a bit. In future it may
> >>> be useful for moving TRX support to separated module / parser (if we
> >>> implement support for them at some point).
> >>> Finally parsing TRX at the end puts us in a better position as we have
> >>> better flash layout knowledge. It may be useful e.g. if it appears there
> >>> is more than 1 TRX partition.
> >>>
> >>> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> >>> ---
> >>> V2: Keep using bcm47xxpart_add_part in new parsing function
> >>> ---
> >>> drivers/mtd/bcm47xxpart.c | 121
> >>> ++++++++++++++++++++++++++++------------------
> >>> 1 file changed, 74 insertions(+), 47 deletions(-)
> >>>
> >>> diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c
> >>> index 283ff7e..1093025 100644
> >>> --- a/drivers/mtd/bcm47xxpart.c
> >>> +++ b/drivers/mtd/bcm47xxpart.c
> >>> @@ -83,6 +83,67 @@ static const char
> >>> *bcm47xxpart_trx_data_part_name(struct mtd_info *master,
> >>> return "rootfs";
> >>> }
> >>>
> >>> +static int bcm47xxpart_parse_trx(struct mtd_info *master,
> >>> + struct mtd_partition *trx,
> >>> + struct mtd_partition *parts,
> >>> + size_t parts_len)
> >>> +{
> >>> + struct trx_header header;
> >>> + size_t bytes_read;
> >>> + int curr_part = 0;
> >>> + int i, err;
> >>> +
> >>> + if (parts_len < 3) {
> >>> + pr_warn("No enough space to add TRX partitions!\n");
> >>> + return -ENOMEM;
> >>> + }
> >>> +
> >>> + err = mtd_read(master, trx->offset, sizeof(header), &bytes_read,
> >>> + (uint8_t *)&header);
> >>> + if (err && !mtd_is_bitflip(err)) {
> >>> + pr_err("mtd_read error while reading TRX header: %d\n", err);
> >>
> >> Minor nit -- Can we make this dev_err() ?
> >
> > The problem is parsers receive struct mtd_info (as an argument) with has
> > empty
> > dev. I just tried
> > dev_info(&master->dev, "TEST TEST TEST :)\n");
> > and got this:
> > [ 0.491576] (null): TEST TEST TEST :)
> >
> > I guess that's the reason why parse_mtd_partitions and
> > mtd_device_parse_register
> > also use pr_* functions.
> >
> > So this should be improved at mtd core subsystem first, then we can use
> > it in
> > drivers as well.
>
> Isn't this patch fixing just that?
> [PATCH] mtd: Add partition device node to mtd partition devices
>
No, this patch is only adding a pointer to a device_node object (DT
node).
To solve the problem, we need to have the master dev name set before we
register its partitions, and this is currently only the case if you
enable CONFIG_MTD_PARTITIONED_MASTER.
next prev parent reply other threads:[~2017-02-09 19:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-10 11:50 [PATCH 1/2] mtd: bcm47xxpart: move TRX parsing code to separated function Rafał Miłecki
2017-01-10 11:50 ` [PATCH 2/2] mtd: bcm47xxpart: support layouts with multiple TRX partitions Rafał Miłecki
2017-01-10 16:19 ` [PATCH 1/2] mtd: bcm47xxpart: move TRX parsing code to separated function Marek Vasut
2017-01-10 16:27 ` Rafał Miłecki
2017-01-10 17:42 ` Marek Vasut
2017-01-10 22:15 ` [PATCH V2 " Rafał Miłecki
2017-01-10 22:15 ` [PATCH V2 2/2] mtd: bcm47xxpart: support layouts with multiple TRX partitions Rafał Miłecki
2017-02-09 16:54 ` [PATCH V2 1/2] mtd: bcm47xxpart: move TRX parsing code to separated function Rafał Miłecki
2017-02-09 17:29 ` Marek Vasut
2017-02-09 17:28 ` Marek Vasut
2017-02-09 18:05 ` Rafał Miłecki
2017-02-09 18:21 ` Marek Vasut
2017-02-09 19:11 ` Boris Brezillon [this message]
2017-02-09 19:33 ` Marek Vasut
2017-02-10 3:00 ` Brian Norris
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=20170209201122.21f4cf6e@bbrezillon \
--to=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=cyrille.pitchen@atmel.com \
--cc=dwmw2@infradead.org \
--cc=hauke@hauke-m.de \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=rafal@milecki.pl \
--cc=richard@nod.at \
--cc=zajec5@gmail.com \
/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.