All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Rydh <samuel@ibrium.se>
To: linuxppc-dev@lists.linuxppc.org
Cc: benh@kernel.crashing.org
Subject: keywest bugfix
Date: Sat, 20 Mar 2004 14:43:16 +0100	[thread overview]
Message-ID: <20040320134316.GA1276@ibrium.se> (raw)


The following patch fixes a deadlock in I2C probing:

===== drivers/i2c/busses/i2c-keywest.c 1.12 vs edited =====
--- 1.12/drivers/i2c/busses/i2c-keywest.c	Mon Mar 15 11:25:23 2004
+++ edited/drivers/i2c/busses/i2c-keywest.c	Sat Mar 20 14:33:07 2004
@@ -608,6 +608,7 @@
 	}
 #endif /* POLLED_MODE */

+	pmac_low_i2c_unlock(np);
 	dev_set_drvdata(dev, iface);

 	for (i=0; i<nchan; i++) {
@@ -645,7 +646,6 @@
 	printk(KERN_INFO "Found KeyWest i2c on \"%s\", %d channel%s, stepping: %d bits\n",
 		np->parent->name, nchan, nchan > 1 ? "s" : "", bsteps);

-	pmac_low_i2c_unlock(np);
 	return 0;
 }


Without this patch, the deadlock occurs in the following situation:

- keywest holds the pmac_low_i2c_lock while registering the i2c adapter.
- i2c_add_adapter() notifies registered drivers by calling
driver->attach_adapter().
- a driver might access the i2c bus from attach_adapter() which
deadlocks since all xfer routines take the lock.

/Samuel

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

                 reply	other threads:[~2004-03-20 13:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20040320134316.GA1276@ibrium.se \
    --to=samuel@ibrium.se \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.linuxppc.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.