lkml.org 
[lkml]   [2005]   [Jul]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH 22/82] remove linux/version.h from drivers/message/fus ion
Date
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


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-07-20 02:11    [W:0.072 / U:0.604 seconds]
©2003-2014 Jasper Spaans. Advertise on this site