From: Christoph Hellwig dasd_cmd just implements three ioctls which are wrappers around functionality in the core kernel or other modules. When merging those into dasd_mod they just add 22 lines of code which is far less than the amount of code removed in the last two patches, and which doesn't spill into another 4k pages when build modular, while removing a 128lines module. Signed-off-by: Christoph Hellwig Cc: Martin Schwidefsky Cc: Heiko Carstens Signed-off-by: Andrew Morton --- dev/null | 128 ------------------------------ drivers/s390/block/Kconfig | 10 -- drivers/s390/block/Makefile | 1 drivers/s390/block/dasd_ioctl.c | 22 +++++ 4 files changed, 22 insertions(+), 139 deletions(-) diff -L drivers/s390/block/dasd_cmb.c -puN drivers/s390/block/dasd_cmb.c~dasd-merge-dasd_cmd-into-dasd_mod /dev/null --- devel/drivers/s390/block/dasd_cmb.c +++ /dev/null 2003-09-15 06:40:47.000000000 -0700 @@ -1,128 +0,0 @@ -/* - * Linux on zSeries Channel Measurement Facility support - * (dasd device driver interface) - * - * Copyright 2000,2003 IBM Corporation - * - * Author: Arnd Bergmann - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -#include -#include -#include -#include - -#include "dasd_int.h" - -static int -dasd_ioctl_cmf_enable(struct block_device *bdev, int no, long args) -{ - struct dasd_device *device; - - device = bdev->bd_disk->private_data; - if (!device) - return -EINVAL; - - return enable_cmf(device->cdev); -} - -static int -dasd_ioctl_cmf_disable(struct block_device *bdev, int no, long args) -{ - struct dasd_device *device; - - device = bdev->bd_disk->private_data; - if (!device) - return -EINVAL; - - return disable_cmf(device->cdev); -} - -static int -dasd_ioctl_readall_cmb(struct block_device *bdev, int no, long args) -{ - struct dasd_device *device; - struct cmbdata __user *udata; - struct cmbdata data; - size_t size; - int ret; - - device = bdev->bd_disk->private_data; - if (!device) - return -EINVAL; - udata = (void __user *) args; - size = _IOC_SIZE(no); - - if (!access_ok(VERIFY_WRITE, udata, size)) - return -EFAULT; - ret = cmf_readall(device->cdev, &data); - if (ret) - return ret; - if (copy_to_user(udata, &data, min(size, sizeof(*udata)))) - return -EFAULT; - return 0; -} - -/* module initialization below here. dasd already provides a mechanism - * to dynamically register ioctl functions, so we simply use this. */ -static inline int -ioctl_reg(unsigned int no, dasd_ioctl_fn_t handler) -{ - return dasd_ioctl_no_register(THIS_MODULE, no, handler); -} - -static inline void -ioctl_unreg(unsigned int no, dasd_ioctl_fn_t handler) -{ - dasd_ioctl_no_unregister(THIS_MODULE, no, handler); -} - -static void -dasd_cmf_exit(void) -{ - ioctl_unreg(BIODASDCMFENABLE, dasd_ioctl_cmf_enable); - ioctl_unreg(BIODASDCMFDISABLE, dasd_ioctl_cmf_disable); - ioctl_unreg(BIODASDREADALLCMB, dasd_ioctl_readall_cmb); -} - -static int __init -dasd_cmf_init(void) -{ - int ret; - ret = ioctl_reg (BIODASDCMFENABLE, dasd_ioctl_cmf_enable); - if (ret) - goto err; - ret = ioctl_reg (BIODASDCMFDISABLE, dasd_ioctl_cmf_disable); - if (ret) - goto err; - ret = ioctl_reg (BIODASDREADALLCMB, dasd_ioctl_readall_cmb); - if (ret) - goto err; - - return 0; -err: - dasd_cmf_exit(); - - return ret; -} - -module_init(dasd_cmf_init); -module_exit(dasd_cmf_exit); - -MODULE_AUTHOR("Arnd Bergmann "); -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("channel measurement facility interface for dasd\n" - "Copyright 2003 IBM Corporation\n"); diff -puN drivers/s390/block/dasd_ioctl.c~dasd-merge-dasd_cmd-into-dasd_mod drivers/s390/block/dasd_ioctl.c --- devel/drivers/s390/block/dasd_ioctl.c~dasd-merge-dasd_cmd-into-dasd_mod 2006-02-20 16:42:25.000000000 -0800 +++ devel-akpm/drivers/s390/block/dasd_ioctl.c 2006-02-20 16:42:25.000000000 -0800 @@ -16,6 +16,7 @@ #include #include +#include #include /* This is ugly... */ @@ -406,6 +407,21 @@ dasd_ioctl_set_ro(struct block_device *b return dasd_set_feature(device->cdev, DASD_FEATURE_READONLY, intval); } +static int +dasd_ioctl_readall_cmb(struct dasd_device *device, unsigned int cmd, + unsigned long arg) +{ + struct cmbdata __user *argp = (void __user *) arg; + size_t size = _IOC_SIZE(cmd); + struct cmbdata data; + int ret; + + ret = cmf_readall(device->cdev, &data); + if (!ret && copy_to_user(argp, &data, min(size, sizeof(*argp)))) + return -EFAULT; + return ret; +} + int dasd_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) @@ -447,6 +463,12 @@ dasd_ioctl(struct inode *inode, struct f return dasd_ioctl_set_ro(bdev, argp); case DASDAPIVER: return dasd_ioctl_api_version(argp); + case BIODASDCMFENABLE: + return enable_cmf(device->cdev); + case BIODASDCMFDISABLE: + return disable_cmf(device->cdev); + case BIODASDREADALLCMB: + return dasd_ioctl_readall_cmb(device, cmd, arg); default: /* if the discipline has an ioctl method try it. */ if (device->discipline->ioctl) { diff -puN drivers/s390/block/Kconfig~dasd-merge-dasd_cmd-into-dasd_mod drivers/s390/block/Kconfig --- devel/drivers/s390/block/Kconfig~dasd-merge-dasd_cmd-into-dasd_mod 2006-02-20 16:42:25.000000000 -0800 +++ devel-akpm/drivers/s390/block/Kconfig 2006-02-20 16:43:07.000000000 -0800 @@ -55,14 +55,4 @@ config DASD_DIAG Disks under VM. If you are not running under VM or unsure what it is, say "N". -config DASD_CMB - tristate "Compatibility interface for DASD channel measurement blocks" - depends on DASD - help - This driver provides an additional interface to the channel measurement - facility, which is normally accessed though sysfs, with a set of - ioctl functions specific to the dasd driver. - This is only needed if you want to use applications written for - linux-2.4 dasd channel measurement facility interface. - endif diff -puN drivers/s390/block/Makefile~dasd-merge-dasd_cmd-into-dasd_mod drivers/s390/block/Makefile --- devel/drivers/s390/block/Makefile~dasd-merge-dasd_cmd-into-dasd_mod 2006-02-20 16:42:25.000000000 -0800 +++ devel-akpm/drivers/s390/block/Makefile 2006-02-20 16:43:12.000000000 -0800 @@ -12,6 +12,5 @@ obj-$(CONFIG_DASD) += dasd_mod.o obj-$(CONFIG_DASD_DIAG) += dasd_diag_mod.o obj-$(CONFIG_DASD_ECKD) += dasd_eckd_mod.o obj-$(CONFIG_DASD_FBA) += dasd_fba_mod.o -obj-$(CONFIG_DASD_CMB) += dasd_cmb.o obj-$(CONFIG_BLK_DEV_XPRAM) += xpram.o obj-$(CONFIG_DCSSBLK) += dcssblk.o _