{"id":809272,"url":"http://patchwork.ozlabs.org/api/patches/809272/?format=json","web_url":"http://patchwork.ozlabs.org/project/kvm-ppc/patch/1504439110050-1911621934-1-diffsplit-thomas@m3y3r.de/","project":{"id":23,"url":"http://patchwork.ozlabs.org/api/projects/23/?format=json","name":"KVM PowerPC development","link_name":"kvm-ppc","list_id":"kvm-ppc.vger.kernel.org","list_email":"kvm-ppc@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1504439110050-1911621934-1-diffsplit-thomas@m3y3r.de>","list_archive_url":null,"date":"2017-09-03T12:19:31","name":"[1/10] KVM: PPC: Book3S HV: Use ARRAY_SIZE macro","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"26e4b7e73480b0f8c40dedae5ed3726b3bd6e572","submitter":{"id":10277,"url":"http://patchwork.ozlabs.org/api/people/10277/?format=json","name":"Thomas Meyer","email":"thomas@m3y3r.de"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/kvm-ppc/patch/1504439110050-1911621934-1-diffsplit-thomas@m3y3r.de/mbox/","series":[{"id":1224,"url":"http://patchwork.ozlabs.org/api/series/1224/?format=json","web_url":"http://patchwork.ozlabs.org/project/kvm-ppc/list/?series=1224","date":"2017-09-03T12:19:31","name":"[1/10] KVM: PPC: Book3S HV: Use ARRAY_SIZE macro","version":1,"mbox":"http://patchwork.ozlabs.org/series/1224/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/809272/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/809272/checks/","tags":{},"related":[],"headers":{"Return-Path":"<kvm-ppc-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=kvm-ppc-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xlXTY1DFfz9t3F\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun,  3 Sep 2017 22:33:53 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752880AbdICMdw (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tSun, 3 Sep 2017 08:33:52 -0400","from www17.your-server.de ([213.133.104.17]:34273 \"EHLO\n\twww17.your-server.de\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1752026AbdICMac (ORCPT\n\t<rfc822;kvm-ppc@vger.kernel.org>); Sun, 3 Sep 2017 08:30:32 -0400","from [95.222.27.54] (helo=olymp)\n\tby www17.your-server.de with esmtpsa\n\t(TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.85_2)\n\t(envelope-from <thomas@m3y3r.de>)\n\tid 1doU2n-0007P1-Lw; Sun, 03 Sep 2017 14:30:29 +0200"],"Subject":"[PATCH 1/10] KVM: PPC: Book3S HV: Use ARRAY_SIZE macro","From":"Thomas Meyer <thomas@m3y3r.de>","To":"kvm-ppc@vger.kernel.org, kvm@vger.kernel.org,\n\tlinuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org","Content-Type":"text/plain; charset=\"UTF-8\"","Mime-Version":"1.0","Message-ID":"<1504439110050-1911621934-1-diffsplit-thomas@m3y3r.de>","References":"<1504439110050-939061377-0-diffsplit-thomas@m3y3r.de>","In-Reply-To":"<1504439110050-939061377-0-diffsplit-thomas@m3y3r.de>","Date":"Sun, 03 Sep 2017 14:19:31 +0200","X-Mailer":"Evolution 3.22.6-1 ","Content-Transfer-Encoding":"7bit","X-Authenticated-Sender":"thomas@m3y3r.de","X-Virus-Scanned":"Clear (ClamAV 0.99.2/23763/Sun Sep  3 10:37:41 2017)","Sender":"kvm-ppc-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<kvm-ppc.vger.kernel.org>","X-Mailing-List":"kvm-ppc@vger.kernel.org"},"content":"Use ARRAY_SIZE macro, rather than explicitly coding some variant of it\nyourself.\nFound with: find -type f -name \"*.c\" -o -name \"*.h\" | xargs perl -p -i -e\n's/\\bsizeof\\s*\\(\\s*(\\w+)\\s*\\)\\s*\\ /\\s*sizeof\\s*\\(\\s*\\1\\s*\\[\\s*0\\s*\\]\\s*\\)\n/ARRAY_SIZE(\\1)/g' and manual check/verification.\n\nSigned-off-by: Thomas Meyer <thomas@m3y3r.de>\n---\n\n--\nTo unsubscribe from this list: send the line \"unsubscribe kvm-ppc\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at  http://vger.kernel.org/majordomo-info.html","diff":"diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c\nindex 359c79cdf0cc..ae80181c4e1f 100644\n--- a/arch/powerpc/kvm/book3s_hv.c\n+++ b/arch/powerpc/kvm/book3s_hv.c\n@@ -19,6 +19,7 @@\n  */\n \n #include <linux/kvm_host.h>\n+#include <linux/kernel.h>\n #include <linux/err.h>\n #include <linux/slab.h>\n #include <linux/preempt.h>\n@@ -1766,7 +1767,7 @@ static struct debugfs_timings_element {\n \t{\"cede\",\toffsetof(struct kvm_vcpu, arch.cede_time)},\n };\n \n-#define N_TIMINGS\t(sizeof(timings) / sizeof(timings[0]))\n+#define N_TIMINGS\t(ARRAY_SIZE(timings))\n \n struct debugfs_timings_state {\n \tstruct kvm_vcpu\t*vcpu;\n","prefixes":["1/10"]}