Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932308AbbGCPjJ (ORCPT ); Fri, 3 Jul 2015 11:39:09 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:42370 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964933AbbGCPjB (ORCPT ); Fri, 3 Jul 2015 11:39:01 -0400 Date: Fri, 3 Jul 2015 08:39:00 -0700 From: Greg Kroah-Hartman To: Marcin Niesluchowski Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Jonathan Corbet , Petr Mladek , Tejun Heo , Kay Sievers , Andrew Morton , Joe Perches , Karol Lewandowski , Bartlomiej Zolnierkiewicz Subject: Re: [RFC 5/8] kmsg: device support in mem class Message-ID: <20150703153900.GB11227@kroah.com> References: <1435920595-30879-1-git-send-email-m.niesluchow@samsung.com> <1435920595-30879-6-git-send-email-m.niesluchow@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1435920595-30879-6-git-send-email-m.niesluchow@samsung.com> User-Agent: Mutt/1.5.23+89 (0255b37be491) (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1653 Lines: 55 On Fri, Jul 03, 2015 at 12:49:52PM +0200, Marcin Niesluchowski wrote: > 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 Ick, you are going to have to come up with a better api if you want this to be able to be merged. I don't want to see #ifdef in .c files, as these changes just make things much messier. > @@ -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 Ick, not ok. greg k-h -- 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/