linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <me@felipebalbi.com>
To: David Brownell <david-b@pacbell.net>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Felipe Balbi <me@felipebalbi.com>,
	linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
	felipe.balbi@nokia.com, sameo@openedhand.com
Subject: Re: [PATCH 2/2] mfd: twl4030: add twl4030-pwrbutton as our child
Date: Sat, 28 Feb 2009 00:09:23 +0200	[thread overview]
Message-ID: <20090227220923.GN16801@frodo> (raw)
In-Reply-To: <200902271358.46863.david-b@pacbell.net>

On Fri, Feb 27, 2009 at 01:58:46PM -0800, David Brownell wrote:
> On Friday 27 February 2009, Andrew Morton wrote:
> > > --- a/drivers/mfd/twl4030-core.c
> > > +++ b/drivers/mfd/twl4030-core.c
> > > @@ -101,6 +101,12 @@
> > >  #define twl_has_usb()        false
> > >  #endif
> > >  
> > > +#if defined(CONFIG_INPUT_TWL4030_PWRBUTTON) \
> > > +     || defined(CONFIG_INPUT_TWL4030_PWBUTTON_MODULE)
> > 
> > OK, this is "wrong".  The core shouldn't need to know about specific
> > clients.
> 
> This is a pretty standard idiom:  only create the device
> nodes a system actually uses.  Applied comprehensively,
> the kernel footprint shrinks ... supporting a device can
> require a lot of ancillary infrastructure, which may not
> need to be compiled in.
> 
> 
> > > +#define twl_has_pwrbutton()  true
> > > +#else
> > > +#define twl_has_pwrbutton()  false
> > > +#endif
> > >  
> > >  /* Triton Core internal information (BEGIN) */
> > >  
> > > @@ -526,6 +532,13 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
> > >               usb_transceiver = child;
> > >       }
> > >  
> > > +     if (twl_has_pwrbutton()) {
> > > +             child = add_child(1, "twl4030_pwrbutton",
> > > +                             NULL, 0, true, pdata->irq_base + 8 + 0, 0);
> > > +             if (IS_ERR(child))
> > > +                     return PTR_ERR(child);
> > > +     }
> > > +
> > >       if (twl_has_regulator()) {
> > >               /*
> > >               child = add_regulator(TWL4030_REG_VPLL1, pdata->vpll1);
> > 
> > The client module should register itself with the core, rather than the core
> > registering the client.
> > 
> > What has gone wrong here?
> 
> Not much I can see.  It's registering a platform_device,
> but only if it could be used on this system.  Quite a lot
> of OMAP3 boards don't hook up this power button.
> 
> Maybe it should also verify that *this* board supports
> a power button.  A boolean flag in the twl4030 platform
> data would suffice, for multi-board kernels.

something like the following should be enough then:

============== cut here ===================
diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c
index c86bc3b..714073f 100644
--- a/drivers/mfd/twl4030-core.c
+++ b/drivers/mfd/twl4030-core.c
@@ -532,7 +532,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
                usb_transceiver = child;
        }
 
-       if (twl_has_pwrbutton()) {
+       if (twl_has_pwrbutton() && pdata->pwrbutton) {
                child = add_child(1, "twl4030_pwrbutton",
                                NULL, 0, true, pdata->irq_base + 8 + 0, 0);
                if (IS_ERR(child))
diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h
index 8137f66..277451e 100644
--- a/include/linux/i2c/twl4030.h
+++ b/include/linux/i2c/twl4030.h
@@ -293,6 +293,8 @@ struct twl4030_platform_data {
        struct regulator_init_data              *vaux3;
        struct regulator_init_data              *vaux4;
 
+       bool                                    pwrbutton;
+
        /* REVISIT more to come ... _nothing_ should be hard-wired */
 };
 

