diff mbox series

firmware: zynqmp: fix declarations for gcc-13

Message ID 20230117164133.1245749-1-arnd@kernel.org (mailing list archive)
State Accepted
Commit d2c865553adb7ad9abf3894cbb209cf1bc95484a
Headers show
Series firmware: zynqmp: fix declarations for gcc-13 | expand

Commit Message

Arnd Bergmann Jan. 17, 2023, 4:41 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

gcc-13.0.1 reports a type mismatch for two functions:

drivers/firmware/xilinx/zynqmp.c:1228:5: error: conflicting types for 'zynqmp_pm_set_rpu_mode' due to enum/integer mismatch; have 'int(u32,  enum rpu_oper_mode)' {aka 'int(unsigned int,  enum rpu_oper_mode)'} [-Werror=enum-int-mismatch]
 1228 | int zynqmp_pm_set_rpu_mode(u32 node_id, enum rpu_oper_mode rpu_mode)
      |     ^~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/firmware/xilinx/zynqmp.c:25:
include/linux/firmware/xlnx-zynqmp.h:552:5: note: previous declaration of 'zynqmp_pm_set_rpu_mode' with type 'int(u32,  u32)' {aka 'int(unsigned int,  unsigned int)'}
  552 | int zynqmp_pm_set_rpu_mode(u32 node_id, u32 arg1);
      |     ^~~~~~~~~~~~~~~~~~~~~~
drivers/firmware/xilinx/zynqmp.c:1246:5: error: conflicting types for 'zynqmp_pm_set_tcm_config' due to enum/integer mismatch; have 'int(u32,  enum rpu_tcm_comb)' {aka 'int(unsigned int,  enum rpu_tcm_comb)'} [-Werror=enum-int-mismatch]
 1246 | int zynqmp_pm_set_tcm_config(u32 node_id, enum rpu_tcm_comb tcm_mode)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/firmware/xlnx-zynqmp.h:553:5: note: previous declaration of 'zynqmp_pm_set_tcm_config' with type 'int(u32,  u32)' {aka 'int(unsigned int,  unsigned int)'}
  553 | int zynqmp_pm_set_tcm_config(u32 node_id, u32 arg1);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~

Change the declaration in the header to match the function definition.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/firmware/xlnx-zynqmp.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Tanmay Shah Jan. 17, 2023, 7:53 p.m. UTC | #1
Hi, Thanks for your patch.


This looks good to me. Thanks for fixing this.

Something must have gone wrong when I ran sparse check on this patch.

Just one question, does this patch need "fixes:" tag?


