Staging: fwserial: Remove unused functions
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
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
@@ -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
PATCH 2/2 Staging: fwserial: Remove wrapper function fwtty_port_put
In reply to Shraddha BarkeFunction 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
@@ -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
@@ -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
Greg KH
maintainerRe: [Outreachy kernel] [PATCH 2/2] Staging: fwserial: Remove wrapper function fwtty_port_put
Quoted 14 lines · Shraddha Barke
Function
fwtty_port_putcan be replaced with direct calls tokref_put. Thus drop the wrapper function.Signed-off-by Shraddha Barke <[email protected]>--- 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
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