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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090227220923.GN16801@frodo>
Date:	Sat, 28 Feb 2009 00:09:23 +0200
From:	Felipe Balbi <me@...ipebalbi.com>
To:	David Brownell <david-b@...bell.net>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Felipe Balbi <me@...ipebalbi.com>,
	linux-kernel@...r.kernel.org, linux-input@...r.kernel.org,
	felipe.balbi@...ia.com, sameo@...nedhand.com
Subject: Re: [PATCH 2/2] mfd: twl4030: add twl4030-pwrbutton as our child

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-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