From: Cyrille Pitchen Date: Tue, 6 Dec 2016 16:01:41 +0000 (+0100) Subject: mtd: spi-nor: improve macronix_quad_enable() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=32c90f1682a01ff9e1c2fa83c18a15e35f7563ce;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Reviewed-by: Jagan Teki Acked-by: Marek Vasut --- diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index be1d41d21d7d..4e35917bd2d9 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);