lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20130816205017.GA2198@kroah.com>
Date:	Fri, 16 Aug 2013 13:50:17 -0700
From:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:	Josh Cartwright <joshc@...eaurora.org>
Cc:	Grant Likely <grant.likely@...aro.org>,
	Rob Herring <rob.herring@...xeda.com>,
	linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	linux-arm-msm@...r.kernel.org,
	Sagar Dharia <sdharia@...eaurora.org>,
	Gilad Avidov <gavidov@...eaurora.org>,
	Michael Bohan <mbohan@...eaurora.org>
Subject: Re: [PATCH RFC 1/3] spmi: Linux driver framework for SPMI

On Fri, Aug 16, 2013 at 03:40:55PM -0500, Josh Cartwright wrote:
> On Fri, Aug 16, 2013 at 12:58:49PM -0700, Greg Kroah-Hartman wrote:
> > On Fri, Aug 16, 2013 at 02:47:15PM -0500, Josh Cartwright wrote:
> > > > > +#ifdef CONFIG_DEBUG_FS
> > > > 
> > > > Why?  If debugfs isn't enabled, the functions should just compile away
> > > > with the debugfs_() calls, so no need to do this type of thing here,
> > > > right?
> > > 
> > > Not sure I follow you, but it may be because this is a bit misleading.
> > > 
> > > Currently CONFIG_DEBUG_FS is being extended to also mean "do you want
> > > the SPMI core to create device entries?".  It would probably make more
> > > sense to have a CONFIG_SPMI_DEBUG option which is def_bool DEBUG_FS, as
> > > other busses have.
> > > 
> > > The #ifdef here would then be #ifdef CONFIG_SPMI_DEBUG, as well as in
> > > the Makefile:
> > > 
> > >   spmi-core-$(CONFIG_SPMI_DEBUG) += spmi-dbgfs.o
> > 
> > If debugfs is enabled why wouldn't you want debugfs entries for your
> > devices?  Don't assume a user is going to be able to rebuild their
> > kernel just for debugging stuff (hint, they usually aren't), so having
> > these present, if they don't cause any performance issues, is usually
> > best to always have around.
> 
> Okay, that makes sense.
> 
> So, backing up a step, you're original comment was regarding the
> CONFIG_DEBUG_FS conditional in spmi-dbgfs.h:
> 
> On Fri, Aug 16, 2013 at 11:46:14AM -0700, Greg Kroah-Hartman wrote:
> > > --- /dev/null
> > > +++ b/drivers/spmi/spmi-dbgfs.h
> > > @@ -0,0 +1,37 @@
> > > +/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
> > > + *
> > > + * This program is free software; you can redistribute it and/or modify
> > > + * it under the terms of the GNU General Public License version 2 and
> > > + * only version 2 as published by the Free Software Foundation.
> > > + *
> > > + * This program is distributed in the hope that it will be useful,
> > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > > + * GNU General Public License for more details.
> > > + */
> > > +#ifndef _SPMI_DBGFS_H
> > > +#define _SPMI_DBGFS_H
> > > +
> > > +#include <linux/spmi.h>
> > > +#include <linux/debugfs.h>
> > > +
> > > +#ifdef CONFIG_DEBUG_FS
> > 
> > Why?  If debugfs isn't enabled, the functions should just compile away
> > with the debugfs_() calls, so no need to do this type of thing here,
> > right?
> 
> The reason why this is done is because the spmi debugfs support code is
> is only built-in when CONFIG_DEBUG_FS is set.
> 
> Would you rather it always be built-in (well, whenever SPMI support is
> included), and rely on the debugfs_* shims to handle the
> !CONFIG_DEBUG_FS case?

Yes, that makes the logic in your driver simpler, and easier to review.
The compiler will just compile away almost all of the logic if debugfs
isn't present, so there shouldn't be any big size difference.

thanks,

greg k-h
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