From: Mike Dunn <mikedunn@newsguy.com>
To: dedekind1@gmail.com
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Scott Branden <sbranden@broadcom.com>,
Wan ZongShun <mcuos.com@gmail.com>,
Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
Kyungmin Park <kyungmin.park@samsung.com>,
Haojian Zhuang <haojian.zhuang@gmail.com>,
Manuel Lauss <manuel.lauss@googlemail.com>,
linux-mtd@lists.infradead.org, Ralf Baechle <ralf@linux-mips.org>,
Jiandong Zheng <jdzheng@broadcom.com>,
Andres Salomon <dilinger@queued.net>,
Olof Johansson <olof@lixom.net>, Jamie Iles <jamie@jamieiles.com>,
Brian Norris <computersforpeace@gmail.com>,
Robert Jarzmik <robert.jarzmik@free.fr>,
Vimal Singh <vimal.newwork@gmail.com>
Subject: Re: [PATCH 1/2] MTD: pass driver methods through partition wrappers on unpartitioned devices
Date: Thu, 22 Dec 2011 15:28:21 -0800 [thread overview]
Message-ID: <4EF3BD15.1030709@newsguy.com> (raw)
In-Reply-To: <1324557264.10300.86.camel@sauron.fi.intel.com>
On 12/22/2011 04:34 AM, Artem Bityutskiy wrote:
> On Tue, 2011-12-20 at 10:42 -0800, Mike Dunn wrote:
>> Ensure driver methods always go through the wrapper functions in the
>> partitioning code by creating a single "partition" on otherwise unpartitioned
>> devices.
>>
>> Tested with nandsim, onenand_sim, and the diskonchip g4 nand driver (currently
>> out-of-tree).
>>
>> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
> Looks good to me in general. Does it change anything from the user-space
> POW (API/ABI)?
No, should be completely transparent (at least that's my intention). The only
new behavior is that the partition code puts a string in the log with the
partition boundaries and partition name, which in the single partition case is
mtd->name, which should avoid any confusion.
> One thing to be aware of: some drivers do like this:
>
> drivers/mtd/maps/plat-ram.c:
>
> /* check to see if there are any available partitions, or wether
> * to add this device whole */
>
> err = mtd_device_parse_register(info->mtd, pdata->probes, 0,
> pdata->partitions, pdata->nr_partitions);
> if (!err)
> dev_info(&pdev->dev, "registered mtd device\n");
>
> if (pdata->nr_partitions) {
> /* add the whole device. */
> err = mtd_device_register(info->mtd, NULL, 0);
> if (err) {
> dev_err(&pdev->dev,
> "failed to register the entire device\n");
> }
> }
>
> Could you please:
> 1. Try to find drivers like this and kill the redundant mtd_device_register()
> call.
> 2. There is no guarantee you will find all. So you could add a check in
> mtd_device_parse_register() which would print a warning if the device is
> added for the second time and return. So the code would work and people
> would be able to notice the warning and fix up the driver.
OK. Sorry, missed that.
>> - add_mtd_device(&slave->mtd);
>> + ret = add_mtd_device(&slave->mtd);
>> + if (ret == 1)
>> + return -ENODEV;
> Is this an unrelated change? Would you separate it out?
No, it's related. Currently, mtd_device_parse_register() does the above if no
partitions are created, whereas here in add_mtd_partitions() the return code of
add_mtd_device() is not checked, so I added this to be consistent with the
previous behavior. mtd_device_parse_register() propagates this return code back
to the caller, so the result is the same.
Thanks,
Mike
next prev parent reply other threads:[~2011-12-22 23:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-20 18:42 [PATCH 0/2] always use partition wrappers; drivers return bitflips Mike Dunn
2011-12-20 18:42 ` [PATCH 1/2] MTD: pass driver methods through partition wrappers on unpartitioned devices Mike Dunn
2011-12-22 12:34 ` Artem Bityutskiy
2011-12-22 23:28 ` Mike Dunn [this message]
2011-12-22 13:05 ` Artem Bityutskiy
2011-12-22 18:03 ` Artem Bityutskiy
2011-12-22 23:28 ` Mike Dunn
2011-12-23 14:47 ` Artem Bityutskiy
2011-12-22 23:28 ` Mike Dunn
2011-12-20 18:42 ` [PATCH 2/2] MTD: read(), read_oob() driver methods return num bitflips Mike Dunn
2011-12-21 8:10 ` [PATCH 0/2] always use partition wrappers; drivers return bitflips Thomas Petazzoni
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=4EF3BD15.1030709@newsguy.com \
--to=mikedunn@newsguy.com \
--cc=computersforpeace@gmail.com \
--cc=dbaryshkov@gmail.com \
--cc=dedekind1@gmail.com \
--cc=dilinger@queued.net \
--cc=dwmw2@infradead.org \
--cc=haojian.zhuang@gmail.com \
--cc=jamie@jamieiles.com \
--cc=jdzheng@broadcom.com \
--cc=kyungmin.park@samsung.com \
--cc=lars@metafoo.de \
--cc=linux-mtd@lists.infradead.org \
--cc=manuel.lauss@googlemail.com \
--cc=mcuos.com@gmail.com \
--cc=olof@lixom.net \
--cc=ralf@linux-mips.org \
--cc=robert.jarzmik@free.fr \
--cc=sbranden@broadcom.com \
--cc=thomas.petazzoni@free-electrons.com \
--cc=vimal.newwork@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).