[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <1435920595-30879-6-git-send-email-m.niesluchow@samsung.com>
Date: Fri, 03 Jul 2015 12:49:52 +0200
From: Marcin Niesluchowski <m.niesluchow@...sung.com>
To: linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-api@...r.kernel.org
Cc: Jonathan Corbet <corbet@....net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Petr Mladek <pmladek@...e.cz>, Tejun Heo <tj@...nel.org>,
Kay Sievers <kay@...y.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Joe Perches <joe@...ches.com>,
Karol Lewandowski <k.lewandowsk@...sung.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
Marcin Niesluchowski <m.niesluchow@...sung.com>
Subject: [RFC 5/8] kmsg: device support in mem class
Mem class is current class in which kmsg device is holded in.
Mem class is exteded by kmsg_sys devices handling.
Signed-off-by: Marcin Niesluchowski <m.niesluchow@...sung.com>
---
drivers/char/mem.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index e518040..8d5ba0d 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -815,7 +815,11 @@ static int memory_open(struct inode *inode, struct file *filp)
minor = iminor(inode);
if (minor >= ARRAY_SIZE(devlist))
+#ifdef CONFIG_PRINTK
+ minor = KMSG_MINOR;
+#else
return -ENXIO;
+#endif
dev = &devlist[minor];
if (!dev->fops)
@@ -837,8 +841,20 @@ 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;
+
+ if (!mode)
+ return NULL;
+
+ minor = MINOR(dev->devt);
+
+#ifdef CONFIG_PRINTK
+ if (minor >= ARRAY_SIZE(devlist))
+ kmsg_sys_mode(minor, mode);
+ else
+#endif
+ if (devlist[minor].mode)
+ *mode = devlist[minor].mode;
return NULL;
}
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists