public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@mandrakesoft.com>
To: Russell King <rmk@arm.linux.org.uk>
Cc: Albert Cranford <ac9410@attbi.com>,
	Linus Torvalds <torvalds@transmeta.com>,
	Kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: [patch 9/9]Four new i2c drivers and __init/__exit cleanup to i2c
Date: Sun, 15 Sep 2002 19:31:47 -0400	[thread overview]
Message-ID: <3D851863.3040107@mandrakesoft.com> (raw)
In-Reply-To: 20020916002619.D30390@flint.arm.linux.org.uk

Russell King wrote:
> On Sun, Sep 15, 2002 at 07:18:46PM -0400, Jeff Garzik wrote:
> 
>>Albert Cranford wrote:
>>
>>>--- linux/drivers/i2c/i2c-elektor.c.orig	2002-09-14 22:10:45.000000000 -0400
>>>+++ linux-2.5.34/drivers/i2c/i2c-elektor.c	2002-09-15 01:18:55.000000000 -0400
>>>@@ -125,12 +125,12 @@
>>> 	int timeout = 2;
>>> 
>>> 	if (irq > 0) {
>>>-		cli();
>>>+		local_irq_disable();
>>> 		if (pcf_pending == 0) {
>>> 			interruptible_sleep_on_timeout(&pcf_wait, timeout*HZ );
>>> 		} else
>>> 			pcf_pending = 0;
>>>-		sti();
>>>+		local_irq_enable();
>>> 	} else {
>>> 		udelay(100);
>>> 	}
>>
>>
>>
>>this is _not_ the way to fix...   use a proper spinlock
> 
> 
> You can't hold a spinlock and sleep though, was one of my points back
> in August.  (Albert submitted a patch with all cli()/sti() converted
> to spin_lock_irqsave()/spin_unlock_irqrestore().)
> 


whoops, you're right.

That follows along with my suggestion in another email, then :)  use a 
semaphore.  The timeout can be handled with a kernel timer.  The timeout 
is clearly multiple seconds, so there's no fine grain involved.

AND, since the timeout is multiple seconds, the code should not be 
disable interrupts for that long anyway.

	Jeff




      reply	other threads:[~2002-09-15 23:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-15 22:46 [patch 9/9]Four new i2c drivers and __init/__exit cleanup to i2c Albert Cranford
2002-09-15 23:18 ` Jeff Garzik
2002-09-15 23:26   ` Russell King
2002-09-15 23:31     ` Jeff Garzik [this message]

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=3D851863.3040107@mandrakesoft.com \
    --to=jgarzik@mandrakesoft.com \
    --cc=ac9410@attbi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk@arm.linux.org.uk \
    --cc=torvalds@transmeta.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