summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMarcin Niesluchowski <m.niesluchow@samsung.com>2015-07-20 14:52:06 +0200
committerSeung-Woo Kim <sw0312.kim@samsung.com>2016-12-14 13:49:13 +0900
commit62bbd37627b8fa194ae668b352d40c090d9cc6e0 (patch)
treee8103004a09347ce9d2c3fa5da1cda219dac0992 /drivers
parent8c83cc6f929d470636e6756d5447337e2f67e741 (diff)
kmsg: add additional buffers support to memory class
Memory class does not support additional kmsg buffers. Add additional kmsg buffers support to: * devnode() callback of "mem" class * file operations of major "mem" character device Change-Id: I15b6c79435b4dc18422a9bd6836bd9c7a87ad60a Signed-off-by: Marcin Niesluchowski <m.niesluchow@samsung.com> Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/mem.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 6b1721f978c2..7d462343a4b0 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -799,9 +799,6 @@ static const struct memdev {
[7] = { "full", 0666, &full_fops, 0 },
[8] = { "random", 0666, &random_fops, 0 },
[9] = { "urandom", 0666, &urandom_fops, 0 },
-#ifdef CONFIG_PRINTK
- [11] = { "kmsg", 0644, &kmsg_fops, 0 },
-#endif
};
static int memory_open(struct inode *inode, struct file *filp)
@@ -811,7 +808,7 @@ static int memory_open(struct inode *inode, struct file *filp)
minor = iminor(inode);
if (minor >= ARRAY_SIZE(devlist))
- return -ENXIO;
+ return kmsg_memory_open(inode, filp);
dev = &devlist[minor];
if (!dev->fops)
@@ -833,16 +830,28 @@ static const struct file_operations memory_fops = {
static char *mem_devnode(struct device *dev, umode_t *mode)
{
- if (mode && devlist[MINOR(dev->devt)].mode)
- *mode = devlist[MINOR(dev->devt)].mode;
+ int minor = MINOR(dev->devt);
+
+ if (!mode)
+ goto out;
+
+ if (minor >= ARRAY_SIZE(devlist)) {
+ kmsg_mode(minor, mode);
+ goto out;
+ }
+
+ if (devlist[minor].mode)
+ *mode = devlist[minor].mode;
+out:
return NULL;
}
-static struct class *mem_class;
+struct class *mem_class;
static int __init chr_dev_init(void)
{
int minor;
+ struct device *kmsg;
if (register_chrdev(MEM_MAJOR, "mem", &memory_fops))
printk("unable to get major %d for memory devs\n", MEM_MAJOR);
@@ -866,6 +875,10 @@ static int __init chr_dev_init(void)
NULL, devlist[minor].name);
}
+ kmsg = init_kmsg(KMSG_MINOR, 0644);
+ if (IS_ERR(kmsg))
+ return PTR_ERR(kmsg);
+
return tty_init();
}