From: "Philippe Rétornaz" <philippe.retornaz@epfl.ch>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: "s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
"maramaopercheseimorto@gmail.com"
<maramaopercheseimorto@gmail.com>,
"sameo@linux.intel.com" <sameo@linux.intel.com>,
Longchamp Valentin <valentin.longchamp@epfl.ch>,
"rpurdie@linux.intel.com" <rpurdie@linux.intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 1/2] mc13783: add LED support
Date: Tue, 18 May 2010 13:27:29 +0200 [thread overview]
Message-ID: <201005181327.29529.philippe.retornaz@epfl.ch> (raw)
In-Reply-To: <20100517190242.GA17604@pengutronix.de>
Le lundi, 17 mai 2010 21.02:42, Uwe Kleine-König a écrit :
> Hi Philippe,
>
> On Mon, May 17, 2010 at 06:40:22PM +0200, Philippe Rétornaz wrote:
> > This adds basic led support for Freescale MC13783 PMIC.
> >
> > Signed-off-by: Philippe Rétornaz <philippe.retornaz@epfl.ch>
> > ---
> > drivers/leds/Kconfig | 7 +
> > drivers/leds/Makefile | 1 +
> > drivers/leds/leds-mc13783.c | 375
> > +++++++++++++++++++++++++++++++++++++++++++ drivers/mfd/mc13783-core.c |
> > 4 +
> > include/linux/mfd/mc13783.h | 68 ++++++++
> > 5 files changed, 455 insertions(+), 0 deletions(-)
> > create mode 100644 drivers/leds/leds-mc13783.c
> >
> > +++ b/drivers/leds/leds-mc13783.c
> > @@ -0,0 +1,375 @@
> > +#include <linux/module.h>
> > +#include <linux/kernel.h>
> > +#include <linux/init.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/leds.h>
> > +#include <linux/workqueue.h>
> > +#include <linux/mfd/mc13783.h>
> > +#include <linux/mfd/mc13783-private.h>
>
> please don't use mc13783-private.h.
I use some register macro defined in mc13783-private.h
Do you perfer I redefine them inside leds-mc13783.c ?
> > +static void mc13783_led_set(struct led_classdev *led_cdev,
> > + enum led_brightness value)
> > +{
> > + struct mc13783_led *led;
> > +
> > + led = container_of(led_cdev, struct mc13783_led, cdev);
> > + led->new_brightness = value;
> > + schedule_work(&led->work);
> > +}
>
> I wonder why you don't set the registers directly here, but use a work
> struct instead.
As Marc explained, it can be called from interrupt context.
> > +#define BL_C_MASK 0x7
> > +#define MD_C_SHIFT 0
> > +#define AD_C_SHIFT 3
> > +#define KP_C_SHIFT 6
> > +#define TC_C_MASK 0x3
[...]
> > +#define TC1HALF_BIT 18
> > +#define SLEWLIM_BIT 23
> > +#define TRIODE_TC_BIT 23
> > +#define TRIODE_MD_BIT 7
> > +#define TRIODE_AD_BIT 8
> > +#define TRIODE_KP_BIT 9
> > +#define BOOST_BIT 10
> > +#define PERIOD_MASK 0x3
> > +#define PERIOD_SHIFT 21
> > +#define ABMODE_MASK 0x7
> > +#define ABMODE_SHIFT 11
> > +#define ABREF_MASK 0x3
> > +#define ABREF_SHIFT 14
>
> Why not group the defines at the beginning of the file and properly
> namespace them?
Ok, I will define it with the register definition I must add to remove mc13783-
private.h inclusion.
[...]
> > + ret = mc13783_reg_write(dev, MC13783_REG_LED_CONTROL_2, reg);
> > + if (ret)
> > + goto out;
> > +
> > +
>
> only one empty line please.
Ok.
[...]
> > +err_register:
> > + if (i > 0) {
> > + for (i = i - 1; i >= 0; i--) {
> > + led_classdev_unregister(&led[i].cdev);
> > + cancel_work_sync(&led[i].work);
> > + }
> > + }
>
> the if isn't necessary, just doing for(...) is enough.
You're right i is signed. I will remove it.
> > +MODULE_DESCRIPTION("LEDs driver for Freescale MC13783 PMIC");
> > +MODULE_AUTHOR("Philipe Rétornaz <philippe.retorna@epfl.ch>");
>
> Philippe with two p? I'm not sure if non-ASCII chars are allowed here.
What a shame, I'm not able to write my own name !
Thank you for the review, I will post a v2 patch with the appropriates fixes
soon.
BTW, should I split this patch in 2 ? One for the mfd device, and one which
adds the led driver ?
Who will merge this ?
Regards,
Philippe
next prev parent reply other threads:[~2010-05-18 11:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-17 16:40 [PATCH 0/2] mc13783: " Philippe Rétornaz
2010-05-17 16:40 ` [PATCH 1/2] mc13783: add " Philippe Rétornaz
2010-05-17 16:40 ` [PATCH 2/2] mx31moboard: Add MC13783 led support Philippe Rétornaz
2010-05-17 19:02 ` [PATCH 1/2] mc13783: add LED support Uwe Kleine-König
2010-05-17 20:00 ` Mark Brown
2010-05-26 12:01 ` Richard Purdie
2010-05-26 15:58 ` Mark Brown
2010-05-18 11:27 ` Philippe Rétornaz [this message]
2010-05-25 14:57 ` Daniel Mack
2010-05-25 15:06 ` Philippe Rétornaz
2010-05-26 12:03 ` Richard Purdie
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=201005181327.29529.philippe.retornaz@epfl.ch \
--to=philippe.retornaz@epfl.ch \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maramaopercheseimorto@gmail.com \
--cc=rpurdie@linux.intel.com \
--cc=s.hauer@pengutronix.de \
--cc=sameo@linux.intel.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=valentin.longchamp@epfl.ch \
/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
all inboxes | Powered by JetHome®