aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/block
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2006-03-24 06:15:21 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-24 10:33:17 -0500
commit8b2eb664ce9dcba8b54ececf5e057470c47e57f7 (patch)
treedab47df832f199b0a1e9e20226b152feb522640a /drivers/s390/block
parent1107ccfbdef280fedc677af3bdbc405611ba554a (diff)
[PATCH] s390: merge cmb into dasdc
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 <hch@lst.de> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/s390/block')
-rw-r--r--drivers/s390/block/Kconfig10
-rw-r--r--drivers/s390/block/Makefile1
-rw-r--r--drivers/s390/block/dasd_cmb.c128
-rw-r--r--drivers/s390/block/dasd_ioctl.c22
4 files changed, 22 insertions, 139 deletions
diff --git a/drivers/s390/block/Kconfig b/drivers/s390/block/Kconfig
index 6f50cc9323d9..baf9cc3ebae3 100644
--- a/drivers/s390/block/Kconfig
+++ b/drivers/s390/block/Kconfig
@@ -55,14 +55,4 @@ config DASD_DIAG
55 Disks under VM. If you are not running under VM or unsure what it is, 55 Disks under VM. If you are not running under VM or unsure what it is,
56 say "N". 56 say "N".
57 57
58config DASD_CMB
59 tristate "Compatibility interface for DASD channel measurement blocks"
60 depends on DASD
61 help
62 This driver provides an additional interface to the channel measurement
63 facility, which is normally accessed though sysfs, with a set of
64 ioctl functions specific to the dasd driver.
65 This is only needed if you want to use applications written for
66 linux-2.4 dasd channel measurement facility interface.
67
68endif 58endif
diff --git a/drivers/s390/block/Makefile b/drivers/s390/block/Makefile
index 58c6780134f7..163e97554f50 100644
--- a/drivers/s390/block/Makefile
+++ b/drivers/s390/block/Makefile
@@ -12,6 +12,5 @@ obj-$(CONFIG_DASD) += dasd_mod.o
12obj-$(CONFIG_DASD_DIAG) += dasd_diag_mod.o 12obj-$(CONFIG_DASD_DIAG) += dasd_diag_mod.o
13obj-$(CONFIG_DASD_ECKD) += dasd_eckd_mod.o 13obj-$(CONFIG_DASD_ECKD) += dasd_eckd_mod.o
14obj-$(CONFIG_DASD_FBA) += dasd_fba_mod.o 14obj-$(CONFIG_DASD_FBA) += dasd_fba_mod.o
15obj-$(CONFIG_DASD_CMB) += dasd_cmb.o
16obj-$(CONFIG_BLK_DEV_XPRAM) += xpram.o 15obj-$(CONFIG_BLK_DEV_XPRAM) += xpram.o
17obj-$(CONFIG_DCSSBLK) += dcssblk.o 16obj-$(CONFIG_DCSSBLK) += dcssblk.o
diff --git a/drivers/s390/block/dasd_cmb.c b/drivers/s390/block/dasd_cmb.c
deleted file mode 100644
index e88f73ee72ce..000000000000
--- a/drivers/s390/block/dasd_cmb.c
+++ /dev/null
@@ -1,128 +0,0 @@
1/*
2 * Linux on zSeries Channel Measurement Facility support
3 * (dasd device driver interface)
4 *
5 * Copyright 2000,2003 IBM Corporation
6 *
7 * Author: Arnd Bergmann <arndb@de.ibm.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2, or (at your option)
12 * any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23#include <linux/init.h>
24#include <linux/module.h>
25#include <asm/ccwdev.h>
26#include <asm/cmb.h>
27
28#include "dasd_int.h"
29
30static int
31dasd_ioctl_cmf_enable(struct block_device *bdev, int no, long args)
32{
33 struct dasd_device *device;
34
35 device = bdev->bd_disk->private_data;
36 if (!device)
37 return -EINVAL;
38
39 return enable_cmf(device->cdev);
40}
41
42static int
43dasd_ioctl_cmf_disable(struct block_device *bdev, int no, long args)
44{
45 struct dasd_device *device;
46
47 device = bdev->bd_disk->private_data;
48 if (!device)
49 return -EINVAL;
50
51 return disable_cmf(device->cdev);
52}
53
54static int
55dasd_ioctl_readall_cmb(struct block_device *bdev, int no, long args)
56{
57 struct dasd_device *device;
58 struct cmbdata __user *udata;
59 struct cmbdata data;
60 size_t size;
61 int ret;
62
63 device = bdev->bd_disk->private_data;
64 if (!device)
65 return -EINVAL;
66 udata = (void __user *) args;
67 size = _IOC_SIZE(no);
68
69 if (!access_ok(VERIFY_WRITE, udata, size))
70 return -EFAULT;
71 ret = cmf_readall(device->cdev, &data);
72 if (ret)
73 return ret;
74 if (copy_to_user(udata, &data, min(size, sizeof(*udata))))
75 return -EFAULT;
76 return 0;
77}
78
79/* module initialization below here. dasd already provides a mechanism
80 * to dynamically register ioctl functions, so we simply use this. */
81static inline int
82ioctl_reg(unsigned int no, dasd_ioctl_fn_t handler)
83{
84 return dasd_ioctl_no_register(THIS_MODULE, no, handler);
85}
86
87static inline void
88ioctl_unreg(unsigned int no, dasd_ioctl_fn_t handler)
89{
90 dasd_ioctl_no_unregister(THIS_MODULE, no, handler);
91}
92
93static void
94dasd_cmf_exit(void)
95{
96 ioctl_unreg(BIODASDCMFENABLE, dasd_ioctl_cmf_enable);
97 ioctl_unreg(BIODASDCMFDISABLE, dasd_ioctl_cmf_disable);
98 ioctl_unreg(BIODASDREADALLCMB, dasd_ioctl_readall_cmb);
99}
100
101static int __init
102dasd_cmf_init(void)
103{
104 int ret;
105 ret = ioctl_reg (BIODASDCMFENABLE, dasd_ioctl_cmf_enable);
106 if (ret)
107 goto err;
108 ret = ioctl_reg (BIODASDCMFDISABLE, dasd_ioctl_cmf_disable);
109 if (ret)
110 goto err;
111 ret = ioctl_reg (BIODASDREADALLCMB, dasd_ioctl_readall_cmb);
112 if (ret)
113 goto err;
114
115 return 0;
116err:
117 dasd_cmf_exit();
118
119 return ret;
120}
121
122module_init(dasd_cmf_init);
123module_exit(dasd_cmf_exit);
124
125MODULE_AUTHOR("Arnd Bergmann <arndb@de.ibm.com>");
126MODULE_LICENSE("GPL");
127MODULE_DESCRIPTION("channel measurement facility interface for dasd\n"
128 "Copyright 2003 IBM Corporation\n");
diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c
index bb6caf46bbd9..c8319bef2730 100644
--- a/drivers/s390/block/dasd_ioctl.c
+++ b/drivers/s390/block/dasd_ioctl.c
@@ -16,6 +16,7 @@
16#include <linux/blkpg.h> 16#include <linux/blkpg.h>
17 17
18#include <asm/ccwdev.h> 18#include <asm/ccwdev.h>
19#include <asm/cmb.h>
19#include <asm/uaccess.h> 20#include <asm/uaccess.h>
20 21
21/* This is ugly... */ 22/* This is ugly... */
@@ -406,6 +407,21 @@ dasd_ioctl_set_ro(struct block_device *bdev, void __user *argp)
406 return dasd_set_feature(device->cdev, DASD_FEATURE_READONLY, intval); 407 return dasd_set_feature(device->cdev, DASD_FEATURE_READONLY, intval);
407} 408}
408 409
410static int
411dasd_ioctl_readall_cmb(struct dasd_device *device, unsigned int cmd,
412 unsigned long arg)
413{
414 struct cmbdata __user *argp = (void __user *) arg;
415 size_t size = _IOC_SIZE(cmd);
416 struct cmbdata data;
417 int ret;
418
419 ret = cmf_readall(device->cdev, &data);
420 if (!ret && copy_to_user(argp, &data, min(size, sizeof(*argp))))
421 return -EFAULT;
422 return ret;
423}
424
409int 425int
410dasd_ioctl(struct inode *inode, struct file *file, 426dasd_ioctl(struct inode *inode, struct file *file,
411 unsigned int cmd, unsigned long arg) 427 unsigned int cmd, unsigned long arg)
@@ -447,6 +463,12 @@ dasd_ioctl(struct inode *inode, struct file *file,
447 return dasd_ioctl_set_ro(bdev, argp); 463 return dasd_ioctl_set_ro(bdev, argp);
448 case DASDAPIVER: 464 case DASDAPIVER:
449 return dasd_ioctl_api_version(argp); 465 return dasd_ioctl_api_version(argp);
466 case BIODASDCMFENABLE:
467 return enable_cmf(device->cdev);
468 case BIODASDCMFDISABLE:
469 return disable_cmf(device->cdev);
470 case BIODASDREADALLCMB:
471 return dasd_ioctl_readall_cmb(device, cmd, arg);
450 default: 472 default:
451 /* if the discipline has an ioctl method try it. */ 473 /* if the discipline has an ioctl method try it. */
452 if (device->discipline->ioctl) { 474 if (device->discipline->ioctl) {