Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1434034 > unrolled thread
| Started by | Richard Weinberger <richard@nod.at> |
|---|---|
| First post | 2016-06-29 22:20 +0200 |
| Last post | 2016-07-04 11:50 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] mtdpart: propagate _get/put_device() Richard Weinberger <richard@nod.at> - 2016-06-29 22:20 +0200
Re: [PATCH] mtdpart: propagate _get/put_device() Richard Weinberger <richard@nod.at> - 2016-07-04 11:50 +0200
Re: [PATCH] mtdpart: propagate _get/put_device() Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-07-04 11:50 +0200
| From | Richard Weinberger <richard@nod.at> |
|---|---|
| Date | 2016-06-29 22:20 +0200 |
| Subject | [PATCH] mtdpart: propagate _get/put_device() |
| Message-ID | <rPu7M-go-7@gated-at.bofh.it> |
If the master device has callbacks for _get/put_device()
and this MTD has slaves a get_mtd_device() call on paritions
will never issue the registered callbacks.
Fix this by propergating _get/put_device() down.
Signed-off-by: Richard Weinberger <richard@nod.at>
---
Hi!
I've found this issue while heavily reworking nandsim.
With my changes applied you can add/remove MTD's during
runtime. I figured that nandsim's refcounting goes nuts.
After tracking down the root cause I figured that
_get/put_device() has no effect on MTD slaves.
Thanks,
//richard
---
drivers/mtd/mtdpart.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 1f13e32..938dbeb 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -317,6 +317,19 @@ static int part_block_markbad(struct mtd_info *mtd, loff_t ofs)
return res;
}
+static int part_get_device(struct mtd_info *mtd)
+{
+ struct mtd_part *part = mtd_to_part(mtd);
+ return part->master->_get_device(part->master);
+}
+
+static void part_put_device(struct mtd_info *mtd)
+{
+ struct mtd_part *part = mtd_to_part(mtd);
+ part->master->_put_device(part->master);
+}
+
+
static int part_ooblayout_ecc(struct mtd_info *mtd, int section,
struct mtd_oob_region *oobregion)
{
@@ -463,6 +476,12 @@ static struct mtd_part *allocate_partition(struct mtd_info *master,
slave->mtd._block_isbad = part_block_isbad;
if (master->_block_markbad)
slave->mtd._block_markbad = part_block_markbad;
+
+ if (master->_get_device)
+ slave->mtd._get_device = part_get_device;
+ if (master->_put_device)
+ slave->mtd._put_device = part_put_device;
+
slave->mtd._erase = part_erase;
slave->master = master;
slave->offset = part->offset;
--
2.7.3
[toc] | [next] | [standalone]
| From | Richard Weinberger <richard@nod.at> |
|---|---|
| Date | 2016-07-04 11:50 +0200 |
| Message-ID | <rR8FQ-3Xv-23@gated-at.bofh.it> |
| In reply to | #1434034 |
Boris, Am 04.07.2016 um 11:35 schrieb Boris Brezillon: > On Wed, 29 Jun 2016 22:14:23 +0200 > Richard Weinberger <richard@nod.at> wrote: > >> If the master device has callbacks for _get/put_device() >> and this MTD has slaves a get_mtd_device() call on paritions >> will never issue the registered callbacks. >> Fix this by propergating _get/put_device() down. >> >> Signed-off-by: Richard Weinberger <richard@nod.at> > > Nit below, otherwise it looks good to me: > > Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com> Will send a v2 without the extra blank line and the typo in the commit message. :) Thanks, //richard
[toc] | [prev] | [next] | [standalone]
| From | Boris Brezillon <boris.brezillon@free-electrons.com> |
|---|---|
| Date | 2016-07-04 11:50 +0200 |
| Message-ID | <rR8FP-3Xv-11@gated-at.bofh.it> |
| In reply to | #1434034 |
On Wed, 29 Jun 2016 22:14:23 +0200
Richard Weinberger <richard@nod.at> wrote:
> If the master device has callbacks for _get/put_device()
> and this MTD has slaves a get_mtd_device() call on paritions
> will never issue the registered callbacks.
> Fix this by propergating _get/put_device() down.
>
> Signed-off-by: Richard Weinberger <richard@nod.at>
Nit below, otherwise it looks good to me:
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> ---
> Hi!
>
> I've found this issue while heavily reworking nandsim.
> With my changes applied you can add/remove MTD's during
> runtime. I figured that nandsim's refcounting goes nuts.
> After tracking down the root cause I figured that
> _get/put_device() has no effect on MTD slaves.
>
> Thanks,
> //richard
>
> ---
> drivers/mtd/mtdpart.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
> index 1f13e32..938dbeb 100644
> --- a/drivers/mtd/mtdpart.c
> +++ b/drivers/mtd/mtdpart.c
> @@ -317,6 +317,19 @@ static int part_block_markbad(struct mtd_info *mtd, loff_t ofs)
> return res;
> }
>
> +static int part_get_device(struct mtd_info *mtd)
> +{
> + struct mtd_part *part = mtd_to_part(mtd);
> + return part->master->_get_device(part->master);
> +}
> +
> +static void part_put_device(struct mtd_info *mtd)
> +{
> + struct mtd_part *part = mtd_to_part(mtd);
> + part->master->_put_device(part->master);
> +}
> +
> +
Extra blank line here.
> static int part_ooblayout_ecc(struct mtd_info *mtd, int section,
> struct mtd_oob_region *oobregion)
> {
> @@ -463,6 +476,12 @@ static struct mtd_part *allocate_partition(struct mtd_info *master,
> slave->mtd._block_isbad = part_block_isbad;
> if (master->_block_markbad)
> slave->mtd._block_markbad = part_block_markbad;
> +
> + if (master->_get_device)
> + slave->mtd._get_device = part_get_device;
> + if (master->_put_device)
> + slave->mtd._put_device = part_put_device;
> +
> slave->mtd._erase = part_erase;
> slave->master = master;
> slave->offset = part->offset;
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web