Re: [PATCH] mtd: spi-nor: don't include linux/mtd/cfi.h from header

From: Ezequiel Garcia
Date: Thu Sep 15 2016 - 11:55:45 EST


On 15 September 2016 at 12:41, Arnd Bergmann <arnd@xxxxxxxx> wrote:
> The newly added broadcom qspi driver in drivers/spi produces a build
> warning when CONFIG_MTD is disabled:
>
> include/linux/mtd/cfi.h:76:2: #warning No CONFIG_MTD_CFI_Ix selected. No NOR chip support can work. [-Werror=cpp]
>
> Since drivers like this one don't actually need the cfi.h header,
> we can just remove it from the spi-nor.h file and add it to
> the only place that actually needs it.
>

AFAICS, the mtd/cfi.h header is needed only for CFI_MFR_xxx,
which are defined in the spi-nor.h header.

Maybe we are better moving those to spi-nor.c as well.

> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> Fixes: fa236a7ef240 ("spi: bcm-qspi: Add Broadcom MSPI driver")
> ---
> drivers/mtd/spi-nor/spi-nor.c | 1 +
> include/linux/mtd/spi-nor.h | 1 -
> 2 files changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
> index d0fc165d7d66..94afcb9fdaf7 100644
> --- a/drivers/mtd/spi-nor/spi-nor.c
> +++ b/drivers/mtd/spi-nor/spi-nor.c
> @@ -21,6 +21,7 @@
> #include <linux/mtd/mtd.h>
> #include <linux/of_platform.h>
> #include <linux/spi/flash.h>
> +#include <linux/mtd/cfi.h>
> #include <linux/mtd/spi-nor.h>
>
> /* Define max times to check status register before we give up. */
> diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
> index c425c7b4c2a0..60ef29565743 100644
> --- a/include/linux/mtd/spi-nor.h
> +++ b/include/linux/mtd/spi-nor.h
> @@ -11,7 +11,6 @@
> #define __LINUX_MTD_SPI_NOR_H
>
> #include <linux/bitops.h>
> -#include <linux/mtd/cfi.h>
> #include <linux/mtd/mtd.h>
>
> /*
> --
> 2.9.0
>



--
Ezequiel GarcÃa, VanguardiaSur
www.vanguardiasur.com.ar