diff options
Diffstat (limited to 'drivers/input/serio')
-rw-r--r-- | drivers/input/serio/Makefile | 1 | ||||
-rw-r--r-- | drivers/input/serio/gscps2.c | 10 | ||||
-rw-r--r-- | drivers/input/serio/hil_mlc.c | 4 | ||||
-rw-r--r-- | drivers/input/serio/hp_sdc.c | 15 | ||||
-rw-r--r-- | drivers/input/serio/i8042-sparcio.h | 1 | ||||
-rw-r--r-- | drivers/input/serio/ps2-gpio.c | 1 | ||||
-rw-r--r-- | drivers/input/serio/sa1111ps2.c | 69 |
7 files changed, 56 insertions, 45 deletions
diff --git a/drivers/input/serio/Makefile b/drivers/input/serio/Makefile index 767bd9b6e1ed..a3ca07621542 100644 --- a/drivers/input/serio/Makefile +++ b/drivers/input/serio/Makefile @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 # # Makefile for the input core drivers. # diff --git a/drivers/input/serio/gscps2.c b/drivers/input/serio/gscps2.c index ecba666afadb..aa9f29b875de 100644 --- a/drivers/input/serio/gscps2.c +++ b/drivers/input/serio/gscps2.c @@ -325,7 +325,7 @@ static void gscps2_close(struct serio *port) * @return: success/error report */ -static int gscps2_probe(struct parisc_device *dev) +static int __init gscps2_probe(struct parisc_device *dev) { struct gscps2port *ps2port; struct serio *serio; @@ -412,7 +412,7 @@ fail_nomem: * @return: success/error report */ -static int gscps2_remove(struct parisc_device *dev) +static int __exit gscps2_remove(struct parisc_device *dev) { struct gscps2port *ps2port = dev_get_drvdata(&dev->dev); @@ -430,7 +430,7 @@ static int gscps2_remove(struct parisc_device *dev) } -static struct parisc_device_id gscps2_device_tbl[] = { +static const struct parisc_device_id gscps2_device_tbl[] __initconst = { { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00084 }, /* LASI PS/2 */ #ifdef DINO_TESTED { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00096 }, /* DINO PS/2 */ @@ -439,11 +439,11 @@ static struct parisc_device_id gscps2_device_tbl[] = { }; MODULE_DEVICE_TABLE(parisc, gscps2_device_tbl); -static struct parisc_driver parisc_ps2_driver = { +static struct parisc_driver parisc_ps2_driver __refdata = { .name = "gsc_ps2", .id_table = gscps2_device_tbl, .probe = gscps2_probe, - .remove = gscps2_remove, + .remove = __exit_p(gscps2_remove), }; static int __init gscps2_init(void) diff --git a/drivers/input/serio/hil_mlc.c b/drivers/input/serio/hil_mlc.c index 65605e4ef3cf..d66d01c5373b 100644 --- a/drivers/input/serio/hil_mlc.c +++ b/drivers/input/serio/hil_mlc.c @@ -784,7 +784,7 @@ static void hil_mlcs_process(unsigned long unused) /************************* Keepalive timer task *********************/ -static void hil_mlcs_timer(unsigned long data) +static void hil_mlcs_timer(struct timer_list *unused) { hil_mlcs_probe = 1; tasklet_schedule(&hil_mlcs_tasklet); @@ -998,7 +998,7 @@ int hil_mlc_unregister(hil_mlc *mlc) static int __init hil_mlc_init(void) { - setup_timer(&hil_mlcs_kicker, &hil_mlcs_timer, 0); + timer_setup(&hil_mlcs_kicker, &hil_mlcs_timer, 0); mod_timer(&hil_mlcs_kicker, jiffies + HZ); tasklet_enable(&hil_mlcs_tasklet); diff --git a/drivers/input/serio/hp_sdc.c b/drivers/input/serio/hp_sdc.c index 559c99ca6592..1d7c7d81a5ef 100644 --- a/drivers/input/serio/hp_sdc.c +++ b/drivers/input/serio/hp_sdc.c @@ -794,7 +794,7 @@ int hp_sdc_release_cooked_irq(hp_sdc_irqhook *callback) /************************* Keepalive timer task *********************/ -static void hp_sdc_kicker(unsigned long data) +static void hp_sdc_kicker(struct timer_list *unused) { tasklet_schedule(&hp_sdc.task); /* Re-insert the periodic task. */ @@ -805,7 +805,7 @@ static void hp_sdc_kicker(unsigned long data) #if defined(__hppa__) -static const struct parisc_device_id hp_sdc_tbl[] = { +static const struct parisc_device_id hp_sdc_tbl[] __initconst = { { .hw_type = HPHW_FIO, .hversion_rev = HVERSION_REV_ANY_ID, @@ -820,7 +820,7 @@ MODULE_DEVICE_TABLE(parisc, hp_sdc_tbl); static int __init hp_sdc_init_hppa(struct parisc_device *d); static struct delayed_work moduleloader_work; -static struct parisc_driver hp_sdc_driver = { +static struct parisc_driver hp_sdc_driver __refdata = { .name = "hp_sdc", .id_table = hp_sdc_tbl, .probe = hp_sdc_init_hppa, @@ -909,9 +909,8 @@ static int __init hp_sdc_init(void) down(&s_sync); /* Wait for t_sync to complete */ /* Create the keepalive task */ - init_timer(&hp_sdc.kicker); + timer_setup(&hp_sdc.kicker, hp_sdc_kicker, 0); hp_sdc.kicker.expires = jiffies + HZ; - hp_sdc.kicker.function = &hp_sdc_kicker; add_timer(&hp_sdc.kicker); hp_sdc.dev_err = 0; @@ -1001,7 +1000,6 @@ static int __init hp_sdc_register(void) uint8_t tq_init_seq[5]; struct semaphore tq_init_sem; #if defined(__mc68000__) - mm_segment_t fs; unsigned char i; #endif @@ -1026,11 +1024,8 @@ static int __init hp_sdc_register(void) hp_sdc.base_io = (unsigned long) 0xf0428000; hp_sdc.data_io = (unsigned long) hp_sdc.base_io + 1; hp_sdc.status_io = (unsigned long) hp_sdc.base_io + 3; - fs = get_fs(); - set_fs(KERNEL_DS); - if (!get_user(i, (unsigned char *)hp_sdc.data_io)) + if (!probe_kernel_read(&i, (unsigned char *)hp_sdc.data_io, 1)) hp_sdc.dev = (void *)1; - set_fs(fs); hp_sdc.dev_err = hp_sdc_init(); #endif if (hp_sdc.dev == NULL) { diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h index 6231d63860ee..796289846204 100644 --- a/drivers/input/serio/i8042-sparcio.h +++ b/drivers/input/serio/i8042-sparcio.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _I8042_SPARCIO_H #define _I8042_SPARCIO_H diff --git a/drivers/input/serio/ps2-gpio.c b/drivers/input/serio/ps2-gpio.c index b50e3817f3c4..c62cceb97bb1 100644 --- a/drivers/input/serio/ps2-gpio.c +++ b/drivers/input/serio/ps2-gpio.c @@ -366,6 +366,7 @@ static int ps2_gpio_probe(struct platform_device *pdev) gpiod_cansleep(drvdata->gpio_clk)) { dev_err(dev, "GPIO data or clk are connected via slow bus\n"); error = -EINVAL; + goto err_free_serio; } drvdata->irq = platform_get_irq(pdev, 0); diff --git a/drivers/input/serio/sa1111ps2.c b/drivers/input/serio/sa1111ps2.c index b3e688911fd9..f9e5c793f4f0 100644 --- a/drivers/input/serio/sa1111ps2.c +++ b/drivers/input/serio/sa1111ps2.c @@ -47,6 +47,8 @@ struct ps2if { struct serio *io; struct sa1111_dev *dev; void __iomem *base; + int rx_irq; + int tx_irq; unsigned int open; spinlock_t lock; unsigned int head; @@ -64,22 +66,22 @@ static irqreturn_t ps2_rxint(int irq, void *dev_id) struct ps2if *ps2if = dev_id; unsigned int scancode, flag, status; - status = sa1111_readl(ps2if->base + PS2STAT); + status = readl_relaxed(ps2if->base + PS2STAT); while (status & PS2STAT_RXF) { if (status & PS2STAT_STP) - sa1111_writel(PS2STAT_STP, ps2if->base + PS2STAT); + writel_relaxed(PS2STAT_STP, ps2if->base + PS2STAT); flag = (status & PS2STAT_STP ? SERIO_FRAME : 0) | (status & PS2STAT_RXP ? 0 : SERIO_PARITY); - scancode = sa1111_readl(ps2if->base + PS2DATA) & 0xff; + scancode = readl_relaxed(ps2if->base + PS2DATA) & 0xff; if (hweight8(scancode) & 1) flag ^= SERIO_PARITY; serio_interrupt(ps2if->io, scancode, flag); - status = sa1111_readl(ps2if->base + PS2STAT); + status = readl_relaxed(ps2if->base + PS2STAT); } return IRQ_HANDLED; @@ -94,12 +96,12 @@ static irqreturn_t ps2_txint(int irq, void *dev_id) unsigned int status; spin_lock(&ps2if->lock); - status = sa1111_readl(ps2if->base + PS2STAT); + status = readl_relaxed(ps2if->base + PS2STAT); if (ps2if->head == ps2if->tail) { disable_irq_nosync(irq); /* done */ } else if (status & PS2STAT_TXE) { - sa1111_writel(ps2if->buf[ps2if->tail], ps2if->base + PS2DATA); + writel_relaxed(ps2if->buf[ps2if->tail], ps2if->base + PS2DATA); ps2if->tail = (ps2if->tail + 1) & (sizeof(ps2if->buf) - 1); } spin_unlock(&ps2if->lock); @@ -122,11 +124,11 @@ static int ps2_write(struct serio *io, unsigned char val) /* * If the TX register is empty, we can go straight out. */ - if (sa1111_readl(ps2if->base + PS2STAT) & PS2STAT_TXE) { - sa1111_writel(val, ps2if->base + PS2DATA); + if (readl_relaxed(ps2if->base + PS2STAT) & PS2STAT_TXE) { + writel_relaxed(val, ps2if->base + PS2DATA); } else { if (ps2if->head == ps2if->tail) - enable_irq(ps2if->dev->irq[1]); + enable_irq(ps2if->tx_irq); head = (ps2if->head + 1) & (sizeof(ps2if->buf) - 1); if (head != ps2if->tail) { ps2if->buf[ps2if->head] = val; @@ -147,30 +149,30 @@ static int ps2_open(struct serio *io) if (ret) return ret; - ret = request_irq(ps2if->dev->irq[0], ps2_rxint, 0, + ret = request_irq(ps2if->rx_irq, ps2_rxint, 0, SA1111_DRIVER_NAME(ps2if->dev), ps2if); if (ret) { printk(KERN_ERR "sa1111ps2: could not allocate IRQ%d: %d\n", - ps2if->dev->irq[0], ret); + ps2if->rx_irq, ret); sa1111_disable_device(ps2if->dev); return ret; } - ret = request_irq(ps2if->dev->irq[1], ps2_txint, 0, + ret = request_irq(ps2if->tx_irq, ps2_txint, 0, SA1111_DRIVER_NAME(ps2if->dev), ps2if); if (ret) { printk(KERN_ERR "sa1111ps2: could not allocate IRQ%d: %d\n", - ps2if->dev->irq[1], ret); - free_irq(ps2if->dev->irq[0], ps2if); + ps2if->tx_irq, ret); + free_irq(ps2if->rx_irq, ps2if); sa1111_disable_device(ps2if->dev); return ret; } ps2if->open = 1; - enable_irq_wake(ps2if->dev->irq[0]); + enable_irq_wake(ps2if->rx_irq); - sa1111_writel(PS2CR_ENA, ps2if->base + PS2CR); + writel_relaxed(PS2CR_ENA, ps2if->base + PS2CR); return 0; } @@ -178,14 +180,14 @@ static void ps2_close(struct serio *io) { struct ps2if *ps2if = io->port_data; - sa1111_writel(0, ps2if->base + PS2CR); + writel_relaxed(0, ps2if->base + PS2CR); - disable_irq_wake(ps2if->dev->irq[0]); + disable_irq_wake(ps2if->rx_irq); ps2if->open = 0; - free_irq(ps2if->dev->irq[1], ps2if); - free_irq(ps2if->dev->irq[0], ps2if); + free_irq(ps2if->tx_irq, ps2if); + free_irq(ps2if->rx_irq, ps2if); sa1111_disable_device(ps2if->dev); } @@ -198,7 +200,7 @@ static void ps2_clear_input(struct ps2if *ps2if) int maxread = 100; while (maxread--) { - if ((sa1111_readl(ps2if->base + PS2DATA) & 0xff) == 0xff) + if ((readl_relaxed(ps2if->base + PS2DATA) & 0xff) == 0xff) break; } } @@ -208,11 +210,11 @@ static unsigned int ps2_test_one(struct ps2if *ps2if, { unsigned int val; - sa1111_writel(PS2CR_ENA | mask, ps2if->base + PS2CR); + writel_relaxed(PS2CR_ENA | mask, ps2if->base + PS2CR); - udelay(2); + udelay(10); - val = sa1111_readl(ps2if->base + PS2STAT); + val = readl_relaxed(ps2if->base + PS2STAT); return val & (PS2STAT_KBC | PS2STAT_KBD); } @@ -243,7 +245,7 @@ static int ps2_test(struct ps2if *ps2if) ret = -ENODEV; } - sa1111_writel(0, ps2if->base + PS2CR); + writel_relaxed(0, ps2if->base + PS2CR); return ret; } @@ -264,7 +266,6 @@ static int ps2_probe(struct sa1111_dev *dev) goto free; } - serio->id.type = SERIO_8042; serio->write = ps2_write; serio->open = ps2_open; @@ -279,6 +280,18 @@ static int ps2_probe(struct sa1111_dev *dev) spin_lock_init(&ps2if->lock); + ps2if->rx_irq = sa1111_get_irq(dev, 0); + if (ps2if->rx_irq <= 0) { + ret = ps2if->rx_irq ? : -ENXIO; + goto free; + } + + ps2if->tx_irq = sa1111_get_irq(dev, 1); + if (ps2if->tx_irq <= 0) { + ret = ps2if->tx_irq ? : -ENXIO; + goto free; + } + /* * Request the physical region for this PS2 port. */ @@ -297,8 +310,8 @@ static int ps2_probe(struct sa1111_dev *dev) sa1111_enable_device(ps2if->dev); /* Incoming clock is 8MHz */ - sa1111_writel(0, ps2if->base + PS2CLKDIV); - sa1111_writel(127, ps2if->base + PS2PRECNT); + writel_relaxed(0, ps2if->base + PS2CLKDIV); + writel_relaxed(127, ps2if->base + PS2PRECNT); /* * Flush any pending input. |