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

From: Matthew Garrett
Date: Tue Dec 02 2008 - 15:06:26 EST


On Tue, Dec 02, 2008 at 11:50:29AM -0800, Andrew Morton wrote:
> > +struct calling_interface_buffer {
> > + u16 class;
> > + u16 select;
> > + volatile u32 input[4];
> > + volatile u32 output[4];
> > +} __attribute__ ((packed));
>
> We have that little __packed helper for this.

Ok. I've switched to that, although the __attribute__ notation seems to
be the dominant form in the kernel right now.

> > +static struct dmi_system_id __initdata dell_device_table[] = {
>
> this can be made const.

Done.

> > + da_num_tokens += tokens;
> > +}
>
> OK. No locking is needed for updates to the global state?

The parse function is called once during module init, before the driver
is registered. On the other hand, that makes me realise that we leak it
if something else fails, so I've fixed that up as well.

> > +#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?

> > + dell_backlight_device = NULL;
> > + ret = PTR_ERR(dell_backlight_device);
>
> The above two statements are in the wrong order.

Good catch, thanks.

--
Matthew Garrett | mjg59@xxxxxxxxxxxxx
--
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/