From 9f10ee32bfaf10dc4d2b0ccd149726eda8df3d57 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Mon, 2 Jul 2018 09:21:16 +0100 Subject: hpet: remove redundant pointer hpet Pointer hpet is being assigned but is never used hence it is redundant and can be removed. Cleans up clang warning: warning: variable 'hpet' set but not used [-Wunused-but-set-variable] Signed-off-by: Colin Ian King Signed-off-by: Greg Kroah-Hartman --- drivers/char/hpet.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index be426eb2a353..4a22b4b41aef 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c @@ -579,7 +579,6 @@ hpet_ioctl_common(struct hpet_dev *devp, unsigned int cmd, unsigned long arg, struct hpet_info *info) { struct hpet_timer __iomem *timer; - struct hpet __iomem *hpet; struct hpets *hpetp; int err; unsigned long v; @@ -591,7 +590,6 @@ hpet_ioctl_common(struct hpet_dev *devp, unsigned int cmd, unsigned long arg, case HPET_DPI: case HPET_IRQFREQ: timer = devp->hd_timer; - hpet = devp->hd_hpet; hpetp = devp->hd_hpets; break; case HPET_IE_ON: -- cgit v1.2.3 From 07fb28b80c7705c15002fe91dd4340bcd5174dbd Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Mon, 2 Jul 2018 09:31:45 +0100 Subject: char: pcmcia: remove redundant pointer dev MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pointer dev is being assigned but is never used hence it is redundant and can be removed. Cleans up clang warning: warning: variable ‘dev’ set but not used [-Wunused-but-set-variable] Signed-off-by: Colin Ian King Signed-off-by: Greg Kroah-Hartman --- drivers/char/pcmcia/cm4000_cs.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 370e0a64ead1..a219964cb770 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c @@ -1748,8 +1748,6 @@ static int cm4000_config_check(struct pcmcia_device *p_dev, void *priv_data) static int cm4000_config(struct pcmcia_device * link, int devno) { - struct cm4000_dev *dev; - link->config_flags |= CONF_AUTO_SET_IO; /* read the config-tuples */ @@ -1759,8 +1757,6 @@ static int cm4000_config(struct pcmcia_device * link, int devno) if (pcmcia_enable_device(link)) goto cs_release; - dev = link->priv; - return 0; cs_release: -- cgit v1.2.3 From 5faecb0162883df2b06965c7e6dd7c42278f7e0d Mon Sep 17 00:00:00 2001 From: "Gustavo A. R. Silva" Date: Mon, 2 Jul 2018 12:57:24 -0500 Subject: /dev/mem: Mark expected switch fall-through In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva Signed-off-by: Greg Kroah-Hartman --- drivers/char/mem.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/char') diff --git a/drivers/char/mem.c b/drivers/char/mem.c index ffeb60d3434c..4b00d6adcccf 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c @@ -765,6 +765,7 @@ static loff_t memory_lseek(struct file *file, loff_t offset, int orig) switch (orig) { case SEEK_CUR: offset += file->f_pos; + /* fall through */ case SEEK_SET: /* to avoid userland mistaking f_pos=-9 as -EBADF=-9 */ if ((unsigned long long)offset >= -MAX_ERRNO) { -- cgit v1.2.3 From ac3167257b9fe16c9426c2087ead1c9f1b0992b1 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Tue, 19 Jun 2018 22:47:28 -0700 Subject: headers: separate linux/mod_devicetable.h from linux/platform_device.h At over 4000 #includes, is the 9th most #included header file in the Linux kernel. It does not need , so drop that header and explicitly add to source files that need it. 4146 #include After this patch, there are 225 files that use , for a reduction of around 3900 times that does not have to be read & parsed. 225 #include This patch was build-tested on 20 different arch-es. It also makes these drivers SubmitChecklist#1 compliant. Signed-off-by: Randy Dunlap Reported-by: kbuild test robot # drivers/media/platform/vimc/ Reported-by: kbuild test robot # drivers/pinctrl/pinctrl-u300.c Signed-off-by: Greg Kroah-Hartman --- drivers/char/hw_random/atmel-rng.c | 1 + drivers/char/hw_random/exynos-trng.c | 1 + drivers/char/hw_random/imx-rngc.c | 1 + drivers/char/hw_random/powernv-rng.c | 1 + 4 files changed, 4 insertions(+) (limited to 'drivers/char') diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c index 661c82cde0f2..433426242b87 100644 --- a/drivers/char/hw_random/atmel-rng.c +++ b/drivers/char/hw_random/atmel-rng.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include diff --git a/drivers/char/hw_random/exynos-trng.c b/drivers/char/hw_random/exynos-trng.c index 1947aed7c044..94235761955c 100644 --- a/drivers/char/hw_random/exynos-trng.c +++ b/drivers/char/hw_random/exynos-trng.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c index 250123bc4905..14730be54edf 100644 --- a/drivers/char/hw_random/imx-rngc.c +++ b/drivers/char/hw_random/imx-rngc.c @@ -13,6 +13,7 @@ */ #include +#include #include #include #include diff --git a/drivers/char/hw_random/powernv-rng.c b/drivers/char/hw_random/powernv-rng.c index 263a5bb8e605..791182aa8e04 100644 --- a/drivers/char/hw_random/powernv-rng.c +++ b/drivers/char/hw_random/powernv-rng.c @@ -10,6 +10,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include +#include #include #include #include -- cgit v1.2.3 From 8d62fe9499b8eb027837892aad8fb52d83a52a41 Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Fri, 13 Jul 2018 00:39:56 +0300 Subject: virtio: virtconsole: Use seq_file for debugfs operations Simplifies the code and is more conventional to what's used in the rest of the kernel for debugfs ops. Signed-off-by: Tuomas Tynkkynen Reviewed-by: Amit Shah Signed-off-by: Greg Kroah-Hartman --- drivers/char/virtio_console.c | 60 ++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 38 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 17084cfcf53e..5b5b5d72eab7 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -1309,51 +1309,35 @@ static const struct attribute_group port_attribute_group = { .attrs = port_sysfs_entries, }; -static ssize_t debugfs_read(struct file *filp, char __user *ubuf, - size_t count, loff_t *offp) +static int debugfs_show(struct seq_file *s, void *data) { - struct port *port; - char *buf; - ssize_t ret, out_offset, out_count; + struct port *port = s->private; + + seq_printf(s, "name: %s\n", port->name ? port->name : ""); + seq_printf(s, "guest_connected: %d\n", port->guest_connected); + seq_printf(s, "host_connected: %d\n", port->host_connected); + seq_printf(s, "outvq_full: %d\n", port->outvq_full); + seq_printf(s, "bytes_sent: %lu\n", port->stats.bytes_sent); + seq_printf(s, "bytes_received: %lu\n", port->stats.bytes_received); + seq_printf(s, "bytes_discarded: %lu\n", port->stats.bytes_discarded); + seq_printf(s, "is_console: %s\n", + is_console_port(port) ? "yes" : "no"); + seq_printf(s, "console_vtermno: %u\n", port->cons.vtermno); - out_count = 1024; - buf = kmalloc(out_count, GFP_KERNEL); - if (!buf) - return -ENOMEM; + return 0; +} - port = filp->private_data; - out_offset = 0; - out_offset += snprintf(buf + out_offset, out_count, - "name: %s\n", port->name ? port->name : ""); - out_offset += snprintf(buf + out_offset, out_count - out_offset, - "guest_connected: %d\n", port->guest_connected); - out_offset += snprintf(buf + out_offset, out_count - out_offset, - "host_connected: %d\n", port->host_connected); - out_offset += snprintf(buf + out_offset, out_count - out_offset, - "outvq_full: %d\n", port->outvq_full); - out_offset += snprintf(buf + out_offset, out_count - out_offset, - "bytes_sent: %lu\n", port->stats.bytes_sent); - out_offset += snprintf(buf + out_offset, out_count - out_offset, - "bytes_received: %lu\n", - port->stats.bytes_received); - out_offset += snprintf(buf + out_offset, out_count - out_offset, - "bytes_discarded: %lu\n", - port->stats.bytes_discarded); - out_offset += snprintf(buf + out_offset, out_count - out_offset, - "is_console: %s\n", - is_console_port(port) ? "yes" : "no"); - out_offset += snprintf(buf + out_offset, out_count - out_offset, - "console_vtermno: %u\n", port->cons.vtermno); - - ret = simple_read_from_buffer(ubuf, count, offp, buf, out_offset); - kfree(buf); - return ret; +static int debugfs_open(struct inode *inode, struct file *file) +{ + return single_open(file, debugfs_show, inode->i_private); } static const struct file_operations port_debugfs_ops = { .owner = THIS_MODULE, - .open = simple_open, - .read = debugfs_read, + .open = debugfs_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; static void set_console_size(struct port *port, u16 rows, u16 cols) -- cgit v1.2.3