Re: [PATCH 1/1] leds: blinkm: Remove unused variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What about this ...


-- 

Dipl.-Ing.
Jan-Simon Möller

jansimon.moeller@xxxxxx
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@xxxxxxxxxxx>
> 
> 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@xxxxxxxxxxx>
> > > ---
> > > 
> > >  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
>From 652251115033be83c3626b260d9f1fdf0e479b73 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan-Simon=20M=C3=B6ller?= <dl9pf@xxxxxx>
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@xxxxxx>
---
 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


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux