Skip to content

Commit

Permalink
mtd: spi-nor: improve macronix_quad_enable()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Jagan Teki <[email protected]>
Acked-by: Marek Vasut <[email protected]>
  • Loading branch information
Cyrille Pitchen committed Feb 10, 2017
1 parent e99ca98 commit 32c90f1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/mtd/spi-nor/spi-nor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 32c90f1

Please sign in to comment.