From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE96B3C26 for ; Mon, 6 Feb 2023 12:16:00 +0000 (UTC) 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="329206645" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="329206645" 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> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain 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 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 35C3DC63797 for ; Mon, 6 Feb 2023 12:16:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3935B10E392; Mon, 6 Feb 2023 12:16:03 +0000 (UTC) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id A6C0110E392 for ; Mon, 6 Feb 2023 12:16:00 +0000 (UTC) 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="329206650" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="329206650" 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 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heikki Krogerus , Andrzej Hajda , "Rafael J . Wysocki" , dri-devel@lists.freedesktop.org, Douglas Anderson , Laurent Pinchart , Krzysztof Kozlowski , Guenter Roeck , Kees Cook , Marek Vasut , chrome-platform@lists.linux.dev, Javier Martinez Canillas , Jernej Skrabec , linux-acpi@vger.kernel.org, "Gustavo A. R. Silva" , Andi Shyti , Thierry Reding , devicetree@vger.kernel.org, Sakari Ailus , =?utf-8?Q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_Pr?= =?utf-8?Q?ado?= , Jonas Karlman , Allen Chen , Stephen Boyd , Rob Herring , Hsin-Yi Wang , Xin Ji , AngeloGioacchino Del Regno , Neil Armstrong , Thomas Zimmermann , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Robert Foss , Daniel Scally , Prashant Malani , Alex Deucher Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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