Re: [PATCH] acpi: const-ify functions

Previous thread: [cpuops cmpxchg V1 0/4] Cmpxchg and xchg operations by Christoph Lameter on Wednesday, December 8, 2010 - 10:55 am. (11 messages)

Next thread: [RFC][PATCH] timekeeping: Keep xtime_nsec remainder separate from ntp_error by Steven Rostedt on Wednesday, December 8, 2010 - 11:30 am. (6 messages)
From: Hanno =?utf-8?q?B=C3=B6ck?=
Date: Wednesday, December 8, 2010 - 11:25 am

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).

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@hboeck.de>
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;
 	mode_t mode;
 	const char *name;
 } acpi_battery_file[] = {
diff -Naurp linux-acpi-1//drivers/acpi/dock.c linux-acpi-2/drivers/acpi/dock.c
--- linux-acpi-1//drivers/acpi/dock.c	2010-12-08 18:42:26.147999998 +0100
+++ linux-acpi-2/drivers/acpi/dock.c	2010-12-08 18:42:53.608999978 +0100
@@ -77,7 +77,7 @@ struct dock_dependent_device {
 	struct list_head list;
 	struct list_head hotplug_list;
 	acpi_handle handle;
-	struct acpi_dock_ops *ops;
+	const struct acpi_dock_ops *ops;
 	void *context;
 };
 
@@ -589,7 +589,8 @@ EXPORT_SYMBOL_GPL(unregister_dock_notifi
  * the dock driver after _DCK is executed.
  */
 int
-register_hotplug_dock_device(acpi_handle handle, struct acpi_dock_ops *ops,
+register_hotplug_dock_device(acpi_handle handle,
+			     const struct acpi_dock_ops *ops,
 			     void *context)
 {
 	struct dock_dependent_device *dd;
diff -Naurp linux-acpi-1//drivers/acpi/sleep.c linux-acpi-2/drivers/acpi/sleep.c
--- linux-acpi-1//drivers/acpi/sleep.c	2010-12-08 18:42:27.559999989 +0100
+++ linux-acpi-2/drivers/acpi/sleep.c	2010-12-08 18:42:53.615000007 +0100
@@ -319,7 +319,7 @@ static int acpi_suspend_state_valid(susp
 	}
 }
 
-static struct ...
From: Alexey Dobriyan
Date: Wednesday, December 8, 2010 - 12:17 pm

It maybe better to call proc_create_date() by hand (and even handle
errors gracefully?
--

Previous thread: [cpuops cmpxchg V1 0/4] Cmpxchg and xchg operations by Christoph Lameter on Wednesday, December 8, 2010 - 10:55 am. (11 messages)

Next thread: [RFC][PATCH] timekeeping: Keep xtime_nsec remainder separate from ntp_error by Steven Rostedt on Wednesday, December 8, 2010 - 11:30 am. (6 messages)