LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Mark Gross <mgross@linux.jf.intel.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	Tim Bird <tim.bird@am.sony.com>,
	linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: ANNOUNCE: CE Linux Forum - Specification V1.0 draft
Date: Tue, 18 May 2004 20:56:08 +0100	[thread overview]
Message-ID: <20040518205608.D30520@flint.arm.linux.org.uk> (raw)
In-Reply-To: <200405181232.48226.mgross@linux.intel.com>; from mgross@linux.jf.intel.com on Tue, May 18, 2004 at 12:32:48PM -0700

On Tue, May 18, 2004 at 12:32:48PM -0700, Mark Gross wrote:
> > --- linux-2.4.20.orig/drivers/ide/ide.c	Thu Nov 28 23:53:13 2002
> > +++ celinux-040213/drivers/ide/ide.c	Thu Feb 12 10:25:12 2004
> > @@ -2739,12 +2776,17 @@
> >   */
> >  void ide_delay_50ms (void)
> >  {
> > +#ifdef CONFIG_IDE_PREEMPT
> > +	__set_current_state(TASK_UNINTERRUPTIBLE);
> > +	schedule_timeout(1+HZ/20); /* from 2.5 */
> > +#else /* CONFIG_IDE_PREEMPT */
> >  #ifndef CONFIG_BLK_DEV_IDECS
> >  	mdelay(50);
> >  #else
> >  	__set_current_state(TASK_UNINTERRUPTIBLE);
> >  	schedule_timeout(HZ/20);
> >  #endif /* CONFIG_BLK_DEV_IDECS */
> > +#endif /* CONFIG_IDE_PREEMPT */
> >  }
> >
> > This great piece 'called IDE-preempt' to be buzzword-compliant is (and
> > that's noticeable just from looking at the diff!) so braindead that it's
> > not explainable by incompetence alone.  You'd get your same result by just
> > _disabling_ CONFIG_BLK_DEV_IDECS instead of adding another broken config
> > option (modulo 2.6 adjustments to the sleep time).
> >
> > Every engineer with the slightest clue would first disable that option, or
> > if ide-cs support is actually needed think _why_ it's different instead of
> > just adding a config option to disable it.  Either it's safe to always use
> > the sleeping variant in which case the original ifdef should go away, or
> > it's not in which case your patch is completely broken.
> >
> 
> OK I'll bite, but just because in your blind hostility and haste you've made a 
> mistake ;)

Christoph is actually making a valid point here and I suspect is trying
to point out the lack of thought put into this change.  The things that
_should_ have been considered before making the change are:

1. Why do we use mdelay() here if CONFIG_BLK_DEV_IDECS is defined?

2. Is the reason for this still valid?

3. If it is safe to sleep here even if CONFIG_CLK_DEV_IDECS is set,
   why bother with mdelay() in the first place?

The _correct_ patch is actually:

 void ide_delay_50ms (void)
 {
-#ifndef CONFIG_BLK_DEV_IDECS
-	mdelay(50);
-#else
 	__set_current_state(TASK_UNINTERRUPTIBLE);
 	schedule_timeout(HZ/20);
-#endif /* CONFIG_BLK_DEV_IDECS */
 }

since PCMCIA always calls drivers from process context now.




(Unfortunately I can't write upside down, but I'll give the answers to
those three items above.  Look away now if you don't want to read the
answers! 8) )


1. PCMCIA used to call drivers in IRQ context, which made it impossible
   to sleep.

2. No, because PCMCIA always calls drivers in process context now, so
   sleeping is possible.

3. Left as an exercise to the reader. 8)

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

  reply	other threads:[~2004-05-18 19:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-17 19:05 Tim Bird
2004-05-17 19:19 ` Christoph Hellwig
2004-05-17 19:59   ` Tim Bird
2004-05-17 20:42   ` Mark Gross
2004-05-17 20:48     ` Arjan van de Ven
     [not found]     ` <20040518074854.A7348@infradead.org>
2004-05-18 19:32       ` Mark Gross
2004-05-18 19:56         ` Russell King [this message]
2004-05-18 20:45           ` Bartlomiej Zolnierkiewicz
2004-05-18 20:00         ` viro
2004-05-19 19:30       ` Tim Bird
2004-05-19 21:57         ` Russell King
2004-05-19 22:02           ` Jeff Garzik
2004-05-19 23:46           ` Tim Bird
2004-05-19 22:08         ` Theodore Ts'o
2004-05-19 23:37           ` Tim Bird
2004-05-17 21:22   ` Tim Bird
2004-05-19 15:27     ` Adrian Bunk
2004-05-19 16:59       ` Tim Bird
2004-05-19 20:16         ` Adrian Bunk
2004-05-19 20:38           ` Tim Bird
2004-05-19 20:48             ` Nicolas Pitre
2004-05-19 22:00         ` Russell King

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=20040518205608.D30520@flint.arm.linux.org.uk \
    --to=rmk+lkml@arm.linux.org.uk \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgross@linux.jf.intel.com \
    --cc=tim.bird@am.sony.com \
    --subject='Re: ANNOUNCE: CE Linux Forum - Specification V1.0 draft' \
    /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).