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 0F28DC636D6 for ; Mon, 6 Feb 2023 12:16:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229894AbjBFMQC (ORCPT ); Mon, 6 Feb 2023 07:16:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbjBFMQB (ORCPT ); Mon, 6 Feb 2023 07:16:01 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F2131815B; Mon, 6 Feb 2023 04:16:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675685760; x=1707221760; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=/sfAfGJA6/XxqLEnP+hho0W1Nhw3gCWgj1LKpNZa/So=; b=XUJKzco//yWIItKBAOwJE0JHvb8VXqeGJlTk7MbDkKaXY8p2851y1hhq bax7NGIP0VWi3L5UOA2y4cfeUbesP/x8IwF/AitiMFd1CBg+ESSzQTo0/ mrbFq75W9xDhevQBowc0zMYKduxez7rUcxR/sYSFAfrbVC42o3IQMQoVN Kq1g5b9GK8K7XS3wUjIJJKKgSxrkanyJxPVd5Vpoqo0/XFI99auAXwz8M 9jqNSHapugPwDyRqz5QjCfHuCgN2/w0Kibu2Occyp40h9VKRCQRHK6des zM09r8wA926mbqR5/epRlNrgAh8poBUo0WD/HqmgNdGDRBbuXiuZQ5Rvb w==; X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="329206643" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="329206643" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Feb 2023 04:15:59 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="729990155" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="729990155" Received: from hayatibx-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.62.213]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Feb 2023 04:15:49 -0800 From: Jani Nikula To: Andy Shevchenko , Pin-yen Lin 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 , linux-kernel@vger.kernel.org, =?utf-8?Q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_Pr?= =?utf-8?Q?ado?= , 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, Alex Deucher , Andi Shyti , Douglas Anderson , "Gustavo A. R. Silva" , Imre Deak , Kees Cook , Thierry Reding Subject: Re: [PATCH v11 3/9] drm/display: Add Type-C switch helpers In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20230204133040.1236799-1-treapking@chromium.org> <20230204133040.1236799-4-treapking@chromium.org> Date: Mon, 06 Feb 2023 14:15:46 +0200 Message-ID: <87k00vyop9.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 06 Feb 2023, Andy Shevchenko wrote: > On Sat, Feb 04, 2023 at 09:30:34PM +0800, Pin-yen Lin wrote: >> Add helpers to register and unregister Type-C "switches" for bridges >> capable of switching their output between two downstream devices. >> >> The helper registers USB Type-C mode switches when the "mode-switch" >> and the "reg" properties are available in Device Tree. > > ... > >> + fwnode_for_each_child_node(port, sw) { >> + if (fwnode_property_present(sw, "mode-switch")) > > This idiom is being used at least twice (in this code, haven't checked the rest > of the patches, though), perhaps > > #define fwnode_for_each_typec_mode_switch(port, sw) \ > fwnode_for_each_child_node(port, sw) \ > if (!fwnode_property_present(sw, "mode-switch")) {} else > > ? See for_each_if() in drm_util.h. BR, Jani. -- Jani Nikula, Intel Open Source Graphics Center