Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp532034lqh; Tue, 7 May 2024 06:51:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWR0hMDdlxewoOIEyybME+Kt/L+beB71D0QWrYwLJL3o43wdnbg5fRaMOWOamQFSlBswT2ZbLZ/3BMg9ePOFU6aZJiGhnLlGaAZXa1syw== X-Google-Smtp-Source: AGHT+IGKCfRXj9GubVswv30zfszdbNbq3eDuh5s/fxufaAVVT7bVf7u423Y3Z6lLnGLmGJru5EfP X-Received: by 2002:a17:902:bb91:b0:1eb:7172:673b with SMTP id m17-20020a170902bb9100b001eb7172673bmr11952953pls.16.1715089899769; Tue, 07 May 2024 06:51:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715089899; cv=pass; d=google.com; s=arc-20160816; b=vcWTjFAQadHubDApEeNQIViFY7XcjAeWwdYuOWgLABzZR/BSXIRTqReyQhS+Rr+DIF pwtUWpAzysZtzu3BDQYx08/Q3AXk9OXFwAiZKqMtYg2iOTZJhV9Ww4Mumt0jzeJblKto q0vFSLb5XAvTNvkCbFLxU1Oej+y+zNIFJ4LAOpx/LSP8JhDiuVuFeGQ4eZuPxJo/ADqS 1cnUPxuTod1G7uXN7yJpZg8Y9hoUYg1m4lgUiCKRizPrMBy2a3zi6ayRoDUipPe7UCnv 9ofIBbNrbUveEEijz+ciAEhT5KVcbH+DrSCaAqwt0ztHCHah1mgOV9DbODfdNfRFC2Ux fp1A== 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=zTPesXh8txUDXX/M0cr2u6PWwEWnOW8RU6XhFcBvEmY=; b=biJjthF9i782paJYL8X8h2i6ME7WKCC0uOy+ZfA2Ewqc6g79vqvWFb22+DeijOqc+M r5i+T3Vcn2BuZTSweSYubk9BT/zh+XYRgC+yI5EOlcG59RYn7kkNge5+9t9jtb3rVeXg fJnxW+K7k9A6P8qrWo4ol8Jo9Eg4bLI/076KJwRD4VQCxuxMWQbUfi3vBxjlevaRW4tc Be+v9PogR9MQyaVpo9pZnwQVyD2v9LwGlt8l2MAoAa2de/y82Xu5zhiNL4dSIAv9PAdK DAtog5lBhLeuzY0+ep+fhjT+dSZeL2tV1GamF1OGm+KPAuUBxObddXZU2vtRA6Kx8PWh zfCA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="W/ysPZ06"; 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-171389-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171389-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id e12-20020a17090301cc00b001ea2838f1d3si10744598plh.458.2024.05.07.06.51.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 06:51:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171389-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="W/ysPZ06"; 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-171389-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171389-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 692F9B29B69 for ; Tue, 7 May 2024 13:23:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8686F16C687; Tue, 7 May 2024 13:18:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="W/ysPZ06" Received: from mail-qv1-f50.google.com (mail-qv1-f50.google.com [209.85.219.50]) (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 C574D168B12 for ; Tue, 7 May 2024 13:18:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715087913; cv=none; b=U0gVX5rDyN4YOafbdcXr0x16HrbCTohEoBz9xgJ0Bjq5Vv0nN8qZPUtGfDvsnTcS7lmoVCWQkyjHHiKe1cVIyaRWa4zBmVsXvp/KcbF8V1qf6MBfWKq1B0h3ypu7Tj0QQbVQSxx7feRKYQCPoPr0xEcsu/0kRVQ8+glQjpXAd88= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715087913; c=relaxed/simple; bh=znTu4kcBZIJ40DAZAzE4ZarYw+mhmMYgFA8GYOICILk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CsyZDN9BpuJnxaDWuj49Gn4G4oCPG24eyxHz5P3XhxfyDHw2ABVWpDsYMMapSdYj6CLEcnHB4QxChQ84B6TI83HDdnq9pWuJruL6XzgMTOd4H8lM/aENveCoky6MBsMrIbEKsOluAuwh+F6LD23Q1Z3I+LbWloCiKiZI1o+lof4= 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=W/ysPZ06; arc=none smtp.client-ip=209.85.219.50 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-qv1-f50.google.com with SMTP id 6a1803df08f44-69b5ece41dfso13978866d6.2 for ; Tue, 07 May 2024 06:18:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1715087911; x=1715692711; 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=W/ysPZ06IYFhtX/6M3QRbwwJGPzhk/CIsHei/AljHXL4JN8aGL6yhVBUYEbi36qpad IA0pgS3Ljw0RtcNaz4Hi1KvWOyOSn4YmxL1sh7QEVCl4lj+o8exRPeBIC6MNNs5LrQWV q4a8DJGW98T/nOESWGyHZFg1FXPO39PWk2Sj4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715087911; x=1715692711; 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=Fr3ODICSHAkY2jbHL+wrEWDk4br+zNbvmXjHEkGVSytDCZfTfoDxMInxUF90o2vrzT NZNkZMitXBVG8wMFV2ePa5/mPvC9YtDEfkS7Du+IiIAG1K4yr+krAODM1HCPV5qy85Q6 rDAR8MZZhE22GRyt2CvhFcBo7GtdxhFhUa6AltVGOVnFnUPvAlyyWHgOciYaWvf044p1 Eq4Ktqy1SCMAxQ22xjIr5ua1YWWqaYmn88E+BxPzZPYAW5iovREEygNn4nWHTfiMhvko gOU267hWJzBmhfYy0fa393w5cv8Ditpfl/YQSS4ykxZwSPIt3lIb8FNh91SuJxnj2oSh ctuw== X-Forwarded-Encrypted: i=1; AJvYcCVijm/zAgQC4uV+mau4ylB8ZJCPz0EEQU7U2SxzCjYOpWgBkd4Wrw0CGZx0vVdgMPG7V1KMuidpA2JqEYolvzc49l634m+jbiVye6hT X-Gm-Message-State: AOJu0Yz1HRNcc/8odBpyUZEZ32+clWWr2cyLmapTgZGDa5bHs9XPhYtP k3I/FnsENoUEzl7OOvJi9AfrJyu038Kif1TVMO3L6aQQgRlL2qLCFtsbAe8DgA== X-Received: by 2002:a05:6214:1253:b0:6a0:b3ec:902f with SMTP id r19-20020a056214125300b006a0b3ec902fmr19399470qvv.15.1715087910820; Tue, 07 May 2024 06:18:30 -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 t15-20020a05621405cf00b006a0d19c3139sm4655105qvz.118.2024.05.07.06.18.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 06:18:30 -0700 (PDT) From: Ricardo Ribalda Date: Tue, 07 May 2024 13:18:27 +0000 Subject: [PATCH 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-v1-1-4a421c21fd06@chromium.org> References: <20240507-cocci-flexarray-v1-0-4a421c21fd06@chromium.org> In-Reply-To: <20240507-cocci-flexarray-v1-0-4a421c21fd06@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