public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Rankin <rankincj@yahoo.com>
To: Devin Heitmueller <dheitmueller@kernellabs.com>
Cc: linux-media@vger.kernel.org, mchehab@redhat.com,
	Antti Palosaari <crope@iki.fi>
Subject: Re: [PATCH] Latest version of em28xx / em28xx-dvb patch for PCTV 290e
Date: Thu, 18 Aug 2011 20:56:34 +0100	[thread overview]
Message-ID: <4E4D6E72.5070509@yahoo.com> (raw)
In-Reply-To: <CAGoCfiwk4vy1V7T=Hdz1CsywgWVpWEis0eDoh2Aqju3LYqcHfA@mail.gmail.com>

On 18/08/11 19:43, Devin Heitmueller wrote:
> You would be well served to break this into a patch series, as it tends to be 
> difficult to review a whole series of changes in a single patch. You seem to 
> be mixed in a bunch of "useless" changes alongside functional changes. For 
> example, if you're trying to add in a missing goto inside an exception block, 
> doing that at the same time as renaming instances of "errCode" to "retval" 
> just creates confusion.

Actually, those two particular changes go together because I'm replacing "return 
errCode" with a goto to "return retval". Ultimately, errCode becomes an unused 
variable.

> And finally, the mutex structure used for the modules is somewhat complicated 
> due to to the need to keep the analog side of the board locked while 
> initializing the digital side. This code was added specifically to prevent 
> race conditions that were seen during initialization as things like udev and 
> dbus attempted to connect to the newly created V4L device while the em28xx-dvb 
> module was still coming up.

OK, thanks. I've been tackling this problem from the "We must always take lock A 
before lock B, and never vice versa" point of view. So the order is:

- take device mutex
- enter em28xx_init_dev()
- enter em28xx_init_extension()
- take device list mutex
- call init() function for every extension with this device

Since dvb_init() is the init() function for the em28xx-dvb extension, it follows 
that it cannot take the device's mutex again. The problem is therefore moved to 
em28xx_dvb_register(), which takes the device list mutex and yet MUST not take 
the mutex for any device in the list.

Combining em28xx_add_into_devlist() with em28xx_init_extension() (and similarly 
em28xx_remove_from_devlist() with em28xx_close_extension()) means that the 
device list must always contain a list of devices that has been initialised 
against every extension in the extension list.

I can probably factor out the simpler patches first, such as using the bit 
operations on em28xx_devused, and the memory leak in em28xx_v4l2_close(). And 
the spelling fixes...

Cheers,
Chris


  parent reply	other threads:[~2011-08-18 20:02 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-18 17:52 [PATCH] Latest version of em28xx / em28xx-dvb patch for PCTV 290e Chris Rankin
2011-08-18 18:43 ` Devin Heitmueller
2011-08-18 18:44   ` Devin Heitmueller
2011-08-18 21:34     ` Chris Rankin
2011-08-18 22:11     ` Chris Rankin
2011-08-19  5:53       ` Mauro Carvalho Chehab
2011-08-20 11:08         ` [PATCH 1/6 ] EM28xx - pass correct buffer size to snprintf Chris Rankin
2011-08-20 11:14         ` [PATCH 2/6] Fix memory leak on disconnect or error Chris Rankin
2011-08-20 11:21         ` [PATCH 3/6] EM28xx - use atomic bit operations for devices-in-use mask Chris Rankin
2011-08-20 11:28         ` [PATCH 4/6] EM28xx - clean up resources should init fail Chris Rankin
2011-08-20 11:31         ` [PATCH 5/6] EM28xx - move printk lines outside mutex lock Chris Rankin
2011-08-20 11:37         ` [PATCH 6/6] EM28xx - don't sleep on disconnect Chris Rankin
2011-08-20 12:17           ` Mauro Carvalho Chehab
2011-08-20 13:46             ` Chris Rankin
2011-08-20 14:20               ` Mauro Carvalho Chehab
2011-08-20 19:01                 ` Chris Rankin
2011-08-20 11:42         ` [PATCH 1/2] EM28xx - fix race " Chris Rankin
2011-08-20 12:36           ` Sylwester Nawrocki
2011-08-20 11:46         ` [PATCH 2/2] EM28xx - fix deadlock when unplugging and replugging a DVB adapter Chris Rankin
2011-08-20 12:34           ` Mauro Carvalho Chehab
2011-08-20 14:40             ` Chris Rankin
2011-08-20 15:02               ` Mauro Carvalho Chehab
2011-08-20 22:38                 ` [PATCH 1/1] " Chris Rankin
2011-08-21 12:32                 ` Chris Rankin
2011-09-13 20:04                   ` Antti Palosaari
2011-09-13 20:47                     ` Chris Rankin
2011-08-18 22:28     ` [PATCH] Latest version of em28xx / em28xx-dvb patch for PCTV 290e Chris Rankin
2011-08-18 23:45     ` Chris Rankin
2011-08-19  0:12     ` Chris Rankin
2011-08-18 19:56   ` Chris Rankin [this message]
2011-08-19  1:01     ` 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=4E4D6E72.5070509@yahoo.com \
    --to=rankincj@yahoo.com \
    --cc=crope@iki.fi \
    --cc=dheitmueller@kernellabs.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.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