Browse Source

[ACPI] move some run-time structure inits to compile time

acpi_processor_limit_fops.write was written at run time,
but can be initiailized at compile-time instead.

Similar for acpi_video_bus_POST_fops.write and friends,
but keep doing those at runtime to avoid prototype-hell.

Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Len Brown <len.brown@intel.com>
Arjan van de Ven 19 years ago
parent
commit
d479e90845

+ 0 - 2
drivers/acpi/processor_core.c

@@ -357,7 +357,6 @@ static int acpi_processor_add_fs(struct acpi_device *device)
 				  ACPI_PROCESSOR_FILE_THROTTLING));
 				  ACPI_PROCESSOR_FILE_THROTTLING));
 	else {
 	else {
 		entry->proc_fops = &acpi_processor_throttling_fops;
 		entry->proc_fops = &acpi_processor_throttling_fops;
-		entry->proc_fops->write = acpi_processor_write_throttling;
 		entry->data = acpi_driver_data(device);
 		entry->data = acpi_driver_data(device);
 		entry->owner = THIS_MODULE;
 		entry->owner = THIS_MODULE;
 	}
 	}
@@ -372,7 +371,6 @@ static int acpi_processor_add_fs(struct acpi_device *device)
 				  ACPI_PROCESSOR_FILE_LIMIT));
 				  ACPI_PROCESSOR_FILE_LIMIT));
 	else {
 	else {
 		entry->proc_fops = &acpi_processor_limit_fops;
 		entry->proc_fops = &acpi_processor_limit_fops;
-		entry->proc_fops->write = acpi_processor_write_limit;
 		entry->data = acpi_driver_data(device);
 		entry->data = acpi_driver_data(device);
 		entry->owner = THIS_MODULE;
 		entry->owner = THIS_MODULE;
 	}
 	}

+ 1 - 1
drivers/acpi/processor_perflib.c

@@ -520,8 +520,8 @@ static void acpi_cpufreq_add_file(struct acpi_processor *pr)
 				  "Unable to create '%s' fs entry\n",
 				  "Unable to create '%s' fs entry\n",
 				  ACPI_PROCESSOR_FILE_PERFORMANCE));
 				  ACPI_PROCESSOR_FILE_PERFORMANCE));
 	else {
 	else {
+		acpi_processor_perf_fops.write = acpi_processor_write_performance;
 		entry->proc_fops = &acpi_processor_perf_fops;
 		entry->proc_fops = &acpi_processor_perf_fops;
-		entry->proc_fops->write = acpi_processor_write_performance;
 		entry->data = acpi_driver_data(device);
 		entry->data = acpi_driver_data(device);
 		entry->owner = THIS_MODULE;
 		entry->owner = THIS_MODULE;
 	}
 	}

+ 1 - 0
drivers/acpi/processor_thermal.c

@@ -394,6 +394,7 @@ ssize_t acpi_processor_write_limit(struct file * file,
 struct file_operations acpi_processor_limit_fops = {
 struct file_operations acpi_processor_limit_fops = {
 	.open = acpi_processor_limit_open_fs,
 	.open = acpi_processor_limit_open_fs,
 	.read = seq_read,
 	.read = seq_read,
+	.write = acpi_processor_write_limit,
 	.llseek = seq_lseek,
 	.llseek = seq_lseek,
 	.release = single_release,
 	.release = single_release,
 };
 };

+ 1 - 0
drivers/acpi/processor_throttling.c

@@ -337,6 +337,7 @@ ssize_t acpi_processor_write_throttling(struct file * file,
 struct file_operations acpi_processor_throttling_fops = {
 struct file_operations acpi_processor_throttling_fops = {
 	.open = acpi_processor_throttling_open_fs,
 	.open = acpi_processor_throttling_open_fs,
 	.read = seq_read,
 	.read = seq_read,
+	.write = acpi_processor_write_throttling,
 	.llseek = seq_lseek,
 	.llseek = seq_lseek,
 	.release = single_release,
 	.release = single_release,
 };
 };

+ 4 - 4
drivers/acpi/video.c

@@ -920,8 +920,8 @@ static int acpi_video_device_add_fs(struct acpi_device *device)
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
 				  "Unable to create 'state' fs entry\n"));
 				  "Unable to create 'state' fs entry\n"));
 	else {
 	else {
+		acpi_video_device_state_fops.write = acpi_video_device_write_state;
 		entry->proc_fops = &acpi_video_device_state_fops;
 		entry->proc_fops = &acpi_video_device_state_fops;
-		entry->proc_fops->write = acpi_video_device_write_state;
 		entry->data = acpi_driver_data(device);
 		entry->data = acpi_driver_data(device);
 		entry->owner = THIS_MODULE;
 		entry->owner = THIS_MODULE;
 	}
 	}
@@ -934,8 +934,8 @@ static int acpi_video_device_add_fs(struct acpi_device *device)
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
 				  "Unable to create 'brightness' fs entry\n"));
 				  "Unable to create 'brightness' fs entry\n"));
 	else {
 	else {
+		acpi_video_device_brightness_fops.write = acpi_video_device_write_brightness;
 		entry->proc_fops = &acpi_video_device_brightness_fops;
 		entry->proc_fops = &acpi_video_device_brightness_fops;
-		entry->proc_fops->write = acpi_video_device_write_brightness;
 		entry->data = acpi_driver_data(device);
 		entry->data = acpi_driver_data(device);
 		entry->owner = THIS_MODULE;
 		entry->owner = THIS_MODULE;
 	}
 	}
@@ -1239,8 +1239,8 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
 				  "Unable to create 'POST' fs entry\n"));
 				  "Unable to create 'POST' fs entry\n"));
 	else {
 	else {
+		acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST;
 		entry->proc_fops = &acpi_video_bus_POST_fops;
 		entry->proc_fops = &acpi_video_bus_POST_fops;
-		entry->proc_fops->write = acpi_video_bus_write_POST;
 		entry->data = acpi_driver_data(device);
 		entry->data = acpi_driver_data(device);
 		entry->owner = THIS_MODULE;
 		entry->owner = THIS_MODULE;
 	}
 	}
@@ -1253,8 +1253,8 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
 				  "Unable to create 'DOS' fs entry\n"));
 				  "Unable to create 'DOS' fs entry\n"));
 	else {
 	else {
+		acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS;
 		entry->proc_fops = &acpi_video_bus_DOS_fops;
 		entry->proc_fops = &acpi_video_bus_DOS_fops;
-		entry->proc_fops->write = acpi_video_bus_write_DOS;
 		entry->data = acpi_driver_data(device);
 		entry->data = acpi_driver_data(device);
 		entry->owner = THIS_MODULE;
 		entry->owner = THIS_MODULE;
 	}
 	}