Skip to contentSkip to conversation

Staging: fwserial: Remove unused functions

PATCH In review Shraddha Barke 2 participants 4 messages Nov 1, 2015 – Nov 4, 2015 Staging

lore
Share & tools
lore
#0 lore raw

cover Staging: fwserial: Remove unused functions

These patches remove unused function and replace wrapper functions by direct call.

Shraddha Barke (2):
Staging: fwserial: Remove unused fwtty_bind_console from header
Staging: fwserial: Remove wrapper function fwtty_port_put

 drivers/staging/fwserial/fwserial.c | 16 +++++-----------
 drivers/staging/fwserial/fwserial.h |  9 ---------
 2 files changed, 5 insertions(+), 20 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/2 Staging: fwserial: Remove unused fwtty_bind_console from header

fwtty_bind_console is defined in header file but not used. Thus remove the definition.

---
 drivers/staging/fwserial/fwserial.h | 8 --------
 1 file changed, 8 deletions(-)
drivers/staging/fwserial/fwserial.h +0 -8
index 787aa4f..8d791ae 100644
@@ -344,14 +344,6 @@ extern struct tty_driver *fwtty_driver;
 struct fwtty_port *fwtty_port_get(unsigned index);
 void fwtty_port_put(struct fwtty_port *port);
 
-static inline void fwtty_bind_console(struct fwtty_port *port,
-				      struct fwconsole_ops *fwcon_ops,
-				      void *data)
-{
-	port->con_data = data;
-	port->fwcon_ops = fwcon_ops;
-}
-
 /*
  * Returns the max send async payload size in bytes based on the unit device
  * link speed. Self-limiting asynchronous bandwidth (via reducing the payload)
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/2 Staging: fwserial: Remove wrapper function fwtty_port_put

In reply to Shraddha Barke

Function fwtty_port_put can be replaced with direct calls to kref_put. Thus drop the wrapper function.

---
 drivers/staging/fwserial/fwserial.c | 16 +++++-----------
 drivers/staging/fwserial/fwserial.h |  1 -
 2 files changed, 5 insertions(+), 12 deletions(-)
drivers/staging/fwserial/fwserial.c +5 -11
index b3ea4bb..8f4c3c0 100644
@@ -893,12 +893,6 @@ static void fwserial_destroy(struct kref *kref)
 	kfree(serial);
 }
 
-void fwtty_port_put(struct fwtty_port *port)
-{
-	kref_put(&port->serial->kref, fwserial_destroy);
-}
-EXPORT_SYMBOL(fwtty_port_put);
-
 static void fwtty_port_dtr_rts(struct tty_port *tty_port, int on)
 {
 	struct fwtty_port *port = to_port(tty_port, port);
@@ -1075,7 +1069,7 @@ static void fwtty_cleanup(struct tty_struct *tty)
 	struct fwtty_port *port = tty->driver_data;
 
 	tty->driver_data = NULL;
-	fwtty_port_put(port);
+	kref_put(&port->serial->kref, fwserial_destroy);
 }
 
 static int fwtty_install(struct tty_driver *driver, struct tty_struct *tty)
@@ -1087,7 +1081,7 @@ static int fwtty_install(struct tty_driver *driver, struct tty_struct *tty)
 	if (!err)
 		tty->driver_data = port;
 	else
-		fwtty_port_put(port);
+		kref_put(&port->serial->kref, fwserial_destroy);
 	return err;
 }
 
@@ -1100,7 +1094,7 @@ static int fwloop_install(struct tty_driver *driver, struct tty_struct *tty)
 	if (!err)
 		tty->driver_data = port;
 	else
-		fwtty_port_put(port);
+		kref_put(&port->serial->kref, fwserial_destroy);
 	return err;
 }
 
@@ -1482,7 +1476,7 @@ static int fwtty_proc_show(struct seq_file *m, void *v)
 		seq_printf(m, "%2d:", i);
 		if (capable(CAP_SYS_ADMIN))
 			fwtty_proc_show_port(m, port);
-		fwtty_port_put(port);
+		kref_put(&port->serial->kref, fwserial_destroy);
 		seq_puts(m, "\n");
 	}
 	return 0;
@@ -1500,7 +1494,7 @@ static int fwtty_debugfs_stats_show(struct seq_file *m, void *v)
 			seq_printf(m, "%2d:", port->index);
 			fwtty_proc_show_port(m, port);
 			fwtty_debugfs_show_port(m, port);
-			fwtty_port_put(port);
+			kref_put(&port->serial->kref, fwserial_destroy);
 			seq_puts(m, "\n");
 		}
 	}
drivers/staging/fwserial/fwserial.h +0 -1
index 8d791ae..64b2559 100644
@@ -342,7 +342,6 @@ static const char loop_dev_name[] = "fwloop";
 extern struct tty_driver *fwtty_driver;
 
 struct fwtty_port *fwtty_port_get(unsigned index);
-void fwtty_port_put(struct fwtty_port *port);
 
 /*
  * Returns the max send async payload size in bytes based on the unit device
Signature · 1 line
2.1.4
maintainer
#3 lore raw

Re: [Outreachy kernel] [PATCH 2/2] Staging: fwserial: Remove wrapper function fwtty_port_put

Quoted 14 lines · Shraddha Barke

Function fwtty_port_put can be replaced with direct calls to kref_put. Thus drop the wrapper function.

---
 drivers/staging/fwserial/fwserial.c | 16 +++++-----------
 drivers/staging/fwserial/fwserial.h |  1 -
 2 files changed, 5 insertions(+), 12 deletions(-)
drivers/staging/fwserial/fwserial.c +0 -0
index b3ea4bb..8f4c3c0 100644

drivers/staging/fwserial/fwserial.c static void fwserial_destroy(struct kref *kref) · line 900

Quoted 8 lines
drivers/staging/fwserial/fwserial.c +0 -5
@@ -893,12 +893,6 @@ static void fwserial_destroy(struct kref *kref)
 	kfree(serial);
 }
 
-void fwtty_port_put(struct fwtty_port *port)
-{
-	kref_put(&port->serial->kref, fwserial_destroy);
-}
-EXPORT_SYMBOL(fwtty_port_put);

This function is ok to have as it properly "hides" the implementation. But, it doesn't need to be exported, and should be made static, can you make that change instead?

thanks,

greg k-h