From mboxrd@z Thu Jan 1 00:00:00 1970 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 3EB57C433FE for ; Fri, 25 Nov 2022 05:52:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229572AbiKYFww (ORCPT ); Fri, 25 Nov 2022 00:52:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229531AbiKYFwu (ORCPT ); Fri, 25 Nov 2022 00:52:50 -0500 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0402F1114E for ; Thu, 24 Nov 2022 21:52:49 -0800 (PST) Received: by mail-ed1-x534.google.com with SMTP id b8so4969353edf.11 for ; Thu, 24 Nov 2022 21:52:48 -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=RzN4h3qOAvIsS9Ytm8ViCV9LTXDRNYxBOrbT9kwa+z4=; b=oEaPYaoWVwjCvCRl0HhYzkfATCZulKO7O6FroIlJirLXfGB0mUMNQ1vzzo0lRHG88h cNaSmIx/Wju99aMFImQwYB8ffU35MFqJyO6o81ePWIivDyODyXWsv9bQogJMB23kCZrX ZuFBm7OSJUcNIYbcpI9E72DmIeVVa15mZVqnY= 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=RzN4h3qOAvIsS9Ytm8ViCV9LTXDRNYxBOrbT9kwa+z4=; b=mjzG9T6jBLiIzgXUefoIeOYcFYcxBl2Pc21yR+wdJtL1AvJxB+sbDJhmIMTFSUiyPC PlOX+nA0Flz67MrNsSbsjyCB/wJSS3l4sKy8suk9SH/TROPS4IifOjs7Hq1JOmoy7770 bB8TzFrkIhdQP/aESr8TI0M1ZdqtPwTKltuC9AD0w+I9tz9DpDjxm3w2eTXCZVeF4lNN Vi/dxWwDE/8TD8J1HVOw+zsJFmNAeipGQbX9jH6M2qsirKuU+CLXdHFnZ41CTj8/XscF dMAomWb22IkD/RyguZJIqt4nhCmP51ko/gunqB1fb5DeaNl+1uGithP9XzGq2Pz/gB60 EEdQ== X-Gm-Message-State: ANoB5pmY5JsgryqKjGn3unWeQiNrfFqRKHrGS78JFUKXxVxLyM0StyKX sIrxS67EemAIZYzVALKtiMBA+NyPub96hPrkBQDcPA== X-Google-Smtp-Source: AA0mqf4swfPzjKVkl1scJTqiUbIDnuAEsouyb52592fG1trV+h5bVVpbQlj0dZBKZjpXqLgzGBJ89YmbylZKTLb1eqs= X-Received: by 2002:a05:6402:1397:b0:467:78f2:d81f with SMTP id b23-20020a056402139700b0046778f2d81fmr16227783edv.88.1669355567575; Thu, 24 Nov 2022 21:52:47 -0800 (PST) MIME-Version: 1.0 References: <20221124102056.393220-1-treapking@chromium.org> <20221124102056.393220-3-treapking@chromium.org> In-Reply-To: From: Pin-yen Lin Date: Fri, 25 Nov 2022 13:52:36 +0800 Message-ID: Subject: Re: [PATCH v6 2/7] platform/chrome: cros_ec_typec: Purge blocking switch devlinks To: Andy Shevchenko Cc: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J . Wysocki" , Prashant Malani , Benson Leung , Guenter Roeck , Javier Martinez Canillas , Stephen Boyd , dri-devel@lists.freedesktop.org, Hsin-Yi Wang , Thomas Zimmermann , devicetree@vger.kernel.org, chrome-platform@lists.linux.dev, linux-acpi@vger.kernel.org, Marek Vasut , Xin Ji , Lyude Paul , =?UTF-8?B?TsOtY29sYXMgRiAuIFIgLiBBIC4gUHJhZG8=?= , AngeloGioacchino Del Regno , linux-kernel@vger.kernel.org, Allen Chen Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Hi Andy, On Thu, Nov 24, 2022 at 8:25 PM Andy Shevchenko wrote: > > On Thu, Nov 24, 2022 at 06:20:51PM +0800, Pin-yen Lin wrote: > > From: Prashant Malani > > > > When using OF graph, the fw_devlink code will create links between the > > individual port driver (cros-ec-typec here) and the parent device for > > a Type-C switch (like mode-switch). Since the mode-switch will in turn > > have the usb-c-connector (i.e the child of the port driver) as a > > supplier, fw_devlink will not be able to resolve the cyclic dependency > > correctly. > > > > As a result, the mode-switch driver probe() never runs, so mode-switches > > are never registered. Because of that, the port driver probe constantly > > fails with -EPROBE_DEFER, because the Type-C connector class requires all > > switch devices to be registered prior to port registration. > > > > To break this deadlock and allow the mode-switch registration to occur, > > purge all the usb-c-connector nodes' absent suppliers. This eliminates > > the connector as a supplier for a switch and allows it to be probed. > > ... > > > + /* > > + * OF graph may have set up some device links with switches, since connectors have their > > + * own compatible. Purge these to avoid a deadlock in switch probe (the switch mistakenly > > + * assumes the connector is a supplier). > > + */ > > A bit too long lines... I'll fix this in v7. > > > + if (dev->of_node) > > Why do you need this check? We use this check to make sure only platforms using OF have their links purged. I'm not sure if this should also be done on x86 platforms. Best regards, Pin-yen > > > + device_for_each_child_node(dev, fwnode) > > + fw_devlink_purge_absent_suppliers(fwnode); > > -- > With Best Regards, > Andy Shevchenko > >