Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp7212270imm; Tue, 28 Aug 2018 08:09:12 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbYpbNhq05LMvF+QyfkvGhzhGK7VKk/QlIQVYBeoVj50OfFiOZm5TYOfRka79oCy4jzP4oG X-Received: by 2002:a62:b2d3:: with SMTP id z80-v6mr2064596pfl.79.1535468952102; Tue, 28 Aug 2018 08:09:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535468952; cv=none; d=google.com; s=arc-20160816; b=ZscTGjxTbiviSbjJE4zTHVGLsQkcnGk1G8pMt7OW5gbEX8zsSDwnEviQnFLV5hnNsc h2y15OaxXVnAum5CLuCbP5lEFiPLAj5df8bTvJwHaUtIRAZ6EvEDzG8dAb9VgEpwoTO5 ftfM0sDacY5uK2KFKZg1goabtf09q+bs1qjyHZEs65bVjNtZRwlaqgyHU5kgERvaC6wO khW5YMbET2mLTNdKNlxYEezVL2XCLyIBQ+W6QCkHZzT2ZRiIPhXX4Z+ug9tGUQG0QO3l MS+cBR3szugqcyN98LGmh3vTlq3N3xEgsZ/T+5DVIT3CRrwgWpL5nXG8Q8lr4HyprG4q 7tow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=yjkqQuJo6LHD+Jsl7d8uD0LnokN1iAY0AV4Wn+x1jpk=; b=wqimNUyWGdulj0Rc17zv1E31shGiqkeKpcQXYTdU8dUkBSlIGi6s71UPmfXUWGSV+B NkWlPm4HTK6eLyX1W9h71FZcwlx1wpwNZ6qxjAwt5UrYmHiKi8Cued9z++7InCWJiCPc PN+9BpxGAXozV/+gGdFRy4yTNYdXK4ZKrhAuagB2qbhxsDNKsyzdh2V2AZFPtPyYctl/ 8wwOQuuPB9OfyU47ZW66l4elsOnOU/hPNPPWYN1w6odC4aK3DUc7g4eS0idXZvaMy8gq 8jk0m6zEOVbszEyPynwLsdv4v83yowS3sXGN5LoQC59hw5b5MpVAlE4yrFXGa1Db/Zo6 HYLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 139-v6si1222271pfb.45.2018.08.28.08.08.56; Tue, 28 Aug 2018 08:09:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727125AbeH1S7P (ORCPT + 99 others); Tue, 28 Aug 2018 14:59:15 -0400 Received: from mail.bootlin.com ([62.4.15.54]:51174 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726120AbeH1S7P (ORCPT ); Tue, 28 Aug 2018 14:59:15 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 3BEEC20797; Tue, 28 Aug 2018 17:07:08 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (AAubervilliers-681-1-53-19.w90-88.abo.wanadoo.fr [90.88.170.19]) by mail.bootlin.com (Postfix) with ESMTPSA id 06B4522A3C; Tue, 28 Aug 2018 17:06:58 +0200 (CEST) Date: Tue, 28 Aug 2018 17:06:57 +0200 From: Maxime Ripard To: Paul Kocialkowski Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, linux-arm-kernel@lists.infradead.org, Mauro Carvalho Chehab , Greg Kroah-Hartman , Chen-Yu Tsai , Thomas Petazzoni , linux-sunxi@googlegroups.com, Randy Li , Hans Verkuil , Ezequiel Garcia , Tomasz Figa , Alexandre Courbot , Philipp Zabel , Laurent Pinchart , Sakari Ailus Subject: Re: [PATCH 2/2] media: cedrus: Add HEVC/H.265 decoding support Message-ID: <20180828150657.dxwevt3oaac3lgx5@flea> References: <20180828080240.10982-1-paul.kocialkowski@bootlin.com> <20180828080240.10982-3-paul.kocialkowski@bootlin.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="gw3paeaxa6sllcdg" Content-Disposition: inline In-Reply-To: <20180828080240.10982-3-paul.kocialkowski@bootlin.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --gw3paeaxa6sllcdg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Tue, Aug 28, 2018 at 10:02:40AM +0200, Paul Kocialkowski wrote: > @@ -165,7 +182,8 @@ static inline void cedrus_write(struct cedrus_dev *de= v, u32 reg, u32 val) > =20 > static inline u32 cedrus_read(struct cedrus_dev *dev, u32 reg) > { > - return readl(dev->base + reg); > + u32 val =3D readl(dev->base + reg); > + return val; I'm not sure that's needed :) > +static void cedrus_h265_frame_info_write_dpb(struct cedrus_ctx *ctx, > + const struct v4l2_hevc_dpb_entry *dpb, > + u8 num_active_dpb_entries) > +{ > + struct cedrus_dev *dev =3D ctx->dev; > + dma_addr_t dst_luma_addr, dst_chroma_addr; > + dma_addr_t mv_col_buf_addr[2]; > + u32 pic_order_cnt[2]; > + unsigned int i; > + > + for (i =3D 0; i < num_active_dpb_entries; i++) { > + dst_luma_addr =3D cedrus_dst_buf_addr(ctx, dpb[i].buffer_index, > + 0); // FIXME - PHYS_OFFSET ? > + dst_chroma_addr =3D cedrus_dst_buf_addr(ctx, dpb[i].buffer_index, > + 1); // FIXME - PHYS_OFFSET ? > + mv_col_buf_addr[0] =3D cedrus_h265_frame_info_mv_col_buf_addr(ctx, > + dpb[i].buffer_index, 0); > + pic_order_cnt[0] =3D dpb[i].pic_order_cnt[0]; > + > + if (dpb[i].field_pic) { > + mv_col_buf_addr[1] =3D > + cedrus_h265_frame_info_mv_col_buf_addr(ctx, > + dpb[i].buffer_index, 1); > + pic_order_cnt[1] =3D dpb[i].pic_order_cnt[1]; > + } > + > + cedrus_h265_frame_info_write_single(dev, i, dpb[i].field_pic, > + pic_order_cnt, > + mv_col_buf_addr, > + dst_luma_addr, > + dst_chroma_addr); > + } > +} You have this a number of times, but you can reduce the range of most of the variables (basically all of them but dev and i) to the loop itself. Declaring them for the whole function like you did suggests that you're going to use the value from one iteration to the other, which isn't the case here. Thanks! Maxime --=20 Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com --gw3paeaxa6sllcdg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE0VqZU19dR2zEVaqr0rTAlCFNr3QFAluFZRAACgkQ0rTAlCFN r3Q5nRAAjSrGzEpYPIXufGp4rmaoLMpcFv9aqDDqOcI7OLsGKo+RkkoePsyUyhHJ V3PErk6MM2D6p3VO0+1wLwUF+ZlCd1awhSgubHzELHLTUmXF1TTwpS2G93oy95B8 l3qWo+1SOOR3NB9L5qAw5W2GXBukaWEVY1jw5A+JGCwfG8AiIV8UiXUUrsPkui49 vxhIGkkd7fPdkna38QcoLvzVNuPdU/u+90NldWISoJbtc7vHqZQMNjoGYf8ITh2U cBbeU6xKF2B0kqRQhpgsJKujpheuBYWitirVSXtn7WKp+32VY8iLgZT+mpbwJLfl bJL+O4QH1w5ov9/pAnNp4IIFbQRS5E/RER/poTOydGYghl6npVmlRatHbqR4nU80 JRnryaB/ukxD5tZMoKYdox6qyVNVW+sZLnkgZayeXVEAlyGHoB9o9TP+mnMymUc5 B0++kmLwO50STdKcgwKu+usvAsCjJSiYnmJHFe7NPhAArdx5Me9+BlI+tuJSKxeT C5IkpN1Pn7I9vg9y0S5vOKmZvYZ9+CYbo841Wry0r2vXRtJ0q96Ab+tEPyABpFQF K0XtBI0NQK8bA1N4jvN5/LJ5rEh8cr4BtjqbjfTr9T7IzEciuoHGZnJkHe9M+jhW Aiexqh9idx2RJIzPhHMA35WXlxA9jw6ok1AZhht1xLudWVMqC/U= =aJvz -----END PGP SIGNATURE----- --gw3paeaxa6sllcdg--