Re: [PATCH] habanalabs: fix enum type mismatch
From: Oded Gabbay
Date: Wed Apr 21 2021 - 10:09:09 EST
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@xxxxxxxxxx> wrote:
>
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> 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@xxxxxxxx>
> ---
> 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
>