Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56969CDB474 for ; Mon, 23 Oct 2023 11:46:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234526AbjJWLqk (ORCPT ); Mon, 23 Oct 2023 07:46:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234530AbjJWLq0 (ORCPT ); Mon, 23 Oct 2023 07:46:26 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10FE9170F for ; Mon, 23 Oct 2023 04:46:15 -0700 (PDT) Received: from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi [213.243.189.158]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id ED268E45; Mon, 23 Oct 2023 13:46:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1698061563; bh=c8OBA2tMxcWtZ98YfkIaXH3jLDxr6zN99ZDa0ZCrO0o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=T7DyTEeEPzlx1p6S3BMNIXvkoJ9eciAYSqNiI7TjHjrdgUzdexcVKIq+pVCfD+G7y meot7/CMTvor6/Gnt89vZgzN3wJPi3ht0zfH2/eORenTV0ID/lyuZ214GKIK5GXgeW pa/5/44mPa6v5EPCoFkVP4Em2lz7fTyTNJFn6H24= Date: Mon, 23 Oct 2023 14:46:21 +0300 From: Laurent Pinchart To: Tomi Valkeinen Cc: Sakari Ailus , linux-media@vger.kernel.org, hverkuil@xs4all.nl, jacopo.mondi@ideasonboard.com, bingbu.cao@intel.com, hongju.wang@intel.com Subject: Re: [PATCH 1/6] media: v4l: subdev: Store the number of pads in sub-device state Message-ID: <20231023114621.GL3336@pendragon.ideasonboard.com> References: <20231013104424.404768-1-sakari.ailus@linux.intel.com> <20231013104424.404768-2-sakari.ailus@linux.intel.com> <20231013105749.GA11101@pendragon.ideasonboard.com> <20231013111507.GE11101@pendragon.ideasonboard.com> <380a79ea-0b68-4ec7-aa37-83e19f239968@ideasonboard.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <380a79ea-0b68-4ec7-aa37-83e19f239968@ideasonboard.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org On Mon, Oct 23, 2023 at 11:34:25AM +0300, Tomi Valkeinen wrote: > On 13/10/2023 14:17, Sakari Ailus wrote: > > On Fri, Oct 13, 2023 at 02:15:07PM +0300, Laurent Pinchart wrote: > >> On Fri, Oct 13, 2023 at 11:06:08AM +0000, Sakari Ailus wrote: > >>> On Fri, Oct 13, 2023 at 01:57:49PM +0300, Laurent Pinchart wrote: > >>>> On Fri, Oct 13, 2023 at 01:44:19PM +0300, Sakari Ailus wrote: > >>>>> Store the number of pads in the sub-device state. This will be needed to > >>>>> validate pad when retrieving information for non-stream-aware users. > >>>> > >>>> I'd rather store a pointer to the subdev. You can get the number of pads > >>>> from there. > >>> > >>> The value is initialised after the array is allocated so this won't change. > >>> > >>> I don't have a strong opinion either way. It's still more efficient to > >>> store just the value. > >> > >> Slightly so, but I don't think it will matter in practice. I believe > >> we'll have more needs to access the subdev from the state in the future, > >> which is why I'd rather store the pointer already. > > > > Fair enough, I'll make it a sub-device pointer. > > I have to say like the num_pads more here. We have a pointer to the pads > array in the struct v4l2_subdev_state, and it'd be logical to also have > the number of elements in that array in struct v4l2_subdev_state. Yes, but we'll likely need access to the subdev in the future, and it would then duplicate the information. -- Regards, Laurent Pinchart