From patchwork Thu Sep 7 08:09:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 9941739 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 075C06038C for ; Thu, 7 Sep 2017 08:09:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB1E91FFAD for ; Thu, 7 Sep 2017 08:09:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DFB292855A; Thu, 7 Sep 2017 08:09:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 549EC1FFAD for ; Thu, 7 Sep 2017 08:09:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754124AbdIGIJF (ORCPT ); Thu, 7 Sep 2017 04:09:05 -0400 Received: from nblzone-211-213.nblnetworks.fi ([83.145.211.213]:33170 "EHLO hillosipuli.retiisi.org.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753018AbdIGIJE (ORCPT ); Thu, 7 Sep 2017 04:09:04 -0400 Received: from valkosipuli.localdomain (valkosipuli.retiisi.org.uk [IPv6:2001:1bc8:1a6:d3d5::80:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by hillosipuli.retiisi.org.uk (Postfix) with ESMTPS id 8100F600E7; Thu, 7 Sep 2017 11:09:02 +0300 (EEST) Received: from sakke by valkosipuli.localdomain with local (Exim 4.89) (envelope-from ) id 1dprrx-0002s7-9J; Thu, 07 Sep 2017 11:09:01 +0300 Date: Thu, 7 Sep 2017 11:09:01 +0300 From: Sakari Ailus To: Hans Verkuil Cc: Sakari Ailus , linux-media@vger.kernel.org, niklas.soderlund@ragnatech.se, robh@kernel.org, laurent.pinchart@ideasonboard.com, devicetree@vger.kernel.org, pavel@ucw.cz, sre@kernel.org Subject: Re: [PATCH v8 08/21] rcar-vin: Use generic parser for parsing fwnode endpoints Message-ID: <20170907080900.nhjbaaacg4jrxpva@valkosipuli.retiisi.org.uk> References: <20170905130553.1332-1-sakari.ailus@linux.intel.com> <20170905130553.1332-9-sakari.ailus@linux.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Hans, On Wed, Sep 06, 2017 at 09:44:32AM +0200, Hans Verkuil wrote: > On 09/05/2017 03:05 PM, Sakari Ailus wrote: > > static int rvin_digital_graph_init(struct rvin_dev *vin) > > { > > - struct v4l2_async_subdev **subdevs = NULL; > > int ret; > > > > - ret = rvin_digital_graph_parse(vin); > > + ret = v4l2_async_notifier_parse_fwnode_endpoints( > > + vin->dev, &vin->notifier, > > + sizeof(struct rvin_graph_entity), rvin_digital_parse_v4l2); > > if (ret) > > return ret; > > > > - if (!vin->digital.asd.match.fwnode.fwnode) { > > - vin_dbg(vin, "No digital subdevice found\n"); > > - return -ENODEV; > > - } > > - > > - /* Register the subdevices notifier. */ > > - subdevs = devm_kzalloc(vin->dev, sizeof(*subdevs), GFP_KERNEL); > > - if (subdevs == NULL) > > - return -ENOMEM; > > - > > - subdevs[0] = &vin->digital.asd; > > - > > - vin_dbg(vin, "Found digital subdevice %pOF\n", > > - to_of_node(subdevs[0]->match.fwnode.fwnode)); > > + if (vin->notifier.num_subdevs > 0) > > + vin_dbg(vin, "Found digital subdevice %pOF\n", > > + to_of_node( > > + vin->notifier.subdevs[0]->match.fwnode.fwnode)); > > As mentioned in my review of patch 6/21, this violates the documentation of the > v4l2_async_notifier_parse_fwnode_endpoints function. > > However, I think the problem is with the documentation and not with this code, > so: > > Acked-by: Hans Verkuil Thanks. I still don't like to encourage accessing the notifier fields directly from drivers, and in this case there isn't a need to either. The following changes work, too, and I'll use them in the next version: I also changed EPERM still used in this version to ENOTCONN. diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index bd551f0be213..d1e5909da087 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -177,10 +177,10 @@ static int rvin_digital_graph_init(struct rvin_dev *vin) if (ret) return ret; - if (vin->notifier.num_subdevs > 0) + if (vin->digital) vin_dbg(vin, "Found digital subdevice %pOF\n", to_of_node( - vin->notifier.subdevs[0]->match.fwnode.fwnode)); + vin->digital->asd.match.fwnode.fwnode)); vin->notifier.bound = rvin_digital_notify_bound; vin->notifier.unbind = rvin_digital_notify_unbind;