mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@infradead.org>
To: linux-kernel@vger.kernel.org
Cc: len.brown@intel.com, akpm@osdl.org
Subject: [patch 1/4]  fix some f_ops abuse in acpi
Date: Fri, 06 Jan 2006 22:46:57 +0100	[thread overview]
Message-ID: <1136584017.2940.93.camel@laptopd505.fenrus.org> (raw)
In-Reply-To: <1136583937.2940.90.camel@laptopd505.fenrus.org>

From: Arjan van de Ven <arjan@infradead.org>

The ACPI layer writes to acpi_processor_limit_fops.write at runtime, while
it in reality is a compile time constant. Move this to the struct definition
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>
CC: Len Brown <len.brown@intel.com>

Index: linux-2.6.15/drivers/acpi/processor_core.c
 drivers/acpi/processor_core.c       |    2 --
 drivers/acpi/processor_perflib.c    |    2 +-
 drivers/acpi/processor_thermal.c    |    1 +
 drivers/acpi/processor_throttling.c |    1 +
 drivers/acpi/video.c                |    8 ++++----
 5 files changed, 7 insertions(+), 7 deletions(-)

Index: linux-2.6.15/drivers/acpi/processor_core.c
===================================================================
--- linux-2.6.15.orig/drivers/acpi/processor_core.c
+++ linux-2.6.15/drivers/acpi/processor_core.c
@@ -357,7 +357,6 @@ static int acpi_processor_add_fs(struct 
 				  ACPI_PROCESSOR_FILE_THROTTLING));
 	else {
 		entry->proc_fops = &acpi_processor_throttling_fops;
-		entry->proc_fops->write = acpi_processor_write_throttling;
 		entry->data = acpi_driver_data(device);
 		entry->owner = THIS_MODULE;
 	}
@@ -372,7 +371,6 @@ static int acpi_processor_add_fs(struct 
 				  ACPI_PROCESSOR_FILE_LIMIT));
 	else {
 		entry->proc_fops = &acpi_processor_limit_fops;
-		entry->proc_fops->write = acpi_processor_write_limit;
 		entry->data = acpi_driver_data(device);
 		entry->owner = THIS_MODULE;
 	}
Index: linux-2.6.15/drivers/acpi/processor_thermal.c
===================================================================
--- linux-2.6.15.orig/drivers/acpi/processor_thermal.c
+++ linux-2.6.15/drivers/acpi/processor_thermal.c
@@ -394,6 +394,7 @@ ssize_t acpi_processor_write_limit(struc
 struct file_operations acpi_processor_limit_fops = {
 	.open = acpi_processor_limit_open_fs,
 	.read = seq_read,
+	.write = acpi_processor_write_limit,
 	.llseek = seq_lseek,
 	.release = single_release,
 };
Index: linux-2.6.15/drivers/acpi/processor_throttling.c
===================================================================
--- linux-2.6.15.orig/drivers/acpi/processor_throttling.c
+++ linux-2.6.15/drivers/acpi/processor_throttling.c
@@ -337,6 +337,7 @@ ssize_t acpi_processor_write_throttling(
 struct file_operations acpi_processor_throttling_fops = {
 	.open = acpi_processor_throttling_open_fs,
 	.read = seq_read,
+	.write = acpi_processor_write_throttling,
 	.llseek = seq_lseek,
 	.release = single_release,
 };
Index: linux-2.6.15/drivers/acpi/video.c
===================================================================
--- linux-2.6.15.orig/drivers/acpi/video.c
+++ linux-2.6.15/drivers/acpi/video.c
@@ -920,8 +920,8 @@ static int acpi_video_device_add_fs(stru
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
 				  "Unable to create 'state' fs entry\n"));
 	else {
+		acpi_video_device_state_fops.write = acpi_video_device_write_state;
 		entry->proc_fops = &acpi_video_device_state_fops;
-		entry->proc_fops->write = acpi_video_device_write_state;
 		entry->data = acpi_driver_data(device);
 		entry->owner = THIS_MODULE;
 	}
@@ -934,8 +934,8 @@ static int acpi_video_device_add_fs(stru
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
 				  "Unable to create 'brightness' fs entry\n"));
 	else {
+		acpi_video_device_brightness_fops.write = acpi_video_device_write_brightness;
 		entry->proc_fops = &acpi_video_device_brightness_fops;
-		entry->proc_fops->write = acpi_video_device_write_brightness;
 		entry->data = acpi_driver_data(device);
 		entry->owner = THIS_MODULE;
 	}
@@ -1239,8 +1239,8 @@ static int acpi_video_bus_add_fs(struct 
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
 				  "Unable to create 'POST' fs entry\n"));
 	else {
+		acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST;
 		entry->proc_fops = &acpi_video_bus_POST_fops;
-		entry->proc_fops->write = acpi_video_bus_write_POST;
 		entry->data = acpi_driver_data(device);
 		entry->owner = THIS_MODULE;
 	}
@@ -1253,8 +1253,8 @@ static int acpi_video_bus_add_fs(struct 
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
 				  "Unable to create 'DOS' fs entry\n"));
 	else {
+		acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS;
 		entry->proc_fops = &acpi_video_bus_DOS_fops;
-		entry->proc_fops->write = acpi_video_bus_write_DOS;
 		entry->data = acpi_driver_data(device);
 		entry->owner = THIS_MODULE;
 	}
Index: linux-2.6.15/drivers/acpi/processor_perflib.c
===================================================================
--- linux-2.6.15.orig/drivers/acpi/processor_perflib.c
+++ linux-2.6.15/drivers/acpi/processor_perflib.c
@@ -520,8 +520,8 @@ static void acpi_cpufreq_add_file(struct
 				  "Unable to create '%s' fs entry\n",
 				  ACPI_PROCESSOR_FILE_PERFORMANCE));
 	else {
+		acpi_processor_perf_fops.write = acpi_processor_write_performance;
 		entry->proc_fops = &acpi_processor_perf_fops;
-		entry->proc_fops->write = acpi_processor_write_performance;
 		entry->data = acpi_driver_data(device);
 		entry->owner = THIS_MODULE;
 	}



  reply	other threads:[~2006-01-06 21:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-06 21:45 [patch 0/4] Series to allow a "const" file_operations struct Arjan van de Ven
2006-01-06 21:46 ` Arjan van de Ven [this message]
2006-01-06 21:47 ` [patch 2/4] fix input layer f_ops abuse Arjan van de Ven
2006-01-06 23:12   ` Dmitry Torokhov
2006-01-06 21:49 ` [patch 3/4] fix cifs bugs wrt writing to f_ops Arjan van de Ven
2006-01-06 21:51 ` [patch 4/4] Actually make the f_ops field const Arjan van de Ven
2006-01-07  8:00   ` Andrew Morton
2006-01-07  8:13     ` Arjan van de Ven
2006-01-06 21:55 ` [patch 0/4] Series to allow a "const" file_operations struct Arjan van de Ven
2006-01-06 22:46   ` Eric Dumazet
2006-01-07  0:29     ` Andrew Morton
2006-01-07  1:01       ` Arnd Bergmann
2006-01-07  7:40       ` Eric Dumazet
2006-01-07  8:33       ` Arjan van de Ven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1136584017.2940.93.camel@laptopd505.fenrus.org \
    --to=arjan@infradead.org \
    --cc=akpm@osdl.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®