linux-pwm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: H Hartley Sweeten <hartleys@visionengravers.com>
Cc: Ryan Mallon <rmallon@gmail.com>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	"linux-pwm@vger.kernel.org" <linux-pwm@vger.kernel.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"poeschel@lemonage.de" <poeschel@lemonage.de>,
	"rob@landley.net" <rob@landley.net>
Subject: Re: [PATCH v4] pwm: add sysfs interface
Date: Tue, 11 Jun 2013 21:48:19 +0200	[thread overview]
Message-ID: <20130611194819.GA29980@mithrandir> (raw)
In-Reply-To: <ADE657CA350FB648AAC2C43247A983F0021DA690F6BE@AUSP01VMBX24.collaborationhost.net>

[-- Attachment #1: Type: text/plain, Size: 2774 bytes --]

On Tue, Jun 11, 2013 at 01:45:37PM -0500, H Hartley Sweeten wrote:
> On Tuesday, June 11, 2013 11:35 AM, Thierry Reding wrote:
> > On Tue, Jun 11, 2013 at 11:47:23AM -0500, H Hartley Sweeten wrote:
> >> On Tuesday, June 11, 2013 9:09 AM, H Hartley Sweeten wrote:
> >>> On Tuesday, June 11, 2013 4:29 AM, Ryan Mallon wrote:
> >>>> On 11/06/13 20:14, Thierry Reding wrote:
> >>>>> On Mon, Jun 10, 2013 at 04:12:07PM -0700, H Hartley Sweeten wrote:
> >>>>>> +config PWM_SYSFS
> >>>>>> +	bool "/sys/class/pwm/... (sysfs interface)"
> >>>>>> +	depends on SYSFS
> >>>>>> +	help
> >>>>>> +	  Say Y here to provide a sysfs interface to control PWMs.
> >>>>>> +
> >>>>>> +	  For every instance of a PWM device there is a pwmchipN directory
> >>>>>> +	  created in /sys/class/pwm. Use the export attribute to request
> >>>>>> +	  a PWM to be accessible from userspace and the unexport attribute
> >>>>>> +	  to return the PWM to the kernel. Each exported PWM will have a
> >>>>>> +	  pwmX directory in the pwmchipN it is associated with.
> >>>>> 
> >>>>> I have a small quibble with this. Introducing options like this make it
> >>>>> increasingly difficult to compile-test all the various combinations, so
> >>>>> I'd like to see this converted to a form that will play well with the
> >>>>> IS_ENABLED() macro. We already have the same issue with DEBUG_FS, only
> >>>>> to a lesser degree because it doesn't have an additional PWM-specific
> >>>>> Kconfig option.
> >>>
> >>> How about removing the Kconfig option and just doing:
> >>>
> >>> obj-$(CONFIG_SYSFS)			+= sysfs.o
> >>>
> >>> This way the PWM sysfs interface is always compiled and included in the build
> >>> as long as CONFIG_SYSFS is enabled. The check in the header would change to
> >> 
> >> That didn't work. As Ryan pointed out we get undefined references due to
> >> sysfs.c being compiled but not core.c when CONFIG_PWM is not enabled.
> >
> > Why not add dummies for the missing functions? It was my impression that
> > we had dummies for all of them already, but if not they should certainly
> > be added to match what other subsystems do.
> 
> I just looked it over and the undefined reference was for pwm_set_polarity().
> The dummy for that function is missing.
> 
> The other problem with this approach is the sysfs.c file gets compiled whenever
> CONFIG_SYSFS is enabled even if CONFIG_PWM is not enabled.

Perhaps add something like this to the Makefile:

	ifeq ($(CONFIG_PWM),y)
	obj-$(CONFIG_SYSFS) += sysfs.o
	endif

That should solve the problem of building sysfs.c if SYSFS && !PWM.

I'm tempted to take your v5 patch and make a note to clean that up
separately at some point (along with similar changes for the DEBUG_FS
support).

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2013-06-11 19:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-10 23:12 [PATCH v4] pwm: add sysfs interface H Hartley Sweeten
2013-06-11 10:14 ` Thierry Reding
2013-06-11 11:28   ` Ryan Mallon
2013-06-11 16:09     ` H Hartley Sweeten
2013-06-11 16:47       ` H Hartley Sweeten
2013-06-11 18:35         ` Thierry Reding
2013-06-11 18:45           ` H Hartley Sweeten
2013-06-11 19:48             ` Thierry Reding [this message]
2013-06-19 16:09               ` H Hartley Sweeten
2013-06-19 17:10                 ` Thierry Reding
2013-06-11 18:32     ` Thierry Reding

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=20130611194819.GA29980@mithrandir \
    --to=thierry.reding@gmail.com \
    --cc=hartleys@visionengravers.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=poeschel@lemonage.de \
    --cc=rmallon@gmail.com \
    --cc=rob@landley.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).