Skip to contentSkip to conversation

rpmsg offchannel deadcoding

PATCH Superseded [email protected] 2 participants 7 messages Apr 24, 2025 – Apr 29, 2025

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover rpmsg offchannel deadcoding

From: "Dr. David Alan Gilbert" <[email protected]>

Hi,
This removes a couple of unused functions in rpmsg,
and (v2) after discussions with Arnaud, follows the thread and removes code that they would call.

(Build tested only)

Dr. David Alan Gilbert (3):
rpmsg: core: Remove deadcode
rpmsg: virtio: Remove uncallable offchannel functions
rpmsg: Remove unused method pointers *send_offchannel

 Documentation/staging/rpmsg.rst  | 46 -----------------------
 drivers/rpmsg/rpmsg_core.c       | 63 --------------------------------
 drivers/rpmsg/rpmsg_internal.h   |  6 ---
 drivers/rpmsg/virtio_rpmsg_bus.c | 22 -----------
 include/linux/rpmsg.h            | 22 -----------
 5 files changed, 159 deletions(-)
Signature · 1 line
2.49.0
#1 lore raw

PATCH v2 1/3 rpmsg: core: Remove deadcode

From: "Dr. David Alan Gilbert" <[email protected]>

rpmsg_send_offchannel() and rpmsg_trysend_offchannel() have been unused since they were added in 2011's
commit bcabbccabffe ("rpmsg: add virtio-based remote processor messaging bus")

Remove them and associated docs.

---
 Documentation/staging/rpmsg.rst | 46 ------------------------
 drivers/rpmsg/rpmsg_core.c      | 63 ---------------------------------
 include/linux/rpmsg.h           | 22 ------------
 3 files changed, 131 deletions(-)
Documentation/staging/rpmsg.rst +0 -46
index 3713adaa1608..40282cca86ca 100644
@@ -110,31 +110,6 @@ or a timeout of 15 seconds elapses. When the latter happens,
 The function can only be called from a process context (for now).
 Returns 0 on success and an appropriate error value on failure.
 
