From: Sandeep Jain <Sandeep_Jain@mentor.com>
To: <dwmw2@infradead.org>, <computersforpeace@gmail.com>
Cc: <linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
Jim Baxter <jim_baxter@mentor.com>,
Sandeep Jain <Sandeep_Jain@mentor.com>
Subject: [PATCH v1 2/2] mtd: Add hooks to call get and put on mtd devices.
Date: Thu, 4 Aug 2016 19:46:34 +0530 [thread overview]
Message-ID: <1470320194-9602-3-git-send-email-Sandeep_Jain@mentor.com> (raw)
In-Reply-To: <1470320194-9602-1-git-send-email-Sandeep_Jain@mentor.com>
From: Jim Baxter <jim_baxter@mentor.com>
Add hooks to mtdpart to call _get_device and _put_device,
this allows the mtd devices to perform internal
reference counting if required.
Signed-off-by: Jim Baxter <jim_baxter@mentor.com>
Signed-off-by: Sandeep Jain <Sandeep_Jain@mentor.com>
---
drivers/mtd/mtdpart.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 1f13e32..adbb1fd 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -338,6 +338,20 @@ static const struct mtd_ooblayout_ops part_ooblayout_ops = {
.free = part_ooblayout_free,
};
+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 inline void free_partition(struct mtd_part *p)
{
kfree(p->mtd.name);
@@ -463,6 +477,10 @@ 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;
--
1.7.9.5
next prev parent reply other threads:[~2016-08-04 14:18 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Sandeep Jain <Sandeep_Jain@mentor.com>
2016-08-04 14:01 ` [PATCH] mtd: Allocate bdi objects dynamically Sandeep Jain
2016-09-17 14:41 ` Richard Weinberger
2016-11-03 11:34 ` Sandeep Jain
2016-11-05 7:22 ` Marek Vasut
2016-11-29 8:12 ` Sandeep Jain
2016-12-01 15:39 ` Marek Vasut
2016-12-01 18:14 ` Brian Norris
2016-12-01 18:18 ` Marek Vasut
2016-08-04 14:16 ` [PATCH v1 0/2] mtd: lock module while used Sandeep Jain
2016-08-04 14:16 ` [PATCH v1 1/2] mtd: m25p80: " Sandeep Jain
2016-11-03 11:39 ` Sandeep Jain
2016-11-05 7:24 ` Marek Vasut
2016-12-01 19:10 ` Brian Norris
2016-08-04 14:16 ` Sandeep Jain [this message]
2016-08-04 17:32 ` [PATCH v1 2/2] mtd: Add hooks to call get and put on mtd devices Richard Weinberger
2016-08-05 11:54 ` Baxter, Jim
2016-08-05 12:13 ` Richard Weinberger
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=1470320194-9602-3-git-send-email-Sandeep_Jain@mentor.com \
--to=sandeep_jain@mentor.com \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=jim_baxter@mentor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
/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
all inboxes | Powered by JetHome®