From: "Jan-Simon Möller" <dl9pf@gmx.de>
To: Bryan Wu <cooloney@gmail.com>
Cc: Sachin Kamat <sachin.kamat@samsung.com>,
Linux LED Subsystem <linux-leds@vger.kernel.org>,
spk.linux@gmail.com
Subject: Re: [PATCH 1/1] leds: blinkm: Remove unused variable
Date: Wed, 09 Jul 2014 14:34:34 +0200 [thread overview]
Message-ID: <3676295.nUINk5lfjs@aragorn> (raw)
In-Reply-To: <3261853.AEHXRXfVcs@samweis.auenland.lan>
[-- Attachment #1: Type: text/plain, Size: 2298 bytes --]
What about this ...
--
Dipl.-Ing.
Jan-Simon Möller
jansimon.moeller@gmx.de
Am Dienstag, 1. Juli 2014, 23:50:29 schrieb Jan-Simon Möller:
> Nighttime here. I'll look tomorrow.
>
> > On Tue, Jul 1, 2014 at 5:07 AM, Sachin Kamat <sachin.kamat@samsung.com>
>
> wrote:
> > > 'ret' is not used in the function. Remove it.
> >
> > Removing it is easy but I guess we should check the return error status
> > here. Jan-Simon, what's your opinion then?
> >
> > Thanks,
> > -Bryan
> >
> > > Signed-off-by: Sachin Kamat <sachin.kamat@samsung.com>
> > > ---
> > >
> > > drivers/leds/leds-blinkm.c | 8 +++-----
> > > 1 file changed, 3 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/drivers/leds/leds-blinkm.c b/drivers/leds/leds-blinkm.c
> > > index d0452b099aee..f07f920ac0ac 100644
> > > --- a/drivers/leds/leds-blinkm.c
> > > +++ b/drivers/leds/leds-blinkm.c
> > > @@ -441,14 +441,13 @@ static int blinkm_transfer_hw(struct i2c_client
> > > *client, int cmd)>
> > >
> > > static void led_work(struct work_struct *work)
> > > {
> > >
> > > - int ret;
> > >
> > > struct blinkm_led *led;
> > > struct blinkm_data *data;
> > > struct blinkm_work *blm_work = work_to_blmwork(work);
> > >
> > > led = blm_work->blinkm_led;
> > > data = i2c_get_clientdata(led->i2c_client);
> > >
> > > - ret = blinkm_transfer_hw(led->i2c_client, BLM_GO_RGB);
> > > + blinkm_transfer_hw(led->i2c_client, BLM_GO_RGB);
> > >
> > > atomic_dec(&led->active);
> > > dev_dbg(&led->i2c_client->dev,
> > >
> > > "# DONE # next_red = %d, next_green = %d,"
> > >
> > > @@ -546,9 +545,8 @@ static void blinkm_led_blue_set(struct led_classdev
> > > *led_cdev,>
> > >
> > > static void blinkm_init_hw(struct i2c_client *client)
> > > {
> > >
> > > - int ret;
> > > - ret = blinkm_transfer_hw(client, BLM_STOP_SCRIPT);
> > > - ret = blinkm_transfer_hw(client, BLM_GO_RGB);
> > > + blinkm_transfer_hw(client, BLM_STOP_SCRIPT);
> > > + blinkm_transfer_hw(client, BLM_GO_RGB);
> > >
> > > }
> > >
> > > static int blinkm_test_run(struct i2c_client *client)
> > >
> > > --
> > > 1.7.9.5
[-- Attachment #2: 0001-Enhance-error-checking-and-remove-sequence-handling.patch --]
[-- Type: text/x-patch, Size: 2167 bytes --]
>From 652251115033be83c3626b260d9f1fdf0e479b73 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan-Simon=20M=C3=B6ller?= <dl9pf@gmx.de>
Date: Wed, 9 Jul 2014 14:26:53 +0200
Subject: [PATCH] Enhance error-checking and remove sequence handling.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jan-Simon Möller <dl9pf@gmx.de>
---
drivers/leds/leds-blinkm.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/leds/leds-blinkm.c b/drivers/leds/leds-blinkm.c
index d0452b0..9e7b988 100644
--- a/drivers/leds/leds-blinkm.c
+++ b/drivers/leds/leds-blinkm.c
@@ -449,6 +449,8 @@ static void led_work(struct work_struct *work)
led = blm_work->blinkm_led;
data = i2c_get_clientdata(led->i2c_client);
ret = blinkm_transfer_hw(led->i2c_client, BLM_GO_RGB);
+ if(ret)
+ dev_err(&led->i2c_client->dev, "BlinkM: HW transfer error\n");
atomic_dec(&led->active);
dev_dbg(&led->i2c_client->dev,
"# DONE # next_red = %d, next_green = %d,"
@@ -548,7 +550,11 @@ static void blinkm_init_hw(struct i2c_client *client)
{
int ret;
ret = blinkm_transfer_hw(client, BLM_STOP_SCRIPT);
+ if(ret)
+ dev_err(&client->dev, "BlinkM: HW transfer error\n");
ret = blinkm_transfer_hw(client, BLM_GO_RGB);
+ if(ret)
+ dev_err(&client->dev, "BlinkM: HW transfer error\n");
}
static int blinkm_test_run(struct i2c_client *client)
@@ -747,6 +753,8 @@ static int blinkm_remove(struct i2c_client *client)
/* make sure no workqueue entries are pending */
for (i = 0; i < 3; i++) {
+ //imbalance active counter to prevent further work
+ atomic_inc(&data->blinkm_leds[i].active);
flush_scheduled_work();
led_classdev_unregister(&data->blinkm_leds[i].led_cdev);
}
@@ -780,6 +788,10 @@ static int blinkm_remove(struct i2c_client *client)
dev_err(&client->dev, "Failure in blinkm_remove ignored. Continuing.\n");
sysfs_remove_group(&client->dev.kobj, &blinkm_group);
+
+ // make sure all is done before returning
+ flush_scheduled_work();
+
return 0;
}
--
1.8.4.5
next prev parent reply other threads:[~2014-07-09 12:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-01 12:07 [PATCH 1/1] leds: blinkm: Remove unused variable Sachin Kamat
2014-07-01 15:54 ` Bryan Wu
2014-07-01 21:50 ` Jan-Simon Möller
2014-07-09 12:34 ` Jan-Simon Möller [this message]
2014-07-15 0:54 ` Bryan Wu
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=3676295.nUINk5lfjs@aragorn \
--to=dl9pf@gmx.de \
--cc=cooloney@gmail.com \
--cc=linux-leds@vger.kernel.org \
--cc=sachin.kamat@samsung.com \
--cc=spk.linux@gmail.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