linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] firmware_loader: simplfy builtin or module check
@ 2022-01-12  2:34 Luis Chamberlain
  2022-01-12  6:37 ` Randy Dunlap
  0 siblings, 1 reply; 5+ messages in thread
From: Luis Chamberlain @ 2022-01-12  2:34 UTC (permalink / raw)
  To: gregkh, bp; +Cc: linux-kernel, linux-fsdevel, Luis Chamberlain, Borislav Petkov

The existing check is outdated and confuses developers. Use the
already existing IS_ENABLED() defined on kconfig.h which makes
the intention much clearer.

Reported-by: Borislav Petkov <bp@alien8.de>
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 include/linux/firmware.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index 3b057dfc8284..fa3493dbe84a 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -34,7 +34,7 @@ static inline bool firmware_request_builtin(struct firmware *fw,
 }
 #endif
 
-#if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE))
+#if IS_ENABLED(CONFIG_FW_LOADER)
 int request_firmware(const struct firmware **fw, const char *name,
 		     struct device *device);
 int firmware_request_nowarn(const struct firmware **fw, const char *name,
-- 
2.34.1


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

* Re: [PATCH] firmware_loader: simplfy builtin or module check
  2022-01-12  2:34 [PATCH] firmware_loader: simplfy builtin or module check Luis Chamberlain
@ 2022-01-12  6:37 ` Randy Dunlap
  2022-01-12  6:56   ` Masahiro Yamada
  0 siblings, 1 reply; 5+ messages in thread
From: Randy Dunlap @ 2022-01-12  6:37 UTC (permalink / raw)
  To: Luis Chamberlain, gregkh, bp; +Cc: linux-kernel, linux-fsdevel, Borislav Petkov



On 1/11/22 18:34, Luis Chamberlain wrote:
> The existing check is outdated and confuses developers. Use the
> already existing IS_ENABLED() defined on kconfig.h which makes
> the intention much clearer.
> 
> Reported-by: Borislav Petkov <bp@alien8.de>
> Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Acked-by: Randy Dunlap <rdunlap@infradead.org>

Thanks.

> ---
>  include/linux/firmware.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/firmware.h b/include/linux/firmware.h
> index 3b057dfc8284..fa3493dbe84a 100644
> --- a/include/linux/firmware.h
> +++ b/include/linux/firmware.h
> @@ -34,7 +34,7 @@ static inline bool firmware_request_builtin(struct firmware *fw,
>  }
>  #endif
>  
> -#if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE))

The "defined(MODULE)" part wasn't needed here. :)

> +#if IS_ENABLED(CONFIG_FW_LOADER)
>  int request_firmware(const struct firmware **fw, const char *name,
>  		     struct device *device);
>  int firmware_request_nowarn(const struct firmware **fw, const char *name,

-- 
~Randy

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

* Re: [PATCH] firmware_loader: simplfy builtin or module check
  2022-01-12  6:37 ` Randy Dunlap
@ 2022-01-12  6:56   ` Masahiro Yamada
  2022-01-12  7:03     ` Randy Dunlap
  0 siblings, 1 reply; 5+ messages in thread
From: Masahiro Yamada @ 2022-01-12  6:56 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: Luis Chamberlain, Greg Kroah-Hartman, Borislav Petkov,
	Linux Kernel Mailing List, Linux FS-devel Mailing List,
	Borislav Petkov

On Wed, Jan 12, 2022 at 3:37 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>
>
>
> On 1/11/22 18:34, Luis Chamberlain wrote:
> > The existing check is outdated and confuses developers. Use the
> > already existing IS_ENABLED() defined on kconfig.h which makes
> > the intention much clearer.
> >
> > Reported-by: Borislav Petkov <bp@alien8.de>
> > Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
>
> Acked-by: Randy Dunlap <rdunlap@infradead.org>
>
> Thanks.
>
> > ---
> >  include/linux/firmware.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/include/linux/firmware.h b/include/linux/firmware.h
> > index 3b057dfc8284..fa3493dbe84a 100644
> > --- a/include/linux/firmware.h
> > +++ b/include/linux/firmware.h
> > @@ -34,7 +34,7 @@ static inline bool firmware_request_builtin(struct firmware *fw,
> >  }
> >  #endif
> >
> > -#if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE))
>
> The "defined(MODULE)" part wasn't needed here. :)



It _is_ needed.

This seems to be equivalent to IS_REACHABLE(CONFIG_FW_LOADER),
not IS_ENABLE(CONFIG_FW_LOADER).



