Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 07814246 authored by Johan Hovold's avatar Johan Hovold
Browse files

USB: serial: allow subdrivers to modify port-endpoint mapping



Allow subdrivers to modify the port-endpoint mapping by passing the
endpoint descriptors to calc_num_ports.

The callback can now also be used to verify that the required endpoints
exists and abort probing otherwise.

This will allow us to get rid of a few hacks in subdrivers that are
already modifying the port-endpoint mapping (or aborting probe due to
missing endpoints), but only after the port structures have been setup.

Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
parent 2ac8fc51
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -611,7 +611,8 @@ static int f81534_find_config_idx(struct usb_serial *serial, u8 *index)
 * The f81534_calc_num_ports() will run to "new style" with checking
 * F81534_PORT_UNAVAILABLE section.
 */
static int f81534_calc_num_ports(struct usb_serial *serial)
static int f81534_calc_num_ports(struct usb_serial *serial,
					struct usb_serial_endpoints *epds)
{
	u8 setting[F81534_CUSTOM_DATA_SIZE];
	u8 setting_idx;
+4 −2
Original line number Diff line number Diff line
@@ -33,7 +33,8 @@ static int initial_wait;
/* Function prototypes for an ipaq */
static int  ipaq_open(struct tty_struct *tty,
			struct usb_serial_port *port);
static int  ipaq_calc_num_ports(struct usb_serial *serial);
static int ipaq_calc_num_ports(struct usb_serial *serial,
					struct usb_serial_endpoints *epds);
static int  ipaq_startup(struct usb_serial *serial);

static const struct usb_device_id ipaq_id_table[] = {
@@ -550,7 +551,8 @@ static int ipaq_open(struct tty_struct *tty,
	return usb_serial_generic_open(tty, port);
}

static int ipaq_calc_num_ports(struct usb_serial *serial)
static int ipaq_calc_num_ports(struct usb_serial *serial,
					struct usb_serial_endpoints *epds)
{
	/*
	 * some devices have 3 endpoints, the 3rd of which
+2 −1
Original line number Diff line number Diff line
@@ -973,7 +973,8 @@ static void mos7720_bulk_out_data_callback(struct urb *urb)
		tty_port_tty_wakeup(&mos7720_port->port->port);
}

static int mos77xx_calc_num_ports(struct usb_serial *serial)
static int mos77xx_calc_num_ports(struct usb_serial *serial,
					struct usb_serial_endpoints *epds)
{
	u16 product = le16_to_cpu(serial->dev->descriptor.idProduct);
	if (product == MOSCHIP_DEVICE_ID_7715)
+2 −1
Original line number Diff line number Diff line
@@ -2104,7 +2104,8 @@ static int mos7840_probe(struct usb_serial *serial,
	return 0;
}

static int mos7840_calc_num_ports(struct usb_serial *serial)
static int mos7840_calc_num_ports(struct usb_serial *serial,
					struct usb_serial_endpoints *epds)
{
	int device_type = (unsigned long)usb_get_serial_data(serial);
	int mos7840_num_ports;
+2 −1
Original line number Diff line number Diff line
@@ -946,7 +946,8 @@ static void mxuport_set_termios(struct tty_struct *tty,
 * Determine how many ports this device has dynamically.  It will be
 * called after the probe() callback is called, but before attach().
 */
static int mxuport_calc_num_ports(struct usb_serial *serial)
static int mxuport_calc_num_ports(struct usb_serial *serial,
					struct usb_serial_endpoints *epds)
{
	unsigned long features = (unsigned long)usb_get_serial_data(serial);

Loading