Skip to content

Commit

Permalink
tty: USB does not need the filp argument in the drivers
Browse files Browse the repository at this point in the history
And indeed none of them use it. Clean this up as it will make moving to a
standard open method rather easier.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Alan Cox authored and Live-CD User committed Sep 19, 2009
1 parent d3b5cff commit a509a7e
Show file tree
Hide file tree
Showing 41 changed files with 68 additions and 131 deletions.
5 changes: 2 additions & 3 deletions drivers/usb/serial/ark3116.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,7 @@ static void ark3116_set_termios(struct tty_struct *tty,
return;
}

static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port,
struct file *filp)
static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port)
{
struct ktermios tmp_termios;
struct usb_serial *serial = port->serial;
Expand All @@ -334,7 +333,7 @@ static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port,
return -ENOMEM;
}

result = usb_serial_generic_open(tty, port, filp);
result = usb_serial_generic_open(tty, port);
if (result)
goto err_out;

Expand Down
4 changes: 2 additions & 2 deletions drivers/usb/serial/belkin_sa.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static int debug;
static int belkin_sa_startup(struct usb_serial *serial);
static void belkin_sa_release(struct usb_serial *serial);
static int belkin_sa_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp);
struct usb_serial_port *port);
static void belkin_sa_close(struct usb_serial_port *port);
static void belkin_sa_read_int_callback(struct urb *urb);
static void belkin_sa_set_termios(struct tty_struct *tty,
Expand Down Expand Up @@ -213,7 +213,7 @@ static void belkin_sa_release(struct usb_serial *serial)


static int belkin_sa_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp)
struct usb_serial_port *port)
{
int retval = 0;

Expand Down
5 changes: 2 additions & 3 deletions drivers/usb/serial/ch341.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,7 @@ static void ch341_close(struct usb_serial_port *port)


/* open this device, set default parameters */
static int ch341_open(struct tty_struct *tty, struct usb_serial_port *port,
struct file *filp)
static int ch341_open(struct tty_struct *tty, struct usb_serial_port *port)
{
struct usb_serial *serial = port->serial;
struct ch341_private *priv = usb_get_serial_port_data(serial->port[0]);
Expand Down Expand Up @@ -333,7 +332,7 @@ static int ch341_open(struct tty_struct *tty, struct usb_serial_port *port,
return -EPROTO;
}

r = usb_serial_generic_open(tty, port, filp);
r = usb_serial_generic_open(tty, port);

out: return r;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/usb/serial/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ static int usb_console_setup(struct console *co, char *options)
/* only call the device specific open if this
* is the first time the port is opened */
if (serial->type->open)
retval = serial->type->open(NULL, port, NULL);
retval = serial->type->open(NULL, port);
else
retval = usb_serial_generic_open(NULL, port, NULL);
retval = usb_serial_generic_open(NULL, port);

if (retval) {
err("could not open USB console port");
Expand Down
6 changes: 2 additions & 4 deletions drivers/usb/serial/cp210x.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
/*
* Function Prototypes
*/
static int cp210x_open(struct tty_struct *, struct usb_serial_port *,
struct file *);
static int cp210x_open(struct tty_struct *tty, struct usb_serial_port *);
static void cp210x_cleanup(struct usb_serial_port *);
static void cp210x_close(struct usb_serial_port *);
static void cp210x_get_termios(struct tty_struct *,
Expand Down Expand Up @@ -368,8 +367,7 @@ static unsigned int cp210x_quantise_baudrate(unsigned int baud) {
return baud;
}

static int cp210x_open(struct tty_struct *tty, struct usb_serial_port *port,
struct file *filp)
static int cp210x_open(struct tty_struct *tty, struct usb_serial_port *port)
{
struct usb_serial *serial = port->serial;
int result;
Expand Down
4 changes: 2 additions & 2 deletions drivers/usb/serial/cyberjack.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static int cyberjack_startup(struct usb_serial *serial);
static void cyberjack_disconnect(struct usb_serial *serial);
static void cyberjack_release(struct usb_serial *serial);
static int cyberjack_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp);
struct usb_serial_port *port);
static void cyberjack_close(struct usb_serial_port *port);
static int cyberjack_write(struct tty_struct *tty,
struct usb_serial_port *port, const unsigned char *buf, int count);
Expand Down Expand Up @@ -173,7 +173,7 @@ static void cyberjack_release(struct usb_serial *serial)
}

static int cyberjack_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp)
struct usb_serial_port *port)
{
struct cyberjack_private *priv;
unsigned long flags;
Expand Down
6 changes: 2 additions & 4 deletions drivers/usb/serial/cypress_m8.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ static int cypress_earthmate_startup(struct usb_serial *serial);
static int cypress_hidcom_startup(struct usb_serial *serial);
static int cypress_ca42v2_startup(struct usb_serial *serial);
static void cypress_release(struct usb_serial *serial);
static int cypress_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp);
static int cypress_open(struct tty_struct *tty, struct usb_serial_port *port);
static void cypress_close(struct usb_serial_port *port);
static void cypress_dtr_rts(struct usb_serial_port *port, int on);
static int cypress_write(struct tty_struct *tty, struct usb_serial_port *port,
Expand Down Expand Up @@ -633,8 +632,7 @@ static void cypress_release(struct usb_serial *serial)
}


