From: Nish Aravamudan <nish.aravamudan@gmail.com>
To: "Moore, Eric Dean" <Eric.Moore@lsil.com>
Cc: Matt Domsch <Matt_Domsch@dell.com>, Olaf Hering <olh@suse.de>,
Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org,
James Bottomley <James.Bottomley@steeleye.com>,
linux-scsi@vger.kernel.org
Subject: Re: [PATCH 22/82] remove linux/version.h from drivers/message/fus ion
Date: Wed, 20 Jul 2005 10:55:02 -0700 [thread overview]
Message-ID: <29495f1d05072010551c875a4a@mail.gmail.com> (raw)
In-Reply-To: <91888D455306F94EBD4D168954A9457C03281EB4@nacos172.co.lsil.com>
On 7/19/05, Moore, Eric Dean <Eric.Moore@lsil.com> wrote:
> On Tuesday, July 12, 2005 8:17 PM, Matt Domsch wrote:
> > In general, this construct:
> >
> > > > -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,6))
> > > > -static int inline scsi_device_online(struct scsi_device *sdev)
> > > > -{
> > > > - return sdev->online;
> > > > -}
> > > > -#endif
> >
> > is better tested as:
> >
> > #ifndef scsi_device_inline
> > static int inline scsi_device_online(struct scsi_device *sdev)
> > {
> > return sdev->online;
> > }
> > #endif
> >
> > when you can. It cleanly eliminates the version test, and tests for
> > exactly what you're looking for - is this function defined.
> >
>
> What you illustrated above is not going to work.
> If your doing #ifndef around a function, such as scsi_device_online, it's
> not going to compile
> when scsi_device_online is already implemented in the kernel tree.
> The routine scsi_device_online is a function, not a define. For a define
> this would work.
>
> I'm trying your example around msleep, msleep_interruptible, and
> msecs_to_jiffies, and
> my code simply won't compile in SLES9 SP2(-191). In SLES9 SP1(-139), these
> three routines were not implemented and
> your suggestion works. I won't be able to to a linux version check as this
> change occurred between service packs
> of the 2.6.5 kernel suse tree. Anybody on the linux forums have any ideas?
>
> Example:
>
> #ifdef msleep
> static void inline msleep(unsigned long msecs)
> {
> set_current_state(TASK_UNINTERRUPTIBLE);
> schedule_timeout(msecs_to_jiffies(msecs) + 1);
> }
> #endif
Just an FYI, if you are trying to emulate the actual behavior of
msleep() in the current kernel via this function, then you need to
place the sleep in a while-loop. Please see kernel/timer.c::msleep().
Your version will wake up on wait-queue events, while msleep() in the
current kernel does not.
Thanks,
Nish
next prev parent reply other threads:[~2005-07-20 17:55 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-20 0:07 [PATCH 22/82] remove linux/version.h from drivers/message/fus ion Moore, Eric Dean
2005-07-20 3:12 ` Matt Domsch
2005-07-20 4:28 ` Stephen Rothwell
2005-07-20 5:09 ` Moore, Eric Moore
2005-07-20 8:30 ` Bernd Petrovitsch
2005-07-20 12:48 ` Matthew Wilcox
2005-07-20 17:54 ` Nathan Lynch
2005-07-20 18:22 ` Matt Domsch
2005-07-20 17:55 ` Nish Aravamudan [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-07-13 15:11 Moore, Eric Dean
2005-07-12 22:34 Moore, Eric Dean
2005-07-12 20:50 Moore, Eric Dean
2005-07-12 20:56 ` Tom Duffy
2005-07-12 22:14 ` David S. Miller
2005-07-11 0:15 Moore, Eric Dean
2005-07-12 20:30 ` Tom Duffy
2005-07-13 2:16 ` Matt Domsch
2005-07-13 14:37 ` Christoph Hellwig
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=29495f1d05072010551c875a4a@mail.gmail.com \
--to=nish.aravamudan@gmail.com \
--cc=Eric.Moore@lsil.com \
--cc=James.Bottomley@steeleye.com \
--cc=Matt_Domsch@dell.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=olh@suse.de \
/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