Skip to contentSkip to conversation

remove unnecessary work pending test

PATCH Applied Xie XiuQi 3 participants 13 messages Sep 6, 2013 – Sep 9, 2013 1 message not in the archive

Subsystems (8)
lore
Share & tools
lore
author
#6 lore raw

PATCH 2/5 input: remove unnecessary work pending test

In reply to Xie XiuQi

Remove unnecessary work pending test before calling schedule_work(). It has been tested in queue_work_on() already.

---
 drivers/input/touchscreen/cyttsp4_core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/input/touchscreen/cyttsp4_core.c +1 -2
index edcf799..b0ee865 100644
@@ -1249,8 +1249,7 @@ static void cyttsp4_watchdog_timer(unsigned long handle)
 	if (!cd)
 		return;
 
-	if (!work_pending(&cd->watchdog_work))
-		schedule_work(&cd->watchdog_work);
+	schedule_work(&cd->watchdog_work);
 
 	return;
 }
Signature · 1 line
1.8.2.2

Xie XiuQi

author
#0 lore raw

cover remove unnecessary work pending test

There's no need to test whether a (delayed) work item in pending before queueing, flushing or cancelling it. It has been tested in queue_work_on() already. No functional changed.

Xie XiuQi (5):
iio: adc: remove unnecessary work pending test
input: remove unnecessary work pending test
lib: remove unnecessary work pending test
staging: olpc_dcon: remove unnecessary work pending test
ipc: input: remove unnecessary work pending test

 drivers/input/touchscreen/cyttsp4_core.c | 3 +--
 drivers/staging/iio/adc/ad7606_core.c    | 7 +++----
 drivers/staging/olpc_dcon/olpc_dcon.c    | 2 +-
 ipc/util.c                               | 4 +---
 lib/debugobjects.c                       | 2 +-
 5 files changed, 7 insertions(+), 11 deletions(-)
Signature · 1 line
1.8.2.2
author
#1 lore raw

PATCH 1/5 iio: adc: remove unnecessary work pending test

Remove unnecessary work pending test before calling schedule_work(). It has been tested in queue_work_on() already. No functional changed.

---
 drivers/staging/iio/adc/ad7606_core.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/staging/iio/adc/ad7606_core.c +3 -4
index 72868ce..c6f99069 100644
@@ -424,10 +424,9 @@ static irqreturn_t ad7606_interrupt(int irq, void *dev_id)
 	struct iio_dev *indio_dev = dev_id;
 	struct ad7606_state *st = iio_priv(indio_dev);
 
-	if (iio_buffer_enabled(indio_dev)) {
-		if (!work_pending(&st->poll_work))
-			schedule_work(&st->poll_work);
-	} else {
+	if (iio_buffer_enabled(indio_dev))
+		schedule_work(&st->poll_work);
+	else {
 		st->done = true;
 		wake_up_interruptible(&st->wq_data_avail);
 	}
Signature · 1 line
1.8.2.2
author
#8 lore raw

PATCH 3/5 lib: remove unnecessary work pending test

In reply to Xie XiuQi

Remove unnecessary work pending test before calling schedule_work(). It has been tested in queue_work_on() already. No functional changed.

---
 lib/debugobjects.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/debugobjects.c +1 -1
index 37061ed..67e84c8 100644
@@ -196,7 +196,7 @@ static void free_object(struct debug_obj *obj)
 	 * initialized:
 	 */
 	if (obj_pool_free > ODEBUG_POOL_SIZE && obj_cache)
-		sched = keventd_up() && !work_pending(&debug_obj_work);
+		sched = keventd_up();
 	hlist_add_head(&obj->node, &obj_pool);
 	obj_pool_free++;
 	obj_pool_used--;
Signature · 1 line
1.8.2.2
author
#10 lore raw

PATCH 4/5 staging: olpc_dcon: remove unnecessary work pending test

In reply to Xie XiuQi

Remove unnecessary work pending test before calling schedule_work(). It has been tested in queue_work_on() already. No functional changed.

---
 drivers/staging/olpc_dcon/olpc_dcon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/olpc_dcon/olpc_dcon.c +1 -1
index 193e1c6..0dfd528 100644
@@ -381,7 +381,7 @@ static void dcon_set_source(struct dcon_priv *dcon, int arg)
 
 	dcon->pending_src = arg;
 
-	if ((dcon->curr_src != arg) && !work_pending(&dcon->switch_source))
+	if (dcon->curr_src != arg)
 		schedule_work(&dcon->switch_source);
 }
 
Signature · 1 line
1.8.2.2
author
#12 lore raw

PATCH 5/5 ipc: remove unnecessary work pending test

In reply to Xie XiuQi

Remove unnecessary work pending test before calling schedule_work(). It has been tested in queue_work_on() already. No functional changed.

Cc Nadia Derbey <[email protected]>
Cc Tejun Heo <[email protected]>
---
 ipc/util.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
