linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: cfi: allow building spi-intel standalone
@ 2022-12-15 16:39 Arnd Bergmann
  2022-12-16  6:36 ` Mika Westerberg
  2022-12-19 15:12 ` Tokunori Ikegami
  0 siblings, 2 replies; 5+ messages in thread
From: Arnd Bergmann @ 2022-12-15 16:39 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
  Cc: Arnd Bergmann, Tokunori Ikegami, Lee Jones, Mauro Lima,
	Tudor Ambarus, Mika Westerberg, Boris Brezillon, linux-mtd,
	linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

When MTD or MTD_CFI_GEOMETRY is disabled, the spi-intel driver
fails to build, as it includes the shared CFI header:

include/linux/mtd/cfi.h:62:2: error: #warning No CONFIG_MTD_CFI_Ix selected. No NOR chip support can work. [-Werror=cpp]
   62 | #warning No CONFIG_MTD_CFI_Ix selected. No NOR chip support can work.

Use an #ifdef here to guard the settings so the header can be included
in all configurations.

Fixes: e23e5a05d1fd ("mtd: spi-nor: intel-spi: Convert to SPI MEM")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/mtd/cfi.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index d88bb56c18e2..0e87b6e2faad 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -15,6 +15,7 @@
 #include <linux/mtd/cfi_endian.h>
 #include <linux/mtd/xip.h>
 
+#if IS_ENABLED(CONFIG_MTD)
 #ifdef CONFIG_MTD_CFI_I1
 #define cfi_interleave(cfi) 1
 #define cfi_interleave_is_1(cfi) (cfi_interleave(cfi) == 1)
@@ -88,7 +89,7 @@ static inline int cfi_interleave_supported(int i)
 		return 0;
 	}
 }
-
+#endif
 
 /* NB: these values must represents the number of bytes needed to meet the
  *     device type (x8, x16, x32).  Eg. a 32 bit device is 4 x 8 bytes.
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mtd: cfi: allow building spi-intel standalone
  2022-12-15 16:39 [PATCH] mtd: cfi: allow building spi-intel standalone Arnd Bergmann
@ 2022-12-16  6:36 ` Mika Westerberg
  2022-12-19 15:12 ` Tokunori Ikegami
  1 sibling, 0 replies; 5+ messages in thread
From: Mika Westerberg @ 2022-12-16  6:36 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Arnd Bergmann, Tokunori Ikegami, Lee Jones, Mauro Lima,
	Tudor Ambarus, Boris Brezillon, linux-mtd, linux-kernel

On Thu, Dec 15, 2022 at 05:39:38PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> When MTD or MTD_CFI_GEOMETRY is disabled, the spi-intel driver
> fails to build, as it includes the shared CFI header:
> 
> include/linux/mtd/cfi.h:62:2: error: #warning No CONFIG_MTD_CFI_Ix selected. No NOR chip support can work. [-Werror=cpp]
>    62 | #warning No CONFIG_MTD_CFI_Ix selected. No NOR chip support can work.
> 
> Use an #ifdef here to guard the settings so the header can be included
> in all configurations.
> 
> Fixes: e23e5a05d1fd ("mtd: spi-nor: intel-spi: Convert to SPI MEM")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mtd: cfi: allow building spi-intel standalone
  2022-12-15 16:39 [PATCH] mtd: cfi: allow building spi-intel standalone Arnd Bergmann
  2022-12-16  6:36 ` Mika Westerberg
@ 2022-12-19 15:12 ` Tokunori Ikegami
  2022-12-20  5:51   ` Tudor Ambarus
  1 sibling, 1 reply; 5+ messages in thread
From: Tokunori Ikegami @ 2022-12-19 15:12 UTC (permalink / raw)
  To: Arnd Bergmann, Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
  Cc: Arnd Bergmann, Lee Jones, Mauro Lima, Tudor Ambarus,
	Mika Westerberg, Boris Brezillon, linux-mtd, linux-kernel


On 2022/12/16 1:39, Arnd Bergmann wrote:
> From: Arnd Bergmann<arnd@arndb.de>
>
> When MTD or MTD_CFI_GEOMETRY is disabled, the spi-intel driver
> fails to build, as it includes the shared CFI header:
The header file linux/mtd/cfi.h is included by the head file 
linux/mtd/spi-nor.h so seems the warning caused.
Is it really necessary to inculude linux/mtd/cfi.h from linux/mtd/spi-nor.h?
(It seems that it can be resolved the issue by removing the including 
cfi.h from spi-nor.h if unnecessary.)
>
> include/linux/mtd/cfi.h:62:2: error: #warning No CONFIG_MTD_CFI_Ix selected. No NOR chip support can work. [-Werror=cpp]
>     62 | #warning No CONFIG_MTD_CFI_Ix selected. No NOR chip support can work.
>
> Use an #ifdef here to guard the settings so the header can be included
> in all configurations.
>
> Fixes: e23e5a05d1fd ("mtd: spi-nor: intel-spi: Convert to SPI MEM")
> Signed-off-by: Arnd Bergmann<arnd@arndb.de>
> ---
>   include/linux/mtd/cfi.h | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
> index d88bb56c18e2..0e87b6e2faad 100644
> --- a/include/linux/mtd/cfi.h
> +++ b/include/linux/mtd/cfi.h
> @@ -15,6 +15,7 @@
>   #include <linux/mtd/cfi_endian.h>
>   #include <linux/mtd/xip.h>
>   
> +#if IS_ENABLED(CONFIG_MTD)

Is it enough to check only CONFIG_MTD here as not necessary to check if 
MTD_CFI_GEOMETRY also?
By the way it seems also that it is needed to use #ifdef only for the 
cfi_interleave warning checking as below.

#if IS_ENABLED(CONFIG_MTD) && IS_ENABLED(CONFIG_MTD_CFI_GEOMETRY)
#ifndef cfi_interleave
#warning No CONFIG_MTD_CFI_Ix selected. No NOR chip support can work.
static inline int cfi_interleave(void *cfi)
{
     BUG();
     return 0;
}
#endif /* cfi_interleave */
#endif /* IS_ENABLED(CONFIG_MTD) && IS_ENABLED(CONFIG_MTD_CFI_GEOMETRY) */

