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

Andrew Morton
2008-12-02T20:23:30Z

On Tue, 2 Dec 2008 20:05:45 +0000
Matthew Garrett <mjg59@srcf.ucam.org> 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.