From patchwork Tue Jan 17 15:08:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brent Pappas X-Patchwork-Id: 44706 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1817828wrn; Tue, 17 Jan 2023 07:25:50 -0800 (PST) X-Google-Smtp-Source: AMrXdXtuGMgC7KA80sblcYnHXTeky8Qn7xM1KBYkkVL0f5SD1bXhmpjNpzv3oCC0nuwpqjGb+aAd X-Received: by 2002:a17:902:ef93:b0:194:9c68:b3e with SMTP id iz19-20020a170902ef9300b001949c680b3emr3813444plb.21.1673969150580; Tue, 17 Jan 2023 07:25:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673969150; cv=none; d=google.com; s=arc-20160816; b=ZSj5cGP+6CNkLitkxPkA/en6riuTjPNC7j7VsY0LJlcBuXIvJscw/vzzoctnScrxZ+ F5wsAJFq7Y9gsbilzTypQ8ZDwwzWRgFNzQq6bPWuuNo2NEOu+09Wh6jYNgaAE8fxfS+X ncmd7eokQP7MjDg7psh3njV/WiEqt2ihdKeV65FY/0j6SUAncKADw08FLMLqI/QXyPXp aRKj7ajcKijvop2j/15/lzdsGDWGSBpfYP47g2bfKOkv+7pXMItXIrY8BxheSN+LsZFJ owioMDIVXTyMHUf7C5W6og+ACs5pUhFX+rcIZtP2Lo1XnYHadN5AGqXAHtrqXIOfJrJv fWfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=a8bTiN8pEvQcuL9m5HpqBW3PCkRfZxwR9JaYuHhgw3U=; b=cHDqpJ+KTxvFRGE0UlElxUsOTUwDOOUdCf37vtB6nu5ytKKqO7p1Zyhe7wHqcsM3nz i9ixKsBW6G+sdbDbzoffsyF1qSMwakg4LNRGKrnTuM6ukvEiQKyuxie47zi8gN4NKsIQ Ipx0c8kgcU0vygdDN9vhE6A0TCC/0F1rA6g/D8VfJcxRdmsWSvJTmntSMOmJRntZOA/n vi5b3MtQW6TheFFJyDpJENyPa1wki5NFrzTHil9I1YM8PaiGEsFNknUBzdp/okCqFeaR j/UonD6EWKFp3+MFty86ZgtjkZcx6XlLMLZXk+dJ0l7Mx8Pw0uiq6mh5nLKr1YTD3xZR P5hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@pappasbrent.com header.s=default header.b=ZtnUDEve; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e8-20020a170902ef4800b0019317affa0dsi31994586plx.275.2023.01.17.07.25.38; Tue, 17 Jan 2023 07:25:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@pappasbrent.com header.s=default header.b=ZtnUDEve; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232592AbjAQPPj (ORCPT + 99 others); Tue, 17 Jan 2023 10:15:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233169AbjAQPPe (ORCPT ); Tue, 17 Jan 2023 10:15:34 -0500 X-Greylist: delayed 379 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 17 Jan 2023 07:15:32 PST Received: from h7.fbrelay.privateemail.com (h7.fbrelay.privateemail.com [162.0.218.230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7801733460; Tue, 17 Jan 2023 07:15:32 -0800 (PST) Received: from MTA-09-3.privateemail.com (mta-09.privateemail.com [198.54.127.58]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by h7.fbrelay.privateemail.com (Postfix) with ESMTPS id 7901560222; Tue, 17 Jan 2023 10:09:11 -0500 (EST) Received: from mta-09.privateemail.com (localhost [127.0.0.1]) by mta-09.privateemail.com (Postfix) with ESMTP id ADA7818000A5; Tue, 17 Jan 2023 10:09:08 -0500 (EST) Received: from bpappas-XPS-13-9310.ucf.edu (050-088-208-136.res.spectrum.com [50.88.208.136]) by mta-09.privateemail.com (Postfix) with ESMTPA id 3525E18000A6; Tue, 17 Jan 2023 10:08:57 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=pappasbrent.com; s=default; t=1673968148; bh=ZBTABHRAmG+D05AOR8APAmPUuxMqGh+RixprC8KC7Fg=; h=From:To:Cc:Subject:Date:From; b=ZtnUDEverhCjMgnJDlCnhUI7h5H3c8kniUIptA0zmVYo+aEOcUaiat+oSQD4yloR6 hBA6xWBw3GinVz3D/O3H+bz3n6Hzst5Vo7TInceipqysJ1gL8ouZkvxp7XhdrJ7s+J AU9uB24zAq+TDpNPEz39gRdu+WNx0YPzbv/cfRJoBlDPP9huYpBM5Q2N/vdxTCMc6V amCczZc43PimUEekzqoZlLFrAunfTug1W9RqnJsI1Rhk/sRGnK4rH7JfeOmPvpCFvT y4+CtOqri1r+YwVearS2IwEW446tpKBT2jjPgqjG8F7Z9VtdQ+fJveBjzEFoE4fo7b KE7o1Ij3xNIQA== From: Brent Pappas To: hdegoede@redhat.com Cc: mchehab@kernel.org, ailus@linux.intel.com, gregkh@linuxfoundation.org, andy@kernel.org, error27@gmail.com, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Brent Pappas Subject: [PATCH] staging: media: atomisp: pci: Replace bytes macros with functions Date: Tue, 17 Jan 2023 10:08:41 -0500 Message-Id: <20230117150841.18061-1-bpappas@pappasbrent.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755283876441388810?= X-GMAIL-MSGID: =?utf-8?q?1755283876441388810?= Replace the function-like macros FPNTBL_BYTES, SCTBL_BYTES, and MORPH_PLANE_BYTES with static inline functions to comply with Linux coding style standards. Signed-off-by: Brent Pappas --- .../staging/media/atomisp/pci/sh_css_params.c | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/staging/media/atomisp/pci/sh_css_params.c index f08564f58242..fe28d75a62a4 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_params.c +++ b/drivers/staging/media/atomisp/pci/sh_css_params.c @@ -98,17 +98,23 @@ #include "sh_css_frac.h" #include "ia_css_bufq.h" -#define FPNTBL_BYTES(binary) \ - (sizeof(char) * (binary)->in_frame_info.res.height * \ - (binary)->in_frame_info.padded_width) +static inline size_t fpntbl_bytes(const struct ia_css_binary *binary) +{ + return (sizeof(char) * binary->in_frame_info.res.height * + binary->in_frame_info.padded_width); +} -#define SCTBL_BYTES(binary) \ - (sizeof(unsigned short) * (binary)->sctbl_height * \ - (binary)->sctbl_aligned_width_per_color * IA_CSS_SC_NUM_COLORS) +static inline size_t sctbl_bytes(const struct ia_css_binary *binary) +{ + return (sizeof(unsigned short) * binary->sctbl_height * + binary->sctbl_aligned_width_per_color * IA_CSS_SC_NUM_COLORS); +} -#define MORPH_PLANE_BYTES(binary) \ - (SH_CSS_MORPH_TABLE_ELEM_BYTES * (binary)->morph_tbl_aligned_width * \ - (binary)->morph_tbl_height) +static inline size_t morph_plane_bytes(const struct ia_css_binary *binary) +{ + return (SH_CSS_MORPH_TABLE_ELEM_BYTES * + binary->morph_tbl_aligned_width * binary->morph_tbl_height); +} /* We keep a second copy of the ptr struct for the SP to access. Again, this would not be necessary on the chip. */ @@ -3279,7 +3285,7 @@ sh_css_params_write_to_ddr_internal( if (binary->info->sp.enable.fpnr) { buff_realloced = reallocate_buffer(&ddr_map->fpn_tbl, &ddr_map_size->fpn_tbl, - (size_t)(FPNTBL_BYTES(binary)), + fpntbl_bytes(binary), params->config_changed[IA_CSS_FPN_ID], &err); if (err) { @@ -3304,7 +3310,7 @@ sh_css_params_write_to_ddr_internal( buff_realloced = reallocate_buffer(&ddr_map->sc_tbl, &ddr_map_size->sc_tbl, - SCTBL_BYTES(binary), + sctbl_bytes(binary), params->sc_table_changed, &err); if (err) { @@ -3538,8 +3544,7 @@ sh_css_params_write_to_ddr_internal( buff_realloced |= reallocate_buffer(virt_addr_tetra_x[i], virt_size_tetra_x[i], - (size_t) - (MORPH_PLANE_BYTES(binary)), + morph_plane_bytes(binary), params->morph_table_changed, &err); if (err) { @@ -3549,8 +3554,7 @@ sh_css_params_write_to_ddr_internal( buff_realloced |= reallocate_buffer(virt_addr_tetra_y[i], virt_size_tetra_y[i], - (size_t) - (MORPH_PLANE_BYTES(binary)), + morph_plane_bytes(binary), params->morph_table_changed, &err); if (err) {