Received: by 10.192.165.156 with SMTP id m28csp1492418imm; Wed, 18 Apr 2018 10:28:08 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+0mPAc3/FHjIOLNdO2bJhGqAr5HD8LX6Ko2AdCzrcxuGwTw2BHGVWBuukVPIEIO7qXM2pp X-Received: by 2002:a17:902:aa03:: with SMTP id be3-v6mr2797503plb.299.1524072487960; Wed, 18 Apr 2018 10:28:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524072487; cv=none; d=google.com; s=arc-20160816; b=DyONxJ4hdBHMdzI7+vgFyBZSlBbN5NoGBbybjPxDPQVgDlQ81sF1tBmXFEBgdmYt9a nBSyB0lueeeS7rJ0B9WF2KWArOmI6RQq7YK/FiMd6p03fMKMjw4Xp3fIf226fLq0HqlP y0MP7/wRnvzjy7u+aFL6NCTs+LVmMavJNiDfUcWZWfSU0FU63NuWsfmRseMgV4YrZetB HZsDZWdu00ARzWbyWokt5/KLp8qFDFb+DzP1EmIT9c6OaIjc/0k80itBPMFfc9SgSCsc KcOCqMW/PIcgOCeNe3yDLOspN/5LdKG/8Y5TKOoQMrKgRg+6xe3QMm9EZZjr8meMeZs1 0l3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:arc-authentication-results; bh=tMfBxVbLNQM+MiJu0empExXFN56H5Sc6X+TL80ID02A=; b=WLFS42HXBqCodlZsHPgLY/Ytex51paCgS9TF3Zxh+025sNdLh2f6QYdhmmwzEiL0Cs vju5H2TDERilg2JWpk2nbzaejNlrgIoePQvx7wVzsNCtoWV6zhkGe1TJz8UqkP0XH8wj F37aBMUJIqqqld8xSnJhfADUo0inwmxJkX+JdXAqsZw9lMHH/+5HOU3X5c8tYHu2vqya rs+TwF6OW+uqbEvq+WM/a745+paJHWOt6LZkgyc89EtMQIrHfgFs6Rgp6VDp8HXw/gcn I3EXK6KuBaCBpK9ArwPdh1gEBhrBiu4xikpmluH9wA3M0Nb74YvR4zCjIDq8p8dLUpAm kN+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c25si747588pgf.237.2018.04.18.10.27.52; Wed, 18 Apr 2018 10:28:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752511AbeDRR0h (ORCPT + 99 others); Wed, 18 Apr 2018 13:26:37 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:36921 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751692AbeDRR0g (ORCPT ); Wed, 18 Apr 2018 13:26:36 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1f8qqo-0002KP-Hu; Wed, 18 Apr 2018 17:26:34 +0000 From: Colin King To: William Breathitt Gray , Linus Walleij , linux-gpio@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] gpio: make several const arrays static, shrinks object size Date: Wed, 18 Apr 2018 18:26:34 +0100 Message-Id: <20180418172634.14734-1-colin.king@canonical.com> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King Don't populate the const read-only arrays 'port' on the stack but instead make them static. Makes the object code smaller: Before: text data bss dec hex filename 8542 4088 672 13302 33f6 drivers/gpio/gpio-gpio-mm.o 10959 4952 832 16743 4167 drivers/gpio/gpio-104-dio-48e.o 9022 5064 1408 15494 3c86 drivers/gpio/gpio-104-idi-48.o After: text data bss dec hex filename 8372 4144 672 13188 3384 drivers/gpio/gpio-gpio-mm.o 10790 5008 832 16630 40f6 drivers/gpio/gpio-104-dio-48e.o 8853 5152 1408 15413 3c35 linux/drivers/gpio/gpio-104-idi-48.o (gcc version 7.2.0 x86_64) Signed-off-by: Colin Ian King --- drivers/gpio/gpio-104-dio-48e.c | 2 +- drivers/gpio/gpio-104-idi-48.c | 2 +- drivers/gpio/gpio-gpio-mm.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-104-dio-48e.c b/drivers/gpio/gpio-104-dio-48e.c index 31e22c93e844..9c4e07fcb74b 100644 --- a/drivers/gpio/gpio-104-dio-48e.c +++ b/drivers/gpio/gpio-104-dio-48e.c @@ -188,7 +188,7 @@ static int dio48e_gpio_get_multiple(struct gpio_chip *chip, unsigned long *mask, { struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip); size_t i; - const size_t ports[] = { 0, 1, 2, 4, 5, 6 }; + static const size_t ports[] = { 0, 1, 2, 4, 5, 6 }; const unsigned int gpio_reg_size = 8; unsigned int bits_offset; size_t word_index; diff --git a/drivers/gpio/gpio-104-idi-48.c b/drivers/gpio/gpio-104-idi-48.c index f35632609379..2c9738adb3a6 100644 --- a/drivers/gpio/gpio-104-idi-48.c +++ b/drivers/gpio/gpio-104-idi-48.c @@ -94,7 +94,7 @@ static int idi_48_gpio_get_multiple(struct gpio_chip *chip, unsigned long *mask, { struct idi_48_gpio *const idi48gpio = gpiochip_get_data(chip); size_t i; - const size_t ports[] = { 0, 1, 2, 4, 5, 6 }; + static const size_t ports[] = { 0, 1, 2, 4, 5, 6 }; const unsigned int gpio_reg_size = 8; unsigned int bits_offset; size_t word_index; diff --git a/drivers/gpio/gpio-gpio-mm.c b/drivers/gpio/gpio-gpio-mm.c index d496cc56c2a2..b56ff2efbf36 100644 --- a/drivers/gpio/gpio-gpio-mm.c +++ b/drivers/gpio/gpio-gpio-mm.c @@ -177,7 +177,7 @@ static int gpiomm_gpio_get_multiple(struct gpio_chip *chip, unsigned long *mask, { struct gpiomm_gpio *const gpiommgpio = gpiochip_get_data(chip); size_t i; - const size_t ports[] = { 0, 1, 2, 4, 5, 6 }; + static const size_t ports[] = { 0, 1, 2, 4, 5, 6 }; const unsigned int gpio_reg_size = 8; unsigned int bits_offset; size_t word_index; -- 2.17.0