Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp360910lqo; Wed, 8 May 2024 01:54:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVMvxltKzFWkW9VdvMZ6r4ZU2k0jYQOC5f6nRg//eJyuiIvHgGG12wK1DvUQmObeuD3HXwskje/seeEKR+HhQOHt9YZbPul9OLnoIzVoQ== X-Google-Smtp-Source: AGHT+IGDgDSwCVOnLMKO3uacS4busLlafhAntButcvfVQVMDhTbbIcBQGrySO8AfzOJBvWb9Ymqr X-Received: by 2002:a17:906:c444:b0:a59:c28a:7ec2 with SMTP id a640c23a62f3a-a59fb95dc67mr110973166b.41.1715158457663; Wed, 08 May 2024 01:54:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715158457; cv=pass; d=google.com; s=arc-20160816; b=Ybb+fuV49GzDle0NnjrXYkCi+dGIxaX+wIbF2vfHlAc0V6atIvoHLqVSqTmVwAYnnw 4Q62Cogikl6XqCohwitkbW7AtOaiW++jAdP6HsTPj5wIzO2raiOPPakr8zT0K74Px/8k dWX/7pIJw6WZdVscZD8S7pRrHoTzPIC2qeOfUMSDLwi6rzjGN34d7EaQ1KvShoHwwsga rjZ3LnaffudQjISgsA3hplHyDfzhsKAjoAGYwhPSsowZgdvvt2bQUqFA14Ti07JxXJyQ C3hlGMCXixfu93CE9ZCsvK5iL5M9UAcHJhC5JnoMhV11BVUtc0YAJ9MLNQsm+G1jj3Sv AcRw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:mail-followup-to :message-id:subject:cc:to:from:date; bh=qKWPldLHwT9dxFE84HQKLRi0iiU9qMHHR8ahB+OPxP0=; fh=CJyz+vfyxLmLQAz+L/2+BG3rHg8LA/csKOPQuxBO2hw=; b=CraDuzVaTPC7D7RloOIcSVm9DZaTYJPnFATveo6JyLiuOnaMbsy34DFPi8J8jFHuUp aZvaBp5QyuU/tTXDihVrQyVGalUNwpxV7WQVgEkjHvcyXwI5b5mBjTlprAtqSW+UoUSi Ka11BJYkLJpGm3JRy/Pi7qoZOwL24421Ol231Sg0wTpUyHy8tqelNcbRebHHRXkn2GgT mpM/KxEozK1RHYpITj4dhAbBYgtVzu1hZcee3Gi9/yEIvrrAar/poSJuJaXjMvEjM9S8 dCPThYL3tK6kgjp8KgOnG7d2nSni3nPrFN5fu516690gspip6Svyy2JZNW6I6bByEu8r nrBQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-172943-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172943-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ds19-20020a170907725300b00a5a03c71c3csi419711ejc.318.2024.05.08.01.54.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 01:54:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172943-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-172943-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172943-linux.lists.archive=gmail.com@vger.kernel.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 39F0D1F214D5 for ; Wed, 8 May 2024 08:54:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4FE4453E32; Wed, 8 May 2024 08:54:10 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4DCAD3EA9C for ; Wed, 8 May 2024 08:54:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715158449; cv=none; b=WQpZVsSoQzoA2qBHSPA6d3Do7DSd+NduCZN7YxCzqwg52moJ0yGOMqFnc0BDDdud/u86Et8NK6BT/+1IZ1M2o90idItPhax1AQvUlQZnlUQBEqeQqoKZOdfbI7nrpQYnl70af/Krmiyl9wxAxIefRuuVsVCs1rAK2mXlV4hXP0o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715158449; c=relaxed/simple; bh=pflO7IhFdkN0vZOy11haWgFFUMQUG7T+bleZpLFH1m4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=saVhGBNE850bdpaiIzTWdXx5M8rqKAOJdAfNzCHUtVbwsEsWITJn/gFtFWrq4ZXtS4M5G1gy6hW2fKBXuN2IeLykGUkxPHpL9FxTzly9mTletuQokH82ygHqv7FChO9UiqqkkPvaGuOU+iZNicWxUSyx7MRlcOrSTfpBJMs9oj8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s4d3M-0001lz-IY; Wed, 08 May 2024 10:53:32 +0200 Received: from [2a0a:edc0:2:b01:1d::c5] (helo=pty.whiteo.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s4d3I-000F6P-1y; Wed, 08 May 2024 10:53:28 +0200 Received: from mtr by pty.whiteo.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1s4d3H-000Z3P-36; Wed, 08 May 2024 10:53:27 +0200 Date: Wed, 8 May 2024 10:53:27 +0200 From: Michael Tretter To: Ricardo Ribalda Cc: Pengutronix Kernel Team , Mauro Carvalho Chehab , Laurent Pinchart , Michal Simek , Andy Walls , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Bjorn Andersson , Konrad Dybcio , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Hans Verkuil Subject: Re: [PATCH v2 01/18] media: allegro: nal-hevc: Refactor nal_hevc_sub_layer_hrd_parameters Message-ID: Mail-Followup-To: Michael Tretter , Ricardo Ribalda , Pengutronix Kernel Team , Mauro Carvalho Chehab , Laurent Pinchart , Michal Simek , Andy Walls , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Bjorn Andersson , Konrad Dybcio , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Hans Verkuil References: <20240507-cocci-flexarray-v2-0-7aea262cf065@chromium.org> <20240507-cocci-flexarray-v2-1-7aea262cf065@chromium.org> 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-Disposition: inline In-Reply-To: <20240507-cocci-flexarray-v2-1-7aea262cf065@chromium.org> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: mtr@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org On Tue, 07 May 2024 16:27:06 +0000, Ricardo Ribalda wrote: > 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) Thanks for the patch. > > 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; The struct is modeled after the specification in ITU-T H.265, which defines the fields as arrays. It's a limitation of the current implementation that only a single element is supported. Maybe replacing the hard coded values with a constant would be more appropriate to document this limitation. Michael > }; > > struct nal_hevc_hrd_parameters { > > -- > 2.45.0.rc1.225.g2a3ae87e7f-goog > >