Received: by 2002:ab2:7104:0:b0:1f7:f6c3:9cb1 with SMTP id z4csp51300lql; Tue, 7 May 2024 09:27:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW7lj/r8toMn0ZfkvPngZm9VBsPPUZfe7beVI575PGbuxp8pLkcAh+aM775iWqlIAqAICyYvl9BCLgfCHbjH08Kt3Fqtlv81VldjpM1DQ== X-Google-Smtp-Source: AGHT+IHFzk7jtzRXtEfj14C2Zdl/P4+fRBTkOVnxFJCD0XJ4hb/7aYFwPT0UATI3XwtUGNlYaURr X-Received: by 2002:ac8:5882:0:b0:437:c024:73f3 with SMTP id d75a77b69052e-43dbef87227mr2223391cf.44.1715099266711; Tue, 07 May 2024 09:27:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715099266; cv=pass; d=google.com; s=arc-20160816; b=syUSKQrKFGNDKGIG3eYKL6e6wS0s5qezr3rCDEEbaahmJkzb+gRaJEgYlXWK0GdE+c 5rkn7wy0ifl/MSEo9iatZzFkVT65MhzjpWazKHSHhF3ZDqJ8QUHygmjMkuQUiYk4Q5ZU GUQjspAkZSFtaYnHBPy1G+avz+3jLILV24gz0ofgAzoY4/hgCiMerFyQKQNmhNaqgH/D FWKPlCGCOhURwmAqU20CQI/S6cfAlJS31X1NB5S92OOW8nU+kr1hOZUpiH/ipabicAKm okdDE/i/V6P2xRUmKOO0CpNTvOgRUWOwCQzISKX5e7X698LUTRuHlwRe0ZBbXx1F28af 0+FA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=XvJOy5lJ/u6e9yHF9m7H/WFxuEXKyxfgmG432+rwWPs=; fh=kuYp+J6UrdLwLDXaXE7Nxurp/YbXG8b1fgBEnamGaoE=; b=oaNYCygW99J/T42Q4e09Q5DNVPn58+zBtvnkdSDFJqSpDUEnNC8t3Uyefhm++EhuZt +ZQ5WKhTpnDjh3wC19nXe4akP0X0+f367Qz9S+k8XM2crmBvUf1D2ayicwPTQl8Mh+zN g6qdD08KqEJDsEYOPRd1azg2l45W09B+pvp/y9iYWq1jGXr5fTGKDL1Ee0vqjWOQ6Yw0 b2SYaAOB/J5Roeu5Nb2KIFfbZ6giuYDXro41AD9cqTpp9NqCkQ6Lqm1KhfK6lobrsCko q6cQwR6ZMvmZIEJ8EvLbV5oxzHJzK/z2H2e/HvOaXnn9UBZaioibFUt8UA9MmItfvx/c rBJg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="XxRE+I/T"; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-171799-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171799-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id dr7-20020a05622a528700b0043cb22b0aadsi11487218qtb.660.2024.05.07.09.27.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 09:27:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171799-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="XxRE+I/T"; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-171799-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171799-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5C31B1C23D04 for ; Tue, 7 May 2024 16:27:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5129316C878; Tue, 7 May 2024 16:27:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="XxRE+I/T" Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2AD316C6A0 for ; Tue, 7 May 2024 16:27:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715099233; cv=none; b=KmmDkAwOBFVGFM7DZ8Cvfp/lRpJ8CrNbPOecWoIt1OqsNkHT1ziWdE/+kAKBv467cmhof/Q0uD6wCITqb5HJJeX2McYw0N4uQKC7BwI7DwgdZiWiphyB05mzBUe2KvrOsB2fo+HkNJr5co6S3qoLbS7L9ELt05Nb2Zovs1rAe44= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715099233; c=relaxed/simple; bh=znTu4kcBZIJ40DAZAzE4ZarYw+mhmMYgFA8GYOICILk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KuQVBEND0tONHGzQjLggSE4NdQzcuDktJfArroWpgW88uHnFAScdOq100J+yV1Su/EAMSOq1Hx6xZNMaiSdVWcLKbUKGhnrk/3JOEehxkKuzL7ALJcGvs8LbPRZitHpwtkSQGo0i8dzOlstUs4+MPxwcD6N3uBoYuWjmgcoy+mw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=XxRE+I/T; arc=none smtp.client-ip=209.85.160.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-qt1-f173.google.com with SMTP id d75a77b69052e-43ab8e0f435so10271811cf.1 for ; Tue, 07 May 2024 09:27:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1715099231; x=1715704031; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=XvJOy5lJ/u6e9yHF9m7H/WFxuEXKyxfgmG432+rwWPs=; b=XxRE+I/TVdkqbZ70usqG6oIolpD7Sj1GI79dpPrxojndgCxNE+f3K4rMKKp8kAloPI xre8gfimtXQ3UyvB9XzsGI1YzMX9GjUk2eo3Tjjy5/K1mJV8rdIWoM/2LXzeFkJmrtD4 JnmiYRf9UYJ8zhJolP5zKBVR8EUE66AeQ9nY0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715099231; x=1715704031; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XvJOy5lJ/u6e9yHF9m7H/WFxuEXKyxfgmG432+rwWPs=; b=K12QaJYQhg22GRizuGNDMdwVoCm4WSgRbFyMl/KlFHL80c+2zNPEiESCcJWSPi8q5v 4XKPSQTBidjgXVU7EzxNfs9lqipnQe/Wss4DurPtwi0BDSBenKMp6KbQrPLQ7wg6FSY8 8Y19LwMsN3KTJkxp8pQ0YDc4A8zTG6R5w6reCiA2l42clt8dW6bcfMFOabqW6hoqLcyt isqxqsgpjs9OxHn8ZVtTFFfWvWnkKfrAszCFaS5/IkvUadG7MjPMhfIQNj7foErBDfr2 SBrVJ98cK3falqxojxB4HQf7/tqY1eZjqTDNHt9xb37yNmxReZ+4hItE0KflevI7bj1p Au8g== X-Forwarded-Encrypted: i=1; AJvYcCXomiqXZikCUqJTgRMsJxBg8NUuyWBeqDTGAnnihl6/yPgFAeqho/Ef0fcryabF4s0MlMaNfvEaEaDuB6qyeaLvgiu4bAdX4ZK3Hrrv X-Gm-Message-State: AOJu0YxHvPHlQKtjduHoEJY9ds1YWORrQt3byomRbS7/haFNYMKbHTpt pLUOTjDBKWDu//s3EWXQI/VV9QFz2sEFHh9Bm17c2umvLFbtdoAjo0WS51k/7g== X-Received: by 2002:ac8:5882:0:b0:437:c024:73f3 with SMTP id d75a77b69052e-43dbef87227mr2207121cf.44.1715099230572; Tue, 07 May 2024 09:27:10 -0700 (PDT) Received: from denia.c.googlers.com (114.152.245.35.bc.googleusercontent.com. [35.245.152.114]) by smtp.gmail.com with ESMTPSA id hf23-20020a05622a609700b0043d1fc9b7d9sm4160597qtb.48.2024.05.07.09.27.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 09:27:09 -0700 (PDT) From: Ricardo Ribalda Date: Tue, 07 May 2024 16:27:06 +0000 Subject: [PATCH v2 01/18] media: allegro: nal-hevc: Refactor nal_hevc_sub_layer_hrd_parameters Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240507-cocci-flexarray-v2-1-7aea262cf065@chromium.org> References: <20240507-cocci-flexarray-v2-0-7aea262cf065@chromium.org> In-Reply-To: <20240507-cocci-flexarray-v2-0-7aea262cf065@chromium.org> To: Michael Tretter , Pengutronix Kernel Team , Mauro Carvalho Chehab , Laurent Pinchart , Michal Simek , Andy Walls , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Bjorn Andersson , Konrad Dybcio Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Hans Verkuil , Ricardo Ribalda X-Mailer: b4 0.12.4 Replace all the single elements arrays with the element itself. Pahole shows the same padding and alignment for x86 and arm in both situations. This fixes this cocci warning: drivers/media/platform/allegro-dvt/nal-hevc.h:102:14-22: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) Signed-off-by: Ricardo Ribalda --- drivers/media/platform/allegro-dvt/allegro-core.c | 6 +++--- drivers/media/platform/allegro-dvt/nal-hevc.c | 11 +++-------- drivers/media/platform/allegro-dvt/nal-hevc.h | 6 +++--- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/media/platform/allegro-dvt/allegro-core.c b/drivers/media/platform/allegro-dvt/allegro-core.c index da61f9beb6b4..369bd88cc0ae 100644 --- a/drivers/media/platform/allegro-dvt/allegro-core.c +++ b/drivers/media/platform/allegro-dvt/allegro-core.c @@ -1852,14 +1852,14 @@ static ssize_t allegro_hevc_write_sps(struct allegro_channel *channel, hrd->dpb_output_delay_length_minus1 = 30; hrd->bit_rate_scale = ffs(channel->bitrate_peak) - 6; - hrd->vcl_hrd[0].bit_rate_value_minus1[0] = + hrd->vcl_hrd[0].bit_rate_value_minus1 = (channel->bitrate_peak >> (6 + hrd->bit_rate_scale)) - 1; cpb_size = v4l2_ctrl_g_ctrl(channel->mpeg_video_cpb_size) * 1000; hrd->cpb_size_scale = ffs(cpb_size) - 4; - hrd->vcl_hrd[0].cpb_size_value_minus1[0] = (cpb_size >> (4 + hrd->cpb_size_scale)) - 1; + hrd->vcl_hrd[0].cpb_size_value_minus1 = (cpb_size >> (4 + hrd->cpb_size_scale)) - 1; - hrd->vcl_hrd[0].cbr_flag[0] = !v4l2_ctrl_g_ctrl(channel->mpeg_video_frame_rc_enable); + hrd->vcl_hrd[0].cbr_flag = !v4l2_ctrl_g_ctrl(channel->mpeg_video_frame_rc_enable); size = nal_hevc_write_sps(&dev->plat_dev->dev, dest, n, sps); diff --git a/drivers/media/platform/allegro-dvt/nal-hevc.c b/drivers/media/platform/allegro-dvt/nal-hevc.c index 9cdf2756e0a3..575089522df5 100644 --- a/drivers/media/platform/allegro-dvt/nal-hevc.c +++ b/drivers/media/platform/allegro-dvt/nal-hevc.c @@ -210,14 +210,9 @@ static void nal_hevc_rbsp_vps(struct rbsp *rbsp, struct nal_hevc_vps *vps) static void nal_hevc_rbsp_sub_layer_hrd_parameters(struct rbsp *rbsp, struct nal_hevc_sub_layer_hrd_parameters *hrd) { - unsigned int i; - unsigned int cpb_cnt = 1; - - for (i = 0; i < cpb_cnt; i++) { - rbsp_uev(rbsp, &hrd->bit_rate_value_minus1[i]); - rbsp_uev(rbsp, &hrd->cpb_size_value_minus1[i]); - rbsp_bit(rbsp, &hrd->cbr_flag[i]); - } + rbsp_uev(rbsp, &hrd->bit_rate_value_minus1); + rbsp_uev(rbsp, &hrd->cpb_size_value_minus1); + rbsp_bit(rbsp, &hrd->cbr_flag); } static void nal_hevc_rbsp_hrd_parameters(struct rbsp *rbsp, diff --git a/drivers/media/platform/allegro-dvt/nal-hevc.h b/drivers/media/platform/allegro-dvt/nal-hevc.h index eb46f12aae80..afa7a9d7d654 100644 --- a/drivers/media/platform/allegro-dvt/nal-hevc.h +++ b/drivers/media/platform/allegro-dvt/nal-hevc.h @@ -97,9 +97,9 @@ struct nal_hevc_vps { }; struct nal_hevc_sub_layer_hrd_parameters { - unsigned int bit_rate_value_minus1[1]; - unsigned int cpb_size_value_minus1[1]; - unsigned int cbr_flag[1]; + unsigned int bit_rate_value_minus1; + unsigned int cpb_size_value_minus1; + unsigned int cbr_flag; }; struct nal_hevc_hrd_parameters { -- 2.45.0.rc1.225.g2a3ae87e7f-goog