Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1377143ybj; Tue, 5 May 2020 19:30:40 -0700 (PDT) X-Google-Smtp-Source: APiQypL1Onx/HSMN95balTTuaACJZQt7MVHNwrh3E+kGQVGeYzjdK3gY1YPxJs9X/dCEg7osjo60 X-Received: by 2002:a50:9f23:: with SMTP id b32mr4773441edf.183.1588732240088; Tue, 05 May 2020 19:30:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588732240; cv=none; d=google.com; s=arc-20160816; b=m8rclfvZsRIRUWKgg+GITWdk4nX3J5bgn2KAHaxsIf8zOHVR0jYIt+PgcLt9SZzKBB Lkrn9f96PZJPsBki7SIjOcXNRK1ZPvQNNjdPn+j32RjuWx2wlwLGtH0lgmaLdsXIQkrd I25B4cUzel61thYLbn7bMMIxz3xDlOxI2LGEAC0JoH70KBUDRNK5HJSIfFK1xzvas7/k qg62vrDyKHNXf44JY5mdE6CqZQwSennoumbNJkve98Tcxs7QfDtlaaWYD/XGU/PaLJIp PXQEKDxGx6Tz3/yrWHi+2Rx1fZqgrK4OCPlrkeTFAzURjydpDLZlxaH1uAmW74iSStAo fFLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=YdQT8GTqtMXAdxsGkOpj5BlMolTsCjEkcfLPlJQ10+I=; b=J6+YDbt2FTB/TitNNwm8m6XbDGKPgrViozCte3ysTUIwS1Cs6pBEcd0xQNqC88krlf TXMm6gQ1K8Ggsnr09gV/xVh9G+JYch5YFKAp2G7Qxu0guzxJaW1ymFdi/j1QftVG/H+v JlLgl7n/JD++K6/BveYTiyjfQl/25VV1FkRDmEVPhBNFatK5Eltzsws5BvIMGNZ2UwRj f1RPWIIisGIrbjOPKR+EkVNtzRItequZIOqK7JTtqeRe3mzu9fjS0fRABJvoiOhAJlYR qTL0RVa2MXfWIOos3Bpe69JEqBNjK0x3aXlrxwSczXL31n7Qsuik6pRlu5LARNhxwUqK ZcnA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id co4si244329edb.83.2020.05.05.19.30.15; Tue, 05 May 2020 19:30:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729699AbgEFC1f (ORCPT + 99 others); Tue, 5 May 2020 22:27:35 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:51946 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729553AbgEFC1f (ORCPT ); Tue, 5 May 2020 22:27:35 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 69940334E4C9448177D9; Wed, 6 May 2020 10:27:32 +0800 (CST) Received: from linux-lmwb.huawei.com (10.175.103.112) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.487.0; Wed, 6 May 2020 10:27:25 +0800 From: Samuel Zou To: , , CC: , , "Samuel Zou" Subject: [PATCH -next] powerpc/kernel/sysfs: Use ARRAY_SIZE instead of calculating the array size Date: Wed, 6 May 2020 10:33:36 +0800 Message-ID: <1588732416-33233-1-git-send-email-zou_wei@huawei.com> X-Mailer: git-send-email 2.6.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.103.112] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org fix coccinelle warning, use ARRAY_SIZE arch/powerpc/kernel/sysfs.c:853:34-35: WARNING: Use ARRAY_SIZE arch/powerpc/kernel/sysfs.c:860:33-34: WARNING: Use ARRAY_SIZE arch/powerpc/kernel/sysfs.c:868:28-29: WARNING: Use ARRAY_SIZE arch/powerpc/kernel/sysfs.c:947:34-35: WARNING: Use ARRAY_SIZE arch/powerpc/kernel/sysfs.c:954:33-34: WARNING: Use ARRAY_SIZE arch/powerpc/kernel/sysfs.c:962:28-29: WARNING: Use ARRAY_SIZE Reported-by: Hulk Robot Signed-off-by: Samuel Zou --- arch/powerpc/kernel/sysfs.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c index 571b325..13d2423 100644 --- a/arch/powerpc/kernel/sysfs.c +++ b/arch/powerpc/kernel/sysfs.c @@ -850,14 +850,14 @@ static int register_cpu_online(unsigned int cpu) #ifdef HAS_PPC_PMC_IBM case PPC_PMC_IBM: attrs = ibm_common_attrs; - nattrs = sizeof(ibm_common_attrs) / sizeof(struct device_attribute); + nattrs = ARRAY_SIZE(ibm_common_attrs); pmc_attrs = classic_pmc_attrs; break; #endif /* HAS_PPC_PMC_IBM */ #ifdef HAS_PPC_PMC_G4 case PPC_PMC_G4: attrs = g4_common_attrs; - nattrs = sizeof(g4_common_attrs) / sizeof(struct device_attribute); + nattrs = ARRAY_SIZE(g4_common_attrs); pmc_attrs = classic_pmc_attrs; break; #endif /* HAS_PPC_PMC_G4 */ @@ -865,7 +865,7 @@ static int register_cpu_online(unsigned int cpu) case PPC_PMC_PA6T: /* PA Semi starts counting at PMC0 */ attrs = pa6t_attrs; - nattrs = sizeof(pa6t_attrs) / sizeof(struct device_attribute); + nattrs = ARRAY_SIZE(pa6t_attrs); pmc_attrs = NULL; break; #endif @@ -944,14 +944,14 @@ static int unregister_cpu_online(unsigned int cpu) #ifdef HAS_PPC_PMC_IBM case PPC_PMC_IBM: attrs = ibm_common_attrs; - nattrs = sizeof(ibm_common_attrs) / sizeof(struct device_attribute); + nattrs = ARRAY_SIZE(ibm_common_attrs); pmc_attrs = classic_pmc_attrs; break; #endif /* HAS_PPC_PMC_IBM */ #ifdef HAS_PPC_PMC_G4 case PPC_PMC_G4: attrs = g4_common_attrs; - nattrs = sizeof(g4_common_attrs) / sizeof(struct device_attribute); + nattrs = ARRAY_SIZE(g4_common_attrs); pmc_attrs = classic_pmc_attrs; break; #endif /* HAS_PPC_PMC_G4 */ @@ -959,7 +959,7 @@ static int unregister_cpu_online(unsigned int cpu) case PPC_PMC_PA6T: /* PA Semi starts counting at PMC0 */ attrs = pa6t_attrs; - nattrs = sizeof(pa6t_attrs) / sizeof(struct device_attribute); + nattrs = ARRAY_SIZE(pa6t_attrs); pmc_attrs = NULL; break; #endif -- 2.6.2