Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754902AbbGCKv5 (ORCPT ); Fri, 3 Jul 2015 06:51:57 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:61387 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754752AbbGCKue (ORCPT ); Fri, 3 Jul 2015 06:50:34 -0400 X-AuditID: cbfec7f5-f794b6d000001495-2b-559668e80432 From: Marcin Niesluchowski To: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org Cc: Jonathan Corbet , Greg Kroah-Hartman , Petr Mladek , Tejun Heo , Kay Sievers , Andrew Morton , Joe Perches , Karol Lewandowski , Bartlomiej Zolnierkiewicz , Marcin Niesluchowski Subject: [RFC 5/8] kmsg: device support in mem class Date: Fri, 03 Jul 2015 12:49:52 +0200 Message-id: <1435920595-30879-6-git-send-email-m.niesluchow@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1435920595-30879-1-git-send-email-m.niesluchow@samsung.com> References: <1435920595-30879-1-git-send-email-m.niesluchow@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrKLMWRmVeSWpSXmKPExsVy+t/xK7ovMqaFGuw9rGQxZ/0aNouNM9az Wjw50M5o0bx4PZvF7PuPWSwaP81ltri16jm7xebvHWwWC9uWsFhc3jWHzeLQ2R8sFgv/b2ay +LX8KKMDr8emVZ1sHidm/Gbx2D93DbvH4r7JrB5fVl1j9ujbsorR48yCI+wenzfJeXxc7xnA GcVlk5Kak1mWWqRvl8CVsfv8fOaCi5wVeyfPYG1gfMTexcjJISFgInFp5yNWCFtM4sK99Wxd jFwcQgJLGSUeHZzFAuE0M0nsP7iVDaSKTcBUom3ZHrBuEYEIiYUXm8CKmAWmMUucbd7L3MXI wSEMNHZqdxxIDYuAqsTJvuNgG3gFPCQ6jnyG2iYncfLYZDCbU8BT4lPfMmYQWwioZsOx+UwT GHkXMDKsYhRNLU0uKE5KzzXSK07MLS7NS9dLzs/dxAgJ3K87GJceszrEKMDBqMTDe+H01FAh 1sSy4srcQ4wSHMxKIrzPg6eFCvGmJFZWpRblxxeV5qQWH2KU5mBREueduet9iJBAemJJanZq akFqEUyWiYNTqoFx8VPeSBel1ppnaaLOWnc9slPqFZZaVQevnCi/nP/d97Qgx4UdEftOPDqT uCZZKq+47sYHdy2p4syzzKkHZPQmB0SWsHYt64iPubfM5+e1nvZlgo+DU0oUzGVrL7iu2/1+ 97Y2gcr0D9nfC6+1cD+Xn6lSLNK9OcDy+bt/6xy39QlGz88TtVBiKc5INNRiLipOBADMRPHt WAIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1427 Lines: 56 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 --- 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/