From 1107ccfbdef280fedc677af3bdbc405611ba554a Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Fri, 24 Mar 2006 03:15:20 -0800 Subject: [PATCH] s390: use normal switch statement for ioctls in dasd_ioctlc Add an ->ioctl method to the dasd_discipline structure. This allows to apply the same kind of cleanups the last patch applied to dasd_ioctl.c to dasd_eckd.c (the only dasd discipline with special ioctls) aswell. Again lots of code removed. During auditing the ioctls I found two fishy return value propagations from copy_{from,to}_user, maintainers please check those, I've marked them with XXX comments. Signed-off-by: Christoph Hellwig Signed-off-by: Martin Schwidefsky Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/s390/block/dasd_ioctl.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'drivers/s390/block/dasd_ioctl.c') diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c index e3ad34686444..bb6caf46bbd9 100644 --- a/drivers/s390/block/dasd_ioctl.c +++ b/drivers/s390/block/dasd_ioctl.c @@ -448,7 +448,14 @@ dasd_ioctl(struct inode *inode, struct file *file, case DASDAPIVER: return dasd_ioctl_api_version(argp); default: - /* resort to the deprecated dynamic ioctl list */ + /* if the discipline has an ioctl method try it. */ + if (device->discipline->ioctl) { + int rval = device->discipline->ioctl(device, cmd, argp); + if (rval != -ENOIOCTLCMD) + return rval; + } + + /* else resort to the deprecated dynamic ioctl list */ list_for_each_entry(ioctl, &dasd_ioctl_list, list) { if (ioctl->no == cmd) { /* Found a matching ioctl. Call it. */ -- cgit v1.2.3