ipc/util.c +1 -3
index 4704223..f9105ed 100644
@@ -67,10 +67,8 @@ static int ipc_memory_callback(struct notifier_block *self,
 		 * In order not to keep the lock on the hotplug memory chain
 		 * for too long, queue a work item that will, when waken up,
 		 * activate the ipcns notification chain.
-		 * No need to keep several ipc work items on the queue.
 		 */
-		if (!work_pending(&ipc_memory_wq))
-			schedule_work(&ipc_memory_wq);
+		schedule_work(&ipc_memory_wq);
 		break;
 	case MEM_GOING_ONLINE:
 	case MEM_GOING_OFFLINE:
Signature · 1 line
1.8.2.2
Reviewed-by on v1 1/5
#2 lore raw

Re: [PATCH 1/5] iio: adc: remove unnecessary work pending test

In reply to Xie XiuQi
Quoted 5 lines · Xie XiuQi

Remove unnecessary work pending test before calling schedule_work(). It has been tested in queue_work_on() already. No functional changed.

One nit below tho.

drivers/staging/iio/adc/ad7606_core.c static irqreturn_t ad7606_interrupt(int irq, void *dev_id) · line 432

Quoted 10 lines
drivers/staging/iio/adc/ad7606_core.c +3 -4
-	if (iio_buffer_enabled(indio_dev)) {
-		if (!work_pending(&st->poll_work))
-			schedule_work(&st->poll_work);
-	} else {
+	if (iio_buffer_enabled(indio_dev))
+		schedule_work(&st->poll_work);
+	else {
 		st->done = true;
 		wake_up_interruptible(&st->wq_data_avail);
 	}

Please don't drop the parentheses. The convention is to have either both or none on if/else.

Thanks.

Signature · 1 line
tejun
maintainer
#3 lore raw

Re: [PATCH 1/5] iio: adc: remove unnecessary work pending test

In reply to Tejun Heo

ccing Michael Hennerich and Lars-Peter Clausen,

Quoted 11 lines · Tejun Heo
Quoted 5 lines · Xie XiuQi

Remove unnecessary work pending test before calling schedule_work(). It has been tested in queue_work_on() already. No functional changed.

One nit below tho.

Quoted 13 lines

drivers/staging/iio/adc/ad7606_core.c static irqreturn_t ad7606_interrupt(int irq, void *dev_id) · line 432

Quoted 10 lines
drivers/staging/iio/adc/ad7606_core.c +3 -4
-	if (iio_buffer_enabled(indio_dev)) {
-		if (!work_pending(&st->poll_work))
-			schedule_work(&st->poll_work);
-	} else {
+	if (iio_buffer_enabled(indio_dev))
+		schedule_work(&st->poll_work);
+	else {
 		st->done = true;
 		wake_up_interruptible(&st->wq_data_avail);
 	}

Please don't drop the parentheses. The convention is to have either both or none on if/else.

I'll fix this up on applying if everyone is happy (can't see why the won't be, but best to check!) Michael is clearly given as the author of driver so should probably have been in the cc list. Whilst I might apply this directly as maintainer I much prefer if I get an ack from the driver author as if nothing else it gives me a warm fuzzy feeling ;)

Also patch title should mention that a) this is a staging driver, b) which adc driver it applies to. I'll fix that up as well on applying it.

Thanks for the patch though, it would probably never have been noticed otherwise!

Quoted 3 lines

Thanks.

maintainer Applied
#5 lore raw

Re: [PATCH 1/5] iio: adc: remove unnecessary work pending test

In reply to a message not in the archive
Quoted 6 lines · Michael Hennerich
Quoted 1 line · Jonathan Cameron

ccing Michael Hennerich and Lars-Peter Clausen,

Looks good to me!

/Acked-by/: /Michael Hennerich/ <[email protected]>

Applied to the togreg branch of iio.git.

Thanks

Quoted 50 lines
Quoted 38 lines · Tejun Heo
Quoted 10 lines · Xie XiuQi
Quoted 5 lines

Remove unnecessary work pending test before calling schedule_work(). It has been tested in queue_work_on() already. No functional changed.

One nit below tho.

Quoted 12 lines

drivers/staging/iio/adc/ad7606_core.c static irqreturn_t ad7606_interrupt(int irq, void *dev_id) · line 432

Quoted 10 lines
drivers/staging/iio/adc/ad7606_core.c +3 -4
-	if (iio_buffer_enabled(indio_dev)) {
-		if (!work_pending(&st->poll_work))
-			schedule_work(&st->poll_work);
-	} else {
+	if (iio_buffer_enabled(indio_dev))
+		schedule_work(&st->poll_work);
+	else {
 		st->done = true;
 		wake_up_interruptible(&st->wq_data_avail);
 	}

Please don't drop the parentheses. The convention is to have either both or none on if/else.

I'll fix this up on applying if everyone is happy (can't see why the won't be, but best to check!) Michael is clearly given as the author of driver so should probably have been in the cc list. Whilst I might apply this directly as maintainer I much prefer if I get an ack from the driver author as if nothing else it gives me a warm fuzzy feeling ;)

Also patch title should mention that a) this is a staging driver, b) which adc driver it applies to. I'll fix that up as well on applying it.

Thanks for the patch though, it would probably never have been noticed otherwise!

Quoted 2 lines

Thanks.

Signature · 8 lines
Greetings,
Michael

--
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368;
Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin,
Margaret Seif