All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Hauke Mehrtens <hauke@hauke-m.de>
Cc: richard@nod.at, dwmw2@infradead.org, computersforpeace@gmail.com,
	linux-mtd@lists.infradead.org, john@phrozen.org
Subject: Re: [PATCH v3 7/8] MTD: xway: add nandaddr to own struct
Date: Sun, 19 Jun 2016 18:32:11 +0200	[thread overview]
Message-ID: <20160619183211.241511e0@bbrezillon> (raw)
In-Reply-To: <20160619182946.273e9b14@bbrezillon>

On Sun, 19 Jun 2016 18:29:46 +0200
Boris Brezillon <boris.brezillon@free-electrons.com> wrote:

> On Sun, 19 Jun 2016 18:08:16 +0200
> Hauke Mehrtens <hauke@hauke-m.de> wrote:
> 
> > Instead of using IO_ADDR_W and IO_ADDR_R use an own pointer to the NAND
> > controller memory area.
> > 
> > Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> > ---
> >  drivers/mtd/nand/xway_nand.c | 22 +++++++++++-----------
> >  1 file changed, 11 insertions(+), 11 deletions(-)
> > 
> > diff --git a/drivers/mtd/nand/xway_nand.c b/drivers/mtd/nand/xway_nand.c
> > index 6fac4c6..282258f 100644
> > --- a/drivers/mtd/nand/xway_nand.c
> > +++ b/drivers/mtd/nand/xway_nand.c
> > @@ -66,22 +66,23 @@
> >  struct xway_nand_data {
> >  	struct nand_chip	chip;
> >  	unsigned long		csflags;
> > +	void __iomem		*nandaddr;
> >  };
> >  
> >  static u8 xway_readb(struct mtd_info *mtd, int op)
> >  {
> >  	struct nand_chip *chip = mtd_to_nand(mtd);
> > -	void __iomem *nandaddr = chip->IO_ADDR_R;
> > +	struct xway_nand_data *data = nand_get_controller_data(chip);
> >  
> > -	return readb(nandaddr + op);
> > +	return readb(data->nandaddr + op);
> >  }
> >  
> >  static void xway_writeb(struct mtd_info *mtd, int op, u8 value)
> >  {
> >  	struct nand_chip *chip = mtd_to_nand(mtd);
> > -	void __iomem *nandaddr = chip->IO_ADDR_W;
> > +	struct xway_nand_data *data = nand_get_controller_data(chip);
> >  
> > -	writeb(value, nandaddr + op);
> > +	writeb(value, data->nandaddr + op);
> >  }
> >  
> >  static void xway_select_chip(struct mtd_info *mtd, int select)
> > @@ -138,7 +139,6 @@ static int xway_nand_probe(struct platform_device *pdev)
> >  	struct mtd_info *mtd;
> >  	struct resource *res;
> >  	int err;
> > -	void __iomem *nandaddr;
> >  	u32 cs;
> >  	u32 cs_flag = 0;
> >  
> > @@ -149,16 +149,16 @@ static int xway_nand_probe(struct platform_device *pdev)
> >  		return -ENOMEM;
> >  
> >  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > -	nandaddr = devm_ioremap_resource(&pdev->dev, res);
> > -	if (IS_ERR(nandaddr))
> > -		return PTR_ERR(nandaddr);
> > +	data->nandaddr = devm_ioremap_resource(&pdev->dev, res);
> > +	if (IS_ERR(data->nandaddr))
> > +		return PTR_ERR(data->nandaddr);
> >  
> >  	nand_set_flash_node(&data->chip, pdev->dev.of_node);
> >  	mtd = nand_to_mtd(&data->chip);
> >  	mtd->dev.parent = &pdev->dev;
> >  
> > -	data->chip.IO_ADDR_R = nandaddr;
> > -	data->chip.IO_ADDR_W = nandaddr;
> > +	data->chip.IO_ADDR_R = data->nandaddr;
> > +	data->chip.IO_ADDR_W = data->nandaddr;  
> 
> If you patched all places using ->IO_ADDR_R/W you should be able to get
> rid of these assignments. If you didn't, please do it in this patch.

Just realized this implies moving patch 8 before this one, because the
default ->read_buf()/->write_buf() are making use of ->IO_ADDR_R/W.

  reply	other threads:[~2016-06-19 16:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-19 16:08 [PATCH v3 0/8] MTD: xway: fix driver Hauke Mehrtens
2016-06-19 16:08 ` [PATCH v3 1/8] MTD: xway: add some more documentation Hauke Mehrtens
2016-06-19 16:14   ` Boris Brezillon
2016-06-19 16:32     ` Hauke Mehrtens
2016-06-19 16:08 ` [PATCH v3 2/8] MTD: xway: convert to normal platform driver Hauke Mehrtens
2016-06-19 16:08 ` [PATCH v3 3/8] MTD: xway: the latched command should be persistent Hauke Mehrtens
2016-06-19 16:22   ` Boris Brezillon
2016-06-19 16:08 ` [PATCH v3 4/8] MTD: xway: use generic reset function Hauke Mehrtens
2016-06-19 16:08 ` [PATCH v3 5/8] MTD: xway: fix nand locking Hauke Mehrtens
2016-06-19 16:26   ` Boris Brezillon
2016-06-19 16:34     ` Hauke Mehrtens
2016-06-19 16:40       ` Boris Brezillon
2016-06-19 16:08 ` [PATCH v3 6/8] MTD: xway: extract read and write function Hauke Mehrtens
2016-06-19 16:08 ` [PATCH v3 7/8] MTD: xway: add nandaddr to own struct Hauke Mehrtens
2016-06-19 16:29   ` Boris Brezillon
2016-06-19 16:32     ` Boris Brezillon [this message]
2016-06-19 16:35       ` Hauke Mehrtens
2016-06-19 16:08 ` [PATCH v3 8/8] MTD: xway: add missing write_buf and read_buf to nand driver Hauke Mehrtens
2016-06-19 16:32   ` Boris Brezillon

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=20160619183211.241511e0@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=hauke@hauke-m.de \
    --cc=john@phrozen.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.