Merge "Merge android-5.4-stable.50 (a200ad5) into msm-5.4"

This commit is contained in:
qctecmdr 2020-07-21 02:33:03 -07:00 • committed by Gerrit - the friendly Code Review server
commit 0241c6609d
1032 changed files with 78198 additions and 70313 deletions

View file

@ -665,11 +665,10 @@ static struct gsm_msg *gsm_data_alloc(struct gsm_mux *gsm, u8 addr, int len,
* FIXME: lock against link layer control transmissions
*/
static void gsm_data_kick(struct gsm_mux *gsm)
static void gsm_data_kick(struct gsm_mux *gsm, struct gsm_dlci *dlci)
{
struct gsm_msg *msg, *nmsg;
int len;
int skip_sof = 0;
list_for_each_entry_safe(msg, nmsg, &gsm->tx_list, list) {
if (gsm->constipated && msg->addr)
@ -691,18 +690,23 @@ static void gsm_data_kick(struct gsm_mux *gsm)
print_hex_dump_bytes("gsm_data_kick: ",
DUMP_PREFIX_OFFSET,
gsm->txframe, len);
if (gsm->output(gsm, gsm->txframe + skip_sof,
len - skip_sof) < 0)
if (gsm->output(gsm, gsm->txframe, len) < 0)
break;
/* FIXME: Can eliminate one SOF in many more cases */
gsm->tx_bytes -= msg->len;
/* For a burst of frames skip the extra SOF within the
burst */
skip_sof = 1;
list_del(&msg->list);
kfree(msg);
if (dlci) {
tty_port_tty_wakeup(&dlci->port);
} else {
int i = 0;
for (i = 0; i < NUM_DLCI; i++)
if (gsm->dlci[i])
tty_port_tty_wakeup(&gsm->dlci[i]->port);
}
}
}
@ -754,7 +758,7 @@ static void __gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg)
/* Add to the actual output queue */
list_add_tail(&msg->list, &gsm->tx_list);
gsm->tx_bytes += msg->len;
gsm_data_kick(gsm);
gsm_data_kick(gsm, dlci);
}
/**
@ -1215,7 +1219,7 @@ static void gsm_control_message(struct gsm_mux *gsm, unsigned int command,
gsm_control_reply(gsm, CMD_FCON, NULL, 0);
/* Kick the link in case it is idling */
spin_lock_irqsave(&gsm->tx_lock, flags);
gsm_data_kick(gsm);
gsm_data_kick(gsm, NULL);
spin_unlock_irqrestore(&gsm->tx_lock, flags);
break;
case CMD_FCOFF:
@ -2525,7 +2529,7 @@ static void gsmld_write_wakeup(struct tty_struct *tty)
/* Queue poll */
clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
spin_lock_irqsave(&gsm->tx_lock, flags);
gsm_data_kick(gsm);
gsm_data_kick(gsm, NULL);
if (gsm->tx_bytes < TX_THRESH_LO) {
gsm_dlci_data_sweep(gsm);
}

View file

@ -1026,7 +1026,7 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
gpios = mctrl_gpio_init(&uart->port, 0);
if (IS_ERR(gpios)) {
ret = PTR_ERR(gpios);
goto out_unlock;
goto err;
} else {
uart->gpios = gpios;
}
@ -1075,8 +1075,10 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
serial8250_apply_quirks(uart);
ret = uart_add_one_port(&serial8250_reg,
&uart->port);
if (ret == 0)
ret = uart->port.line;
if (ret)
goto err;
ret = uart->port.line;
} else {
dev_info(uart->port.dev,
"skipping CIR port at 0x%lx / 0x%llx, IRQ %d\n",
@ -1098,10 +1100,14 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
}
}
out_unlock:
mutex_unlock(&serial_mutex);
return ret;
err:
uart->port.dev = NULL;
mutex_unlock(&serial_mutex);
return ret;
}
EXPORT_SYMBOL(serial8250_register_8250_port);

View file

