All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Josh Cartwright <joshc@codeaurora.org>
Cc: linux-arm-msm@vger.kernel.org,
	Gilad Avidov <gavidov@codeaurora.org>,
	linux-kernel@vger.kernel.org,
	Rob Herring <rob.herring@calxeda.com>,
	Michael Bohan <mbohan@codeaurora.org>,
	Grant Likely <grant.likely@linaro.org>,
	Sagar Dharia <sdharia@codeaurora.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH RFC 1/3] spmi: Linux driver framework for SPMI
Date: Fri, 16 Aug 2013 13:50:17 -0700	[thread overview]
Message-ID: <20130816205017.GA2198@kroah.com> (raw)
In-Reply-To: <20130816204055.GK4035@joshc.qualcomm.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Josh Cartwright <joshc@codeaurora.org>
Cc: Grant Likely <grant.likely@linaro.org>,
	Rob Herring <rob.herring@calxeda.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-arm-msm@vger.kernel.org,
	Sagar Dharia <sdharia@codeaurora.org>,
	Gilad Avidov <gavidov@codeaurora.org>,
	Michael Bohan <mbohan@codeaurora.org>
Subject: Re: [PATCH RFC 1/3] spmi: Linux driver framework for SPMI
Date: Fri, 16 Aug 2013 13:50:17 -0700	[thread overview]
Message-ID: <20130816205017.GA2198@kroah.com> (raw)
In-Reply-To: <20130816204055.GK4035@joshc.qualcomm.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: gregkh@linuxfoundation.org (Greg Kroah-Hartman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFC 1/3] spmi: Linux driver framework for SPMI
Date: Fri, 16 Aug 2013 13:50:17 -0700	[thread overview]
Message-ID: <20130816205017.GA2198@kroah.com> (raw)
In-Reply-To: <20130816204055.GK4035@joshc.qualcomm.com>

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

  reply	other threads:[~2013-08-16 20:50 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-15 19:50 [PATCH RFC 0/3] Add support for the System Power Management Interface (SPMI) Josh Cartwright
2013-08-15 19:50 ` Josh Cartwright
2013-08-09 20:37 ` [PATCH RFC 2/3] spmi: Add MSM PMIC Arbiter SPMI controller Josh Cartwright
2013-08-09 20:37   ` Josh Cartwright
2013-08-16 18:52   ` Greg Kroah-Hartman
2013-08-16 18:52     ` Greg Kroah-Hartman
2013-08-09 20:37 ` [PATCH RFC 1/3] spmi: Linux driver framework for SPMI Josh Cartwright
2013-08-09 20:37   ` Josh Cartwright
2013-08-16 18:46   ` Greg Kroah-Hartman
2013-08-16 18:46     ` Greg Kroah-Hartman
2013-08-16 19:47     ` Josh Cartwright
2013-08-16 19:47       ` Josh Cartwright
2013-08-16 19:47       ` Josh Cartwright
2013-08-16 19:50       ` Josh Cartwright
2013-08-16 19:50         ` Josh Cartwright
2013-08-16 19:50         ` Josh Cartwright
2013-08-16 19:58       ` Greg Kroah-Hartman
2013-08-16 19:58         ` Greg Kroah-Hartman
2013-08-16 19:58         ` Greg Kroah-Hartman
2013-08-16 20:40         ` Josh Cartwright
2013-08-16 20:40           ` Josh Cartwright
2013-08-16 20:40           ` Josh Cartwright
2013-08-16 20:50           ` Greg Kroah-Hartman [this message]
2013-08-16 20:50             ` Greg Kroah-Hartman
2013-08-16 20:50             ` Greg Kroah-Hartman
2013-08-16 18:49   ` Greg Kroah-Hartman
2013-08-16 18:49     ` Greg Kroah-Hartman
2013-08-16 20:21     ` Josh Cartwright
2013-08-16 20:21       ` Josh Cartwright
2013-08-16 20:21       ` Josh Cartwright
2013-08-16 20:28       ` Greg Kroah-Hartman
2013-08-16 20:28         ` Greg Kroah-Hartman
2013-08-16 20:28         ` Greg Kroah-Hartman
2013-08-16 19:04   ` Kumar Gala
2013-08-16 19:04     ` Kumar Gala
2013-08-16 19:04     ` Kumar Gala
     [not found] ` <b639088d50df93caaef8fe7e09c12953b1153ce8.1376596224.git.joshc@codeaurora.org>
     [not found]   ` <D1534646-7CB5-4EE7-8C1E-1C607BE22396@codeaurora.org>
2013-08-16 19:25     ` [PATCH RFC 3/3] spmi: document the PMIC arbiter SPMI bindings Josh Cartwright
2013-08-16 19:25       ` Josh Cartwright
2013-08-16 19:25       ` Josh Cartwright
2013-08-16 19:48       ` Kumar Gala
2013-08-16 19:48         ` Kumar Gala
2013-08-16 19:48         ` Kumar Gala
2013-08-16 23:17         ` Stephen Warren
2013-08-16 23:17           ` Stephen Warren
2013-08-16 23:17           ` Stephen Warren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130816205017.GA2198@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=gavidov@codeaurora.org \
    --cc=grant.likely@linaro.org \
    --cc=joshc@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbohan@codeaurora.org \
    --cc=rob.herring@calxeda.com \
    --cc=sdharia@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.