mtd: spi-nor: improve macronix_quad_enable()

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sun Feb 12 18:59:07 PST 2017


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=32c90f1682a01ff9e1c2fa83c18a15e35f7563ce
Commit:     32c90f1682a01ff9e1c2fa83c18a15e35f7563ce
Parent:     e99ca98f1d7190c16601b00d0c96212d7c00577d
Author:     Cyrille Pitchen <cyrille.pitchen at atmel.com>
AuthorDate: Tue Dec 6 17:01:41 2016 +0100
Committer:  Cyrille Pitchen <cyrille.pitchen at atmel.com>
CommitDate: Fri Feb 10 13:54:52 2017 +0100

    mtd: spi-nor: improve macronix_quad_enable()
    
    The patch checks whether the Quad Enable bit is already set in the Status
    Register. If so, the function exits immediately with a successful return
    code.
    
    Signed-off-by: Cyrille Pitchen <cyrille.pitchen at atmel.com>
    Reviewed-by: Jagan Teki <jagan at openedev.com>
    Acked-by: Marek Vasut <marek.vasut at gmail.com>
---
 drivers/mtd/spi-nor/spi-nor.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index be1d41d..4e35917 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -1305,6 +1305,9 @@ static int macronix_quad_enable(struct spi_nor *nor)
 	val = read_sr(nor);
 	if (val < 0)
 		return val;
+	if (val & SR_QUAD_EN_MX)
+		return 0;
+
 	write_enable(nor);
 
 	write_sr(nor, val | SR_QUAD_EN_MX);



More information about the linux-mtd-cvs mailing list