From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8D61314A73 for ; Fri, 12 Jun 2026 07:20:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=209.85.128.169 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781248832; cv=pass; b=rlFQRt6dL5Z1kPZPEtWO10PfrM8NxyG1KVctCfhBkz6YlrsnqfFwMLwgWu9MwRaoxH99YTtcNaskczrQH15+XbSxWVu/HNWRwPjuajdisgJCCSyjOK0LHrTHNHTQpmKJkUH+OHx+trkbvyWv3Om/SQE57/z5NuJVyYNQGxehoHM= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781248832; c=relaxed/simple; bh=IkWHCCFQX7aMDTxBgQKIawFEFZfCBBbHv2LydgIraqk=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=f0V+z6E3I82AjbRZKjK9vpIju555hwybl1l0vbzgaP+Q1mDg5afjOget8ItGpKPvaiSM+CSKbnUHrdwT1d6Flc82nT3QgzZot7xT4oQZfxCeXQXDvS3XYdWsbSt8JOI2YSqTk6lz8vSVnQBJYpw+FqsMfK8CIoMgug9jNPSRHao= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Oj4GuGzD; arc=pass smtp.client-ip=209.85.128.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Oj4GuGzD" Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-7dc6fbf3e86so7901707b3.3 for ; Fri, 12 Jun 2026 00:20:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1781248830; cv=none; d=google.com; s=arc-20240605; b=Zdd2gAKJ+vPA0fvSHok3JKhQKmiygkwxzw/QMTTolI2M1iwMtCzGbIEjhcaRrHyid3 54mNyetH8ZPI5jzXisb+1b0QsVhmAJieaqqktdBrBjdU/pYHfKuZzna4nODR76l3F+uq a9kNvlhbNfQaijNQzg+Ht9eAyrx56CUSdRFZIkt6/6NOtbCtuMI+EMqcqbID31ZuEMyX ueGdOS2DRrqyfkN/Q0SybYXQW2UEc5u+Z9n5XARH7byd6Mlk0pEt6fhVxKaOvnCR8fNf lmoYD3hGpZOb9BH0rbASfQMZgirzu9Ic9JFNl+wYzUD9zBi53RJUgjZA3V5OUGS7PsJ4 DlQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=PEcj4bZjlu2HtgA6/DpQKuZoEr9jILxBgREI+9hl/bg=; fh=N9BD5qLnEfi7VF1z5Jrj2MvijTR7rsngrfDiJHSyyu4=; b=JjLc3y60/1zxbSOTsLCh1hMsu9s7bRl17Th0Td+qkxarL7neAGWGgIBE1vIFxcIaxf Y+clF7H9hF3k1BlGvSu+nUpd5S+fIDhYvISaYf41rBEDo+vFPs3mxuWkyLTgZiPrJmXo NW1Hto4HOLoqXRRqZJtePEvsfXPECORa7sVzppqjegP2y6HYoj3GFepnwhszyRfM0kWj utP6dtfusDdgnoD3LFIB+Pt2lyJMGAgW8wDWD0zjsSiiL3hjnc86t2iBADe0Uq7e7Tbc eozASP9SH0uovwFA217V9C6qsZcBWORJVS0H2HiDjxGj+TSHm3yOMRLOaupxZblwpQln LQ0g==; darn=vger.kernel.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1781248830; x=1781853630; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=PEcj4bZjlu2HtgA6/DpQKuZoEr9jILxBgREI+9hl/bg=; b=Oj4GuGzDu9GI26DqlprSNV/s5e3UxGAX3WAvF5EG3Eog+1hSTDfzsXpVg87iTTjNlf v8jWX1Dd+SPcZvi25Y2OkVchGb6xU6Sg8YfVmgsfJ99CLZH8s5qOmu3/P68rcrtYPtxS k85chdfol8gkgjb95XHASHkvZ+YTtvZKmW/tU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781248830; x=1781853630; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=PEcj4bZjlu2HtgA6/DpQKuZoEr9jILxBgREI+9hl/bg=; b=UTULZwB3cqLQ9ow04QtaF72x68TYKj4Uog6BwdP/twyrq/pBDB8xsK3IHZTAVT7b/f GwuaaNLzqnCq6By61LgpDV7j+DjAswjOx77yzFPfTrqQlFgHdi7uxcgpH3efoarrxywP yvpYUQjg/GKB/02NRcBxiRUWrZZ5PFDoB9H80IZ0wCDIVVyWjx/sLRbnH6qBL/MRvydN SDXqwXFNmBSCsWK/oEUOxMdfmGbzTR+7c2R+GTQqMqfwJoUOOQUkbzzFyFSvuEpXywuB 1WRBBtaErjK68SDxdCIZ3xKeDjLusZXB1GsfKnO3zcsHawwvhkda1sPUpaIByMFmO0DT BRrQ== X-Forwarded-Encrypted: i=1; AFNElJ8g1nbbyxTH0t1Jcks/aHFY5qyg65EwWDs9i9+EEpwC8dM71cDpm/0g3Q1XnHudY4jfCfqTEAWPWZfzzrU=@vger.kernel.org X-Gm-Message-State: AOJu0YyJbLuTap4CvIwGFUr+ciwzWBZtQyA0c8LLSsGDcbHSEPfnMxtl e0yy0KTIdeo8X0Q14jpyxG92D2zPvuhpGu055opLqrsA7Q10Z7D6M18Zf26fLmA+L9xh+D80oFE weJB1oSbesOJODfYZvyGKwiJcj7mkCJgbWIeToiO5 X-Gm-Gg: Acq92OHLK2nVHMjCam4xzSHKukg/jXRlkPBKdUuXkQUn8hvctG3IWegfpz+gi5DwiaZ mUYtxTrnLUqqk0G7wTGvp1QC/YTuk4eObv0spUwj6m7AuwxMXBdJF525mVHQtz+wvRbEch7MP96 Ld1cx+fA/lHA4FFXdMCCMTZ4eOmVPia4xG8rP5je3ydJA0L2MG7c4DRxit+N2Z/3KDC/uLt/iF4 s/g4sMVIjMnZmxDV8GkQe6/PNaQgrWpy39/Et5gEYlQ5KdJu31+mTm0aDzKDrUZwUJ146dcsOvf 7c2iQBdY X-Received: by 2002:a05:690c:c4ce:b0:7ef:81dc:c0e7 with SMTP id 00721157ae682-7f7b6242881mr15277067b3.19.1781248829675; Fri, 12 Jun 2026 00:20:29 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20260610084053.2059858-1-wenst@chromium.org> <20260610084053.2059858-3-wenst@chromium.org> In-Reply-To: From: Chen-Yu Tsai Date: Fri, 12 Jun 2026 16:20:18 +0900 X-Gm-Features: AVVi8Cfix6rlRxpmlL_G61si3smqjEz2qk3oIH1X9DTqc3HutmT3uL6lEMZg0_I Message-ID: Subject: Re: [PATCH v2 02/16] device property: Add fwnode_graph_get_next_port_endpoint() To: Andy Shevchenko Cc: Bartosz Golaszewski , Greg Kroah-Hartman , Daniel Scally , Heikki Krogerus , Sakari Ailus , "Rafael J. Wysocki" , Danilo Krummrich , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Alan Stern , linux-acpi@vger.kernel.org, driver-core@lists.linux.dev, linux-pm@vger.kernel.org, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jun 10, 2026 at 11:08=E2=80=AFPM Andy Shevchenko wrote: > > On Wed, Jun 10, 2026 at 04:40:36PM +0800, Chen-Yu Tsai wrote: > > Due to design constraints of the power sequencing API, the consumer > > must first be sure that the other side is actually a provider, or it > > will continually get -EPROBE_DEFER when requesting the power > > sequencing descriptor. > > > > In the upcoming USB power sequencing integration, the USB hub driver > > first needs to check whether a graph connection exists, and whether > > the other side of the connection is a supported connector type. The > > USB port is tied to a "port" firmware node, and this new helper will > > be used to get the endpoint under the known "port" firmware node. > > ... > > > +/** > > + * fwnode_graph_get_next_port_endpoint - Get next endpoint firmware no= de in port > > + * @port: Pointer to the target port firmware node > > + * @prev: Previous endpoint node or %NULL to get the first > > + * > > + * The caller is responsible for calling fwnode_handle_put() on the re= turned > > + * fwnode pointer. Note that this function also puts a reference to @p= rev > > + * unconditionally. > > + * > > + * Return: an endpoint firmware node pointer or %NULL if no more endpo= ints > > + * are available. > > Yeah, you see, even here is inconsistency with previously added kernel-do= c. > > > + */ > > +struct fwnode_handle *fwnode_graph_get_next_port_endpoint(const struct= fwnode_handle *port, > > + struct fwnode_h= andle *prev) > > +{ > > + struct fwnode_handle *ep; > > Unused? > > > + while (1) { > > This is usually harder to read and follow. It's like "pay much attention = on > the code", but here no rocket science, no code to really pay attention to= . > > > + prev =3D fwnode_get_next_child_node(port, prev); > > + if (!prev) > > + break; > > + > > + if (WARN(!fwnode_name_eq(prev, "endpoint"), > > + "non endpoint node is used (%pfw)", prev)) > > + continue; > > + > > + break; > > + } > > + > > + return prev; > > +} > > So, this can be rewritten as > > ep =3D prev; > do { > ep =3D fwnode_get_next_child_node(port, ep); > if (fwnode_name_eq(ep, "endpoint")) > break; > > WARN_ON(ep, ...); > } while (ep); > > return ep; > > But also big question why? to WARN*(). There is no use in the entire > property.c. Will drop. This function was lifted from drivers/of/property.c then adapted to the fwnode APIs, so it still has the structure of its origin. With the WARN() gone, rewriting it as do {} while() becomes: do { prev =3D fwnode_get_next_child_node(port, prev); if (prev && fwnode_name_eq(prev, "endpoint")) break; } while (prev); return prev; Thanks ChenYu