From patchwork Thu Feb 4 16:33:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin King X-Patchwork-Id: 376594 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 673E5C433E0 for ; Thu, 4 Feb 2021 16:36:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2AFD564F4E for ; Thu, 4 Feb 2021 16:36:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237121AbhBDQfL (ORCPT ); Thu, 4 Feb 2021 11:35:11 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:56437 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237893AbhBDQev (ORCPT ); Thu, 4 Feb 2021 11:34:51 -0500 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 1l7hZs-0007Ok-FC; Thu, 04 Feb 2021 16:33:56 +0000 From: Colin King To: Jean-Christophe Trotin , Mauro Carvalho Chehab , linux-media@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: platform: sti: make a const array static, makes object smaller Date: Thu, 4 Feb 2021 16:33:56 +0000 Message-Id: <20210204163356.105945-1-colin.king@canonical.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Colin Ian King Don't populate the const array bws on the stack but instead it static. Makes the object code smaller by 8 bytes: Before: text data bss dec hex filename 12504 4568 0 17072 42b0 media/platform/sti/hva/hva-h264.o After: text data bss dec hex filename 12272 4792 0 17064 42a8 media/platform/sti/hva/hva-h264.o (gcc version 10.2.0) Signed-off-by: Colin Ian King --- drivers/media/platform/sti/hva/hva-h264.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/sti/hva/hva-h264.c b/drivers/media/platform/sti/hva/hva-h264.c index c34f7cf5aed2..98cb00d2d868 100644 --- a/drivers/media/platform/sti/hva/hva-h264.c +++ b/drivers/media/platform/sti/hva/hva-h264.c @@ -428,8 +428,10 @@ static int hva_h264_fill_slice_header(struct hva_ctx *pctx, */ struct device *dev = ctx_to_dev(pctx); int cabac = V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC; - const unsigned char slice_header[] = { 0x00, 0x00, 0x00, 0x01, - 0x41, 0x34, 0x07, 0x00}; + static const unsigned char slice_header[] = { + 0x00, 0x00, 0x00, 0x01, + 0x41, 0x34, 0x07, 0x00 + }; int idr_pic_id = frame_num % 2; enum hva_picture_coding_type type; u32 frame_order = frame_num % ctrls->gop_size; @@ -488,7 +490,7 @@ static int hva_h264_fill_data_nal(struct hva_ctx *pctx, unsigned int stream_size, unsigned int *size) { struct device *dev = ctx_to_dev(pctx); - const u8 start[] = { 0x00, 0x00, 0x00, 0x01 }; + static const u8 start[] = { 0x00, 0x00, 0x00, 0x01 }; dev_dbg(dev, "%s %s stuffing bytes %d\n", pctx->name, __func__, stuffing_bytes); @@ -521,7 +523,7 @@ static int hva_h264_fill_sei_nal(struct hva_ctx *pctx, u8 *addr, u32 *size) { struct device *dev = ctx_to_dev(pctx); - const u8 start[] = { 0x00, 0x00, 0x00, 0x01 }; + static const u8 start[] = { 0x00, 0x00, 0x00, 0x01 }; struct hva_h264_stereo_video_sei info; u8 offset = 7; u8 msg = 0;