linux-gbmc: everspin: Add Linux < 5.11 compatibility for spi_nor_read_sr
Prior to Linux 5.11, spi_nor_read_sr() was a static function defined
internally in drivers/mtd/spi-nor/core.c and was not declared in core.h.
When compiling everspin.c against Linux 5.10 (such as for Nuvoton
platforms), calls to spi_nor_read_sr() fail due to implicit function
declaration warnings treated as errors.
Add a compatibility fallback implementation of spi_nor_read_sr() for
LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0) using spi_mem_exec_op()
when nor->spimem is valid, or nor->controller_ops->read_reg() otherwise,
matching upstream 5.10 core.c behavior.
Tested: Built a 5.10 platform image and ran on the platform. Verified that erase commands use nearly no CPU time even though they wait.
Fusion-Link: fusion2 N/A
Google-Bug-Id: 565629335
Change-Id: I13159c0c11c3c6ad4df9e5605d463bbc3649e66e
Signed-off-by: William A. Kennington III <wak@google.com>
1 file changed