Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4587608pxu; Tue, 20 Oct 2020 23:29:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRLwA0v5zLhCj9uIsDcwaqfTr8BVOvIkLJNTRM8b3MZH9rrPHutX9zPhzm9ksFo8ZJeCNm X-Received: by 2002:a17:906:c0c4:: with SMTP id bn4mr1885284ejb.27.1603261740225; Tue, 20 Oct 2020 23:29:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603261740; cv=none; d=google.com; s=arc-20160816; b=FxXf4o20dpdLCARyeZG+5lmwWpE3aDjAsEPJZwZkROhJLhBe2sh3MUwmDc25zIYhOA YMI4Cz9tRtuiA9zmivffeQcjpBkk+cI2P1xXHwEfyqhaNyBmJpZLWTlMEA423773nBn0 2WtM0uJ9E9zYKLvNJWne1WvGEGtFoclxH4OsoVSTS5v+rar45lu2OJZiwQ1G+tEUks6K ZhXbKe8xTRpTTHQ3dLavdNk/+iV1klmimebRnzVVKymCsgl50Oo6MMXMcnA9CifEZI5P cqZuO4nZMmm2CuoWq/8YAlVcaya46AHN/9bJs7aS/wsEHTqcuGlyXYP6g6TZdG5Akj/n VjsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=fCZbg57Yko9mbpAMuzdarR+Rf1D+KodM55ZBv9Pq50U=; b=vtyQO95tuYlJbi9ZZ/ntIQFo1loLpwowQ8cYvZqsOS0Ja4OcCJ6CYiD3qwxSbI22ps BkJDa4kVKj4sJi1A4/YgylGrkyiAGAngUPh0hjvSRGS44gViQJTdgoaGAluqpUCqKfOC iVBCMpSvbi0XT/tytIOTvRoTOwl8grADLdRr2rzQ+fZhIqs4GM5BvwmhiXObW5bT1ZRh lAy3p6AnUbEX+nP6uQM9BOZMVOHWpp+lv4zuSVApEWu6LGuMmMXtjbMk0ms9yNHOYCjN aPGZMUDz15NUMWqvKCk7MEST/22b/qNqpo9XPRpkXvinK31NF2MOxJxcXOkCp/Hfm91l 8Hdg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h5si766421eds.269.2020.10.20.23.28.38; Tue, 20 Oct 2020 23:29:00 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436708AbgJTPmM (ORCPT + 99 others); Tue, 20 Oct 2020 11:42:12 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:50694 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436532AbgJTPmM (ORCPT ); Tue, 20 Oct 2020 11:42:12 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kUtm0-0007wZ-Fx; Tue, 20 Oct 2020 15:42:04 +0000 From: Colin King To: Oliver Hartkopp , Marc Kleine-Budde , "David S . Miller" , Jakub Kicinski , linux-can@vger.kernel.org, netdev@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] can: isotp: make const array static, makes object smaller Date: Tue, 20 Oct 2020 16:42:03 +0100 Message-Id: <20201020154203.54711-1-colin.king@canonical.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King Don't populate the const array plen on the stack but instead it static. Makes the object code smaller by 926 bytes. Before: text data bss dec hex filename 26531 1943 64 28538 6f7a net/can/isotp.o After: text data bss dec hex filename 25509 2039 64 27612 6bdc net/can/isotp.o (gcc version 10.2.0) Signed-off-by: Colin Ian King --- net/can/isotp.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/net/can/isotp.c b/net/can/isotp.c index 4c2062875893..3fd714f81875 100644 --- a/net/can/isotp.c +++ b/net/can/isotp.c @@ -252,14 +252,16 @@ static void isotp_rcv_skb(struct sk_buff *skb, struct sock *sk) static u8 padlen(u8 datalen) { - const u8 plen[] = {8, 8, 8, 8, 8, 8, 8, 8, 8, /* 0 - 8 */ - 12, 12, 12, 12, /* 9 - 12 */ - 16, 16, 16, 16, /* 13 - 16 */ - 20, 20, 20, 20, /* 17 - 20 */ - 24, 24, 24, 24, /* 21 - 24 */ - 32, 32, 32, 32, 32, 32, 32, 32, /* 25 - 32 */ - 48, 48, 48, 48, 48, 48, 48, 48, /* 33 - 40 */ - 48, 48, 48, 48, 48, 48, 48, 48}; /* 41 - 48 */ + static const u8 plen[] = { + 8, 8, 8, 8, 8, 8, 8, 8, 8, /* 0 - 8 */ + 12, 12, 12, 12, /* 9 - 12 */ + 16, 16, 16, 16, /* 13 - 16 */ + 20, 20, 20, 20, /* 17 - 20 */ + 24, 24, 24, 24, /* 21 - 24 */ + 32, 32, 32, 32, 32, 32, 32, 32, /* 25 - 32 */ + 48, 48, 48, 48, 48, 48, 48, 48, /* 33 - 40 */ + 48, 48, 48, 48, 48, 48, 48, 48 /* 41 - 48 */ + }; if (datalen > 48) return 64; -- 2.27.0