On 1/17/23 8:41 AM, Arnd Bergmann wrote:
> CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.
>
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> gcc-13.0.1 reports a type mismatch for two functions:
>
> drivers/firmware/xilinx/zynqmp.c:1228:5: error: conflicting types for 'zynqmp_pm_set_rpu_mode' due to enum/integer mismatch; have 'int(u32,  enum rpu_oper_mode)' {aka 'int(unsigned int,  enum rpu_oper_mode)'} [-Werror=enum-int-mismatch]
>   1228 | int zynqmp_pm_set_rpu_mode(u32 node_id, enum rpu_oper_mode rpu_mode)
>        |     ^~~~~~~~~~~~~~~~~~~~~~
> In file included from drivers/firmware/xilinx/zynqmp.c:25:
> include/linux/firmware/xlnx-zynqmp.h:552:5: note: previous declaration of 'zynqmp_pm_set_rpu_mode' with type 'int(u32,  u32)' {aka 'int(unsigned int,  unsigned int)'}
>    552 | int zynqmp_pm_set_rpu_mode(u32 node_id, u32 arg1);
>        |     ^~~~~~~~~~~~~~~~~~~~~~
> drivers/firmware/xilinx/zynqmp.c:1246:5: error: conflicting types for 'zynqmp_pm_set_tcm_config' due to enum/integer mismatch; have 'int(u32,  enum rpu_tcm_comb)' {aka 'int(unsigned int,  enum rpu_tcm_comb)'} [-Werror=enum-int-mismatch]
>   1246 | int zynqmp_pm_set_tcm_config(u32 node_id, enum rpu_tcm_comb tcm_mode)
>        |     ^~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/firmware/xlnx-zynqmp.h:553:5: note: previous declaration of 'zynqmp_pm_set_tcm_config' with type 'int(u32,  u32)' {aka 'int(unsigned int,  unsigned int)'}
>    553 | int zynqmp_pm_set_tcm_config(u32 node_id, u32 arg1);
>        |     ^~~~~~~~~~~~~~~~~~~~~~~~
>
> Change the declaration in the header to match the function definition.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>   include/linux/firmware/xlnx-zynqmp.h | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h
> index eb88b4ba62f9..0e4c70987e6a 100644
> --- a/include/linux/firmware/xlnx-zynqmp.h
> +++ b/include/linux/firmware/xlnx-zynqmp.h
> @@ -549,8 +549,8 @@ int zynqmp_pm_request_wake(const u32 node,
>                             const u64 address,
>                             const enum zynqmp_pm_request_ack ack);
>   int zynqmp_pm_get_rpu_mode(u32 node_id, enum rpu_oper_mode *rpu_mode);
> -int zynqmp_pm_set_rpu_mode(u32 node_id, u32 arg1);
> -int zynqmp_pm_set_tcm_config(u32 node_id, u32 arg1);
> +int zynqmp_pm_set_rpu_mode(u32 node_id, enum rpu_oper_mode rpu_mode);
> +int zynqmp_pm_set_tcm_config(u32 node_id, enum rpu_tcm_comb tcm_mode);
>   int zynqmp_pm_set_sd_config(u32 node, enum pm_sd_config_type config, u32 value);
>   int zynqmp_pm_set_gem_config(u32 node, enum pm_gem_config_type config,
>                               u32 value);
> @@ -849,12 +849,12 @@ static inline int zynqmp_pm_get_rpu_mode(u32 node_id, enum rpu_oper_mode *rpu_mo
>          return -ENODEV;
>   }
>
> -static inline int zynqmp_pm_set_rpu_mode(u32 node_id, u32 arg1)
> +static inline int zynqmp_pm_set_rpu_mode(u32 node_id, enum rpu_oper_mode rpu_mode)
>   {
>          return -ENODEV;
>   }
>
> -static inline int zynqmp_pm_set_tcm_config(u32 node_id, u32 arg1)
> +static inline int zynqmp_pm_set_tcm_config(u32 node_id, enum rpu_tcm_comb tcm_mode)
>   {
>          return -ENODEV;
>   }
> --
> 2.39.0
>
Arnd Bergmann Jan. 17, 2023, 8:03 p.m. UTC | #2
On Tue, Jan 17, 2023, at 20:53, Tanmay Shah wrote:
> This looks good to me. Thanks for fixing this.
>
> Something must have gone wrong when I ran sparse check on this patch.

I don't think any of our previous tooling caught this, only gcc-13
changed some of the behavior around enums.

> Just one question, does this patch need "fixes:" tag?

Probably a good idea:

Fixes: a5e56980cfb7 ("firmware: xilinx: Add RPU configuration APIs")

I can apply this directly to the soc fixes branch if you like
and add that line.

     Arnd
Tanmay Shah Jan. 17, 2023, 8:14 p.m. UTC | #3
On 1/17/23 12:03 PM, Arnd Bergmann wrote:
> On Tue, Jan 17, 2023, at 20:53, Tanmay Shah wrote:
>> This looks good to me. Thanks for fixing this.
>>
>> Something must have gone wrong when I ran sparse check on this patch.
> I don't think any of our previous tooling caught this, only gcc-13
> changed some of the behavior around enums.
>
>> Just one question, does this patch need "fixes:" tag?
> Probably a good idea:
>
> Fixes: a5e56980cfb7 ("firmware: xilinx: Add RPU configuration APIs")
>
> I can apply this directly to the soc fixes branch if you like
> and add that line.
>
>       Arnd

