From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (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 D78EF1A5BAF for ; Tue, 25 Feb 2025 17:36:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740504989; cv=none; b=Y8KLbnEAY1M3x5SQjK6fNh/6ymOSkdeoVh+C+bOPwa9zi9G+UmrvGkn3roqJ7bcZa3Uyx3srqyw7LD/cFkxlVYDSQtW+NE/6Rdz+anHbONCdStdwBcga2I4NRB48BJLFCGqxJvDO5XQ1WX9p9Ha7u8aFdsaAGoc9YTayv+P9xcA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740504989; c=relaxed/simple; bh=wjyJdMeZ3XtiUqcsjPl3/9q8Gj0lBxCZzql4SD2VkA0=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JNQC/fxPNdL/7M7XzyTC0wJ7ZgyDWLTgRnQ0UUMysOAar5ieEjwXl9atorKAWLfXqjFOuwiAStOxTjBq3DcF1lc4Nimxfsp8dbcDdMYypFg8AaMTVE4TErsHHqA5o/B4BuGrGOkWA4WJppxYLou6Xuhzomeno18BTTivhOOdZfw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=b1bgoAoK; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="b1bgoAoK" Received: by mail.gandi.net (Postfix) with ESMTPSA id 1D72644327; Tue, 25 Feb 2025 17:36:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1740504984; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pET0nVdSZvklJ9U7JwmtwIZwaF754aOJaksS3akpOXw=; b=b1bgoAoKCCoulVZ/+hkYrikGXdLVW+PYWXdFsYAHmUtmv+7fXhORJWESQsS+FW0nXnWcJ4 m+FzZnZGqmBhnovsC0Dm32A5o5yQGtniD1TYq95llftKOeKwLwaaUJk3NxWhV5jubYErLx IHq+CS6PHy2FbUxz0IJDJdCj//oiFw1PDdjbohLjWNSpVWtArHcfh2AxGA6GOvgpQZhOqn 1/2RbLRMuDk+Tn5XV97FMznO0VKfG6rsibEbgUKMDyGyPOcOqG5iLFV37pR29WVy8Mg5n7 qu6D/POsD6AZG4dvNeK1bI87bgOwT3hIPBe2HiSYA1igxbCl2uxGX/06g1wxFA== Date: Tue, 25 Feb 2025 18:36:21 +0100 From: Luca Ceresoli To: Jani Nikula Cc: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dmitry Baryshkov , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 1/2] drm/bridge: move bridges_show logic from drm_debugfs.c Message-ID: <20250225183621.6b33684b@booty> In-Reply-To: <878qpu56cm.fsf@intel.com> References: <20250225-drm-debugfs-show-all-bridges-v7-0-8826037ada37@bootlin.com> <20250225-drm-debugfs-show-all-bridges-v7-1-8826037ada37@bootlin.com> <878qpu56cm.fsf@intel.com> Organization: Bootlin X-Mailer: Claws Mail 4.3.0 (GTK 3.24.43; x86_64-redhat-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdekvdefvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepfffhvfevuffkjghfohfogggtgfesthejredtredtvdenucfhrhhomhepnfhutggrucevvghrvghsohhlihcuoehluhgtrgdrtggvrhgvshholhhisegsohhothhlihhnrdgtohhmqeenucggtffrrghtthgvrhhnpeeglefffefghefhtddvfeeufeeiveekgffgleekieduteekkeetvdehudekgfdvvdenucffohhmrghinhepsghoohhtlhhinhdrtghomhenucfkphepvdgrtddvmeeijedtmedvtddvtdemvggrtddumegsvgegudemleehvgejmeefgeefmeeludefvgenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvrgdtvdemieejtdemvddtvddtmegvrgdtudemsggvgedumeelhegvjeemfeegfeemledufegvpdhhvghlohepsghoohhthidpmhgrihhlfhhrohhmpehluhgtrgdrtggvrhgvshholhhisegsohhothhlihhnrdgtohhmpdhnsggprhgtphhtthhopeduiedprhgtphhtthhopehjrghnihdrnhhikhhulhgrsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheprghnughriigvjhdrhhgrjhgurgesihhnthgvlhdrtghomhdprhgtphhtthhopehnvghilhdrrghrmhhsthhro hhngheslhhinhgrrhhordhorhhgpdhrtghpthhtoheprhhfohhssheskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepnfgruhhrvghnthdrphhinhgthhgrrhhtsehiuggvrghsohhnsghorghrugdrtghomhdprhgtphhtthhopehjohhnrghssehkfihisghoohdrshgvpdhrtghpthhtohepjhgvrhhnvghjrdhskhhrrggsvggtsehgmhgrihhlrdgtohhmpdhrtghpthhtohepmhgrrghrthgvnhdrlhgrnhhkhhhorhhstheslhhinhhugidrihhnthgvlhdrtghomh X-GND-Sasl: luca.ceresoli@bootlin.com Hello Jani, On Tue, 25 Feb 2025 18:36:41 +0200 Jani Nikula wrote: > On Tue, 25 Feb 2025, Luca Ceresoli wrote: > > In preparation to expose more info about bridges in debugfs, which will > > require more insight into drm_bridge data structures, move the bridges_show > > code to drm_bridge.c. > > > > Suggested-by: Dmitry Baryshkov > > Signed-off-by: Luca Ceresoli > > I hate myself for doing this on a patch that's at v7... but here goes. Please don't! :-) This patch is new in v7, and a different (and definitely worse) approach was present in v6, but there was nothing before. > Perhaps consider moving the bridges debugfs creation and fops to > drm_bridge.c instead of just adding > drm_bridge_debugfs_show_encoder_bridges(). > > For example, add drm_bridge_debugfs_add(struct drm_encoder *encoder), > which then contains the debugfs_create_file() call. I think it should go in drm_encoder.c, not drm_bridge.c, right? Here we are showing the bridges attached to an encoder, so the entry point is each encoder. On the other hand in patch 2 we should move the drm_debugfs_global_add() code to drm_bridge.c, as it's showing bridges ina encoder-independent way. And finally drm_bridge should export the common drm_bridge_debugfs_show_bridge() function to drm_encoder.c. Do you think this is correct? > Interestingly, this lets you drop a lot of #ifdef CONFIG_DEBUG_FS. The > compiler optimizes the fops struct and the functions away when > debugfs_create_file() becomes a stub for CONFIG_DEBUG_FS=n. It becomes > all around cleaner. This surely makes the idea interesting. Cleaner code is always welcome. Luca -- Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com