@ -1871,12 +1871,6 @@ pci_moxa_setup(struct serial_private *priv,
#define PCIE_DEVICE_ID_WCH_CH384_4S 0x3470
#define PCIE_DEVICE_ID_WCH_CH382_2S 0x3253
#define PCI_VENDOR_ID_PERICOM 0x12D8
#define PCI_DEVICE_ID_PERICOM_PI7C9X7951 0x7951
#define PCI_DEVICE_ID_PERICOM_PI7C9X7952 0x7952
#define PCI_DEVICE_ID_PERICOM_PI7C9X7954 0x7954
#define PCI_DEVICE_ID_PERICOM_PI7C9X7958 0x7958
#define PCI_VENDOR_ID_ACCESIO 0x494f
#define PCI_DEVICE_ID_ACCESIO_PCIE_COM_2SDB 0x1051
#define PCI_DEVICE_ID_ACCESIO_MPCIE_COM_2S 0x1053

View file

@ -2539,6 +2539,8 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port,
struct ktermios *termios,
struct ktermios *old)
{
unsigned int tolerance = port->uartclk / 100;
/*
* Ask the core to calculate the divisor for us.
* Allow 1% tolerance at the upper limit so uart clks marginally
@ -2547,7 +2549,7 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port,
*/
return uart_get_baud_rate(port, termios, old,
port->uartclk / 16 / UART_DIV_MAX,
port->uartclk);
(port->uartclk + tolerance) / 16);
}
void

View file

@ -2585,6 +2585,7 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap,
uap->port.fifosize = uap->fifosize;
uap->port.flags = UPF_BOOT_AUTOCONF;
uap->port.line = index;
spin_lock_init(&uap->port.lock);
amba_ports[index] = uap;

View file

