From: Arnd Bergmann on
The pktcdvd driver uses proper locking and does not need the
BKL in the ioctl and llseek functions of the character device,
so kill both. Moving the compat_ioctl handling from common code
into the driver itself fixes build problems when CONFIG_BLOCK is

Acked-by: Randy Dunlap <randy.dunlap(a)>
Signed-off-by: Arnd Bergmann <arnd(a)>
On Wednesday 28 April 2010, Stephen Rothwell wrote:

> My fixes tree is here: ssh:// it
> currently only contains your pktcdvd patch. My understanding was that
> this patch was a fix for a build problem with Linus' tree.

Ah, I had forgotten that this was still needed and Jens or Peter
obviously never picked it up.

Linus, could you merge this now to fix building with CONFIG_BLOCK
disabled? It's fallout of a patch c5ecc484c "pktcdvd: use BIO list
management functions", but I fixed it because the problem appeared
in compat_ioctl handling. It now came up because the patch conflicted
with the BKL pushdown, which the original patch does as a side-effect.


diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index ddf1942..8a549db 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -48,6 +48,7 @@
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
+#include <linux/compat.h>
#include <linux/kthread.h>
#include <linux/errno.h>
#include <linux/spinlock.h>
@@ -2984,7 +2985,7 @@ static void pkt_get_status(struct pkt_ctrl_command *ctrl_cmd)

-static int pkt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
+static long pkt_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
void __user *argp = (void __user *)arg;
struct pkt_ctrl_command ctrl_cmd;
@@ -3021,10 +3022,20 @@ static int pkt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cm
return ret;

+static long pkt_ctl_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+ return pkt_ctl_ioctl(file, cmd, (unsigned long)compat_ptr(arg));

static const struct file_operations pkt_ctl_fops = {
- .ioctl = pkt_ctl_ioctl,
- .owner = THIS_MODULE,
+ .open = nonseekable_open,
+ .unlocked_ioctl = pkt_ctl_ioctl,
+ .compat_ioctl = pkt_ctl_compat_ioctl,
+ .owner = THIS_MODULE,

static struct miscdevice pkt_misc = {
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index c32a1b6..641640d 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -102,7 +102,6 @@
#include <linux/nbd.h>
#include <linux/random.h>
#include <linux/filter.h>
-#include <linux/pktcdvd.h>

#include <linux/hiddev.h>

@@ -1126,8 +1125,6 @@ COMPATIBLE_IOCTL(PPGETMODE)
-/* pktcdvd */
/* Big A */
/* sparc only */
/* Big Q for sound/OSS */
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)
More majordomo info at
Please read the FAQ at