diff mbox series

[062/120] MIPS: PS2: SIF: sif_rpc_unbind() to release an RPC server connection

Message ID eea0946866fa71f7c062d67c8a71a5ebdacffeef.1567326213.git.noring@nocrew.org (mailing list archive)
State RFC
Headers show
Series Linux for the PlayStation 2 | expand

Commit Message

Fredrik Noring Sept. 1, 2019, 4:02 p.m. UTC
Signed-off-by: Fredrik Noring <noring@nocrew.org>
---
 arch/mips/include/asm/mach-ps2/sif.h |  1 +
 drivers/ps2/sif.c                    | 16 ++++++++++++++++
 2 files changed, 17 insertions(+)
diff mbox series

Patch

diff --git a/arch/mips/include/asm/mach-ps2/sif.h b/arch/mips/include/asm/mach-ps2/sif.h
index 1d9a7ede2fb5..5a3128920c9a 100644
--- a/arch/mips/include/asm/mach-ps2/sif.h
+++ b/arch/mips/include/asm/mach-ps2/sif.h
@@ -86,5 +86,6 @@  struct sif_rpc_client
 };
 
 int sif_rpc_bind(struct sif_rpc_client *client, u32 server_id);
+void sif_rpc_unbind(struct sif_rpc_client *client);
 
 #endif /* __ASM_MACH_PS2_SIF_H */
diff --git a/drivers/ps2/sif.c b/drivers/ps2/sif.c
index ecb26239518c..3c098a46832c 100644
--- a/drivers/ps2/sif.c
+++ b/drivers/ps2/sif.c
@@ -395,6 +395,8 @@  static irqreturn_t sif0_dma_handler(int irq, void *dev_id)
  * A %PAGE_SIZE buffer is allocated to store RPC data. A future improvement is
  * to make its size adjustable.
  *
+ * The connection can be released with sif_rpc_unbind().
+ *
  * Return: 0 on success, otherwise a negative error number
  */
 int sif_rpc_bind(struct sif_rpc_client *client, u32 server_id)
@@ -425,6 +427,20 @@  int sif_rpc_bind(struct sif_rpc_client *client, u32 server_id)
 }
 EXPORT_SYMBOL_GPL(sif_rpc_bind);
 
+/**
+ * sif_rpc_unbind - release a connection to an IOP RPC server
+ * @client: RPC client object to release
+ *
+ * The connection must have been established with sif_rpc_bind().
+ */
+void sif_rpc_unbind(struct sif_rpc_client *client)
+{
+	free_page((unsigned long)client->client_buffer);
+
+	/* FIXME: Release the IOP RPC server part */
+}
+EXPORT_SYMBOL_GPL(sif_rpc_unbind);
+
 static void cmd_rpc_end(const struct sif_cmd_header *header,
 	const void *data, void *arg)
 {