提交 9c8b04be 编写于 作者: V Vasiliy Kulikov 提交者: Len Brown

ACPI: constify ops structs

Structs battery_file, acpi_dock_ops, file_operations,
thermal_cooling_device_ops, thermal_zone_device_ops, kernel_param_ops
are not changed in runtime.  It is safe to make them const.
register_hotplug_dock_device() was altered to take const "ops" argument
to respect acpi_dock_ops' const notion.
Signed-off-by: NVasiliy Kulikov <segoon@openwall.com>
Acked-by: NJeff Garzik <jgarzik@redhat.com>
Signed-off-by: NLen Brown <len.brown@intel.com>
上级 e545b55a
...@@ -863,7 +863,7 @@ DECLARE_FILE_FUNCTIONS(alarm); ...@@ -863,7 +863,7 @@ DECLARE_FILE_FUNCTIONS(alarm);
}, \ }, \
} }
static struct battery_file { static const struct battery_file {
struct file_operations ops; struct file_operations ops;
mode_t mode; mode_t mode;
const char *name; const char *name;
......
...@@ -77,7 +77,7 @@ struct dock_dependent_device { ...@@ -77,7 +77,7 @@ struct dock_dependent_device {
struct list_head list; struct list_head list;
struct list_head hotplug_list; struct list_head hotplug_list;
acpi_handle handle; acpi_handle handle;
struct acpi_dock_ops *ops; const struct acpi_dock_ops *ops;
void *context; void *context;
}; };
...@@ -589,7 +589,7 @@ EXPORT_SYMBOL_GPL(unregister_dock_notifier); ...@@ -589,7 +589,7 @@ EXPORT_SYMBOL_GPL(unregister_dock_notifier);
* the dock driver after _DCK is executed. * the dock driver after _DCK is executed.
*/ */
int 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) void *context)
{ {
struct dock_dependent_device *dd; struct dock_dependent_device *dd;
......
...@@ -92,7 +92,7 @@ static ssize_t acpi_ec_write_io(struct file *f, const char __user *buf, ...@@ -92,7 +92,7 @@ static ssize_t acpi_ec_write_io(struct file *f, const char __user *buf,
return count; return count;
} }
static struct file_operations acpi_ec_io_ops = { static const struct file_operations acpi_ec_io_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = acpi_ec_open_io, .open = acpi_ec_open_io,
.read = acpi_ec_read_io, .read = acpi_ec_read_io,
......
...@@ -110,7 +110,7 @@ fan_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state) ...@@ -110,7 +110,7 @@ fan_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state)
return result; return result;
} }
static struct thermal_cooling_device_ops fan_cooling_ops = { static const struct thermal_cooling_device_ops fan_cooling_ops = {
.get_max_state = fan_get_max_state, .get_max_state = fan_get_max_state,
.get_cur_state = fan_get_cur_state, .get_cur_state = fan_get_cur_state,
.set_cur_state = fan_set_cur_state, .set_cur_state = fan_set_cur_state,
......
...@@ -244,7 +244,7 @@ processor_set_cur_state(struct thermal_cooling_device *cdev, ...@@ -244,7 +244,7 @@ processor_set_cur_state(struct thermal_cooling_device *cdev,
return result; return result;
} }
struct thermal_cooling_device_ops processor_cooling_ops = { const struct thermal_cooling_device_ops processor_cooling_ops = {
.get_max_state = processor_get_max_state, .get_max_state = processor_get_max_state,
.get_cur_state = processor_get_cur_state, .get_cur_state = processor_get_cur_state,
.set_cur_state = processor_set_cur_state, .set_cur_state = processor_set_cur_state,
......
...@@ -149,12 +149,12 @@ static int param_get_debug_level(char *buffer, const struct kernel_param *kp) ...@@ -149,12 +149,12 @@ static int param_get_debug_level(char *buffer, const struct kernel_param *kp)
return result; return result;
} }
static struct kernel_param_ops param_ops_debug_layer = { static const struct kernel_param_ops param_ops_debug_layer = {
.set = param_set_uint, .set = param_set_uint,
.get = param_get_debug_layer, .get = param_get_debug_layer,
}; };
static struct kernel_param_ops param_ops_debug_level = { static const struct kernel_param_ops param_ops_debug_level = {
.set = param_set_uint, .set = param_set_uint,
.get = param_get_debug_level, .get = param_get_debug_level,
}; };
......
...@@ -812,7 +812,7 @@ acpi_thermal_unbind_cooling_device(struct thermal_zone_device *thermal, ...@@ -812,7 +812,7 @@ acpi_thermal_unbind_cooling_device(struct thermal_zone_device *thermal,
thermal_zone_unbind_cooling_device); thermal_zone_unbind_cooling_device);
} }
static struct thermal_zone_device_ops acpi_thermal_zone_ops = { static const struct thermal_zone_device_ops acpi_thermal_zone_ops = {
.bind = acpi_thermal_bind_cooling_device, .bind = acpi_thermal_bind_cooling_device,
.unbind = acpi_thermal_unbind_cooling_device, .unbind = acpi_thermal_unbind_cooling_device,
.get_temp = thermal_get_temp, .get_temp = thermal_get_temp,
......
...@@ -308,7 +308,7 @@ video_set_cur_state(struct thermal_cooling_device *cooling_dev, unsigned long st ...@@ -308,7 +308,7 @@ video_set_cur_state(struct thermal_cooling_device *cooling_dev, unsigned long st
return acpi_video_device_lcd_set_level(video, level); return acpi_video_device_lcd_set_level(video, level);
} }
static struct thermal_cooling_device_ops video_cooling_ops = { static const struct thermal_cooling_device_ops video_cooling_ops = {
.get_max_state = video_get_max_state, .get_max_state = video_get_max_state,
.get_cur_state = video_get_cur_state, .get_cur_state = video_get_cur_state,
.set_cur_state = video_set_cur_state, .set_cur_state = video_set_cur_state,
......
...@@ -218,12 +218,12 @@ static void ata_acpi_dev_uevent(acpi_handle handle, u32 event, void *data) ...@@ -218,12 +218,12 @@ static void ata_acpi_dev_uevent(acpi_handle handle, u32 event, void *data)
ata_acpi_uevent(dev->link->ap, dev, event); ata_acpi_uevent(dev->link->ap, dev, event);
} }
static struct acpi_dock_ops ata_acpi_dev_dock_ops = { static const struct acpi_dock_ops ata_acpi_dev_dock_ops = {
.handler = ata_acpi_dev_notify_dock, .handler = ata_acpi_dev_notify_dock,
.uevent = ata_acpi_dev_uevent, .uevent = ata_acpi_dev_uevent,
}; };
static struct acpi_dock_ops ata_acpi_ap_dock_ops = { static const struct acpi_dock_ops ata_acpi_ap_dock_ops = {
.handler = ata_acpi_ap_notify_dock, .handler = ata_acpi_ap_notify_dock,
.uevent = ata_acpi_ap_uevent, .uevent = ata_acpi_ap_uevent,
}; };
......
...@@ -110,7 +110,7 @@ static int post_dock_fixups(struct notifier_block *nb, unsigned long val, ...@@ -110,7 +110,7 @@ static int post_dock_fixups(struct notifier_block *nb, unsigned long val,
} }
static struct acpi_dock_ops acpiphp_dock_ops = { static const struct acpi_dock_ops acpiphp_dock_ops = {
.handler = handle_hotplug_event_func, .handler = handle_hotplug_event_func,
}; };
......
...@@ -128,7 +128,7 @@ extern int is_dock_device(acpi_handle handle); ...@@ -128,7 +128,7 @@ extern int is_dock_device(acpi_handle handle);
extern int register_dock_notifier(struct notifier_block *nb); extern int register_dock_notifier(struct notifier_block *nb);
extern void unregister_dock_notifier(struct notifier_block *nb); extern void unregister_dock_notifier(struct notifier_block *nb);
extern int register_hotplug_dock_device(acpi_handle handle, extern int register_hotplug_dock_device(acpi_handle handle,
struct acpi_dock_ops *ops, const struct acpi_dock_ops *ops,
void *context); void *context);
extern void unregister_hotplug_dock_device(acpi_handle handle); extern void unregister_hotplug_dock_device(acpi_handle handle);
#else #else
......
...@@ -337,7 +337,7 @@ extern struct cpuidle_driver acpi_idle_driver; ...@@ -337,7 +337,7 @@ extern struct cpuidle_driver acpi_idle_driver;
/* in processor_thermal.c */ /* in processor_thermal.c */
int acpi_processor_get_limit_info(struct acpi_processor *pr); int acpi_processor_get_limit_info(struct acpi_processor *pr);
extern struct thermal_cooling_device_ops processor_cooling_ops; extern const struct thermal_cooling_device_ops processor_cooling_ops;
#ifdef CONFIG_CPU_FREQ #ifdef CONFIG_CPU_FREQ
void acpi_thermal_cpufreq_init(void); void acpi_thermal_cpufreq_init(void);
void acpi_thermal_cpufreq_exit(void); void acpi_thermal_cpufreq_exit(void);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册