Skip to contentSkip to conversation

drivers: Push down BKL into various drivers

DISCUSSION Applied Geert Uytterhoeven 3 participants 4 messages Jun 5, 2010 – Jun 6, 2010 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 57 lines · Linux Kernel Mailing List
drivers/input/misc/hp_sdc_rtc.c +17 -10
index ad730e1..e00a1cc 100644
@@ -43,6 +43,7 @@
  #include <linux/proc_fs.h>
  #include <linux/poll.h>
  #include <linux/rtc.h>
+#include <linux/smp_lock.h>
  #include <linux/semaphore.h>
 
  MODULE_AUTHOR("Brian S. Julin <[email protected]>");
@@ -64,8 +65,8 @@ static DECLARE_WAIT_QUEUE_HEAD(hp_sdc_rtc_wait);
  static ssize_t hp_sdc_rtc_read(struct file *file, char __user *buf,
                               size_t count, loff_t *ppos);
 
-static int hp_sdc_rtc_ioctl(struct inode *inode, struct file *file,
-                           unsigned int cmd, unsigned long arg);
+static long hp_sdc_rtc_unlocked_ioctl(struct file *file,
+                                     unsigned int cmd, unsigned long arg);
 
  static unsigned int hp_sdc_rtc_poll(struct file *file, poll_table *wait);
 
@@ -512,7 +513,7 @@ static int hp_sdc_rtc_read_proc(char *page, char **start, off_t off,
         return len;
  }
 
-static int hp_sdc_rtc_ioctl(struct inode *inode, struct file *file,
+static int hp_sdc_rtc_ioctl(struct file *file,
                            unsigned int cmd, unsigned long arg)
  {
  #if 1
@@ -659,14 +660,27 @@ static int hp_sdc_rtc_ioctl(struct inode *inode, struct file *file,
  #endif
  }
 
+static long hp_sdc_rtc_unlocked_ioctl(struct file *file,
+                                     unsigned int cmd, unsigned long arg)
+{
+       int ret;
+
+       lock_kernel();
+       ret = hp_sdc_rtc_ioctl(file, cmd, arg);
+       unlock_kernel();
+
+       return ret;
+}
+
+
  static const struct file_operations hp_sdc_rtc_fops = {
-        .owner =       THIS_MODULE,
-        .llseek =      no_llseek,
-        .read =                hp_sdc_rtc_read,
-        .poll =                hp_sdc_rtc_poll,
-        .ioctl =       hp_sdc_rtc_ioctl,
-        .open =                hp_sdc_rtc_open,
-        .fasync =      hp_sdc_rtc_fasync,

drivers/input/misc/hp_sdc_rtc.c static int hp_sdc_rtc_ioctl(struct inode *inode, struct file *file, · line 686

Quoted 10 lines
drivers/input/misc/hp_sdc_rtc.c +7 -0
+        .owner =               THIS_MODULE,
+        .llseek =              no_llseek,
+        .read =                        hp_sdc_rtc_read,
+        .poll =                        hp_sdc_rtc_poll,
+        .unlocked_ioctl =      hp_sdc_rtc_ioctl,
+        .open =                        hp_sdc_rtc_open,
+        .fasync =              hp_sdc_rtc_fasync,
  };
 
  static struct miscdevice hp_sdc_rtc_dev = {

Something went wrong with this one:

| drivers/input/misc/hp_sdc_rtc.c:681: warning: initialization from incompatible pointer type
| drivers/input/misc/hp_sdc_rtc.c:665: warning:
‘hp_sdc_rtc_unlocked_ioctl’ defined but not used

(detected while debugging my script to find compiler warning regressions)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#2 lore raw

hp_sdc_rtc: fix broken ioctl conversion

Commit 55929332c92 "drivers: Push down BKL into various drivers" introduced a regression in hp_sdc_rtc, caused by a missing change of the .unlocked_ioctl pointer to the newly introduced function.

Quoted 6 lines · Geert Uytterhoeven

Something went wrong with this one:

| drivers/input/misc/hp_sdc_rtc.c:681: warning: initialization from incompatible pointer type
| drivers/input/misc/hp_sdc_rtc.c:665: warning:
‘hp_sdc_rtc_unlocked_ioctl’ defined but not used

drivers/input/misc/hp_sdc_rtc.c +1 -1
index e00a1cc..c190664 100644
@@ -678,7 +678,7 @@ static const struct file_operations hp_sdc_rtc_fops = {
         .llseek =		no_llseek,
         .read =			hp_sdc_rtc_read,
         .poll =			hp_sdc_rtc_poll,
-        .unlocked_ioctl = 	hp_sdc_rtc_ioctl,
+        .unlocked_ioctl =	hp_sdc_rtc_unlocked_ioctl,
         .open =			hp_sdc_rtc_open,
         .fasync =		hp_sdc_rtc_fasync,
 };
#3 lore raw

Re: hp_sdc_rtc: fix broken ioctl conversion

Quoted 20 lines · Arnd Bergmann

Commit 55929332c92 "drivers: Push down BKL into various drivers" introduced a regression in hp_sdc_rtc, caused by a missing change of the .unlocked_ioctl pointer to the newly introduced function.

Quoted 6 lines · Geert Uytterhoeven

Something went wrong with this one:

| drivers/input/misc/hp_sdc_rtc.c:681: warning: initialization from incompatible pointer type
| drivers/input/misc/hp_sdc_rtc.c:665: warning:
‘hp_sdc_rtc_unlocked_ioctl’ defined but not used

drivers/input/misc/hp_sdc_rtc.c +0 -0
index e00a1cc..c190664 100644

drivers/input/misc/hp_sdc_rtc.c static const struct file_operations hp_sdc_rtc_fops = { · line 684

Quoted 8 lines
drivers/input/misc/hp_sdc_rtc.c +1 -1
@@ -678,7 +678,7 @@ static const struct file_operations hp_sdc_rtc_fops = {
         .llseek =		no_llseek,
         .read =			hp_sdc_rtc_read,
         .poll =			hp_sdc_rtc_poll,
-        .unlocked_ioctl = 	hp_sdc_rtc_ioctl,
+        .unlocked_ioctl =	hp_sdc_rtc_unlocked_ioctl,
         .open =			hp_sdc_rtc_open,
         .fasync =		hp_sdc_rtc_fasync,
 };

Queued for .35, thanks!

author Acked-by
#4 lore raw

Re: hp_sdc_rtc: fix broken ioctl conversion

In reply to Arnd Bergmann
Quoted 6 lines · Arnd Bergmann

Commit 55929332c92 "drivers: Push down BKL into various drivers" introduced a regression in hp_sdc_rtc, caused by a missing change of the .unlocked_ioctl pointer to the newly introduced function.

On Saturday 05 June 2010, Geert Uytterhoeven wrote:

Quoted 8 lines
Quoted 6 lines

Something went wrong with this one:

| drivers/input/misc/hp_sdc_rtc.c:681: warning: initialization from incompatible pointer type
| drivers/input/misc/hp_sdc_rtc.c:665: warning:
‘hp_sdc_rtc_unlocked_ioctl’ defined but not used

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds