linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] memory: mtk-smi: Use ARRAY_SIZE to define MTK_SMI_CLK_NR_MAX
@ 2021-10-15 15:15 AngeloGioacchino Del Regno
  2021-10-16  2:13 ` Yong Wu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: AngeloGioacchino Del Regno @ 2021-10-15 15:15 UTC (permalink / raw)
  To: krzysztof.kozlowski
  Cc: yong.wu, matthias.bgg, linux-mediatek, linux-kernel,
	linux-arm-kernel, AngeloGioacchino Del Regno

This definition is tied to the number of SMI common clocks (the array
mtk_smi_common_clks): improve the definition by using the ARRAY_SIZE
macro instead. That will also reduce room for mistakes when updating
the aforementioned array in the future.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/memory/mtk-smi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
index b883dcc0bbfa..6331422141e8 100644
--- a/drivers/memory/mtk-smi.c
+++ b/drivers/memory/mtk-smi.c
@@ -94,8 +94,6 @@ enum mtk_smi_type {
 	MTK_SMI_GEN2_SUB_COMM,	/* gen2 smi sub common */
 };
 
-#define MTK_SMI_CLK_NR_MAX			4
-
 /* larbs: Require apb/smi clocks while gals is optional. */
 static const char * const mtk_smi_larb_clks[] = {"apb", "smi", "gals"};
 #define MTK_SMI_LARB_REQ_CLK_NR		2
@@ -106,6 +104,7 @@ static const char * const mtk_smi_larb_clks[] = {"apb", "smi", "gals"};
  * sub common: Require apb/smi/gals0 clocks in has_gals case. Otherwise, only apb/smi are required.
  */
 static const char * const mtk_smi_common_clks[] = {"apb", "smi", "gals0", "gals1"};
+#define MTK_SMI_CLK_NR_MAX		ARRAY_SIZE(mtk_smi_common_clks)
 #define MTK_SMI_COM_REQ_CLK_NR		2
 #define MTK_SMI_COM_GALS_REQ_CLK_NR	MTK_SMI_CLK_NR_MAX
 #define MTK_SMI_SUB_COM_GALS_REQ_CLK_NR 3
-- 
2.33.0


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH] memory: mtk-smi: Use ARRAY_SIZE to define MTK_SMI_CLK_NR_MAX
  2021-10-15 15:15 [PATCH] memory: mtk-smi: Use ARRAY_SIZE to define MTK_SMI_CLK_NR_MAX AngeloGioacchino Del Regno
@ 2021-10-16  2:13 ` Yong Wu
  2021-10-21  9:21 ` Krzysztof Kozlowski
  2021-11-15 14:10 ` Krzysztof Kozlowski
  2 siblings, 0 replies; 4+ messages in thread
From: Yong Wu @ 2021-10-16  2:13 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, krzysztof.kozlowski
  Cc: matthias.bgg, linux-mediatek, linux-kernel, linux-arm-kernel

On Fri, 2021-10-15 at 17:15 +0200, AngeloGioacchino Del Regno wrote:
> This definition is tied to the number of SMI common clocks (the array
> mtk_smi_common_clks): improve the definition by using the ARRAY_SIZE
> macro instead. That will also reduce room for mistakes when updating
> the aforementioned array in the future.
> 
> Signed-off-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@collabora.com>

Reviewed-by: Yong Wu <yong.wu@mediatek.com>

Thanks for this patch.

