{"id":808250,"url":"http://patchwork.ozlabs.org/api/1.2/patches/808250/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/20170831132449.27600-1-colin.king@canonical.com/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/1.2/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170831132449.27600-1-colin.king@canonical.com>","list_archive_url":null,"date":"2017-08-31T13:24:49","name":"fsl/fman: make arrays port_ids static, reduces object code size","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"9ef4b14717c624f76bd90eccb5f5820233f41c2b","submitter":{"id":2900,"url":"http://patchwork.ozlabs.org/api/1.2/people/2900/?format=json","name":"Colin Ian King","email":"colin.king@canonical.com"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/1.2/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/20170831132449.27600-1-colin.king@canonical.com/mbox/","series":[{"id":828,"url":"http://patchwork.ozlabs.org/api/1.2/series/828/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=828","date":"2017-08-31T13:24:49","name":"fsl/fman: make arrays port_ids static, reduces object code size","version":1,"mbox":"http://patchwork.ozlabs.org/series/828/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/808250/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/808250/checks/","tags":{},"related":[],"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@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=netdev-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 3xjjm06BVVz9sPm\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 31 Aug 2017 23:25:04 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751406AbdHaNYw (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 31 Aug 2017 09:24:52 -0400","from youngberry.canonical.com ([91.189.89.112]:48553 \"EHLO\n\tyoungberry.canonical.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751375AbdHaNYv (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Thu, 31 Aug 2017 09:24:51 -0400","from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost)\n\tby youngberry.canonical.com with esmtpsa\n\t(TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76)\n\t(envelope-from <colin.king@canonical.com>)\n\tid 1dnPSk-0000dj-A1; Thu, 31 Aug 2017 13:24:50 +0000"],"From":"Colin King <colin.king@canonical.com>","To":"Madalin Bucur <madalin.bucur@nxp.com>, netdev@vger.kernel.org","Cc":"kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org","Subject":"[PATCH] fsl/fman: make arrays port_ids static,\n\treduces object code size","Date":"Thu, 31 Aug 2017 14:24:49 +0100","Message-Id":"<20170831132449.27600-1-colin.king@canonical.com>","X-Mailer":"git-send-email 2.14.1","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"8bit","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"From: Colin Ian King <colin.king@canonical.com>\n\nDon't populate the arrays port_ids on the stack, instead make them static.\nMakes the object code smaller by over 700 bytes:\n\nBefore:\n   text\t   data\t    bss\t    dec\t    hex\tfilename\n  28785\t   5832\t    192\t  34809\t   87f9\tfman.o\n\nAfter:\n   text\t   data\t    bss\t    dec\t    hex\tfilename\n  27921\t   5992\t    192\t  34105\t   8539\tfman.o\n\nSigned-off-by: Colin Ian King <colin.king@canonical.com>\n---\n drivers/net/ethernet/freescale/fman/fman.c | 14 ++++++++++----\n 1 file changed, 10 insertions(+), 4 deletions(-)","diff":"diff --git a/drivers/net/ethernet/freescale/fman/fman.c b/drivers/net/ethernet/freescale/fman/fman.c\nindex f420dac2f484..9530405030a7 100644\n--- a/drivers/net/ethernet/freescale/fman/fman.c\n+++ b/drivers/net/ethernet/freescale/fman/fman.c\n@@ -2368,15 +2368,21 @@ u32 fman_get_qman_channel_id(struct fman *fman, u32 port_id)\n \tint i;\n \n \tif (fman->state->rev_info.major >= 6) {\n-\t\tu32 port_ids[] = {0x30, 0x31, 0x28, 0x29, 0x2a, 0x2b,\n-\t\t\t\t  0x2c, 0x2d, 0x2, 0x3, 0x4, 0x5, 0x7, 0x7};\n+\t\tstatic const u32 port_ids[] = {\n+\t\t\t0x30, 0x31, 0x28, 0x29, 0x2a, 0x2b,\n+\t\t\t0x2c, 0x2d, 0x2, 0x3, 0x4, 0x5, 0x7, 0x7\n+\t\t};\n+\n \t\tfor (i = 0; i < fman->state->num_of_qman_channels; i++) {\n \t\t\tif (port_ids[i] == port_id)\n \t\t\t\tbreak;\n \t\t}\n \t} else {\n-\t\tu32 port_ids[] = {0x30, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x1,\n-\t\t\t\t  0x2, 0x3, 0x4, 0x5, 0x7, 0x7};\n+\t\tstatic const u32 port_ids[] = {\n+\t\t\t0x30, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x1,\n+\t\t\t0x2, 0x3, 0x4, 0x5, 0x7, 0x7\n+\t\t};\n+\n \t\tfor (i = 0; i < fman->state->num_of_qman_channels; i++) {\n \t\t\tif (port_ids[i] == port_id)\n \t\t\t\tbreak;\n","prefixes":[]}