Commit 590e1e42 authored by Jason Wang's avatar Jason Wang Committed by Michael Ellerman

powerpc/sysfs: Replace sizeof(arr)/sizeof(arr[0]) with ARRAY_SIZE

The ARRAY_SIZE macro is more compact and more formal in linux source.
Signed-off-by: default avatarJason Wang <wangborong@cdjrlc.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210624063632.25632-1-wangborong@cdjrlc.com
parent cae46446
...@@ -843,14 +843,14 @@ static int register_cpu_online(unsigned int cpu) ...@@ -843,14 +843,14 @@ static int register_cpu_online(unsigned int cpu)
#ifdef HAS_PPC_PMC_IBM #ifdef HAS_PPC_PMC_IBM
case PPC_PMC_IBM: case PPC_PMC_IBM:
attrs = ibm_common_attrs; attrs = ibm_common_attrs;
nattrs = sizeof(ibm_common_attrs) / sizeof(struct device_attribute); nattrs = ARRAY_SIZE(ibm_common_attrs);
pmc_attrs = classic_pmc_attrs; pmc_attrs = classic_pmc_attrs;
break; break;
#endif /* HAS_PPC_PMC_IBM */ #endif /* HAS_PPC_PMC_IBM */
#ifdef HAS_PPC_PMC_G4 #ifdef HAS_PPC_PMC_G4
case PPC_PMC_G4: case PPC_PMC_G4:
attrs = g4_common_attrs; attrs = g4_common_attrs;
nattrs = sizeof(g4_common_attrs) / sizeof(struct device_attribute); nattrs = ARRAY_SIZE(g4_common_attrs);
pmc_attrs = classic_pmc_attrs; pmc_attrs = classic_pmc_attrs;
break; break;
#endif /* HAS_PPC_PMC_G4 */ #endif /* HAS_PPC_PMC_G4 */
...@@ -858,7 +858,7 @@ static int register_cpu_online(unsigned int cpu) ...@@ -858,7 +858,7 @@ static int register_cpu_online(unsigned int cpu)
case PPC_PMC_PA6T: case PPC_PMC_PA6T:
/* PA Semi starts counting at PMC0 */ /* PA Semi starts counting at PMC0 */
attrs = pa6t_attrs; attrs = pa6t_attrs;
nattrs = sizeof(pa6t_attrs) / sizeof(struct device_attribute); nattrs = ARRAY_SIZE(pa6t_attrs);
pmc_attrs = NULL; pmc_attrs = NULL;
break; break;
#endif #endif
...@@ -940,14 +940,14 @@ static int unregister_cpu_online(unsigned int cpu) ...@@ -940,14 +940,14 @@ static int unregister_cpu_online(unsigned int cpu)
#ifdef HAS_PPC_PMC_IBM #ifdef HAS_PPC_PMC_IBM
case PPC_PMC_IBM: case PPC_PMC_IBM:
attrs = ibm_common_attrs; attrs = ibm_common_attrs;
nattrs = sizeof(ibm_common_attrs) / sizeof(struct device_attribute); nattrs = ARRAY_SIZE(ibm_common_attrs);
pmc_attrs = classic_pmc_attrs; pmc_attrs = classic_pmc_attrs;
break; break;
#endif /* HAS_PPC_PMC_IBM */ #endif /* HAS_PPC_PMC_IBM */
#ifdef HAS_PPC_PMC_G4 #ifdef HAS_PPC_PMC_G4
case PPC_PMC_G4: case PPC_PMC_G4:
attrs = g4_common_attrs; attrs = g4_common_attrs;
nattrs = sizeof(g4_common_attrs) / sizeof(struct device_attribute); nattrs = ARRAY_SIZE(g4_common_attrs);
pmc_attrs = classic_pmc_attrs; pmc_attrs = classic_pmc_attrs;
break; break;
#endif /* HAS_PPC_PMC_G4 */ #endif /* HAS_PPC_PMC_G4 */
...@@ -955,7 +955,7 @@ static int unregister_cpu_online(unsigned int cpu) ...@@ -955,7 +955,7 @@ static int unregister_cpu_online(unsigned int cpu)
case PPC_PMC_PA6T: case PPC_PMC_PA6T:
/* PA Semi starts counting at PMC0 */ /* PA Semi starts counting at PMC0 */
attrs = pa6t_attrs; attrs = pa6t_attrs;
nattrs = sizeof(pa6t_attrs) / sizeof(struct device_attribute); nattrs = ARRAY_SIZE(pa6t_attrs);
pmc_attrs = NULL; pmc_attrs = NULL;
break; break;
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment