Re: [PATCH] acpi: const-ify functions

From: Alexey Dobriyan
Date: Wed Dec 08 2010 - 14:17:50 EST


On Wed, Dec 08, 2010 at 07:25:10PM +0100, Hanno Böck wrote:
> Will const a couple of functions and variables. This is extracted
> from grsecurity (with only a slight modification to limit a line
> to 80 chars).

Why don't they do it themselves? :^)

> Patch is against linux-acpi-2.6 git.
>
> Similar patches have been sent in the past but not applied,
> supposedly because they weren't sent to subsystem maintainers.
> (I may continue to send similar extracts to other subsystems)
>
> ---
> Signed-off-by: Hanno Boeck <hanno@xxxxxxxxx>

Signed-off-by should be before --- -- it must make into changelog.

> diff -Naurp linux-acpi-1//drivers/acpi/battery.c linux-acpi-2/drivers/acpi/battery.c
> --- linux-acpi-1//drivers/acpi/battery.c 2010-12-08 18:42:26.187000005 +0100
> +++ linux-acpi-2/drivers/acpi/battery.c 2010-12-08 18:42:53.595000204 +0100
> @@ -851,7 +851,7 @@ DECLARE_FILE_FUNCTIONS(alarm);
> }
>
> static struct battery_file {
> - struct file_operations ops;
> + const struct file_operations ops;

Whoa, does this work?

> mode_t mode;
> const char *name;
> } acpi_battery_file[] = {

It maybe better to call proc_create_date() by hand (and even handle
errors gracefully?
--
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/