mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: nand_omap_gpmc: Fix mtd_info usage
@ 2019-09-30  6:53 Teresa Remmet
  2019-09-30 18:43 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Teresa Remmet @ 2019-09-30  6:53 UTC (permalink / raw)
  To: barebox

The mtd_info has not been set correctly in the omap gpmc probe.
Remove the mtd_info in the private struct like it has been done in
other nand drivers. And update the driver accordingly.

Fixes: 76b6f74c5397 ("mtd: nand: Embed struct mtd_info into struct nand_chip")

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
---
 drivers/mtd/nand/nand_omap_gpmc.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/nand/nand_omap_gpmc.c b/drivers/mtd/nand/nand_omap_gpmc.c
index c4d0cdfb573f..83fa93b61707 100644
--- a/drivers/mtd/nand/nand_omap_gpmc.c
+++ b/drivers/mtd/nand/nand_omap_gpmc.c
@@ -110,7 +110,6 @@ struct gpmc_nand_info {
 	struct device_d *pdev;
 	struct gpmc_nand_platform_data *pdata;
 	struct nand_chip nand;
-	struct mtd_info minfo;
 	int gpmc_cs;
 	void *gpmc_command;
 	void *gpmc_address;
@@ -582,8 +581,8 @@ static int omap_gpmc_read_buf_manual(struct mtd_info *mtd, struct nand_chip *chi
  */
 static void omap_read_buf_pref(struct mtd_info *mtd, u_char *buf, int len)
 {
-	struct gpmc_nand_info *info = container_of(mtd,
-						struct gpmc_nand_info, minfo);
+	struct nand_chip *nand_chip = mtd_to_nand(mtd);
+	struct gpmc_nand_info *info = nand_chip->priv;
 	u32 r_count = 0;
 	u32 *p = (u32 *)buf;
 
@@ -623,8 +622,9 @@ static void omap_read_buf_pref(struct mtd_info *mtd, u_char *buf, int len)
 static void omap_write_buf_pref(struct mtd_info *mtd,
 					const u_char *buf, int len)
 {
-	struct gpmc_nand_info *info = container_of(mtd,
-						struct gpmc_nand_info, minfo);
+	struct nand_chip *nand_chip = mtd_to_nand(mtd);
+	struct gpmc_nand_info *info = nand_chip->priv;
+
 	u32 w_count = 0;
 	u_char *buf1 = (u_char *)buf;
 	u32 *p32 = (u32 *)buf;
@@ -1021,8 +1021,8 @@ static int gpmc_read_page_hwecc(struct mtd_info *mtd,
 static int omap_gpmc_eccmode(struct gpmc_nand_info *oinfo,
 		enum gpmc_ecc_mode mode)
 {
-	struct mtd_info *minfo = &oinfo->minfo;
 	struct nand_chip *nand = &oinfo->nand;
+	struct mtd_info *minfo = &nand->mtd;
 	int offset, err;
 	int i, j;
 
@@ -1116,7 +1116,7 @@ static int omap_gpmc_eccmode(struct gpmc_nand_info *oinfo,
 			omap_oobinfo.eccpos[oinfo->nand.ecc.total - 1] + 1;
 
 		err = elm_config(BCH16_ECC,
-				 oinfo->minfo.writesize / nand->ecc.size,
+				 minfo->writesize / nand->ecc.size,
 				 nand->ecc.size, nand->ecc.bytes);
 		if (err < 0)
 			return err;
@@ -1199,7 +1199,7 @@ static int gpmc_nand_probe(struct device_d *pdev)
 	nand = &oinfo->nand;
 	nand->priv = (void *)oinfo;
 
-	minfo = &oinfo->minfo;
+	minfo = &nand->mtd;
 	minfo->parent = pdev;
 
 	if (pdata->cs >= GPMC_NUM_CS) {
-- 
2.7.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mtd: nand: nand_omap_gpmc: Fix mtd_info usage
  2019-09-30  6:53 [PATCH] mtd: nand: nand_omap_gpmc: Fix mtd_info usage Teresa Remmet
@ 2019-09-30 18:43 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2019-09-30 18:43 UTC (permalink / raw)
  To: Teresa Remmet; +Cc: barebox

On Mon, Sep 30, 2019 at 08:53:13AM +0200, Teresa Remmet wrote:
> The mtd_info has not been set correctly in the omap gpmc probe.
> Remove the mtd_info in the private struct like it has been done in
> other nand drivers. And update the driver accordingly.
> 
> Fixes: 76b6f74c5397 ("mtd: nand: Embed struct mtd_info into struct nand_chip")
> 
> Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
> ---
>  drivers/mtd/nand/nand_omap_gpmc.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)

Applied to master, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-30 18:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-30  6:53 [PATCH] mtd: nand: nand_omap_gpmc: Fix mtd_info usage Teresa Remmet
2019-09-30 18:43 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox