Re: [PATCH 2/2] misc: Add dell-laptop driver

From: Andrew Morton
Date: Tue Dec 02 2008 - 15:23:32 EST


On Tue, 2 Dec 2008 20:05:45 +0000
Matthew Garrett <mjg59@xxxxxxxxxxxxx> wrote:

> > > +#ifdef CONFIG_ACPI
> > > + if (acpi_video_backlight_support())
> > > + return 0;
> > > +#endif
> >
> > Do we need the ifdefs here? It looks like include/linux/acpi.h tries
> > to provide a suitable 0-returning stub?
>
> They're protected by #ifdef CONFIG_ACPI_VIDEO, but it looks like acpi.h
> is empty if CONFIG_ACPI isn't set?

No, acpi.h has a _few_ ACPI=n stubs:

: static inline int early_acpi_boot_init(void)
: {
: return 0;
: }
: static inline int acpi_boot_init(void)
: {
: return 0;
: }
:
: static inline int acpi_boot_table_init(void)
: {
: return 0;
: }
:
: static inline int acpi_mps_check(void)
: {
: return 0;
: }
:
: static inline int acpi_check_resource_conflict(struct resource *res)
: {
: return 0;
: }
:
: static inline int acpi_check_region(resource_size_t start, resource_size_t n,
: const char *name)
: {
: return 0;
: }
:
: static inline int acpi_check_mem_region(resource_size_t start,
: resource_size_t n, const char *name)
: {
: return 0;
: }

So it seems that acpi_video_backlight_support() should be added to this
list. Except it already has a stub, in the wrong place. This whole block:

: #if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE)
:
: extern long acpi_video_get_capabilities(acpi_handle graphics_dev_handle);
: extern long acpi_is_video_device(struct acpi_device *device);
: extern int acpi_video_backlight_support(void);
: extern int acpi_video_display_switch_support(void);
:
: #else
:
: static inline long acpi_video_get_capabilities(acpi_handle graphics_dev_handle)
: {
: return 0;
: }
:
: static inline long acpi_is_video_device(struct acpi_device *device)
: {
: return 0;
: }
:
: static inline int acpi_video_backlight_support(void)
: {
: return 0;
: }
:
: static inline int acpi_video_display_switch_support(void)
: {
: return 0;
: }
:
: #endif /* defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) */
:

needs to be moved outside the `#ifdef CONFIG_ACPI' altogether. Then you
can drop the ifdef.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/