[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211025092752.2824678-3-sean@geanix.com>
Date: Mon, 25 Oct 2021 11:27:50 +0200
From: Sean Nyekjaer <sean@...nix.com>
To: Boris Brezillon <boris.brezillon@...labora.com>
Cc: Sean Nyekjaer <sean@...nix.com>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>,
Boris Brezillon <bbrezillon@...nel.org>,
linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH v3 2/4] mtd: mtdconcat: add suspend lock handling
Use MTD hooks to control suspend/resume of MTD devices.
concat_{suspend,resume} will be called from mtd_{suspend,resume},
which already have taken the suspend/resume lock.
It's safe to proceed with calling MTD device hooks directly from here.
Fixes: 013e6292aaf5 ("mtd: rawnand: Simplify the locking")
Suggested-by: Boris Brezillon <boris.brezillon@...labora.com>
Signed-off-by: Sean Nyekjaer <sean@...nix.com>
---
drivers/mtd/mtdconcat.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c
index f685a581df48..37532f529820 100644
--- a/drivers/mtd/mtdconcat.c
+++ b/drivers/mtd/mtdconcat.c
@@ -566,9 +566,15 @@ static int concat_suspend(struct mtd_info *mtd)
for (i = 0; i < concat->num_subdev; i++) {
struct mtd_info *subdev = concat->subdev[i];
- if ((rc = mtd_suspend(subdev)) < 0)
+ /*
+ * Call MTD hook directly from here,
+ * mtd_suspend() have the suspend/resume lock.
+ */
+ rc = subdev->_suspend ? subdev->_suspend(subdev) : 0;
+ if (rc < 0)
return rc;
}
+
return rc;
}
@@ -579,7 +585,12 @@ static void concat_resume(struct mtd_info *mtd)
for (i = 0; i < concat->num_subdev; i++) {
struct mtd_info *subdev = concat->subdev[i];
- mtd_resume(subdev);
+ /*
+ * Call MTD hook directly from here,
+ * mtd_resume() have the suspend/resume lock.
+ */
+ if (subdev->_resume)
+ subdev->_resume(subdev);
}
}
--
2.33.0
Powered by blists - more mailing lists