Re: [PATCH] Patches for tiny 386 kernels, again. Linux kernel2.6.22.7

From: Andrey Panin
Date: Tue Sep 25 2007 - 00:46:07 EST


On 267, 09 24, 2007 at 03:09:17PM -0400, Dave Jones wrote:
> On Mon, Sep 24, 2007 at 01:51:17AM -0700, Jonathan Campbell wrote:
>
>
> > +#if defined(__i386__) && defined(CONFIG_DMI)
> > dmi_check_system(acpi_dmi_table);
> > #endif
> >
> > +#ifdef CONFIG_DMI
> > dmi_scan_machine();
> > +#endif
> >
> > +#ifdef CONFIG_DMI
> > /* Check and install the TSC clocksource */
> > dmi_check_system(bad_tsc_dmi_table);
> > +#endif
> >
> > +#ifdef CONFIG_DMI
> > dmi_check_system(acpi_osl_dmi_table);
> > +#endif
>
> Instead of adding all these ifdefs, we could just define
> add something along the lines of..
>
> #ifndef CONFIG_DMI
> #define dmi_check_system do {} while (0)
> #endif
>
> in some header, which hides the uglies away from the code
> whilst having the same net effect.

Let take a look at linux/dmi.h:

#ifdef CONFIG_DMI

extern int dmi_check_system(struct dmi_system_id *list);
extern char * dmi_get_system_info(int field);
extern struct dmi_device * dmi_find_device(int type, const char *name,
struct dmi_device *from);
extern void dmi_scan_machine(void);
extern int dmi_get_year(int field);
extern int dmi_name_in_vendors(char *str);

#else

static inline int dmi_check_system(struct dmi_system_id *list) { return 0; }
static inline char * dmi_get_system_info(int field) { return NULL; }
static inline struct dmi_device * dmi_find_device(int type, const char *name,
struct dmi_device *from) { return NULL; }
static inline int dmi_get_year(int year) { return 0; }
static inline int dmi_name_in_vendors(char *s) { return 0; }

#endif

--
Andrey Panin | Linux and UNIX system administrator
pazke@xxxxxxxxx | PGP key: wwwkeys.pgp.net

Attachment: signature.asc
Description: Digital signature