Note: The cfi_interleave warning checking was implemented by the 
following commit.
   241651d04d67 ("[MTD] Fix CFI build error when no map width or 
interleave supported")

>   #ifdef CONFIG_MTD_CFI_I1
>   #define cfi_interleave(cfi) 1
>   #define cfi_interleave_is_1(cfi) (cfi_interleave(cfi) == 1)
> @@ -88,7 +89,7 @@ static inline int cfi_interleave_supported(int i)
>   		return 0;
>   	}
>   }
> -
> +#endif
>   
>   /* NB: these values must represents the number of bytes needed to meet the
>    *     device type (x8, x16, x32).  Eg. a 32 bit device is 4 x 8 bytes.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mtd: cfi: allow building spi-intel standalone
  2022-12-19 15:12 ` Tokunori Ikegami
@ 2022-12-20  5:51   ` Tudor Ambarus
  2022-12-20 14:41     ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: Tudor Ambarus @ 2022-12-20  5:51 UTC (permalink / raw)
  To: Tokunori Ikegami, Arnd Bergmann, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra
  Cc: Arnd Bergmann, Lee Jones, Mauro Lima, Tudor Ambarus,
	Mika Westerberg, Boris Brezillon, linux-mtd, linux-kernel



On 19.12.2022 17:12, Tokunori Ikegami wrote:
> 
> On 2022/12/16 1:39, Arnd Bergmann wrote:
>> From: Arnd Bergmann<arnd@arndb.de>
>>
>> When MTD or MTD_CFI_GEOMETRY is disabled, the spi-intel driver
>> fails to build, as it includes the shared CFI header:
> The header file linux/mtd/cfi.h is included by the head file 
> linux/mtd/spi-nor.h so seems the warning caused.
> Is it really necessary to inculude linux/mtd/cfi.h from 
> linux/mtd/spi-nor.h?
> (It seems that it can be resolved the issue by removing the including 
> cfi.h from spi-nor.h if unnecessary.)

SPI NOR does not depend on CFI. cfi.h shouldn't be included by
spi-nor.h, indeed.

Cheers,
ta

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mtd: cfi: allow building spi-intel standalone
  2022-12-20  5:51   ` Tudor Ambarus
@ 2022-12-20 14:41     ` Arnd Bergmann
  0 siblings, 0 replies; 5+ messages in thread
From: Arnd Bergmann @ 2022-12-20 14:41 UTC (permalink / raw)
  To: Tudor Ambarus, Tokunori Ikegami, Arnd Bergmann, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra
  Cc: Lee Jones, Mauro Lima, Tudor Ambarus, Mika Westerberg,
	Boris Brezillon, linux-mtd, linux-kernel

On Tue, Dec 20, 2022, at 06:51, Tudor Ambarus wrote:
> On 19.12.2022 17:12, Tokunori Ikegami wrote:
>> 
>> On 2022/12/16 1:39, Arnd Bergmann wrote:
>>> From: Arnd Bergmann<arnd@arndb.de>
>>>
>>> When MTD or MTD_CFI_GEOMETRY is disabled, the spi-intel driver
>>> fails to build, as it includes the shared CFI header:
>> The header file linux/mtd/cfi.h is included by the head file 
>> linux/mtd/spi-nor.h so seems the warning caused.
>> Is it really necessary to inculude linux/mtd/cfi.h from 
>> linux/mtd/spi-nor.h?
>> (It seems that it can be resolved the issue by removing the including 
>> cfi.h from spi-nor.h if unnecessary.)
>
> SPI NOR does not depend on CFI. cfi.h shouldn't be included by
> spi-nor.h, indeed.

Right, I sent v2 now doing this instead.

    Arnd

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-12-20 14:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-15 16:39 [PATCH] mtd: cfi: allow building spi-intel standalone Arnd Bergmann
2022-12-16  6:36 ` Mika Westerberg
2022-12-19 15:12 ` Tokunori Ikegami
2022-12-20  5:51   ` Tudor Ambarus
2022-12-20 14:41     ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).