static int cypress_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp)
static int cypress_open(struct tty_struct *tty, struct usb_serial_port *port)
{
struct cypress_private *priv = usb_get_serial_port_data(port);
struct usb_serial *serial = port->serial;
Expand Down
6 changes: 2 additions & 4 deletions drivers/usb/serial/digi_acceleport.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,7 @@ static int digi_write(struct tty_struct *tty, struct usb_serial_port *port,
static void digi_write_bulk_callback(struct urb *urb);
static int digi_write_room(struct tty_struct *tty);
static int digi_chars_in_buffer(struct tty_struct *tty);
static int digi_open(struct tty_struct *tty, struct usb_serial_port *port,
struct file *filp);
static int digi_open(struct tty_struct *tty, struct usb_serial_port *port);
static void digi_close(struct usb_serial_port *port);
static int digi_carrier_raised(struct usb_serial_port *port);
static void digi_dtr_rts(struct usb_serial_port *port, int on);
Expand Down Expand Up @@ -1347,8 +1346,7 @@ static int digi_carrier_raised(struct usb_serial_port *port)
return 0;
}

static int digi_open(struct tty_struct *tty, struct usb_serial_port *port,
struct file *filp)
static int digi_open(struct tty_struct *tty, struct usb_serial_port *port)
{
int ret;
unsigned char buf[32];
Expand Down
8 changes: 3 additions & 5 deletions drivers/usb/serial/empeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ static int debug;
#define EMPEG_PRODUCT_ID 0x0001

/* function prototypes for an empeg-car player */
static int empeg_open(struct tty_struct *tty, struct usb_serial_port *port,
struct file *filp);
static int empeg_open(struct tty_struct *tty, struct usb_serial_port *port);
static void empeg_close(struct usb_serial_port *port);
static int empeg_write(struct tty_struct *tty, struct usb_serial_port *port,
const unsigned char *buf,
Expand Down Expand Up @@ -142,16 +141,15 @@ static int bytes_out;
/******************************************************************************
* Empeg specific driver functions
******************************************************************************/
static int empeg_open(struct tty_struct *tty, struct usb_serial_port *port,
struct file *filp)
static int empeg_open(struct tty_struct *tty,struct usb_serial_port *port)
{
struct usb_serial *serial = port->serial;
int result = 0;

dbg("%s - port %d", __func__, port->number);

/* Force default termio settings */
empeg_set_termios(tty, port, NULL) ;
empeg_set_termios(tty, port, NULL);

bytes_in = 0;
bytes_out = 0;
Expand Down
6 changes: 2 additions & 4 deletions drivers/usb/serial/ftdi_sio.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,8 +747,7 @@ static int ftdi_sio_probe(struct usb_serial *serial,
const struct usb_device_id *id);
static int ftdi_sio_port_probe(struct usb_serial_port *port);
static int ftdi_sio_port_remove(struct usb_serial_port *port);
static int ftdi_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp);
static int ftdi_open(struct tty_struct *tty, struct usb_serial_port *port);
static void ftdi_close(struct usb_serial_port *port);
static void ftdi_dtr_rts(struct usb_serial_port *port, int on);
static int ftdi_write(struct tty_struct *tty, struct usb_serial_port *port,
Expand Down Expand Up @@ -1680,8 +1679,7 @@ static int ftdi_sio_port_remove(struct usb_serial_port *port)
return 0;
}

static int ftdi_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp)
static int ftdi_open(struct tty_struct *tty, struct usb_serial_port *port)
{ /* ftdi_open */
struct usb_device *dev = port->serial->dev;
struct ftdi_private *priv = usb_get_serial_port_data(port);
Expand Down
3 changes: 1 addition & 2 deletions drivers/usb/serial/garmin_gps.c
Original file line number Diff line number Diff line change
Expand Up @@ -933,8 +933,7 @@ static int garmin_init_session(struct usb_serial_port *port)



static int garmin_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp)
static int garmin_open(struct tty_struct *tty, struct usb_serial_port *port)
{
unsigned long flags;
int status = 0;
Expand Down
3 changes: 1 addition & 2 deletions drivers/usb/serial/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ void usb_serial_generic_deregister(void)
#endif
}

int usb_serial_generic_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp)
int usb_serial_generic_open(struct tty_struct *tty, struct usb_serial_port *port)
{
struct usb_serial *serial = port->serial;
int result = 0;
Expand Down
6 changes: 2 additions & 4 deletions drivers/usb/serial/io_edgeport.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,7 @@ static void edge_bulk_out_data_callback(struct urb *urb);
static void edge_bulk_out_cmd_callback(struct urb *urb);

/* function prototypes for the usbserial callbacks */
static int edge_open(struct tty_struct *tty, struct usb_serial_port *port,
struct file *filp);
static int edge_open(struct tty_struct *tty, struct usb_serial_port *port);
static void edge_close(struct usb_serial_port *port);
static int edge_write(struct tty_struct *tty, struct usb_serial_port *port,
const unsigned char *buf, int count);
Expand Down Expand Up @@ -852,8 +851,7 @@ static void edge_bulk_out_cmd_callback(struct urb *urb)
* If successful, we return 0
* Otherwise we return a negative error number.
*****************************************************************************/
static int edge_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp)
static int edge_open(struct tty_struct *tty, struct usb_serial_port *port)
{
struct edgeport_port *edge_port = usb_get_serial_port_data(port);
struct usb_serial *serial;
Expand Down
3 changes: 1 addition & 2 deletions drivers/usb/serial/io_ti.c
Original file line number Diff line number Diff line change
Expand Up @@ -1831,8 +1831,7 @@ static void edge_bulk_out_callback(struct urb *urb)
tty_kref_put(tty);
}

static int edge_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp)
static int edge_open(struct tty_struct *tty, struct usb_serial_port *port)
{
struct edgeport_port *edge_port = usb_get_serial_port_data(port);
struct edgeport_serial *edge_serial;
Expand Down
9 changes: 2 additions & 7 deletions drivers/usb/serial/ipaq.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static int initial_wait;

/* Function prototypes for an ipaq */
static int ipaq_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp);
struct usb_serial_port *port);
static void ipaq_close(struct usb_serial_port *port);
static int ipaq_calc_num_ports(struct usb_serial *serial);
static int ipaq_startup(struct usb_serial *serial);
Expand Down Expand Up @@ -587,7 +587,7 @@ static int bytes_in;
static int bytes_out;

