diff mbox

[3/5] rapidio: run discovery as an asynchronous process

Message ID 20121003152953.79aecece.akpm@linux-foundation.org (mailing list archive)
State Not Applicable
Headers show

Commit Message

Andrew Morton Oct. 3, 2012, 10:29 p.m. UTC
On Wed,  3 Oct 2012 15:18:41 -0400
Alexandre Bounine <alexandre.bounine@idt.com> wrote:

> Modify mport initialization routine to run the RapidIO discovery process
> asynchronously. This allows to have an arbitrary order of enumerating and
> discovering ports in systems with multiple RapidIO controllers without
> creating a deadlock situation if enumerator port is registered after a
> discovering one.
> 
> Making netID matching to mportID ensures consistent net ID assignment in
> multiport RapidIO systems with asynchronous discovery process (global counter
> implementation is affected by race between threads).
> 
>
> ...
>
> +static void __devinit disc_work_handler(struct work_struct *_work)
> +{
> +	struct rio_disc_work *work = container_of(_work,
> +						  struct rio_disc_work, work);

There's a nice simple way to avoid such ugliness:
diff mbox

Patch

--- a/drivers/rapidio/rio.c~rapidio-run-discovery-as-an-asynchronous-process-fix
+++ a/drivers/rapidio/rio.c
@@ -1269,9 +1269,9 @@  struct rio_disc_work {
 
 static void __devinit disc_work_handler(struct work_struct *_work)
 {
-	struct rio_disc_work *work = container_of(_work,
-						  struct rio_disc_work, work);
+	struct rio_disc_work *work;
 
+	work = container_of(_work, struct rio_disc_work, work);
 	pr_debug("RIO: discovery work for mport %d %s\n",
 		 work->mport->id, work->mport->name);
 	rio_disc_mport(work->mport);