@ -20,6 +20,7 @@
#include <linux/vt_kern.h>
#include <linux/input.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#define MAX_CONFIG_LEN 40
@ -27,6 +28,7 @@ static struct kgdb_io kgdboc_io_ops;
/* -1 = init not run yet, 0 = unconfigured, 1 = configured. */
static int configured = -1;
static DEFINE_MUTEX(config_mutex);
static char config[MAX_CONFIG_LEN];
static struct kparam_string kps = {
@ -38,6 +40,8 @@ static int kgdboc_use_kms; /* 1 if we use kernel mode switching */
static struct tty_driver *kgdb_tty_driver;
static int kgdb_tty_line;
static struct platform_device *kgdboc_pdev;
#ifdef CONFIG_KDB_KEYBOARD
static int kgdboc_reset_connect(struct input_handler *handler,
struct input_dev *dev,
@ -133,11 +137,13 @@ static void kgdboc_unregister_kbd(void)
static void cleanup_kgdboc(void)
{
if (configured != 1)
return;
if (kgdb_unregister_nmi_console())
return;
kgdboc_unregister_kbd();
if (configured == 1)
kgdb_unregister_io_module(&kgdboc_io_ops);
kgdb_unregister_io_module(&kgdboc_io_ops);
}
static int configure_kgdboc(void)
@ -200,20 +206,79 @@ nmi_con_failed:
kgdb_unregister_io_module(&kgdboc_io_ops);
noconfig:
kgdboc_unregister_kbd();
config[0] = 0;
configured = 0;
cleanup_kgdboc();
return err;
}
static int kgdboc_probe(struct platform_device *pdev)
{
int ret = 0;
mutex_lock(&config_mutex);
if (configured != 1) {
ret = configure_kgdboc();
/* Convert "no device" to "defer" so we'll keep trying */
if (ret == -ENODEV)
ret = -EPROBE_DEFER;
}
mutex_unlock(&config_mutex);
return ret;
}
static struct platform_driver kgdboc_platform_driver = {
.probe = kgdboc_probe,
.driver = {
.name = "kgdboc",
.suppress_bind_attrs = true,
},
};
static int __init init_kgdboc(void)
{
/* Already configured? */
if (configured == 1)
int ret;
/*
* kgdboc is a little bit of an odd "platform_driver". It can be
* up and running long before the platform_driver object is
* created and thus doesn't actually store anything in it. There's
* only one instance of kgdb so anything is stored as global state.
* The platform_driver is only created so that we can leverage the
* kernel's mechanisms (like -EPROBE_DEFER) to call us when our
* underlying tty is ready. Here we init our platform driver and
* then create the single kgdboc instance.
*/
ret = platform_driver_register(&kgdboc_platform_driver);
if (ret)
return ret;
kgdboc_pdev = platform_device_alloc("kgdboc", PLATFORM_DEVID_NONE);
if (!kgdboc_pdev) {
ret = -ENOMEM;
goto err_did_register;
}
ret = platform_device_add(kgdboc_pdev);
if (!ret)
return 0;
return configure_kgdboc();
platform_device_put(kgdboc_pdev);
err_did_register:
platform_driver_unregister(&kgdboc_platform_driver);
return ret;
}
static void exit_kgdboc(void)
{
mutex_lock(&config_mutex);
cleanup_kgdboc();
mutex_unlock(&config_mutex);
platform_device_unregister(kgdboc_pdev);
platform_driver_unregister(&kgdboc_platform_driver);
}
static int kgdboc_get_char(void)
@ -236,24 +301,20 @@ static int param_set_kgdboc_var(const char *kmessage,
const struct kernel_param *kp)
{
size_t len = strlen(kmessage);
int ret = 0;
if (len >= MAX_CONFIG_LEN) {
pr_err("config string too long\n");
return -ENOSPC;
}
/* Only copy in the string if the init function has not run yet */
if (configured < 0) {
strcpy(config, kmessage);
return 0;
}
if (kgdb_connected) {
pr_err("Cannot reconfigure while KGDB is connected.\n");
return -EBUSY;
}
mutex_lock(&config_mutex);
strcpy(config, kmessage);
/* Chop out \n char as a result of echo */
if (len && config[len - 1] == '\n')
@ -262,8 +323,30 @@ static int param_set_kgdboc_var(const char *kmessage,
if (configured == 1)
cleanup_kgdboc();
/* Go and configure with the new params. */
return configure_kgdboc();
/*
* Configure with the new params as long as init already ran.
* Note that we can get called before init if someone loads us
* with "modprobe kgdboc kgdboc=..." or if they happen to use the
* the odd syntax of "kgdboc.kgdboc=..." on the kernel command.
*/
if (configured >= 0)
ret = configure_kgdboc();
/*
* If we couldn't configure then clear out the config. Note that
* specifying an invalid config on the kernel command line vs.
* through sysfs have slightly different behaviors. If we fail
* to configure what was specified on the kernel command line
* we'll leave it in the 'config' and return -EPROBE_DEFER from
* our probe. When specified through sysfs userspace is
* responsible for loading the tty driver before setting up.
*/
if (ret)
config[0] = '\0';
mutex_unlock(&config_mutex);
return ret;
}
static int dbg_restore_graphics;
@ -326,15 +409,8 @@ __setup("kgdboc=", kgdboc_option_setup);
/* This is only available if kgdboc is a built in for early debugging */
static int __init kgdboc_early_init(char *opt)
{
/* save the first character of the config string because the
* init routine can destroy it.
*/
char save_ch;
kgdboc_option_setup(opt);
save_ch = config[0];
init_kgdboc();
config[0] = save_ch;
configure_kgdboc();
return 0;
}
@ -342,7 +418,7 @@ early_param("ekgdboc", kgdboc_early_init);
#endif /* CONFIG_KGDB_SERIAL_CONSOLE */
module_init(init_kgdboc);
module_exit(cleanup_kgdboc);
module_exit(exit_kgdboc);
module_param_call(kgdboc, param_set_kgdboc_var, param_get_string, &kps, 0644);
MODULE_PARM_DESC(kgdboc, "<serial_device>[,baud]");
MODULE_DESCRIPTION("KGDB Console TTY Driver");

View file

@ -127,7 +127,11 @@ static DEFINE_SPINLOCK(func_buf_lock); /* guard 'func_buf' and friends */
static unsigned long key_down[BITS_TO_LONGS(KEY_CNT)]; /* keyboard key bitmap */
static unsigned char shift_down[NR_SHIFT]; /* shift state counters.. */
static bool dead_key_next;
static int npadch = -1; /* -1 or number assembled on pad */
/* Handles a number being assembled on the number pad */
static bool npadch_active;
static unsigned int npadch_value;
static unsigned int diacr;
static char rep; /* flag telling character repeat */
@ -845,12 +849,12 @@ static void k_shift(struct vc_data *vc, unsigned char value, char up_flag)
shift_state &= ~(1 << value);
/* kludge */
if (up_flag && shift_state != old_state && npadch != -1) {
if (up_flag && shift_state != old_state && npadch_active) {
if (kbd->kbdmode == VC_UNICODE)
to_utf8(vc, npadch);
to_utf8(vc, npadch_value);
else
put_queue(vc, npadch & 0xff);
npadch = -1;
put_queue(vc, npadch_value & 0xff);
npadch_active = false;
}
}
@ -868,7 +872,7 @@ static void k_meta(struct vc_data *vc, unsigned char value, char up_flag)
static void k_ascii(struct vc_data *vc, unsigned char value, char up_flag)
{
int base;
unsigned int base;
if (up_flag)
return;
@ -882,10 +886,12 @@ static void k_ascii(struct vc_data *vc, unsigned char value, char up_flag)
base = 16;
}
if (npadch == -1)
npadch = value;
else
npadch = npadch * base + value;
if (!npadch_active) {
npadch_value = 0;
npadch_active = true;
}
npadch_value = npadch_value * base + value;
}
static void k_lock(struct vc_data *vc, unsigned char value, char up_flag)