>
> > +#if IS_ENABLED(CONFIG_FW_LOADER)
> >  int request_firmware(const struct firmware **fw, const char *name,
> >                    struct device *device);
> >  int firmware_request_nowarn(const struct firmware **fw, const char *name,
>
> --
> ~Randy



-- 
Best Regards
Masahiro Yamada

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

* Re: [PATCH] firmware_loader: simplfy builtin or module check
  2022-01-12  6:56   ` Masahiro Yamada
@ 2022-01-12  7:03     ` Randy Dunlap
  2022-01-12  7:36       ` Randy Dunlap
  0 siblings, 1 reply; 5+ messages in thread
From: Randy Dunlap @ 2022-01-12  7:03 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Luis Chamberlain, Greg Kroah-Hartman, Borislav Petkov,
	Linux Kernel Mailing List, Linux FS-devel Mailing List,
	Borislav Petkov



On 1/11/22 22:56, Masahiro Yamada wrote:
> On Wed, Jan 12, 2022 at 3:37 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>>
>>
>>
>> On 1/11/22 18:34, Luis Chamberlain wrote:
>>> The existing check is outdated and confuses developers. Use the
>>> already existing IS_ENABLED() defined on kconfig.h which makes
>>> the intention much clearer.
>>>
>>> Reported-by: Borislav Petkov <bp@alien8.de>
>>> Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>>> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
>>
>> Acked-by: Randy Dunlap <rdunlap@infradead.org>
>>
>> Thanks.
>>
>>> ---
>>>  include/linux/firmware.h | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/include/linux/firmware.h b/include/linux/firmware.h
>>> index 3b057dfc8284..fa3493dbe84a 100644
>>> --- a/include/linux/firmware.h
>>> +++ b/include/linux/firmware.h
>>> @@ -34,7 +34,7 @@ static inline bool firmware_request_builtin(struct firmware *fw,
>>>  }
>>>  #endif
>>>
>>> -#if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE))
>>
>> The "defined(MODULE)" part wasn't needed here. :)
> 
> 
> 
> It _is_ needed.
> 
> This seems to be equivalent to IS_REACHABLE(CONFIG_FW_LOADER),
> not IS_ENABLE(CONFIG_FW_LOADER).
> 

Hm, /me confused.

How can CONFIG_FW_LOADER_MODULE be =y when MODULE is not defined?

> 
> 
>>
>>> +#if IS_ENABLED(CONFIG_FW_LOADER)
>>>  int request_firmware(const struct firmware **fw, const char *name,
>>>                    struct device *device);
>>>  int firmware_request_nowarn(const struct firmware **fw, const char *name,
>>
>> --
>> ~Randy
> 
> 
> 

-- 
~Randy

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

* Re: [PATCH] firmware_loader: simplfy builtin or module check
  2022-01-12  7:03     ` Randy Dunlap
@ 2022-01-12  7:36       ` Randy Dunlap
  0 siblings, 0 replies; 5+ messages in thread
From: Randy Dunlap @ 2022-01-12  7:36 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Luis Chamberlain, Greg Kroah-Hartman, Borislav Petkov,
	Linux Kernel Mailing List, Linux FS-devel Mailing List,
	Borislav Petkov



On 1/11/22 23:03, Randy Dunlap wrote:
> 
> 
> On 1/11/22 22:56, Masahiro Yamada wrote:
>> On Wed, Jan 12, 2022 at 3:37 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>>>
>>>
>>>
>>> On 1/11/22 18:34, Luis Chamberlain wrote:
>>>> The existing check is outdated and confuses developers. Use the
>>>> already existing IS_ENABLED() defined on kconfig.h which makes
>>>> the intention much clearer.
>>>>
>>>> Reported-by: Borislav Petkov <bp@alien8.de>
>>>> Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>>>> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
>>>
>>> Acked-by: Randy Dunlap <rdunlap@infradead.org>
>>>
>>> Thanks.
>>>
>>>> ---
>>>>  include/linux/firmware.h | 2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/include/linux/firmware.h b/include/linux/firmware.h
>>>> index 3b057dfc8284..fa3493dbe84a 100644
>>>> --- a/include/linux/firmware.h
>>>> +++ b/include/linux/firmware.h
>>>> @@ -34,7 +34,7 @@ static inline bool firmware_request_builtin(struct firmware *fw,
>>>>  }
>>>>  #endif
>>>>
>>>> -#if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE))
>>>
>>> The "defined(MODULE)" part wasn't needed here. :)
>>
>>
>>
>> It _is_ needed.
>>
>> This seems to be equivalent to IS_REACHABLE(CONFIG_FW_LOADER),
>> not IS_ENABLE(CONFIG_FW_LOADER).>>
> 
> Hm, /me confused.
> 
> How can CONFIG_FW_LOADER_MODULE be =y when MODULE is not defined?
> 

OK, I get it now. Thanks for correcting me.

>>
>>
>>>
>>>> +#if IS_ENABLED(CONFIG_FW_LOADER)
>>>>  int request_firmware(const struct firmware **fw, const char *name,
>>>>                    struct device *device);
>>>>  int firmware_request_nowarn(const struct firmware **fw, const char *name,
>>>
>>> --
>>> ~Randy
>>
>>
>>
> 

-- 
~Randy

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

end of thread, other threads:[~2022-01-12  7:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-12  2:34 [PATCH] firmware_loader: simplfy builtin or module check Luis Chamberlain
2022-01-12  6:37 ` Randy Dunlap
2022-01-12  6:56   ` Masahiro Yamada
2022-01-12  7:03     ` Randy Dunlap
2022-01-12  7:36       ` Randy Dunlap

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).