> ---
>  drivers/memory/mtk-smi.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c
> index b883dcc0bbfa..6331422141e8 100644
> --- a/drivers/memory/mtk-smi.c
> +++ b/drivers/memory/mtk-smi.c
> @@ -94,8 +94,6 @@ enum mtk_smi_type {
>  	MTK_SMI_GEN2_SUB_COMM,	/* gen2 smi sub common */
>  };
>  
> -#define MTK_SMI_CLK_NR_MAX			4
> -
>  /* larbs: Require apb/smi clocks while gals is optional. */
>  static const char * const mtk_smi_larb_clks[] = {"apb", "smi",
> "gals"};
>  #define MTK_SMI_LARB_REQ_CLK_NR		2
> @@ -106,6 +104,7 @@ static const char * const mtk_smi_larb_clks[] =
> {"apb", "smi", "gals"};
>   * sub common: Require apb/smi/gals0 clocks in has_gals case.
> Otherwise, only apb/smi are required.
>   */
>  static const char * const mtk_smi_common_clks[] = {"apb", "smi",
> "gals0", "gals1"};
> +#define MTK_SMI_CLK_NR_MAX		ARRAY_SIZE(mtk_smi_common_clks)
>  #define MTK_SMI_COM_REQ_CLK_NR		2
>  #define MTK_SMI_COM_GALS_REQ_CLK_NR	MTK_SMI_CLK_NR_MAX
>  #define MTK_SMI_SUB_COM_GALS_REQ_CLK_NR 3
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH] memory: mtk-smi: Use ARRAY_SIZE to define MTK_SMI_CLK_NR_MAX
  2021-10-15 15:15 [PATCH] memory: mtk-smi: Use ARRAY_SIZE to define MTK_SMI_CLK_NR_MAX AngeloGioacchino Del Regno
  2021-10-16  2:13 ` Yong Wu
@ 2021-10-21  9:21 ` Krzysztof Kozlowski
  2021-11-15 14:10 ` Krzysztof Kozlowski
  2 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2021-10-21  9:21 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: yong.wu, matthias.bgg, linux-mediatek, linux-kernel, linux-arm-kernel

On 15/10/2021 17:15, AngeloGioacchino Del Regno wrote:
> This definition is tied to the number of SMI common clocks (the array
> mtk_smi_common_clks): improve the definition by using the ARRAY_SIZE
> macro instead. That will also reduce room for mistakes when updating
> the aforementioned array in the future.
> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/memory/mtk-smi.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 

Thanks for the patch. I sent mtk-smi pull request some time ago and it
is late in the cycle, so this might need to wait for next cycle. I'll
keep it in my queue.

Best regards,
Krzysztof

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH] memory: mtk-smi: Use ARRAY_SIZE to define MTK_SMI_CLK_NR_MAX
  2021-10-15 15:15 [PATCH] memory: mtk-smi: Use ARRAY_SIZE to define MTK_SMI_CLK_NR_MAX AngeloGioacchino Del Regno
  2021-10-16  2:13 ` Yong Wu
  2021-10-21  9:21 ` Krzysztof Kozlowski
@ 2021-11-15 14:10 ` Krzysztof Kozlowski
  2 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2021-11-15 14:10 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: Krzysztof Kozlowski, linux-mediatek, linux-kernel, matthias.bgg,
	yong.wu, linux-arm-kernel

On Fri, 15 Oct 2021 17:15:57 +0200, AngeloGioacchino Del Regno wrote:
> This definition is tied to the number of SMI common clocks (the array
> mtk_smi_common_clks): improve the definition by using the ARRAY_SIZE
> macro instead. That will also reduce room for mistakes when updating
> the aforementioned array in the future.
> 
> 

Applied, thanks!

[1/1] memory: mtk-smi: Use ARRAY_SIZE to define MTK_SMI_CLK_NR_MAX
      commit: 3191e91ae15b60e69523578975bf5c6326ce1be4

Best regards,
-- 
Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

end of thread, other threads:[~2021-11-15 14:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-15 15:15 [PATCH] memory: mtk-smi: Use ARRAY_SIZE to define MTK_SMI_CLK_NR_MAX AngeloGioacchino Del Regno
2021-10-16  2:13 ` Yong Wu
2021-10-21  9:21 ` Krzysztof Kozlowski
2021-11-15 14:10 ` Krzysztof Kozlowski

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