static int ipaq_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp)
struct usb_serial_port *port)
{
struct usb_serial *serial = port->serial;
struct ipaq_private *priv;
Expand Down Expand Up @@ -628,11 +628,6 @@ static int ipaq_open(struct tty_struct *tty,
priv->free_len += PACKET_SIZE;
}

if (tty) {
/* FIXME: These two are bogus */
tty->raw = 1;
tty->real_raw = 1;
}
/*
* Lose the small buffers usbserial provides. Make larger ones.
*/
Expand Down
3 changes: 1 addition & 2 deletions drivers/usb/serial/ipw.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,7 @@ static void ipw_read_bulk_callback(struct urb *urb)
return;
}

static int ipw_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp)
static int ipw_open(struct tty_struct *tty, struct usb_serial_port *port)
{
struct usb_device *dev = port->serial->dev;
u8 buf_flow_static[16] = IPW_BYTES_FLOWINIT;
Expand Down
6 changes: 2 additions & 4 deletions drivers/usb/serial/ir-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ static int buffer_size;
static int xbof = -1;

static int ir_startup (struct usb_serial *serial);
static int ir_open(struct tty_struct *tty, struct usb_serial_port *port,
struct file *filep);
static int ir_open(struct tty_struct *tty, struct usb_serial_port *port);
static void ir_close(struct usb_serial_port *port);
static int ir_write(struct tty_struct *tty, struct usb_serial_port *port,
const unsigned char *buf, int count);
Expand Down Expand Up @@ -296,8 +295,7 @@ static int ir_startup(struct usb_serial *serial)
return 0;
}