I am ok with that.

Thanks,

Tanmay
Michal Simek Jan. 18, 2023, 7:29 a.m. UTC | #4
Hi,

On 1/17/23 21:03, Arnd Bergmann wrote:
> 
> On Tue, Jan 17, 2023, at 20:53, Tanmay Shah wrote:
>> This looks good to me. Thanks for fixing this.
>>
>> Something must have gone wrong when I ran sparse check on this patch.
> 
> I don't think any of our previous tooling caught this, only gcc-13
> changed some of the behavior around enums.
> 
>> Just one question, does this patch need "fixes:" tag?
> 
> Probably a good idea:
> 
> Fixes: a5e56980cfb7 ("firmware: xilinx: Add RPU configuration APIs")
> 
> I can apply this directly to the soc fixes branch if you like
> and add that line.

I have other patches in my soc branch to send you too.
Around next week I will be sending PR for it.
I can include this one too but up2you.

Thanks,
Michal
Arnd Bergmann Jan. 18, 2023, 7:31 a.m. UTC | #5
On Wed, Jan 18, 2023, at 08:29, Michal Simek wrote:
> On 1/17/23 21:03, Arnd Bergmann wrote:
>> 
>> On Tue, Jan 17, 2023, at 20:53, Tanmay Shah wrote:
>>> This looks good to me. Thanks for fixing this.
>>>
>>> Something must have gone wrong when I ran sparse check on this patch.
>> 
>> I don't think any of our previous tooling caught this, only gcc-13
>> changed some of the behavior around enums.
>> 
>>> Just one question, does this patch need "fixes:" tag?
>> 
>> Probably a good idea:
>> 
>> Fixes: a5e56980cfb7 ("firmware: xilinx: Add RPU configuration APIs")
>> 
>> I can apply this directly to the soc fixes branch if you like
>> and add that line.
>
> I have other patches in my soc branch to send you too.
> Around next week I will be sending PR for it.
> I can include this one too but up2you.

Since this is required for building with the latest compiler
I think we want this in 6.2 and backported to stable kernels
quickly. I'm about to send a fixes pull request for 6.2, so I'll
just include it here.

    Arnd
Michal Simek Jan. 18, 2023, 7:38 a.m. UTC | #6
On 1/18/23 08:31, Arnd Bergmann wrote:
> On Wed, Jan 18, 2023, at 08:29, Michal Simek wrote:
>> On 1/17/23 21:03, Arnd Bergmann wrote:
>>>
>>> On Tue, Jan 17, 2023, at 20:53, Tanmay Shah wrote:
>>>> This looks good to me. Thanks for fixing this.
>>>>
>>>> Something must have gone wrong when I ran sparse check on this patch.
>>>
>>> I don't think any of our previous tooling caught this, only gcc-13
>>> changed some of the behavior around enums.
>>>
>>>> Just one question, does this patch need "fixes:" tag?
>>>
>>> Probably a good idea:
>>>
>>> Fixes: a5e56980cfb7 ("firmware: xilinx: Add RPU configuration APIs")
>>>
>>> I can apply this directly to the soc fixes branch if you like
>>> and add that line.
>>
>> I have other patches in my soc branch to send you too.
>> Around next week I will be sending PR for it.
>> I can include this one too but up2you.
> 
> Since this is required for building with the latest compiler
> I think we want this in 6.2 and backported to stable kernels
> quickly. I'm about to send a fixes pull request for 6.2, so I'll
> just include it here.

ok. Deal.

Acked-by: Michal Simek <michal.simek@amd.com>

Thanks,
Michal
patchwork-bot+linux-soc@kernel.org Jan. 20, 2023, 10:10 a.m. UTC | #7
Hello:

This patch was applied to soc/soc.git (arm/fixes)
by Arnd Bergmann <arnd@arndb.de>:

