* [PATCH] habanalabs: fix enum type mismatch
@ 2021-04-21 13:52 Arnd Bergmann
2021-04-21 14:08 ` Oded Gabbay
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2021-04-21 13:52 UTC (permalink / raw)
To: Oded Gabbay, Greg Kroah-Hartman
Cc: Arnd Bergmann, Ofir Bitton, Tomer Tayar, Omer Shpigelman,
Ohad Sharabi, Alon Mizrahi, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
The definition of these two arrays does not match the type of the
enums in them:
drivers/misc/habanalabs/goya/goya.c:136:21: error: implicit conversion from 'enum goya_pll_index' to 'enum pll_index' [-Werror=enum-conversion]
136 | [CPU_PLL] = GOYA_CPU_PLL,
drivers/misc/habanalabs/gaudi/gaudi.c:126:21: error: implicit conversion from 'enum gaudi_pll_index' to 'enum pll_index' [-Werror=enum-conversion]
126 | [CPU_PLL] = GAUDI_CPU_PLL,
Remove the enum and just use literal numbers, which avoids the
warning and is more concise without really losing any information.
Fixes: e8f9392a5c7f ("habanalabs: support legacy and new pll indexes")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/misc/habanalabs/gaudi/gaudi.c | 38 ++++++++-------------------
drivers/misc/habanalabs/goya/goya.c | 29 ++++++--------------
2 files changed, 19 insertions(+), 48 deletions(-)
diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalabs/gaudi/gaudi.c
index b751652f80a8..69bd7ff694f8 100644
--- a/drivers/misc/habanalabs/gaudi/gaudi.c
+++ b/drivers/misc/habanalabs/gaudi/gaudi.c
@@ -105,34 +105,18 @@
#define GAUDI_PLL_MAX 10
-/*
- * this enum kept here for compatibility with old FW (in which each asic has
- * unique PLL numbering
- */
-enum gaudi_pll_index {
- GAUDI_CPU_PLL = 0,
- GAUDI_PCI_PLL,
- GAUDI_SRAM_PLL,
- GAUDI_HBM_PLL,
- GAUDI_NIC_PLL,
- GAUDI_DMA_PLL,
- GAUDI_MESH_PLL,
- GAUDI_MME_PLL,
- GAUDI_TPC_PLL,
- GAUDI_IF_PLL,
-};
-
+/* compatibility with old FW (in which each asic has unique PLL numbering */
static enum pll_index gaudi_pll_map[PLL_MAX] = {
- [CPU_PLL] = GAUDI_CPU_PLL,
- [PCI_PLL] = GAUDI_PCI_PLL,
- [SRAM_PLL] = GAUDI_SRAM_PLL,
- [HBM_PLL] = GAUDI_HBM_PLL,
- [NIC_PLL] = GAUDI_NIC_PLL,
- [DMA_PLL] = GAUDI_DMA_PLL,
- [MESH_PLL] = GAUDI_MESH_PLL,
- [MME_PLL] = GAUDI_MME_PLL,
- [TPC_PLL] = GAUDI_TPC_PLL,
- [IF_PLL] = GAUDI_IF_PLL,
+ [CPU_PLL] = 0,
+ [PCI_PLL] = 1,
+ [SRAM_PLL] = 2,
+ [HBM_PLL] = 3,
+ [NIC_PLL] = 4,
+ [DMA_PLL] = 5,
+ [MESH_PLL] = 6,
+ [MME_PLL] = 7,
+ [TPC_PLL] = 8,
+ [IF_PLL] = 9,
};
static const char gaudi_irq_name[GAUDI_MSI_ENTRIES][GAUDI_MAX_STRING_LEN] = {
diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc/habanalabs/goya/goya.c
index e27338f4aad2..0a8cf00b5f45 100644
--- a/drivers/misc/habanalabs/goya/goya.c
+++ b/drivers/misc/habanalabs/goya/goya.c
@@ -118,28 +118,15 @@
#define IS_MME_IDLE(mme_arch_sts) \
(((mme_arch_sts) & MME_ARCH_IDLE_MASK) == MME_ARCH_IDLE_MASK)
-/*
- * this enum kept here for compatibility with old FW (in which each asic has
- * unique PLL numbering
- */
-enum goya_pll_index {
- GOYA_CPU_PLL = 0,
- GOYA_IC_PLL,
- GOYA_MC_PLL,
- GOYA_MME_PLL,
- GOYA_PCI_PLL,
- GOYA_EMMC_PLL,
- GOYA_TPC_PLL,
-};
-
+/* compatibility with old FW (in which each asic has unique PLL numbering */
static enum pll_index goya_pll_map[PLL_MAX] = {
- [CPU_PLL] = GOYA_CPU_PLL,
- [IC_PLL] = GOYA_IC_PLL,
- [MC_PLL] = GOYA_MC_PLL,
- [MME_PLL] = GOYA_MME_PLL,
- [PCI_PLL] = GOYA_PCI_PLL,
- [EMMC_PLL] = GOYA_EMMC_PLL,
- [TPC_PLL] = GOYA_TPC_PLL,
+ [CPU_PLL] = 0,
+ [IC_PLL] = 1,
+ [MC_PLL] = 2,
+ [MME_PLL] = 3,
+ [PCI_PLL] = 4,
+ [EMMC_PLL] = 5,
+ [TPC_PLL] = 6,
};
static const char goya_irq_name[GOYA_MSIX_ENTRIES][GOYA_MAX_STRING_LEN] = {
--
2.29.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] habanalabs: fix enum type mismatch
2021-04-21 13:52 [PATCH] habanalabs: fix enum type mismatch Arnd Bergmann
@ 2021-04-21 14:08 ` Oded Gabbay
0 siblings, 0 replies; 2+ messages in thread
From: Oded Gabbay @ 2021-04-21 14:08 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Oded Gabbay, Greg Kroah-Hartman, Arnd Bergmann, Ofir Bitton,
Tomer Tayar, Omer Shpigelman, Ohad Sharabi, Alon Mizrahi,
Linux-Kernel@Vger. Kernel. Org
Hi Arnd,
Thanks for the fix but I already have a pending patch for rc1 that
fixes this issue.
See: https://lkml.org/lkml/2021/4/17/73
Oded
On Wed, Apr 21, 2021 at 4:53 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> The definition of these two arrays does not match the type of the
> enums in them:
>
> drivers/misc/habanalabs/goya/goya.c:136:21: error: implicit conversion from 'enum goya_pll_index' to 'enum pll_index' [-Werror=enum-conversion]
> 136 | [CPU_PLL] = GOYA_CPU_PLL,
> drivers/misc/habanalabs/gaudi/gaudi.c:126:21: error: implicit conversion from 'enum gaudi_pll_index' to 'enum pll_index' [-Werror=enum-conversion]
> 126 | [CPU_PLL] = GAUDI_CPU_PLL,
>
> Remove the enum and just use literal numbers, which avoids the
> warning and is more concise without really losing any information.
>
> Fixes: e8f9392a5c7f ("habanalabs: support legacy and new pll indexes")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/misc/habanalabs/gaudi/gaudi.c | 38 ++++++++-------------------
> drivers/misc/habanalabs/goya/goya.c | 29 ++++++--------------
> 2 files changed, 19 insertions(+), 48 deletions(-)
>
> diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalabs/gaudi/gaudi.c
> index b751652f80a8..69bd7ff694f8 100644
> --- a/drivers/misc/habanalabs/gaudi/gaudi.c
> +++ b/drivers/misc/habanalabs/gaudi/gaudi.c
> @@ -105,34 +105,18 @@
>
> #define GAUDI_PLL_MAX 10
>
> -/*
> - * this enum kept here for compatibility with old FW (in which each asic has
> - * unique PLL numbering
> - */
> -enum gaudi_pll_index {
> - GAUDI_CPU_PLL = 0,
> - GAUDI_PCI_PLL,
> - GAUDI_SRAM_PLL,
> - GAUDI_HBM_PLL,
> - GAUDI_NIC_PLL,
> - GAUDI_DMA_PLL,
> - GAUDI_MESH_PLL,
> - GAUDI_MME_PLL,
> - GAUDI_TPC_PLL,
> - GAUDI_IF_PLL,
> -};
> -
> +/* compatibility with old FW (in which each asic has unique PLL numbering */
> static enum pll_index gaudi_pll_map[PLL_MAX] = {
> - [CPU_PLL] = GAUDI_CPU_PLL,
> - [PCI_PLL] = GAUDI_PCI_PLL,
> - [SRAM_PLL] = GAUDI_SRAM_PLL,
> - [HBM_PLL] = GAUDI_HBM_PLL,
> - [NIC_PLL] = GAUDI_NIC_PLL,
> - [DMA_PLL] = GAUDI_DMA_PLL,
> - [MESH_PLL] = GAUDI_MESH_PLL,
> - [MME_PLL] = GAUDI_MME_PLL,
> - [TPC_PLL] = GAUDI_TPC_PLL,
> - [IF_PLL] = GAUDI_IF_PLL,
> + [CPU_PLL] = 0,
> + [PCI_PLL] = 1,
> + [SRAM_PLL] = 2,
> + [HBM_PLL] = 3,
> + [NIC_PLL] = 4,
> + [DMA_PLL] = 5,
> + [MESH_PLL] = 6,
> + [MME_PLL] = 7,
> + [TPC_PLL] = 8,
> + [IF_PLL] = 9,
> };
>
> static const char gaudi_irq_name[GAUDI_MSI_ENTRIES][GAUDI_MAX_STRING_LEN] = {
> diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc/habanalabs/goya/goya.c
> index e27338f4aad2..0a8cf00b5f45 100644
> --- a/drivers/misc/habanalabs/goya/goya.c
> +++ b/drivers/misc/habanalabs/goya/goya.c
> @@ -118,28 +118,15 @@
> #define IS_MME_IDLE(mme_arch_sts) \
> (((mme_arch_sts) & MME_ARCH_IDLE_MASK) == MME_ARCH_IDLE_MASK)
>
> -/*
> - * this enum kept here for compatibility with old FW (in which each asic has
> - * unique PLL numbering
> - */
> -enum goya_pll_index {
> - GOYA_CPU_PLL = 0,
> - GOYA_IC_PLL,
> - GOYA_MC_PLL,
> - GOYA_MME_PLL,
> - GOYA_PCI_PLL,
> - GOYA_EMMC_PLL,
> - GOYA_TPC_PLL,
> -};
> -
> +/* compatibility with old FW (in which each asic has unique PLL numbering */
> static enum pll_index goya_pll_map[PLL_MAX] = {
> - [CPU_PLL] = GOYA_CPU_PLL,
> - [IC_PLL] = GOYA_IC_PLL,
> - [MC_PLL] = GOYA_MC_PLL,
> - [MME_PLL] = GOYA_MME_PLL,
> - [PCI_PLL] = GOYA_PCI_PLL,
> - [EMMC_PLL] = GOYA_EMMC_PLL,
> - [TPC_PLL] = GOYA_TPC_PLL,
> + [CPU_PLL] = 0,
> + [IC_PLL] = 1,
> + [MC_PLL] = 2,
> + [MME_PLL] = 3,
> + [PCI_PLL] = 4,
> + [EMMC_PLL] = 5,
> + [TPC_PLL] = 6,
> };
>
> static const char goya_irq_name[GOYA_MSIX_ENTRIES][GOYA_MAX_STRING_LEN] = {
> --
> 2.29.2
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-21 14:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21 13:52 [PATCH] habanalabs: fix enum type mismatch Arnd Bergmann
2021-04-21 14:08 ` Oded Gabbay
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).