/* Internal helper functions Read the status register, returning its value in the location Return the status register value. Returns negative if error occurred.  */
static int read_sr(struct m25p *flash)
/* Internal helper functions Read the status register, returning its value in the location Return the status register value. Returns negative if error occurred.  */
static int read_sr(struct m25p *flash)
{
	ssize_t retval;
	u8 code = OPCODE_RDSR;
	u8 val;
	retval = spi_write_then_read(flash->spi, &code, 1, &val, 1);
	if (retval < 0) {
		dev_err(&flash->spi->dev, "error %d reading SR\n",
				(int) retval);
		return retval;
	}
	return val;
}