On Tue, 17 Jan 2023 17:41:14 +0100 you wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> gcc-13.0.1 reports a type mismatch for two functions:
> 
> drivers/firmware/xilinx/zynqmp.c:1228:5: error: conflicting types for 'zynqmp_pm_set_rpu_mode' due to enum/integer mismatch; have 'int(u32,  enum rpu_oper_mode)' {aka 'int(unsigned int,  enum rpu_oper_mode)'} [-Werror=enum-int-mismatch]
>  1228 | int zynqmp_pm_set_rpu_mode(u32 node_id, enum rpu_oper_mode rpu_mode)
>       |     ^~~~~~~~~~~~~~~~~~~~~~
> In file included from drivers/firmware/xilinx/zynqmp.c:25:
> include/linux/firmware/xlnx-zynqmp.h:552:5: note: previous declaration of 'zynqmp_pm_set_rpu_mode' with type 'int(u32,  u32)' {aka 'int(unsigned int,  unsigned int)'}
>   552 | int zynqmp_pm_set_rpu_mode(u32 node_id, u32 arg1);
>       |     ^~~~~~~~~~~~~~~~~~~~~~
> drivers/firmware/xilinx/zynqmp.c:1246:5: error: conflicting types for 'zynqmp_pm_set_tcm_config' due to enum/integer mismatch; have 'int(u32,  enum rpu_tcm_comb)' {aka 'int(unsigned int,  enum rpu_tcm_comb)'} [-Werror=enum-int-mismatch]
>  1246 | int zynqmp_pm_set_tcm_config(u32 node_id, enum rpu_tcm_comb tcm_mode)
>       |     ^~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/firmware/xlnx-zynqmp.h:553:5: note: previous declaration of 'zynqmp_pm_set_tcm_config' with type 'int(u32,  u32)' {aka 'int(unsigned int,  unsigned int)'}
>   553 | int zynqmp_pm_set_tcm_config(u32 node_id, u32 arg1);
>       |     ^~~~~~~~~~~~~~~~~~~~~~~~
> 
> [...]

Here is the summary with links:
  - firmware: zynqmp: fix declarations for gcc-13
    https://git.kernel.org/soc/soc/c/d2c865553adb

You are awesome, thank you!
diff mbox series

Patch

diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h
index eb88b4ba62f9..0e4c70987e6a 100644
--- a/include/linux/firmware/xlnx-zynqmp.h
+++ b/include/linux/firmware/xlnx-zynqmp.h
@@ -549,8 +549,8 @@  int zynqmp_pm_request_wake(const u32 node,
 			   const u64 address,
 			   const enum zynqmp_pm_request_ack ack);
 int zynqmp_pm_get_rpu_mode(u32 node_id, enum rpu_oper_mode *rpu_mode);
-int zynqmp_pm_set_rpu_mode(u32 node_id, u32 arg1);
-int zynqmp_pm_set_tcm_config(u32 node_id, u32 arg1);
+int zynqmp_pm_set_rpu_mode(u32 node_id, enum rpu_oper_mode rpu_mode);
+int zynqmp_pm_set_tcm_config(u32 node_id, enum rpu_tcm_comb tcm_mode);
 int zynqmp_pm_set_sd_config(u32 node, enum pm_sd_config_type config, u32 value);
 int zynqmp_pm_set_gem_config(u32 node, enum pm_gem_config_type config,
 			     u32 value);
@@ -849,12 +849,12 @@  static inline int zynqmp_pm_get_rpu_mode(u32 node_id, enum rpu_oper_mode *rpu_mo
 	return -ENODEV;
 }
 
-static inline int zynqmp_pm_set_rpu_mode(u32 node_id, u32 arg1)
+static inline int zynqmp_pm_set_rpu_mode(u32 node_id, enum rpu_oper_mode rpu_mode)
 {
 	return -ENODEV;
 }
 
-static inline int zynqmp_pm_set_tcm_config(u32 node_id, u32 arg1)
+static inline int zynqmp_pm_set_tcm_config(u32 node_id, enum rpu_tcm_comb tcm_mode)
 {
 	return -ENODEV;
 }