-::
-
-  int rpmsg_send_offchannel(struct rpmsg_endpoint *ept, u32 src, u32 dst,
-							void *data, int len);
-
-
-sends a message across to the remote processor, using the src and dst
-addresses provided by the user.
-
-The caller should specify the endpoint, the data it wants to send,
-its length (in bytes), and explicit source and destination addresses.
-The message will then be sent to the remote processor to which the
-endpoint's channel belongs, but the endpoint's src and channel dst
-addresses will be ignored (and the user-provided addresses will
-be used instead).
-
-In case there are no TX buffers available, the function will block until
-one becomes available (i.e. until the remote processor consumes
-a tx buffer and puts it back on virtio's used descriptor ring),
-or a timeout of 15 seconds elapses. When the latter happens,
--ERESTARTSYS is returned.
-
-The function can only be called from a process context (for now).
-Returns 0 on success and an appropriate error value on failure.
-
 ::
 
   int rpmsg_trysend(struct rpmsg_endpoint *ept, void *data, int len);
@@ -173,27 +148,6 @@ return -ENOMEM without waiting until one becomes available.
 The function can only be called from a process context (for now).
 Returns 0 on success and an appropriate error value on failure.
 
-::
-
-  int rpmsg_trysend_offchannel(struct rpmsg_endpoint *ept, u32 src, u32 dst,
-							void *data, int len);
-
-
-sends a message across to the remote processor, using source and
-destination addresses provided by the user.
-
-The user should specify the channel, the data it wants to send,
-its length (in bytes), and explicit source and destination addresses.
-The message will then be sent to the remote processor to which the
-channel belongs, but the channel's src and dst addresses will be
-ignored (and the user-provided addresses will be used instead).
-
-In case there are no TX buffers available, the function will immediately
-return -ENOMEM without waiting until one becomes available.
-
-The function can only be called from a process context (for now).
-Returns 0 on success and an appropriate error value on failure.
-
 ::
 
   struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_device *rpdev,
drivers/rpmsg/rpmsg_core.c +0 -63

75 lines not on this page · raw message

include/linux/rpmsg.h +0 -22
index 90d8e4475f80..fb7ab9165645 100644
@@ -184,13 +184,9 @@ struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_device *,
 
 int rpmsg_send(struct rpmsg_endpoint *ept, void *data, int len);
 int rpmsg_sendto(struct rpmsg_endpoint *ept, void *data, int len, u32 dst);
-int rpmsg_send_offchannel(struct rpmsg_endpoint *ept, u32 src, u32 dst,
-			  void *data, int len);
 
 int rpmsg_trysend(struct rpmsg_endpoint *ept, void *data, int len);
 int rpmsg_trysendto(struct rpmsg_endpoint *ept, void *data, int len, u32 dst);
-int rpmsg_trysend_offchannel(struct rpmsg_endpoint *ept, u32 src, u32 dst,
-			     void *data, int len);
 
 __poll_t rpmsg_poll(struct rpmsg_endpoint *ept, struct file *filp,
 			poll_table *wait);
@@ -271,15 +267,6 @@ static inline int rpmsg_sendto(struct rpmsg_endpoint *ept, void *data, int len,
 
 }
 
-static inline int rpmsg_send_offchannel(struct rpmsg_endpoint *ept, u32 src,
-					u32 dst, void *data, int len)
-{
-	/* This shouldn't be possible */
-	WARN_ON(1);
-
-	return -ENXIO;
-}
-
 static inline int rpmsg_trysend(struct rpmsg_endpoint *ept, void *data, int len)
 {
 	/* This shouldn't be possible */
@@ -297,15 +284,6 @@ static inline int rpmsg_trysendto(struct rpmsg_endpoint *ept, void *data,
 	return -ENXIO;
 }
 
-static inline int rpmsg_trysend_offchannel(struct rpmsg_endpoint *ept, u32 src,
-					   u32 dst, void *data, int len)
-{
-	/* This shouldn't be possible */
-	WARN_ON(1);
-
-	return -ENXIO;
-}
-
 static inline __poll_t rpmsg_poll(struct rpmsg_endpoint *ept,
 				      struct file *filp, poll_table *wait)
 {
Signature · 1 line
2.49.0
#2 lore raw

PATCH v2 2/3 rpmsg: virtio: Remove uncallable offchannel functions

In reply to [email protected]

From: "Dr. David Alan Gilbert" <[email protected]>

The virtio_rpmsg_send_offchannel() and virtio_rpmsg_trysend_offchannel() are wired up to the send_offchannel and trysend_offchannel members of rpmsg_endpoint_ops, the only dereference of those was by the unused, and now removed rpmsg_send_offchannel() and rpmsg_trysend_offchannel() functions.

Remove them.

---
 drivers/rpmsg/virtio_rpmsg_bus.c | 22 ----------------------
 1 file changed, 22 deletions(-)
drivers/rpmsg/virtio_rpmsg_bus.c +0 -22
index 89d7a3b8c48b..1474e8000207 100644
@@ -141,13 +141,9 @@ static void virtio_rpmsg_destroy_ept(struct rpmsg_endpoint *ept);
 static int virtio_rpmsg_send(struct rpmsg_endpoint *ept, void *data, int len);
 static int virtio_rpmsg_sendto(struct rpmsg_endpoint *ept, void *data, int len,
 			       u32 dst);
-static int virtio_rpmsg_send_offchannel(struct rpmsg_endpoint *ept, u32 src,
-					u32 dst, void *data, int len);
 static int virtio_rpmsg_trysend(struct rpmsg_endpoint *ept, void *data, int len);
 static int virtio_rpmsg_trysendto(struct rpmsg_endpoint *ept, void *data,
 				  int len, u32 dst);
-static int virtio_rpmsg_trysend_offchannel(struct rpmsg_endpoint *ept, u32 src,
-					   u32 dst, void *data, int len);
 static ssize_t virtio_rpmsg_get_mtu(struct rpmsg_endpoint *ept);
 static struct rpmsg_device *__rpmsg_create_channel(struct virtproc_info *vrp,
 						   struct rpmsg_channel_info *chinfo);
@@ -156,10 +152,8 @@ static const struct rpmsg_endpoint_ops virtio_endpoint_ops = {
 	.destroy_ept = virtio_rpmsg_destroy_ept,
 	.send = virtio_rpmsg_send,
 	.sendto = virtio_rpmsg_sendto,
-	.send_offchannel = virtio_rpmsg_send_offchannel,
 	.trysend = virtio_rpmsg_trysend,
 	.trysendto = virtio_rpmsg_trysendto,
-	.trysend_offchannel = virtio_rpmsg_trysend_offchannel,
 	.get_mtu = virtio_rpmsg_get_mtu,
 };
 
@@ -665,14 +659,6 @@ static int virtio_rpmsg_sendto(struct rpmsg_endpoint *ept, void *data, int len,
 	return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, true);
 }
 
-static int virtio_rpmsg_send_offchannel(struct rpmsg_endpoint *ept, u32 src,
-					u32 dst, void *data, int len)
-{
-	struct rpmsg_device *rpdev = ept->rpdev;
-
-	return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, true);
-}
-
 static int virtio_rpmsg_trysend(struct rpmsg_endpoint *ept, void *data, int len)
 {
 	struct rpmsg_device *rpdev = ept->rpdev;
@@ -690,14 +676,6 @@ static int virtio_rpmsg_trysendto(struct rpmsg_endpoint *ept, void *data,
 	return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, false);
 }
 
-static int virtio_rpmsg_trysend_offchannel(struct rpmsg_endpoint *ept, u32 src,
-					   u32 dst, void *data, int len)
-{
-	struct rpmsg_device *rpdev = ept->rpdev;
-
-	return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, false);
-}
-
 static ssize_t virtio_rpmsg_get_mtu(struct rpmsg_endpoint *ept)
 {
 	struct rpmsg_device *rpdev = ept->rpdev;
Signature · 1 line
2.49.0
#3 lore raw

PATCH v2 3/3 rpmsg: Remove unused method pointers *send_offchannel

In reply to [email protected]

From: "Dr. David Alan Gilbert" <[email protected]>

After the previous patch, there are no implementers of the send_offchannel() and trysend_offchannel() methods.

Remove them.

---
 drivers/rpmsg/rpmsg_internal.h | 6 ------
 1 file changed, 6 deletions(-)
drivers/rpmsg/rpmsg_internal.h +0 -6
index 42c7007be1b5..397e4926bd02 100644
@@ -50,10 +50,8 @@ struct rpmsg_device_ops {
  * @destroy_ept:	see @rpmsg_destroy_ept(), required
  * @send:		see @rpmsg_send(), required
  * @sendto:		see @rpmsg_sendto(), optional
- * @send_offchannel:	see @rpmsg_send_offchannel(), optional
  * @trysend:		see @rpmsg_trysend(), required
  * @trysendto:		see @rpmsg_trysendto(), optional
- * @trysend_offchannel:	see @rpmsg_trysend_offchannel(), optional
  * @poll:		see @rpmsg_poll(), optional
  * @set_flow_control:	see @rpmsg_set_flow_control(), optional
  * @get_mtu:		see @rpmsg_get_mtu(), optional
@@ -67,13 +65,9 @@ struct rpmsg_endpoint_ops {
 
 	int (*send)(struct rpmsg_endpoint *ept, void *data, int len);
 	int (*sendto)(struct rpmsg_endpoint *ept, void *data, int len, u32 dst);
-	int (*send_offchannel)(struct rpmsg_endpoint *ept, u32 src, u32 dst,
-				  void *data, int len);
 
 	int (*trysend)(struct rpmsg_endpoint *ept, void *data, int len);
 	int (*trysendto)(struct rpmsg_endpoint *ept, void *data, int len, u32 dst);
-	int (*trysend_offchannel)(struct rpmsg_endpoint *ept, u32 src, u32 dst,
-			     void *data, int len);
 	__poll_t (*poll)(struct rpmsg_endpoint *ept, struct file *filp,
 			     poll_table *wait);
 	int (*set_flow_control)(struct rpmsg_endpoint *ept, bool pause, u32 dst);
Signature · 1 line
2.49.0
maintainer
#4 lore raw

Re: [PATCH v2 3/3] rpmsg: Remove unused method pointers *send_offchannel

Hi,

Quoted 31 lines · On Thu, Apr 24, 2025 at 03:27:46PM +0100, [email protected] wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

After the previous patch, there are no implementers of the send_offchannel() and trysend_offchannel() methods.

Remove them.

---
 drivers/rpmsg/rpmsg_internal.h | 6 ------
 1 file changed, 6 deletions(-)
drivers/rpmsg/rpmsg_internal.h +0 -2
index 42c7007be1b5..397e4926bd02 100644
@@ -50,10 +50,8 @@ struct rpmsg_device_ops {
  * @destroy_ept:	see @rpmsg_destroy_ept(), required
  * @send:		see @rpmsg_send(), required
  * @sendto:		see @rpmsg_sendto(), optional
- * @send_offchannel:	see @rpmsg_send_offchannel(), optional
  * @trysend:		see @rpmsg_trysend(), required
  * @trysendto:		see @rpmsg_trysendto(), optional
- * @trysend_offchannel:	see @rpmsg_trysend_offchannel(), optional
  * @poll:		see @rpmsg_poll(), optional
  * @set_flow_control:	see @rpmsg_set_flow_control(), optional
  * @get_mtu:		see @rpmsg_get_mtu(), optional
@@ -67,13 +65,9 @@ struct rpmsg_endpoint_ops {
 
 	int (*send)(struct rpmsg_endpoint *ept, void *data, int len);
 	int (*sendto)(struct rpmsg_endpoint *ept, void *data, int len, u32 dst);

drivers/rpmsg/rpmsg_internal.h struct rpmsg_endpoint_ops { · line 73

Quoted 10 lines
drivers/rpmsg/rpmsg_internal.h +0 -4
-	int (*send_offchannel)(struct rpmsg_endpoint *ept, u32 src, u32 dst,
-				  void *data, int len);
 
 	int (*trysend)(struct rpmsg_endpoint *ept, void *data, int len);
 	int (*trysendto)(struct rpmsg_endpoint *ept, void *data, int len, u32 dst);
-	int (*trysend_offchannel)(struct rpmsg_endpoint *ept, u32 src, u32 dst,
-			     void *data, int len);
 	__poll_t (*poll)(struct rpmsg_endpoint *ept, struct file *filp,
 			     poll_table *wait);
 	int (*set_flow_control)(struct rpmsg_endpoint *ept, bool pause, u32 dst);

I'm good with this patchset. Can you fix the last paragraph in the comment for function rpmsg_send_offchannel_raw() and remove the reference to "_offchannel"?

Thanks,
Mathieu

Quoted 3 lines
Signature · 1 line
2.49.0
#5 lore raw

Re: [PATCH v2 3/3] rpmsg: Remove unused method pointers *send_offchannel

Quoted 37 lines · * Mathieu Poirier ([email protected]) wrote:

Hi,

Quoted 34 lines · On Thu, Apr 24, 2025 at 03:27:46PM +0100, [email protected] wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

After the previous patch, there are no implementers of the send_offchannel() and trysend_offchannel() methods.

Remove them.

---
 drivers/rpmsg/rpmsg_internal.h | 6 ------
 1 file changed, 6 deletions(-)
drivers/rpmsg/rpmsg_internal.h +0 -4
index 42c7007be1b5..397e4926bd02 100644
@@ -50,10 +50,8 @@ struct rpmsg_device_ops {
  * @destroy_ept:	see @rpmsg_destroy_ept(), required
  * @send:		see @rpmsg_send(), required
  * @sendto:		see @rpmsg_sendto(), optional
- * @send_offchannel:	see @rpmsg_send_offchannel(), optional
  * @trysend:		see @rpmsg_trysend(), required
  * @trysendto:		see @rpmsg_trysendto(), optional
- * @trysend_offchannel:	see @rpmsg_trysend_offchannel(), optional
  * @poll:		see @rpmsg_poll(), optional
  * @set_flow_control:	see @rpmsg_set_flow_control(), optional
  * @get_mtu:		see @rpmsg_get_mtu(), optional
@@ -67,13 +65,9 @@ struct rpmsg_endpoint_ops {
 
 	int (*send)(struct rpmsg_endpoint *ept, void *data, int len);
 	int (*sendto)(struct rpmsg_endpoint *ept, void *data, int len, u32 dst);
-	int (*send_offchannel)(struct rpmsg_endpoint *ept, u32 src, u32 dst,
-				  void *data, int len);
 
Quoted 10 lines

drivers/rpmsg/rpmsg_internal.h struct rpmsg_endpoint_ops { · line 73

Quoted 7 lines
drivers/rpmsg/rpmsg_internal.h +0 -2
 	int (*trysend)(struct rpmsg_endpoint *ept, void *data, int len);
 	int (*trysendto)(struct rpmsg_endpoint *ept, void *data, int len, u32 dst);
-	int (*trysend_offchannel)(struct rpmsg_endpoint *ept, u32 src, u32 dst,
-			     void *data, int len);
 	__poll_t (*poll)(struct rpmsg_endpoint *ept, struct file *filp,
 			     poll_table *wait);
 	int (*set_flow_control)(struct rpmsg_endpoint *ept, bool pause, u32 dst);

I'm good with this patchset. Can you fix the last paragraph in the comment for function rpmsg_send_offchannel_raw() and remove the reference to "_offchannel"?

Sure. I'll cut a v3 with that as an extra patch at the end.

Dave

Quoted 7 lines

Thanks,
Mathieu

Quoted 3 lines
Signature · 1 line
2.49.0
Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
#6 lore raw

Re: [PATCH v2 3/3] rpmsg: Remove unused method pointers *send_offchannel

Quoted 49 lines · * Dr. David Alan Gilbert ([email protected]) wrote:
Quoted 37 lines · * Mathieu Poirier ([email protected]) wrote:

Hi,

Quoted 34 lines · On Thu, Apr 24, 2025 at 03:27:46PM +0100, [email protected] wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

After the previous patch, there are no implementers of the send_offchannel() and trysend_offchannel() methods.

Remove them.

---
 drivers/rpmsg/rpmsg_internal.h | 6 ------
 1 file changed, 6 deletions(-)
drivers/rpmsg/rpmsg_internal.h +0 -4
index 42c7007be1b5..397e4926bd02 100644
@@ -50,10 +50,8 @@ struct rpmsg_device_ops {
  * @destroy_ept:	see @rpmsg_destroy_ept(), required
  * @send:		see @rpmsg_send(), required
  * @sendto:		see @rpmsg_sendto(), optional
- * @send_offchannel:	see @rpmsg_send_offchannel(), optional
  * @trysend:		see @rpmsg_trysend(), required
  * @trysendto:		see @rpmsg_trysendto(), optional
- * @trysend_offchannel:	see @rpmsg_trysend_offchannel(), optional
  * @poll:		see @rpmsg_poll(), optional
  * @set_flow_control:	see @rpmsg_set_flow_control(), optional
  * @get_mtu:		see @rpmsg_get_mtu(), optional
@@ -67,13 +65,9 @@ struct rpmsg_endpoint_ops {
 
 	int (*send)(struct rpmsg_endpoint *ept, void *data, int len);
 	int (*sendto)(struct rpmsg_endpoint *ept, void *data, int len, u32 dst);
-	int (*send_offchannel)(struct rpmsg_endpoint *ept, u32 src, u32 dst,
-				  void *data, int len);
 
Quoted 10 lines

drivers/rpmsg/rpmsg_internal.h struct rpmsg_endpoint_ops { · line 73

Quoted 7 lines
drivers/rpmsg/rpmsg_internal.h +0 -2
 	int (*trysend)(struct rpmsg_endpoint *ept, void *data, int len);
 	int (*trysendto)(struct rpmsg_endpoint *ept, void *data, int len, u32 dst);
-	int (*trysend_offchannel)(struct rpmsg_endpoint *ept, u32 src, u32 dst,
-			     void *data, int len);
 	__poll_t (*poll)(struct rpmsg_endpoint *ept, struct file *filp,
 			     poll_table *wait);
 	int (*set_flow_control)(struct rpmsg_endpoint *ept, bool pause, u32 dst);

I'm good with this patchset. Can you fix the last paragraph in the comment for function rpmsg_send_offchannel_raw() and remove the reference to "_offchannel"?

Quoted 1 line

Sure. I'll cut a v3 with that as an extra patch at the end.

Actually I rolled it in, see v3 series starting with message:
[email protected]

that I just sent.

Dave

Quoted 15 lines

Dave

Quoted 7 lines

Thanks,
Mathieu

Quoted 3 lines
Signature · 1 line
2.49.0
Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/