static int ir_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp)
static int ir_open(struct tty_struct *tty, struct usb_serial_port *port)
{
char *buffer;
int result = 0;
Expand Down
5 changes: 2 additions & 3 deletions drivers/usb/serial/iuu_phoenix.c
Original file line number Diff line number Diff line change
Expand Up @@ -1018,8 +1018,7 @@ static void iuu_close(struct usb_serial_port *port)
}
}

static int iuu_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp)
static int iuu_open(struct tty_struct *tty, struct usb_serial_port *port)
{
struct usb_serial *serial = port->serial;
u8 *buf;
Expand Down Expand Up @@ -1077,7 +1076,7 @@ static int iuu_open(struct tty_struct *tty,
tty->termios->c_iflag = 0;
priv->termios_initialized = 1;
priv->poll = 0;
}
}
spin_unlock_irqrestore(&priv->lock, flags);

/* initialize writebuf */
Expand Down
3 changes: 1 addition & 2 deletions drivers/usb/serial/keyspan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1209,8 +1209,7 @@ static int keyspan_write_room(struct tty_struct *tty)
}


static int keyspan_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp)
static int keyspan_open(struct tty_struct *tty, struct usb_serial_port *port)
{
struct keyspan_port_private *p_priv;
struct keyspan_serial_private *s_priv;
Expand Down
3 changes: 1 addition & 2 deletions drivers/usb/serial/keyspan.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@

/* Function prototypes for Keyspan serial converter */
static int keyspan_open (struct tty_struct *tty,
struct usb_serial_port *port,
struct file *filp);
struct usb_serial_port *port);
static void keyspan_close (struct usb_serial_port *port);
static void keyspan_dtr_rts (struct usb_serial_port *port, int on);
static int keyspan_startup (struct usb_serial *serial);
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/serial/keyspan_pda.c
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ static int keyspan_pda_carrier_raised(struct usb_serial_port *port)


static int keyspan_pda_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp)
struct usb_serial_port *port)
{
struct usb_serial *serial = port->serial;
unsigned char room;
Expand Down
10 changes: 2 additions & 8 deletions drivers/usb/serial/kl5kusb105.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ static int debug;
static int klsi_105_startup(struct usb_serial *serial);
static void klsi_105_disconnect(struct usb_serial *serial);
static void klsi_105_release(struct usb_serial *serial);
static int klsi_105_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp);
static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port);
static void klsi_105_close(struct usb_serial_port *port);
static int klsi_105_write(struct tty_struct *tty,
struct usb_serial_port *port, const unsigned char *buf, int count);
Expand Down Expand Up @@ -358,8 +357,7 @@ static void klsi_105_release(struct usb_serial *serial)
}
} /* klsi_105_release */

static int klsi_105_open(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp)
static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port)
{
struct klsi_105_private *priv = usb_get_serial_port_data(port);
int retval = 0;
Expand All @@ -371,10 +369,6 @@ static int klsi_105_open(struct tty_struct *tty,

dbg("%s port %d", __func__, port->number);

/* force low_latency on so that our tty_push actually forces
* the data through
* tty->low_latency = 1; */

/* Do a defined restart:
* Set up sane default baud rate and send the 'READ_ON'
* vendor command.
Expand Down
Loading

0 comments on commit a509a7e

Please sign in to comment.