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 8F55EC05027 for ; Thu, 9 Feb 2023 04:30:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229698AbjBIEaG (ORCPT ); Wed, 8 Feb 2023 23:30:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229873AbjBIE3x (ORCPT ); Wed, 8 Feb 2023 23:29:53 -0500 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 934283E081 for ; Wed, 8 Feb 2023 20:29:25 -0800 (PST) Received: by mail-il1-x131.google.com with SMTP id v15so390990ilc.10 for ; Wed, 08 Feb 2023 20:29:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=bescMjn7FtyPXif9z42K5Kti4WQibJgEOUCofteOlbU=; b=efbpqpZ8ruVdXCPyxPr8jDefM3U8oaOj3EXWBJQevNTETQvcO2dE/qtmWax943hsRR hXvF9OSBw1p+PC27CXPrMC2rOofIy441d7jZSKzpR3sOkGqwzMVORaVIxNJkydQm7TzH 8ViDfzFimT4EAz6hz5X1Yn6/9z/6vbonm+MDU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bescMjn7FtyPXif9z42K5Kti4WQibJgEOUCofteOlbU=; b=uwn4asUN0Smvv8GIbBigYCfiO1rzqX6Yet6YeAG2fO7h6S622MOC3CCUKKH38/lkEI QYcAbviEGIQnhjgVS7tgud0G6GOR9HGUQBeSkDvjSJ1Qjqdy43faZ/JpZ+pic/Tz9+8t beKKmkCXpv7V1Fok3EvniXf4XUZ7yNblmgo01Xwfm6JoLI8X3DG0Vc1No/lRYgpmvGvD QnebhwJ4ZH5i2T6eBIGVSjm91xz4ZKeunzovNbub10RPpAKnlGdOBckigK5MO57A5E1+ Os9M3+csAnnrDN5vCQQoeNeX9PhzjS5DLAbbDIDtQ0SNr6lPMM3JarnqczOhfz1Np3ye /1cQ== X-Gm-Message-State: AO0yUKVu5i8JF8BAl6Hnqo04OSfJTh3yGFoJUA9lEK1jXka8NfWMqRCk 1E9CSgBVsMXoGpGtByVr0hNDQWLY4if6OdjSApzVfA== X-Google-Smtp-Source: AK7set+YCKJbelSZgHy/neopyqons0VAhG7SjB9chuOXUmdoUIbOQBP9AdNx/HVfzI+OikZm7IrbjJahfEHqdtFqiQw= X-Received: by 2002:a92:4412:0:b0:310:fd95:6d81 with SMTP id r18-20020a924412000000b00310fd956d81mr5201921ila.42.1675916924769; Wed, 08 Feb 2023 20:28:44 -0800 (PST) MIME-Version: 1.0 References: <20230204133040.1236799-1-treapking@chromium.org> <20230204133040.1236799-2-treapking@chromium.org> In-Reply-To: From: Pin-yen Lin Date: Thu, 9 Feb 2023 12:28:33 +0800 Message-ID: Subject: Re: [PATCH v11 1/9] device property: Add remote endpoint to devcon matcher To: Sakari Ailus Cc: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Greg Kroah-Hartman , "Rafael J . Wysocki" , Prashant Malani , Benson Leung , Guenter Roeck , linux-kernel@vger.kernel.org, =?UTF-8?B?TsOtY29sYXMgRiAuIFIgLiBBIC4gUHJhZG8=?= , Hsin-Yi Wang , devicetree@vger.kernel.org, Allen Chen , Lyude Paul , linux-acpi@vger.kernel.org, dri-devel@lists.freedesktop.org, Marek Vasut , Xin Ji , Stephen Boyd , AngeloGioacchino Del Regno , Thomas Zimmermann , Javier Martinez Canillas , chrome-platform@lists.linux.dev, Chen-Yu Tsai Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sakari, Thanks for the review. On Mon, Feb 6, 2023 at 5:11 AM Sakari Ailus wrote: > > Hi Pin-yen, > > On Sat, Feb 04, 2023 at 09:30:32PM +0800, Pin-yen Lin wrote: > > From: Prashant Malani > > > > When searching the device graph for device matches, check the > > remote-endpoint itself for a match. > > > > Some drivers register devices for individual endpoints. This allows > > the matcher code to evaluate those for a match too, instead > > of only looking at the remote parent devices. This is required when a > > device supports two mode switches in its endpoints, so we can't simply > > register the mode switch with the parent node. > > > > Signed-off-by: Prashant Malani > > Signed-off-by: Pin-yen Lin > > Reviewed-by: Chen-Yu Tsai > > Tested-by: Chen-Yu Tsai > > Thanks for the update. > > I intended to give my Reviewed-by: but there's something still needs to be > addressed. See below. > > > > > --- > > > > Changes in v11: > > - Added missing fwnode_handle_put in drivers/base/property.c > > > > Changes in v10: > > - Collected Reviewed-by and Tested-by tags > > > > Changes in v6: > > - New in v6 > > > > drivers/base/property.c | 16 ++++++++++++++++ > > 1 file changed, 16 insertions(+) > > > > diff --git a/drivers/base/property.c b/drivers/base/property.c > > index 2a5a37fcd998..e6f915b72eb7 100644 > > --- a/drivers/base/property.c > > +++ b/drivers/base/property.c > > @@ -1223,6 +1223,22 @@ static unsigned int fwnode_graph_devcon_matches(struct fwnode_handle *fwnode, > > break; > > } > > > > + /* > > + * Some drivers may register devices for endpoints. Check > > + * the remote-endpoints for matches in addition to the remote > > + * port parent. > > + */ > > + node = fwnode_graph_get_remote_endpoint(ep); > > Here fwnode_graph_get_remote_endpoint() returns an endpoint... > > > + if (fwnode_device_is_available(node)) { > > and you're calling fwnode_device_is_available() on the endpoint node, which > always returns true. > > Shouldn't you call this on the device node instead? What about match() > below? Yes we should have checked the availability on the device node itself instead of the endpoint node. But regarding the match() call, we need to call it with the endpoint node because that's where we put the "mode-switch" properties and register the mode switches on. We can't use the device node because we want to register two mode switches for the same device node. Regards, Pin-yen > > > + ret = match(node, con_id, data); > > + if (ret) { > > + if (matches) > > + matches[count] = ret; > > + count++; > > + } > > + } > > + fwnode_handle_put(node); > > + > > node = fwnode_graph_get_remote_port_parent(ep); > > if (!fwnode_device_is_available(node)) { > > fwnode_handle_put(node); > > -- > Kind regards, > > Sakari Ailus