Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp223761lql; Fri, 12 Apr 2024 08:31:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX7iHtM35XdulTR2q1SY5GfxWc1UfcS2PMGP5TR+naDjpqDvfR49DIjTpIDZHQJxXddb8sS6+R7y9ajOgX6452j5/BAbD0DLOXkC0jPmA== X-Google-Smtp-Source: AGHT+IGMJW/fe6JLgXju9S9w7X+mPOkUuqCZsWMyZH8Yv5mhc7/3Q6sE8NOL2zKQ41s62G5JBTbz X-Received: by 2002:a05:6214:1746:b0:69b:aa1:7910 with SMTP id dc6-20020a056214174600b0069b0aa17910mr2744269qvb.1.1712935913528; Fri, 12 Apr 2024 08:31:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712935913; cv=pass; d=google.com; s=arc-20160816; b=dv3g4KaFq88ZcFeJAmMT8l+4VetufF/KyW0M1y6qRkLCO9Z/tWtRfvlHME9lOfCM/A O6Sz+oCCBjS+Lj47LGAFlGOH4zW/v32USiwpwUNJu72LesjbLmXqZ/D4d/NRV4ToteM+ CL3gDkRe1LzZDnpcpcu+DLjk7VjrHS8akjMoaL0b75845MP/J/9JZLeox5NL37YSSzHc aHn3uXOFrEGF+W9HKDqgKjVXWhm7tffFosm3gqQ0Y5Z2vdLp7ZHC3KQ9ZFqThHGJSlfD wGXnSdhsUtvjGaVQu5WHV+FtyVJzEdruF5/t1VQ4JHRB26iqtKpQHHdcXes60DCTRXn2 a8uQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=CMsVtEc+fkMZLYTzgy2t6ZaiXB5bp6ETy0WpccjVS6A=; fh=y+V6owUirPqNE6wy3KfbsH1yRRFB2mh9jMVeDYRG6p8=; b=h9OQ+pmHugIQ9QWQOS5PrHTDW1qVcH2LNlOPf/i9R+vKEFSkDjH6CCQj/bt5XmxpSP RqrsBTrMdDls/v/xtSjqrJ7Ec9wb9XCw/vjIqVYiSPIgXc9oE4SehvmS6vs8eXU3rBrh td2H7gK65smtJY/dcfQTCKb//0utJIJz7A3nC2pHW+RngF67HlBC2cO6zO+eEW9j/CAf 8p62wFYjX2meMnNEwvObczCHqgHZRPR7ke7/cMn3OwQ3lktiF40+y/F1fZ9jqkc5JzFF ff1SrOEraUCJltn2GLg8icmGfoEAjMH9utUaS87LLpDrw+KzJhny/AUEd9VwcIf1q2fl w1ag==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EP2Dwzri; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-142680-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142680-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id e5-20020a0562141d0500b0069b5aad4ad7si1191621qvd.599.2024.04.12.08.31.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 08:31:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142680-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EP2Dwzri; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-142680-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142680-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 24E9D1C21314 for ; Fri, 12 Apr 2024 13:04:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C8AC627E8; Fri, 12 Apr 2024 13:03:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="EP2Dwzri" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1891F55E4C; Fri, 12 Apr 2024 13:03:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712927023; cv=none; b=thSRQHiHriqEZ/ZL9kSfNqZgUOCMuggxt7N1BdIe8nAoAOFnkwlG8RSVnpOotyLaSLYjkb4CFhi7+9m151GaswIQApaMT3WLJvGJww0imSM+JiC1rakk5xjJpQ95/yc6GPoNK1vbdjvI+Jm0cSWL138gj92PNdgWbvwqLxPxx1M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712927023; c=relaxed/simple; bh=vCkHpizOxk1oGDxM8fxP7qxinTI6j9RtzAj3GndDZa8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jFpZByrSvdwdSrIDbNISBueLaKJkxBwP/oy1NoiDBDsJ3ruAedQQeNH6dP/drY+EmX96/pexHm/kIVo/GsuzfnvN1N892ycaPodIzUDEtTFL5N4zW+xEpNqygJDV73ylm+D5+y7tnMchIEE+metbgOTsGl3l95dh8S8EgP0KnBc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=EP2Dwzri; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712927018; x=1744463018; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=vCkHpizOxk1oGDxM8fxP7qxinTI6j9RtzAj3GndDZa8=; b=EP2DwzritExFOFCDq6DvwPI8mLuQfNoT08bu2+Xcx6LbZys5SODWh0JN pPsA9XjBvKv5rjNV6BwzJ/z8cX8sFFj1gMRt5NJB4LVEmSAmjwCDJ5jQK p9P8nQ++UF7kQTzfpkvpb8N1rhWGamAZ8ogOk7FveXjK/tOcgE6lBNFXc YnOOu7hnWeFqIq4LBIPVn+HxmzkLe0DX8L521tzTlLo9ehiHcPb9lYLER OHYR8fgEr72hinkGcWJgqwQmitunn0QXhrSe14nEIKzlMPXVBfcE51c34 8G2fhQVpu7WqbKLZiXsezVx7X49mPXyNW/3NatTJrKSRc9v2xpWL4khmR Q==; X-CSE-ConnectionGUID: grEAWrvQQWyOez51YCQhVg== X-CSE-MsgGUID: pw9K4v1jTluTPlwZULp7Rw== X-IronPort-AV: E=McAfee;i="6600,9927,11041"; a="12230264" X-IronPort-AV: E=Sophos;i="6.07,196,1708416000"; d="scan'208";a="12230264" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2024 06:03:37 -0700 X-CSE-ConnectionGUID: Ae/EZF/1SbC9WOOGl52Rmw== X-CSE-MsgGUID: vFYwf3fLRYGQ8pVEzMTaiw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,196,1708416000"; d="scan'208";a="26034729" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2024 06:03:36 -0700 Received: from kekkonen.localdomain (localhost [127.0.0.1]) by kekkonen.fi.intel.com (Postfix) with SMTP id 3C47B120359; Fri, 12 Apr 2024 16:03:33 +0300 (EEST) Date: Fri, 12 Apr 2024 13:03:33 +0000 From: Sakari Ailus To: Umang Jain Cc: linux-media@vger.kernel.org, Alexander Shiyan , Kieran Bingham , open list Subject: Re: [PATCH v5 2/6] media: imx335: Parse fwnode properties Message-ID: References: <20240412122842.193713-1-umang.jain@ideasonboard.com> <20240412122842.193713-3-umang.jain@ideasonboard.com> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240412122842.193713-3-umang.jain@ideasonboard.com> Hi Umang, On Fri, Apr 12, 2024 at 05:58:38PM +0530, Umang Jain wrote: > From: Kieran Bingham > > Call the V4L2 fwnode device parser to handle controls that are > standardised by the framework. > > Signed-off-by: Kieran Bingham > Signed-off-by: Umang Jain > --- > drivers/media/i2c/imx335.c | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/drivers/media/i2c/imx335.c b/drivers/media/i2c/imx335.c > index c633ea1380e7..3ea9c0ebe278 100644 > --- a/drivers/media/i2c/imx335.c > +++ b/drivers/media/i2c/imx335.c > @@ -1227,10 +1227,12 @@ static int imx335_init_controls(struct imx335 *imx335) > { > struct v4l2_ctrl_handler *ctrl_hdlr = &imx335->ctrl_handler; > const struct imx335_mode *mode = imx335->cur_mode; > + struct v4l2_fwnode_device_properties props; > u32 lpfr; > int ret; > > - ret = v4l2_ctrl_handler_init(ctrl_hdlr, 7); > + /* v4l2_fwnode_device_properties can add two more controls */ > + ret = v4l2_ctrl_handler_init(ctrl_hdlr, 9); > if (ret) > return ret; > > @@ -1295,9 +1297,15 @@ static int imx335_init_controls(struct imx335 *imx335) > if (imx335->hblank_ctrl) > imx335->hblank_ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY; > > - if (ctrl_hdlr->error) { > - dev_err(imx335->dev, "control init failed: %d\n", > - ctrl_hdlr->error); > + ret = v4l2_fwnode_device_parse(imx335->dev, &props); > + if (!ret) { > + /* Failure sets ctrl_hdlr->error, which we check afterwards anyway */ > + v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &imx335_ctrl_ops, > + &props); > + } > + > + if (ctrl_hdlr->error || ret) { > + dev_err(imx335->dev, "control init failed: %d\n", ctrl_hdlr->error); Too long line. > v4l2_ctrl_handler_free(ctrl_hdlr); > return ctrl_hdlr->error; The handler may not be in error state if only v4l2_fwnode_device_parse() failed. Should that be something that should prevent probing a driver though, or could it just be ignored? I.e. in that case I'd only check for handler's error, not ret. > } -- Kind regards, Sakari Ailus