-- 
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2009-02-27 22:09 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-27 19:28 [PATCH 1/2] input: misc: add twl4030-pwrbutton driver Felipe Balbi
2009-02-27 19:28 ` [PATCH 2/2] mfd: twl4030: add twl4030-pwrbutton as our child Felipe Balbi
2009-02-27 20:36   ` Andrew Morton
2009-02-27 21:58     ` David Brownell
2009-02-27 22:09       ` Felipe Balbi [this message]
2009-02-27 22:12       ` Andrew Morton
2009-02-27 23:20         ` David Brownell
2009-02-27 23:42           ` Andrew Morton
2009-07-22 19:27             ` Trilok Soni
2009-07-22 22:25               ` David Brownell
2009-02-27 20:33 ` [PATCH 1/2] input: misc: add twl4030-pwrbutton driver Andrew Morton
2009-02-27 20:37   ` Felipe Balbi
2009-02-27 21:50     ` lockdep and threaded IRQs (was: [PATCH 1/2] input: misc: add twl4030-pwrbutton driver) David Brownell
2009-02-27 22:09       ` Andrew Morton
2009-02-27 23:18         ` lockdep and threaded IRQs (was: ...) David Brownell
2009-02-27 23:32           ` Andrew Morton
2009-02-28  0:01             ` Andrew Morton
2009-02-28  2:30               ` David Brownell
2009-02-28  2:39                 ` Andrew Morton
2009-02-28  4:46                   ` David Brownell
2009-02-28  5:12                     ` Andrew Morton
2009-02-28  6:17                       ` David Brownell
2009-02-28 11:13                     ` Thomas Gleixner
2009-02-28 12:16                       ` David Brownell
2009-02-28 16:42                         ` Thomas Gleixner
2009-02-28 20:02                           ` David Brownell
2009-02-28 20:55                             ` Thomas Gleixner
2009-02-28 21:13                               ` Thomas Gleixner
2009-02-28 22:37                                 ` David Brownell
2009-02-28 22:05                               ` David Brownell
2009-03-01  9:43                                 ` Thomas Gleixner
2009-03-01 22:54                                   ` David Brownell
2009-03-02 13:16                                     ` Peter Zijlstra
2009-03-02 21:04                                       ` David Brownell
2009-03-02 21:16                                         ` Peter Zijlstra
2009-03-02 21:29                                           ` Andrew Morton
2009-03-02 21:37                                           ` David Brownell
2009-03-02 21:41                                             ` Peter Zijlstra
2009-03-02 22:09                                               ` David Brownell
2009-03-02 22:19                                                 ` Peter Zijlstra
2009-03-02 22:40                                                   ` David Brownell
2009-03-02 22:51                                                     ` Peter Zijlstra
2009-03-02 23:29                                                       ` David Brownell
2009-03-03  7:45                                                         ` Peter Zijlstra
2009-03-02 22:46                                                   ` lockdep and threaded IRQs David Miller
2009-03-02 22:57                                                     ` Andrew Morton
2009-03-02 23:07                                                       ` Peter Zijlstra
2009-03-02 23:02                                                     ` Peter Zijlstra
2009-03-02 23:35                                           ` lockdep and threaded IRQs (was: ...) Alan Cox
2009-03-01 22:11                               ` David Brownell
2009-02-28 11:48                     ` lockdep and threaded IRQs Stefan Richter
2009-02-28 20:19                       ` David Brownell
2009-02-28 21:10                         ` Stefan Richter
2009-03-02 13:16           ` lockdep and threaded IRQs (was: ...) Peter Zijlstra
2009-03-02 22:10             ` David Brownell
2009-03-02 22:25               ` Peter Zijlstra
2009-03-02 23:20                 ` David Brownell
2009-03-02 23:26                   ` Ingo Molnar
2009-03-02 23:42                     ` David Brownell
2009-03-02 23:53                       ` Ingo Molnar
2009-03-03  0:33                         ` David Brownell
2009-03-03  0:44                           ` Ingo Molnar
2009-03-03  2:37                             ` David Brownell
2009-03-03  9:27                               ` Peter Zijlstra
2009-03-03  9:45                                 ` Ingo Molnar
2009-03-03  9:47                                 ` Alan Cox
2009-03-03 10:03                                   ` Ingo Molnar
2009-03-03 10:30                                     ` Alan Cox
2009-03-03 10:39                                       ` Peter Zijlstra
2009-03-03 10:48                                       ` Ingo Molnar
2009-03-03 11:13                                         ` Alan Cox
2009-03-03 11:33                                           ` Ingo Molnar
2009-03-03 11:19                                         ` Ingo Molnar
2009-03-18  1:04                                         ` David Brownell
2009-03-18  2:00                             ` David Brownell
2009-03-03 11:53                       ` Thomas Gleixner
2009-03-05  2:49                         ` David Brownell
2009-03-06 14:40                           ` Thomas Gleixner
2009-03-18  3:06                             ` David Brownell
2009-03-02 23:48                     ` David Brownell
2009-03-02 23:58                       ` Ingo Molnar
2009-03-02 15:13           ` [PATCH] genirq: assert that irq handlers are indeed run in hardirq context Peter Zijlstra
2009-03-02 19:48             ` David Brownell
2009-02-28 11:20       ` lockdep and threaded IRQs Stefan Richter
2009-02-28 20:10         ` David Brownell
2009-02-28  5:51 ` [PATCH 1/2] input: misc: add twl4030-pwrbutton driver Trilok Soni
2009-02-28 12:05   ` [PATCH] mfd: twl4030: add twl4030-pwrbutton as our child Felipe Balbi
2009-02-28 22:23 ` [PATCH 1/2] input: misc: add twl4030-pwrbutton driver Dmitry Torokhov
2009-03-01  0:30   ` Felipe Balbi
2009-03-01  0:58     ` Dmitry Torokhov
2009-03-01 14:40       ` Felipe Balbi
2009-03-04  9:00         ` Dmitry Torokhov
2009-03-04 10:12           ` Felipe Balbi
2009-03-05  1:38             ` David Brownell
2009-03-05 23:54           ` David Brownell
2009-03-06  9:43             ` Dmitry Torokhov

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=20090227220923.GN16801@frodo \
    --to=me@felipebalbi.com \
    --cc=akpm@linux-foundation.org \
    --cc=david-b@pacbell.net \
    --cc=felipe.balbi@nokia.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sameo@openedhand.com \
    /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).