From nobody Sat May 10 08:57:25 2025 Delivered-To: importer2@patchew.org Received-SPF: pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; envelope-from=linux-kernel-owner@vger.kernel.org; helo=vger.kernel.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1606216046; cv=none; d=zohomail.com; s=zohoarc; b=A4+QN+lypxfX1uD4ucmIwzvT4A+Yrjt0A5Id7IDi6vI7udtsD+DheDcBW4bPfPBJtK9z2ww63oxeTbiDdunTYw+FjXs3N+SqE8BOWq0t75n/M9LsyPUH2eXh7QFJQRI18ItGsNcdgQihYg8a9krrWSUQcTMiTUg29caP2Y59WVM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606216046; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VAn2W7JdDb1ja5NzkCGy/GjRQhq/RfM6L2BYJ+PAosw=; b=LdfCX4boIpEEeJP0aczlbBtkQn2gE39u2QpTvxIgjrkFbt97ZneqcCSPa2EEGdC2ab8TQ+Ryj77tJEGAcyUHoKM9t0rVq5FkblA6hIM0MCuDepXCf7WtTRB80/QKP7sFhCYcelizT/ZXTrLLVyLrRy8u8t9sYXMzC4fqIJ0wlGQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mx.zohomail.com with SMTP id 1606216046013538.0227561110142; Tue, 24 Nov 2020 03:07:26 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732703AbgKXLHT (ORCPT ); Tue, 24 Nov 2020 06:07:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:33806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732500AbgKXLGf (ORCPT ); Tue, 24 Nov 2020 06:06:35 -0500 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 23D7521534; Tue, 24 Nov 2020 11:06:31 +0000 (UTC) Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1khW9V-000FaG-5D; Tue, 24 Nov 2020 12:06:29 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1606215991; bh=hA+Hp1F1U3SzbaT/vCbm8FR+9RlEJ1EetZ8a2k907LA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KLJ9qJhhpXM5SXj/EYeC1upbN378ye63jHpEVbKcbQpT/sZyW1KQYbvyjzT5jghW9 zU0APHEW3n66Yq2lhKc2M0TRIych8wf8IY8WVCU8Rb2XL3sMeb0j0yf+vHd4WmGQL6 ed/hfVqMQ0Ad1Orw8jFJ/IGDMzMCQ4V6fFZ+01Go= From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , "Daniel W. S. Almeida" , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH 21/31] media: vidtv: simplify the crc writing logic Date: Tue, 24 Nov 2020 12:06:17 +0100 Message-Id: <7c0c37d86968c17104357164a675f46132f9c5c6.1606215584.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Cleanup the table_section_crc32_write_into() function by initializing struct psi_write_args only once and by passing the args as a pointer. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/test-drivers/vidtv/vidtv_psi.c | 39 +++++++++----------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/drivers/media/test-drivers/vidtv/vidtv_psi.c b/drivers/media/t= est-drivers/vidtv/vidtv_psi.c index 36f1c56d9e24..423b4fa2e473 100644 --- a/drivers/media/test-drivers/vidtv/vidtv_psi.c +++ b/drivers/media/test-drivers/vidtv/vidtv_psi.c @@ -254,26 +254,23 @@ static u32 vidtv_psi_ts_psi_write_into(struct psi_wri= te_args *args) return nbytes; } =20 -static u32 table_section_crc32_write_into(struct crc32_write_args args) +static u32 table_section_crc32_write_into(struct crc32_write_args *args) { - struct psi_write_args psi_args =3D {}; - u32 nbytes =3D 0; + struct psi_write_args psi_args =3D { + .dest_buf =3D args->dest_buf, + .from =3D &args->crc, + .len =3D CRC_SIZE_IN_BYTES, + .dest_offset =3D args->dest_offset, + .pid =3D args->pid, + .new_psi_section =3D false, + .continuity_counter =3D args->continuity_counter, + .is_crc =3D true, + .dest_buf_sz =3D args->dest_buf_sz, + }; =20 /* the CRC is the last entry in the section */ =20 - psi_args.dest_buf =3D args.dest_buf; - psi_args.from =3D &args.crc; - psi_args.len =3D CRC_SIZE_IN_BYTES; - psi_args.dest_offset =3D args.dest_offset; - psi_args.pid =3D args.pid; - psi_args.new_psi_section =3D false; - psi_args.continuity_counter =3D args.continuity_counter; - psi_args.is_crc =3D true; - psi_args.dest_buf_sz =3D args.dest_buf_sz; - - nbytes +=3D vidtv_psi_ts_psi_write_into(&psi_args); - - return nbytes; + return vidtv_psi_ts_psi_write_into(&psi_args); } =20 static void vidtv_psi_desc_chain(struct vidtv_psi_desc *head, struct vidtv= _psi_desc *desc) @@ -1023,7 +1020,7 @@ u32 vidtv_psi_pat_write_into(struct vidtv_psi_pat_wri= te_args args) c_args.dest_buf_sz =3D args.buf_sz; =20 /* Write the CRC32 at the end */ - nbytes +=3D table_section_crc32_write_into(c_args); + nbytes +=3D table_section_crc32_write_into(&c_args); =20 return nbytes; } @@ -1258,7 +1255,7 @@ u32 vidtv_psi_pmt_write_into(struct vidtv_psi_pmt_wri= te_args args) c_args.dest_buf_sz =3D args.buf_sz; =20 /* Write the CRC32 at the end */ - nbytes +=3D table_section_crc32_write_into(c_args); + nbytes +=3D table_section_crc32_write_into(&c_args); =20 return nbytes; } @@ -1397,7 +1394,7 @@ u32 vidtv_psi_sdt_write_into(struct vidtv_psi_sdt_wri= te_args args) c_args.dest_buf_sz =3D args.buf_sz; =20 /* Write the CRC at the end */ - nbytes +=3D table_section_crc32_write_into(c_args); + nbytes +=3D table_section_crc32_write_into(&c_args); =20 return nbytes; } @@ -1754,7 +1751,7 @@ u32 vidtv_psi_nit_write_into(struct vidtv_psi_nit_wri= te_args args) c_args.dest_buf_sz =3D args.buf_sz; =20 /* Write the CRC32 at the end */ - nbytes +=3D table_section_crc32_write_into(c_args); + nbytes +=3D table_section_crc32_write_into(&c_args); =20 return nbytes; } @@ -1944,7 +1941,7 @@ u32 vidtv_psi_eit_write_into(struct vidtv_psi_eit_wri= te_args args) c_args.dest_buf_sz =3D args.buf_sz; =20 /* Write the CRC at the end */ - nbytes +=3D table_section_crc32_write_into(c_args); + nbytes +=3D table_section_crc32_write_into(&c_args); =20 return nbytes; } --=20 2.28.0