[PATCH 2/6] MTD: xway: fix invalid operator

Boris Brezillon boris.brezillon at free-electrons.com
Tue Jun 7 12:04:04 PDT 2016


On Tue, 7 Jun 2016 19:40:14 +0200
Hauke Mehrtens <hauke at hauke-m.de> wrote:

> On 06/07/2016 11:28 AM, Boris Brezillon wrote:
> > On Sun,  5 Jun 2016 23:20:05 +0200
> > Hauke Mehrtens <hauke at hauke-m.de> wrote:
> >   
> >> From: John Crispin <john at phrozen.org>
> >>
> >> xway_read_byte should use a logic or and not an add operator when
> >> working out the NAND address. The NAND address bits are used to
> >> activate the pins to the NAND flash.
> >>
> >> Signed-off-by: John Crispin <john at phrozen.org>
> >> Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
> >> ---
> >>  drivers/mtd/nand/xway_nand.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/mtd/nand/xway_nand.c b/drivers/mtd/nand/xway_nand.c
> >> index ccac19c..0ab6e83 100644
> >> --- a/drivers/mtd/nand/xway_nand.c
> >> +++ b/drivers/mtd/nand/xway_nand.c
> >> @@ -134,7 +134,7 @@ static unsigned char xway_read_byte(struct mtd_info *mtd)
> >>  	int ret;
> >>  
> >>  	spin_lock_irqsave(&ebu_lock, flags);
> >> -	ret = ltq_r8((void __iomem *)(nandaddr + NAND_READ_DATA));
> >> +	ret = ltq_r8((void __iomem *)(nandaddr | NAND_READ_DATA));  
> > 
> > It's doing exactly the same, isn't it? What's the rationale behind this
> > change?  
> 
> Yes that is correct, this is only a style change.
> 
> In the other places we are also using the bool operations and this
> address space is not a list of registers, but some address bits are used
> to activate or deactivate some pins and all data written to this address
> range is handled in the same way.

Well, I find it clearer to use the '+' operator when manipulating
pointer addresses, but maybe that's just a matter of taste.


-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com



More information about the linux-mtd mailing list