aboutsummaryrefslogtreecommitdiffstats
diff options
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-05 10:48:38 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-05 10:48:38 -0700
commit5a0af5e5cedb0a4b84f731b07ac06560af12894f (patch)
tree9bd135a26170cde5828ad004e944c0192ab60d20
parent55f6dd5580cda146f328b8aff2de1460347bb840 (diff)
downloadpatches-5a0af5e5cedb0a4b84f731b07ac06560af12894f.tar.gz
fix up usb to serial minor number patches
-rw-r--r--series1
-rw-r--r--usb-serial-idr.patch8
-rw-r--r--usb-serial-increase-the-number-of-devices-we-support.patch59
-rw-r--r--usb-serial-ports-add-minor-and-port-number.patch89
4 files changed, 92 insertions, 65 deletions
diff --git a/series b/series
index 705b12cbfa4c1b..433ac1f1cca7c8 100644
--- a/series
+++ b/series
@@ -1,6 +1,7 @@
# My specific stuff, at the top to make it easier to work stuff below.
usb-serial-ports-add-minor-and-port-number.patch
usb-serial-idr.patch
+usb-serial-increase-the-number-of-devices-we-support.patch
0001-Simulate-fake-Fn-key-on-PS-2-keyboards-w-o-one-eg.-C.patch
devnode_gid.patch
0001-kdbus-interprocess-message-router.patch
diff --git a/usb-serial-idr.patch b/usb-serial-idr.patch
index be364cb08ddf02..1b5f43e5d737a9 100644
--- a/usb-serial-idr.patch
+++ b/usb-serial-idr.patch
@@ -2,7 +2,7 @@ From foo@baz Tue Jun 4 12:06:11 PDT 2013
Date: Tue, 04 Jun 2013 12:06:11 -0700
To: Greg KH <gregkh@linuxfoundation.org>
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Subject: [PATCH 2/2] USB: serial: make minor allocation dynamic
+Subject: [PATCH 2/3] USB: serial: make minor allocation dynamic
This moves the allocation of minor device numbers from a static array to
be dynamic, using the idr interface. This means that you could
@@ -155,7 +155,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mutex_unlock(&table_lock);
}
-@@ -1042,7 +1047,7 @@ static int usb_serial_probe(struct usb_i
+@@ -1040,7 +1045,7 @@ static int usb_serial_probe(struct usb_i
*/
serial->disconnected = 1;
@@ -164,7 +164,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
dev_err(ddev, "No more free serial devices\n");
goto probe_error;
}
-@@ -1226,7 +1231,6 @@ static struct usb_driver usb_serial_driv
+@@ -1224,7 +1229,6 @@ static struct usb_driver usb_serial_driv
static int __init usb_serial_init(void)
{
@@ -172,7 +172,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
int result;
usb_serial_tty_driver = alloc_tty_driver(SERIAL_TTY_MINORS);
-@@ -1234,9 +1238,6 @@ static int __init usb_serial_init(void)
+@@ -1232,9 +1236,6 @@ static int __init usb_serial_init(void)
return -ENOMEM;
/* Initialize our global data */
diff --git a/usb-serial-increase-the-number-of-devices-we-support.patch b/usb-serial-increase-the-number-of-devices-we-support.patch
new file mode 100644
index 00000000000000..97096a24b93978
--- /dev/null
+++ b/usb-serial-increase-the-number-of-devices-we-support.patch
@@ -0,0 +1,59 @@
+From foo@baz Wed Jun 5 10:45:16 PDT 2013
+Date: Wed, 05 Jun 2013 10:45:16 -0700
+To: Greg KH <gregkh@linuxfoundation.org>
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Subject: [PATCH 3/3] USB: serial: increase the number of devices we support
+
+We had the limit of 255 USB to serial devices on one system for almost
+15 years, with no complaints. But now it's time to move on from these
+tiny "baby" systems, and bump the number up to 3000, which should last
+us a few more years.
+
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/usb-serial.c | 8 ++++++--
+ include/linux/usb/serial.h | 4 ----
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+--- a/drivers/usb/serial/usb-serial.c
++++ b/drivers/usb/serial/usb-serial.c
+@@ -43,6 +43,10 @@
+ #define DRIVER_AUTHOR "Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
+ #define DRIVER_DESC "USB Serial Driver core"
+
++#define SERIAL_TTY_MAJOR 188
++#define SERIAL_TTY_MINORS 3000 /* should be enough for a while */
++#define SERIAL_TTY_NO_MINOR (SERIAL_TTY_MINORS + 1)
++
+ /* There is no MODULE_DEVICE_TABLE for usbserial.c. Instead
+ the MODULE_DEVICE_TABLE declarations in each serial driver
+ cause the "hotplug" program to pull in whatever module is necessary
+@@ -105,12 +109,12 @@ static int get_free_serial(struct usb_se
+
+ dev_dbg(&serial->interface->dev, "%s %d\n", __func__, num_ports);
+
+- *minor = 0xffffffff;
++ *minor = SERIAL_TTY_NO_MINOR;
+ for (i = 0; i < num_ports; ++i) {
+ x = get_free_port(serial->port[i]);
+ if (x < 0)
+ goto error;
+- if (*minor == 0xffffffff)
++ if (*minor == SERIAL_TTY_NO_MINOR)
+ *minor = x;
+ serial->port[i]->port_number = i;
+ }
+--- a/include/linux/usb/serial.h
++++ b/include/linux/usb/serial.h
+@@ -19,10 +19,6 @@
+ #include <linux/sysrq.h>
+ #include <linux/kfifo.h>
+
+-#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */
+-#define SERIAL_TTY_MINORS 254 /* loads of devices :) */
+-#define SERIAL_TTY_NO_MINOR 0xffffffff /* No minor was assigned */
+-
+ /* The maximum number of ports one device can grab at once */
+ #define MAX_NUM_PORTS 8
+
diff --git a/usb-serial-ports-add-minor-and-port-number.patch b/usb-serial-ports-add-minor-and-port-number.patch
index bb2dc17c7f4230..467c82e9234306 100644
--- a/usb-serial-ports-add-minor-and-port-number.patch
+++ b/usb-serial-ports-add-minor-and-port-number.patch
@@ -2,7 +2,7 @@ From foo@baz Tue Jun 4 11:51:13 PDT 2013
Date: Tue, 04 Jun 2013 11:51:13 -0700
To: Greg KH <gregkh@linuxfoundation.org>
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Subject: [PATCH 1/2] USB: serial: ports: add minor and port number
+Subject: [PATCH 1/3] USB: serial: ports: add minor and port number
The usb_serial_port structure had the number field, which was the minor
number for the port, which almost no one really cared about. They
@@ -29,9 +29,9 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/garmin_gps.c | 6 +--
drivers/usb/serial/io_edgeport.c | 60 ++++++++++++--------------------
drivers/usb/serial/io_ti.c | 21 ++++-------
- drivers/usb/serial/keyspan.c | 31 +++++++---------
+ drivers/usb/serial/keyspan.c | 29 ++++++---------
drivers/usb/serial/metro-usb.c | 4 +-
- drivers/usb/serial/mos7720.c | 39 ++++++++++----------
+ drivers/usb/serial/mos7720.c | 37 +++++++++----------
drivers/usb/serial/mos7840.c | 52 +++++++++------------------
drivers/usb/serial/opticon.c | 2 -
drivers/usb/serial/pl2303.c | 2 -
@@ -41,9 +41,8 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/usb-serial.c | 7 ++-
drivers/usb/serial/usb_wwan.c | 2 -
drivers/usb/serial/whiteheat.c | 20 +++++-----
- drivers/usb/serial/zte_ev.c | 4 +-
include/linux/usb/serial.h | 6 ++-
- 25 files changed, 138 insertions(+), 185 deletions(-)
+ 24 files changed, 134 insertions(+), 181 deletions(-)
--- a/drivers/staging/serqt_usb2/serqt_usb2.c
+++ b/drivers/staging/serqt_usb2/serqt_usb2.c
@@ -184,7 +183,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
-@@ -423,7 +423,7 @@ static void cypress_set_dead(struct usb_
+@@ -435,7 +435,7 @@ static void cypress_set_dead(struct usb_
spin_unlock_irqrestore(&priv->lock, flags);
dev_err(&port->dev, "cypress_m8 suspending failing port %d - "
@@ -193,7 +192,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
}
-@@ -651,7 +651,7 @@ static int cypress_write(struct tty_stru
+@@ -667,7 +667,7 @@ static int cypress_write(struct tty_stru
{
struct cypress_private *priv = usb_get_serial_port_data(port);
@@ -534,19 +533,16 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
if (tty) {
cflag = tty->termios.c_cflag;
/* Baud rate calculation takes baud rate as an integer
-@@ -1557,9 +1557,9 @@ static int keyspan_usa26_send_setup(stru
+@@ -1556,7 +1556,7 @@ static int keyspan_usa26_send_setup(stru
s_priv = usb_get_serial_data(serial);
p_priv = usb_get_serial_port_data(port);
d_details = s_priv->device_details;
- device_port = port->number - port->serial->minor;
+ device_port = port->port_number;
-- outcont_urb = d_details->outcont_endpoints[port->number];
-+ outcont_urb = d_details->outcont_endpoints[device_port];
this_urb = p_priv->outcont_urb;
- dev_dbg(&port->dev, "%s - endpoint %d\n", __func__, usb_pipeendpoint(this_urb->pipe));
-@@ -1710,7 +1710,7 @@ static int keyspan_usa28_send_setup(stru
+@@ -1700,7 +1700,7 @@ static int keyspan_usa28_send_setup(stru
s_priv = usb_get_serial_data(serial);
p_priv = usb_get_serial_port_data(port);
d_details = s_priv->device_details;
@@ -555,7 +551,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
/* only do something if we have a bulk out endpoint */
this_urb = p_priv->outcont_urb;
-@@ -1840,17 +1840,16 @@ static int keyspan_usa49_send_setup(stru
+@@ -1830,17 +1830,16 @@ static int keyspan_usa49_send_setup(stru
this_urb = s_priv->glocont_urb;
/* Work out which port within the device is being setup */
@@ -577,7 +573,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
/* Save reset port val for resend.
Don't overwrite resend for open/close condition. */
-@@ -1865,7 +1864,6 @@ static int keyspan_usa49_send_setup(stru
+@@ -1855,7 +1854,6 @@ static int keyspan_usa49_send_setup(stru
memset(&msg, 0, sizeof(struct keyspan_usa49_portControlMessage));
@@ -585,7 +581,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
msg.portNumber = device_port;
/* Only set baud rate if it's changed */
-@@ -2155,12 +2153,11 @@ static int keyspan_usa67_send_setup(stru
+@@ -2145,12 +2143,11 @@ static int keyspan_usa67_send_setup(stru
this_urb = s_priv->glocont_urb;
/* Work out which port within the device is being setup */
@@ -600,7 +596,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
return -1;
}
-@@ -2401,7 +2398,7 @@ static int keyspan_port_probe(struct usb
+@@ -2391,7 +2388,7 @@ static int keyspan_port_probe(struct usb
/* Setup values for the various callback routines */
cback = &keyspan_callbacks[d_details->msg_format];
@@ -624,7 +620,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
-@@ -1036,7 +1036,7 @@ static int mos7720_open(struct tty_struc
+@@ -1047,7 +1047,7 @@ static int mos7720_open(struct tty_struc
*
* 0x08 : SP1/2 Control Reg
*/
@@ -633,7 +629,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
read_mos_reg(serial, port_number, LSR, &data);
dev_dbg(&port->dev, "SS::%p LSR:%x\n", mos7720_port, data);
-@@ -1055,7 +1055,7 @@ static int mos7720_open(struct tty_struc
+@@ -1066,7 +1066,7 @@ static int mos7720_open(struct tty_struc
write_mos_reg(serial, port_number, SP_CONTROL_REG, 0x00);
read_mos_reg(serial, dummy, SP_CONTROL_REG, &data);
@@ -642,7 +638,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
write_mos_reg(serial, dummy, SP_CONTROL_REG, data);
mos7720_port->shadowLCR = 0x83;
write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR);
-@@ -1136,8 +1136,8 @@ static void mos7720_close(struct usb_ser
+@@ -1147,8 +1147,8 @@ static void mos7720_close(struct usb_ser
usb_kill_urb(port->write_urb);
usb_kill_urb(port->read_urb);
@@ -653,7 +649,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mos7720_port->open = 0;
}
-@@ -1161,8 +1161,7 @@ static void mos7720_break(struct tty_str
+@@ -1172,8 +1172,7 @@ static void mos7720_break(struct tty_str
data = mos7720_port->shadowLCR & ~UART_LCR_SBC;
mos7720_port->shadowLCR = data;
@@ -663,7 +659,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
}
/*
-@@ -1293,8 +1292,8 @@ static void mos7720_throttle(struct tty_
+@@ -1304,8 +1303,8 @@ static void mos7720_throttle(struct tty_
/* if we are implementing RTS/CTS, toggle that line */
if (tty->termios.c_cflag & CRTSCTS) {
mos7720_port->shadowMCR &= ~UART_MCR_RTS;
@@ -674,7 +670,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
if (status != 0)
return;
}
-@@ -1325,8 +1324,8 @@ static void mos7720_unthrottle(struct tt
+@@ -1336,8 +1335,8 @@ static void mos7720_unthrottle(struct tt
/* if we are implementing RTS/CTS, toggle that line */
if (tty->termios.c_cflag & CRTSCTS) {
mos7720_port->shadowMCR |= UART_MCR_RTS;
@@ -685,7 +681,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
if (status != 0)
return;
}
-@@ -1350,7 +1349,7 @@ static int set_higher_rates(struct mosch
+@@ -1361,7 +1360,7 @@ static int set_higher_rates(struct mosch
* Init Sequence for higher rates
***********************************************/
dev_dbg(&port->dev, "Sending Setting Commands ..........\n");
@@ -694,7 +690,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
write_mos_reg(serial, port_number, IER, 0x00);
write_mos_reg(serial, port_number, FCR, 0x00);
-@@ -1476,7 +1475,7 @@ static int send_cmd_write_baud_rate(stru
+@@ -1487,7 +1486,7 @@ static int send_cmd_write_baud_rate(stru
port = mos7720_port->port;
serial = port->serial;
@@ -703,7 +699,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
dev_dbg(&port->dev, "%s - baud = %d\n", __func__, baudrate);
/* Calculate the Divisor */
-@@ -1527,7 +1526,7 @@ static void change_port_settings(struct
+@@ -1538,7 +1537,7 @@ static void change_port_settings(struct
port = mos7720_port->port;
serial = port->serial;
@@ -712,16 +708,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
if (!mos7720_port->open) {
dev_dbg(&port->dev, "%s - port not opened\n", __func__);
-@@ -1618,7 +1617,7 @@ static void change_port_settings(struct
- mos7720_port->shadowMCR |= (UART_MCR_XONANY);
- /* To set hardware flow control to the specified *
- * serial port, in SP1/2_CONTROL_REG */
-- if (port->number)
-+ if (port->port_number)
- write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x01);
- else
- write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x02);
-@@ -1720,7 +1719,7 @@ static int get_lsr_info(struct tty_struc
+@@ -1731,7 +1730,7 @@ static int get_lsr_info(struct tty_struc
struct usb_serial_port *port = tty->driver_data;
unsigned int result = 0;
unsigned char data = 0;
@@ -730,7 +717,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
int count;
count = mos7720_chars_in_buffer(tty);
-@@ -1782,8 +1781,8 @@ static int mos7720_tiocmset(struct tty_s
+@@ -1793,8 +1792,8 @@ static int mos7720_tiocmset(struct tty_s
mcr &= ~UART_MCR_LOOP;
mos7720_port->shadowMCR = mcr;
@@ -741,7 +728,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
return 0;
}
-@@ -1827,8 +1826,8 @@ static int set_modem_info(struct moschip
+@@ -1838,8 +1837,8 @@ static int set_modem_info(struct moschip
}
mos7720_port->shadowMCR = mcr;
@@ -752,7 +739,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
return 0;
}
-@@ -1845,7 +1844,7 @@ static int get_serial_info(struct moschi
+@@ -1856,7 +1855,7 @@ static int get_serial_info(struct moschi
tmp.type = PORT_16550A;
tmp.line = mos7720_port->port->serial->minor;
@@ -887,7 +874,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tmp.irq = 0;
tmp.flags = ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ;
tmp.xmit_fifo_size = NUM_URBS * URB_TRANSFER_BUFFER_SIZE;
-@@ -2221,7 +2206,7 @@ static int mos7840_port_probe(struct usb
+@@ -2240,7 +2225,7 @@ static int mos7840_port_probe(struct usb
/* we set up the pointers to the endpoints in the mos7840_open *
* function, as the structures aren't created yet. */
@@ -896,7 +883,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
dev_dbg(&port->dev, "mos7840_startup: configuring port %d\n", pnum);
mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL);
-@@ -2242,7 +2227,6 @@ static int mos7840_port_probe(struct usb
+@@ -2261,7 +2246,6 @@ static int mos7840_port_probe(struct usb
* usb-serial.c:get_free_serial() and cannot therefore be used
* to index device instances */
mos7840_port->port_num = pnum + 1;
@@ -1022,7 +1009,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
}
mutex_unlock(&table_lock);
return serial;
-@@ -1050,7 +1051,7 @@ static int usb_serial_probe(struct usb_i
+@@ -1048,7 +1049,7 @@ static int usb_serial_probe(struct usb_i
/* register all of the individual ports with the driver core */
for (i = 0; i < num_ports; ++i) {
port = serial->port[i];
@@ -1134,26 +1121,6 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
return firm_send_command(port, WHITEHEAT_REPORT_TX_DONE,
(__u8 *)&close_command, sizeof(close_command));
}
---- a/drivers/usb/serial/zte_ev.c
-+++ b/drivers/usb/serial/zte_ev.c
-@@ -41,7 +41,7 @@ static int zte_ev_usb_serial_open(struct
- int len;
- unsigned char *buf;
-
-- if (port->number != 0)
-+ if (port->port_number != 0)
- return -ENODEV;
-
- buf = kmalloc(MAX_SETUP_DATA_SIZE, GFP_KERNEL);
-@@ -166,7 +166,7 @@ static void zte_ev_usb_serial_close(stru
- int len;
- unsigned char *buf;
-
-- if (port->number != 0)
-+ if (port->port_number != 0)
- return;
-
- buf = kmalloc(MAX_SETUP_DATA_SIZE, GFP_KERNEL);
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -37,7 +37,8 @@