LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Andy Walls <awalls@md.metrocast.net>,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	stoth@kernellabs.com
Subject: Re: cx23885-input.c does in fact use a workqueue....
Date: Mon, 14 Feb 2011 12:03:39 +0100	[thread overview]
Message-ID: <20110214110339.GC18742@htj.dyndns.org> (raw)
In-Reply-To: <20110214043355.GA28090@core.coreip.homeip.net>

Hello,

On Sun, Feb 13, 2011 at 08:33:55PM -0800, Dmitry Torokhov wrote:
> > The cx23885 driver does in fact schedule work for IR input handling:
> > 
> > Here's where it is scheduled for CX23888 chips:
> > 
> > http://git.linuxtv.org/media_tree.git?a=blob;f=drivers/media/video/cx23885/cx23885-ir.c;h=7125247dd25558678c823ee3262675570c9aa630;hb=HEAD#l76
> > 
> > Here's where it is scheduled for CX23885 chips:
> > 
> > http://git.linuxtv.org/media_tree.git?a=blob;f=drivers/media/video/cx23885/cx23885-core.c;h=359882419b7f588b7c698dbcfb6a39ddb1603301;hb=HEAD#l1861

Ah, sorry about missing those.

> > The two different chips are handled slightly differently because
> > 
> > a. the CX23888 IR unit is accessable via a PCI register block.  The IR
> > IRQ can be acknowledged with direct PCI register accesses in an
> > interrupt context, and the IR pulse FIFO serviced later in a workqueue
> > context.
> > 
> > b. the CX23885 IR unit is accessed over an I2C bus.  The CX23885 A/V IRQ
> > has to be masked in an interrupt context (with PCI registers accesses).
> > Then the CX23885 A/V unit's IR IRQ is ack'ed over I2C in a workqueue
> > context and the IR pulse FIFO is also serviced over I2C in a workqueue
> > context.
> > 
> > 
> > So what should be done about the flush_scheduled_work()?  I think it
> > belongs there.
> > 
> 
> Convert to using threaded irq?

Or

1. Just flush the work items explicitly using flush_work_sync().

2. Create a dedicated workqueue to serve as flushing domain.

The first would look like the following.  Does this look correct?

Thanks.

diff --git a/drivers/media/video/cx23885/cx23885-input.c b/drivers/media/video/cx23885/cx23885-input.c
index 199b996..e27cedb 100644
--- a/drivers/media/video/cx23885/cx23885-input.c
+++ b/drivers/media/video/cx23885/cx23885-input.c
@@ -229,6 +229,9 @@ static void cx23885_input_ir_stop(struct cx23885_dev *dev)
 		v4l2_subdev_call(dev->sd_ir, ir, rx_s_parameters, &params);
 		v4l2_subdev_call(dev->sd_ir, ir, rx_g_parameters, &params);
 	}
+	flush_work_sync(&dev->cx25840_work);
+	flush_work_sync(&dev->ir_rx_work);
+	flush_work_sync(&dev->ir_tx_work);
 }
 
 static void cx23885_input_ir_close(struct rc_dev *rc)

-- 
tejun

  reply	other threads:[~2011-02-14 11:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-14  1:35 Andy Walls
2011-02-14  4:33 ` Dmitry Torokhov
2011-02-14 11:03   ` Tejun Heo [this message]
2011-02-15  0:54     ` Andy Walls
2011-02-15  9:12       ` Tejun Heo
2011-02-15  9:20       ` [PATCH] cx23885: restore flushes of cx23885_dev work items Tejun Heo
2011-02-15 20:00         ` Mauro Carvalho Chehab

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=20110214110339.GC18742@htj.dyndns.org \
    --to=tj@kernel.org \
    --cc=awalls@md.metrocast.net \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=stoth@kernellabs.com \
    --subject='Re: cx23885-input.c does in fact use a workqueue....' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).