[PATCH] device: property: Remove deadcode

linux@treblig.org posted 1 patch 1 week, 2 days ago
drivers/base/property.c  | 41 ----------------------------------------
include/linux/property.h |  4 ----
2 files changed, 45 deletions(-)
[PATCH] device: property: Remove deadcode
Posted by linux@treblig.org 1 week, 2 days ago
From: "Dr. David Alan Gilbert" <linux@treblig.org>

fwnode_graph_get_endpoint_count() was added in 2021 by
commit c87b8fc56966 ("device property: Implement
fwnode_graph_get_endpoint_count()")

but has never been used.

fwnode_graph_get_remote_port() has been unused since 2017's
commit 6a71d8d77795 ("device property: Add fwnode_graph_get_port_parent")

Remove them.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
 drivers/base/property.c  | 41 ----------------------------------------
 include/linux/property.h |  4 ----
 2 files changed, 45 deletions(-)

diff --git a/drivers/base/property.c b/drivers/base/property.c
index 837d77e3af2b..0cf8a7afaaee 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -1116,22 +1116,6 @@ fwnode_graph_get_remote_port_parent(const struct fwnode_handle *fwnode)
 }
 EXPORT_SYMBOL_GPL(fwnode_graph_get_remote_port_parent);
 
-/**
- * fwnode_graph_get_remote_port - Return fwnode of a remote port
- * @fwnode: Endpoint firmware node pointing to the remote endpoint
- *
- * Extracts firmware node of a remote port the @fwnode points to.
- *
- * The caller is responsible for calling fwnode_handle_put() on the returned
- * fwnode pointer.
- */
-struct fwnode_handle *
-fwnode_graph_get_remote_port(const struct fwnode_handle *fwnode)
-{
-	return fwnode_get_next_parent(fwnode_graph_get_remote_endpoint(fwnode));
-}
-EXPORT_SYMBOL_GPL(fwnode_graph_get_remote_port);
-
 /**
  * fwnode_graph_get_remote_endpoint - Return fwnode of a remote endpoint
  * @fwnode: Endpoint firmware node pointing to the remote endpoint
@@ -1227,31 +1211,6 @@ fwnode_graph_get_endpoint_by_id(const struct fwnode_handle *fwnode,
 }
 EXPORT_SYMBOL_GPL(fwnode_graph_get_endpoint_by_id);
 
-/**
- * fwnode_graph_get_endpoint_count - Count endpoints on a device node
- * @fwnode: The node related to a device
- * @flags: fwnode lookup flags
- * Count endpoints in a device node.
- *
- * If FWNODE_GRAPH_DEVICE_DISABLED flag is specified, also unconnected endpoints
- * and endpoints connected to disabled devices are counted.
- */
-unsigned int fwnode_graph_get_endpoint_count(const struct fwnode_handle *fwnode,
-					     unsigned long flags)
-{
-	struct fwnode_handle *ep;
-	unsigned int count = 0;
-
-	fwnode_graph_for_each_endpoint(fwnode, ep) {
-		if (flags & FWNODE_GRAPH_DEVICE_DISABLED ||
-		    fwnode_graph_remote_available(ep))
-			count++;
-	}
-
-	return count;
-}
-EXPORT_SYMBOL_GPL(fwnode_graph_get_endpoint_count);
-
 /**
  * fwnode_graph_parse_endpoint - parse common endpoint node properties
  * @fwnode: pointer to endpoint fwnode_handle
diff --git a/include/linux/property.h b/include/linux/property.h
index 61fc20e5f81f..4301f5130280 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -470,8 +470,6 @@ struct fwnode_handle *
 fwnode_graph_get_port_parent(const struct fwnode_handle *fwnode);
 struct fwnode_handle *fwnode_graph_get_remote_port_parent(
 	const struct fwnode_handle *fwnode);
-struct fwnode_handle *fwnode_graph_get_remote_port(
-	const struct fwnode_handle *fwnode);
 struct fwnode_handle *fwnode_graph_get_remote_endpoint(
 	const struct fwnode_handle *fwnode);
 
@@ -497,8 +495,6 @@ static inline bool fwnode_graph_is_endpoint(const struct fwnode_handle *fwnode)
 struct fwnode_handle *
 fwnode_graph_get_endpoint_by_id(const struct fwnode_handle *fwnode,
 				u32 port, u32 endpoint, unsigned long flags);
-unsigned int fwnode_graph_get_endpoint_count(const struct fwnode_handle *fwnode,
-					     unsigned long flags);
 
 #define fwnode_graph_for_each_endpoint(fwnode, child)				\
 	for (child = fwnode_graph_get_next_endpoint(fwnode, NULL); child;	\
-- 
2.47.0
Re: [PATCH] device: property: Remove deadcode
Posted by Sakari Ailus 6 days, 19 hours ago
Hi David,

Thanks for the patch.

On Sat, Nov 16, 2024 at 12:32:53AM +0000, linux@treblig.org wrote:
> From: "Dr. David Alan Gilbert" <linux@treblig.org>
> 
> fwnode_graph_get_endpoint_count() was added in 2021 by
> commit c87b8fc56966 ("device property: Implement
> fwnode_graph_get_endpoint_count()")
> 
> but has never been used.
> 
> fwnode_graph_get_remote_port() has been unused since 2017's
> commit 6a71d8d77795 ("device property: Add fwnode_graph_get_port_parent")
> 
> Remove them.
> 
> Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>

Both of the functions also exist to span the same scope as the OF API,
hence they should exist as long as the OF framework continues to provide
these API functions. The equivalent OF functions are used by drivers
currently.

-- 
Kind regards,

Sakari Ailus