From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on archive.lwn.net X-Spam-Level: X-Spam-Status: No, score=-5.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by archive.lwn.net (Postfix) with ESMTP id 83DE47D910 for ; Wed, 18 Mar 2020 14:00:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727089AbgCROAv (ORCPT ); Wed, 18 Mar 2020 10:00:51 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:51229 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726851AbgCROAu (ORCPT ); Wed, 18 Mar 2020 10:00:50 -0400 X-Originating-IP: 2.224.242.101 Received: from uno.localdomain (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 6A30E60015; Wed, 18 Mar 2020 14:00:30 +0000 (UTC) Date: Wed, 18 Mar 2020 15:03:26 +0100 From: Jacopo Mondi To: Laurent Pinchart Cc: linux-media@vger.kernel.org, Sakari Ailus , Jacopo Mondi , Niklas =?utf-8?Q?S=C3=B6derlund?= , Kieran Bingham , Lad Prabhakar , linux-renesas-soc@vger.kernel.org Subject: Re: [PATCH v2 3/4] media: v4l2-async: Log message in case of heterogenous fwnode match Message-ID: <20200318140326.nbgyhad3zxgaxjgd@uno.localdomain> References: <20200318002507.30336-1-laurent.pinchart+renesas@ideasonboard.com> <20200318002507.30336-4-laurent.pinchart+renesas@ideasonboard.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200318002507.30336-4-laurent.pinchart+renesas@ideasonboard.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Archived-At: List-Archive: List-Post: Hi Laurent, On Wed, Mar 18, 2020 at 02:25:06AM +0200, Laurent Pinchart wrote: > When a notifier supplies a device fwnode and a subdev supplies an > endpoint fwnode, incorrect matches may occur if multiple subdevs > correspond to the same device fwnode. This can't be handled > transparently in the framework, and requires the notifier to switch to > endpoint fwnodes. Log a message to notify of this problem. A second > message is added to help accelerating the transition to endpoint > matching. > > Signed-off-by: Laurent Pinchart > --- > drivers/media/v4l2-core/v4l2-async.c | 24 +++++++++++++++++++++++- > 1 file changed, 23 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c > index 224b39a7aeb1..9f393a7be455 100644 > --- a/drivers/media/v4l2-core/v4l2-async.c > +++ b/drivers/media/v4l2-core/v4l2-async.c > @@ -77,6 +77,7 @@ static bool match_fwnode(struct v4l2_async_notifier *notifier, > struct fwnode_handle *dev_fwnode; > bool asd_fwnode_is_ep; > bool sd_fwnode_is_ep; > + struct device *dev; > const char *name; > > /* > @@ -113,7 +114,28 @@ static bool match_fwnode(struct v4l2_async_notifier *notifier, > > fwnode_handle_put(dev_fwnode); > > - return dev_fwnode == other_fwnode; > + if (dev_fwnode != other_fwnode) > + return false; > + > + /* > + * We have an heterogenous match. Retrieve the struct device of the > + * side that matched on a device fwnode to print its driver name. > + */ > + if (sd_fwnode_is_ep) > + dev = notifier->v4l2_dev ? notifier->v4l2_dev->dev > + : notifier->sd->dev; Have you considered passing the device directly ? seems notifier is only used for that... Apart this small nit, for the series Reviewed-by: Jacopo Mondi Thanks j > + else > + dev = sd->dev; > + > + if (dev && dev->driver) { > + if (sd_fwnode_is_ep) > + dev_info(dev, "Driver %s uses device fwnode, incorrect match may occur\n", > + dev->driver->name); > + dev_info(dev, "Consider updating driver %s to match on endpoints\n", > + dev->driver->name); > + } > + > + return true; > } > > static bool match_custom(struct v4l2_async_notifier *notifier, > -- > Regards, > > Laurent Pinchart >