* [PATCH] perfmon: use ARRAY_SIZE() macro
@ 2018-12-25 2:58 ` Gustavo A. R. Silva
0 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2018-12-25 2:58 UTC (permalink / raw)
To: Tony Luck, Fenghua Yu; +Cc: linux-ia64, linux-kernel, Gustavo A. R. Silva
Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element
or, as in this particular case, sizeof the structure name.
This issue was detected with the help of Coccinelle.
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
arch/ia64/kernel/perfmon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 46bff1661836..b39df5078e19 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -4644,7 +4644,7 @@ static pfm_cmd_desc_t pfm_cmd_tab[]={
/* 32 */PFM_CMD(pfm_write_ibrs, PFM_CMD_PCLRWS, PFM_CMD_ARG_MANY, pfarg_dbreg_t, NULL),
/* 33 */PFM_CMD(pfm_write_dbrs, PFM_CMD_PCLRWS, PFM_CMD_ARG_MANY, pfarg_dbreg_t, NULL)
};
-#define PFM_CMD_COUNT (sizeof(pfm_cmd_tab)/sizeof(pfm_cmd_desc_t))
+#define PFM_CMD_COUNT ARRAY_SIZE(pfm_cmd_tab)
static int
pfm_check_task_state(pfm_context_t *ctx, int cmd, unsigned long flags)
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] perfmon: use ARRAY_SIZE() macro
@ 2018-12-25 2:58 ` Gustavo A. R. Silva
0 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2018-12-25 2:58 UTC (permalink / raw)
To: Tony Luck, Fenghua Yu; +Cc: linux-ia64, linux-kernel, Gustavo A. R. Silva
Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element
or, as in this particular case, sizeof the structure name.
This issue was detected with the help of Coccinelle.
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
arch/ia64/kernel/perfmon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 46bff1661836..b39df5078e19 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -4644,7 +4644,7 @@ static pfm_cmd_desc_t pfm_cmd_tab[]={
/* 32 */PFM_CMD(pfm_write_ibrs, PFM_CMD_PCLRWS, PFM_CMD_ARG_MANY, pfarg_dbreg_t, NULL),
/* 33 */PFM_CMD(pfm_write_dbrs, PFM_CMD_PCLRWS, PFM_CMD_ARG_MANY, pfarg_dbreg_t, NULL)
};
-#define PFM_CMD_COUNT (sizeof(pfm_cmd_tab)/sizeof(pfm_cmd_desc_t))
+#define PFM_CMD_COUNT ARRAY_SIZE(pfm_cmd_tab)
static int
pfm_check_task_state(pfm_context_t *ctx, int cmd, unsigned long flags)
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] perfmon: use ARRAY_SIZE() macro
2018-12-25 2:58 ` Gustavo A. R. Silva
@ 2019-01-14 16:54 ` Gustavo A. R. Silva
-1 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2019-01-14 16:54 UTC (permalink / raw)
To: Tony Luck, Fenghua Yu; +Cc: linux-ia64, linux-kernel
Hi,
Friendly ping:
Who can take this, please?
Thanks
--
Gustavo
On 12/24/18 8:58 PM, Gustavo A. R. Silva wrote:
> Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element
> or, as in this particular case, sizeof the structure name.
>
> This issue was detected with the help of Coccinelle.
>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
> arch/ia64/kernel/perfmon.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
> index 46bff1661836..b39df5078e19 100644
> --- a/arch/ia64/kernel/perfmon.c
> +++ b/arch/ia64/kernel/perfmon.c
> @@ -4644,7 +4644,7 @@ static pfm_cmd_desc_t pfm_cmd_tab[]={
> /* 32 */PFM_CMD(pfm_write_ibrs, PFM_CMD_PCLRWS, PFM_CMD_ARG_MANY, pfarg_dbreg_t, NULL),
> /* 33 */PFM_CMD(pfm_write_dbrs, PFM_CMD_PCLRWS, PFM_CMD_ARG_MANY, pfarg_dbreg_t, NULL)
> };
> -#define PFM_CMD_COUNT (sizeof(pfm_cmd_tab)/sizeof(pfm_cmd_desc_t))
> +#define PFM_CMD_COUNT ARRAY_SIZE(pfm_cmd_tab)
>
> static int
> pfm_check_task_state(pfm_context_t *ctx, int cmd, unsigned long flags)
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] perfmon: use ARRAY_SIZE() macro
@ 2019-01-14 16:54 ` Gustavo A. R. Silva
0 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2019-01-14 16:54 UTC (permalink / raw)
To: Tony Luck, Fenghua Yu; +Cc: linux-ia64, linux-kernel
Hi,
Friendly ping:
Who can take this, please?
Thanks
--
Gustavo
On 12/24/18 8:58 PM, Gustavo A. R. Silva wrote:
> Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element
> or, as in this particular case, sizeof the structure name.
>
> This issue was detected with the help of Coccinelle.
>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
> arch/ia64/kernel/perfmon.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
> index 46bff1661836..b39df5078e19 100644
> --- a/arch/ia64/kernel/perfmon.c
> +++ b/arch/ia64/kernel/perfmon.c
> @@ -4644,7 +4644,7 @@ static pfm_cmd_desc_t pfm_cmd_tab[]={
> /* 32 */PFM_CMD(pfm_write_ibrs, PFM_CMD_PCLRWS, PFM_CMD_ARG_MANY, pfarg_dbreg_t, NULL),
> /* 33 */PFM_CMD(pfm_write_dbrs, PFM_CMD_PCLRWS, PFM_CMD_ARG_MANY, pfarg_dbreg_t, NULL)
> };
> -#define PFM_CMD_COUNT (sizeof(pfm_cmd_tab)/sizeof(pfm_cmd_desc_t))
> +#define PFM_CMD_COUNT ARRAY_SIZE(pfm_cmd_tab)
>
> static int
> pfm_check_task_state(pfm_context_t *ctx, int cmd, unsigned long flags)
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-01-14 16:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-25 2:58 [PATCH] perfmon: use ARRAY_SIZE() macro Gustavo A. R. Silva
2018-12-25 2:58 ` Gustavo A. R. Silva
2019-01-14 16:54 ` Gustavo A. R. Silva
2019-01-14 16:54 ` Gustavo A. R. Silva
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.