Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] s390: move s390_root_dev_* out of the cio layer

Extract the s390_root_dev_* functions from the common I/O layer as they are
also used by non-ccw device drivers.

Signed-off-by: Carsten Otte <cotte@de.ibm.com>
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>

authored by

Carsten Otte and committed by
Linus Torvalds
cfb1b555 6810a2bc

+74 -48
+1 -1
drivers/s390/Makefile
··· 2 2 # Makefile for the S/390 specific device drivers 3 3 # 4 4 5 - obj-y += s390mach.o sysinfo.o 5 + obj-y += s390mach.o sysinfo.o s390_rdev.o 6 6 obj-y += cio/ block/ char/ crypto/ net/ scsi/ 7 7 8 8 drivers-y += drivers/s390/built-in.o
+1 -1
drivers/s390/block/dcssblk.c
··· 15 15 #include <asm/io.h> 16 16 #include <linux/completion.h> 17 17 #include <linux/interrupt.h> 18 - #include <asm/ccwdev.h> // for s390_root_dev_(un)register() 18 + #include <asm/s390_rdev.h> 19 19 20 20 //#define DCSSBLK_DEBUG /* Debug messages on/off */ 21 21 #define DCSSBLK_NAME "dcssblk"
-41
drivers/s390/cio/css.c
··· 481 481 482 482 subsys_initcall(init_channel_subsystem); 483 483 484 - /* 485 - * Register root devices for some drivers. The release function must not be 486 - * in the device drivers, so we do it here. 487 - */ 488 - static void 489 - s390_root_dev_release(struct device *dev) 490 - { 491 - kfree(dev); 492 - } 493 - 494 - struct device * 495 - s390_root_dev_register(const char *name) 496 - { 497 - struct device *dev; 498 - int ret; 499 - 500 - if (!strlen(name)) 501 - return ERR_PTR(-EINVAL); 502 - dev = kmalloc(sizeof(struct device), GFP_KERNEL); 503 - if (!dev) 504 - return ERR_PTR(-ENOMEM); 505 - memset(dev, 0, sizeof(struct device)); 506 - strncpy(dev->bus_id, name, min(strlen(name), (size_t)BUS_ID_SIZE)); 507 - dev->release = s390_root_dev_release; 508 - ret = device_register(dev); 509 - if (ret) { 510 - kfree(dev); 511 - return ERR_PTR(ret); 512 - } 513 - return dev; 514 - } 515 - 516 - void 517 - s390_root_dev_unregister(struct device *dev) 518 - { 519 - if (dev) 520 - device_unregister(dev); 521 - } 522 - 523 484 int 524 485 css_enqueue_subchannel_slow(unsigned long schid) 525 486 { ··· 525 564 526 565 MODULE_LICENSE("GPL"); 527 566 EXPORT_SYMBOL(css_bus_type); 528 - EXPORT_SYMBOL(s390_root_dev_register); 529 - EXPORT_SYMBOL(s390_root_dev_unregister); 530 567 EXPORT_SYMBOL_GPL(css_characteristics_avail);
+2 -1
drivers/s390/net/cu3088.c
··· 1 1 /* 2 - * $Id: cu3088.c,v 1.35 2005/03/30 19:28:52 richtera Exp $ 2 + * $Id: cu3088.c,v 1.36 2005/10/25 14:37:17 cohuck Exp $ 3 3 * 4 4 * CTC / LCS ccw_device driver 5 5 * ··· 27 27 #include <linux/module.h> 28 28 #include <linux/err.h> 29 29 30 + #include <asm/s390_rdev.h> 30 31 #include <asm/ccwdev.h> 31 32 #include <asm/ccwgroup.h> 32 33
+1 -1
drivers/s390/net/iucv.c
··· 54 54 #include <asm/s390_ext.h> 55 55 #include <asm/ebcdic.h> 56 56 #include <asm/smp.h> 57 - #include <asm/ccwdev.h> //for root device stuff 57 + #include <asm/s390_rdev.h> 58 58 59 59 /* FLAGS: 60 60 * All flags are defined in the field IPFLAGS1 of each function
+1
drivers/s390/net/qeth_main.c
··· 65 65 #include <asm/timex.h> 66 66 #include <asm/semaphore.h> 67 67 #include <asm/uaccess.h> 68 + #include <asm/s390_rdev.h> 68 69 69 70 #include "qeth.h" 70 71 #include "qeth_mpc.h"
+53
drivers/s390/s390_rdev.c
··· 1 + /* 2 + * drivers/s390/s390_rdev.c 3 + * s390 root device 4 + * $Revision: 1.2 $ 5 + * 6 + * Copyright (C) 2002, 2005 IBM Deutschland Entwicklung GmbH, 7 + * IBM Corporation 8 + * Author(s): Cornelia Huck (cohuck@de.ibm.com) 9 + * Carsten Otte (cotte@de.ibm.com) 10 + */ 11 + 12 + #include <linux/slab.h> 13 + #include <linux/err.h> 14 + #include <linux/device.h> 15 + #include <asm/s390_rdev.h> 16 + 17 + static void 18 + s390_root_dev_release(struct device *dev) 19 + { 20 + kfree(dev); 21 + } 22 + 23 + struct device * 24 + s390_root_dev_register(const char *name) 25 + { 26 + struct device *dev; 27 + int ret; 28 + 29 + if (!strlen(name)) 30 + return ERR_PTR(-EINVAL); 31 + dev = kmalloc(sizeof(struct device), GFP_KERNEL); 32 + if (!dev) 33 + return ERR_PTR(-ENOMEM); 34 + memset(dev, 0, sizeof(struct device)); 35 + strncpy(dev->bus_id, name, min(strlen(name), (size_t)BUS_ID_SIZE)); 36 + dev->release = s390_root_dev_release; 37 + ret = device_register(dev); 38 + if (ret) { 39 + kfree(dev); 40 + return ERR_PTR(ret); 41 + } 42 + return dev; 43 + } 44 + 45 + void 46 + s390_root_dev_unregister(struct device *dev) 47 + { 48 + if (dev) 49 + device_unregister(dev); 50 + } 51 + 52 + EXPORT_SYMBOL(s390_root_dev_register); 53 + EXPORT_SYMBOL(s390_root_dev_unregister);
-3
include/asm-s390/ccwdev.h
··· 185 185 extern int _ccw_device_get_device_number(struct ccw_device *); 186 186 extern int _ccw_device_get_subchannel_number(struct ccw_device *); 187 187 188 - extern struct device *s390_root_dev_register(const char *); 189 - extern void s390_root_dev_unregister(struct device *); 190 - 191 188 extern void *ccw_device_get_chp_desc(struct ccw_device *, int); 192 189 #endif /* _S390_CCWDEV_H_ */
+15
include/asm-s390/s390_rdev.h
··· 1 + /* 2 + * include/asm-s390/ccwdev.h 3 + * 4 + * Copyright (C) 2002,2005 IBM Deutschland Entwicklung GmbH, IBM Corporation 5 + * Author(s): Cornelia Huck <cohuck@de.ibm.com> 6 + * Carsten Otte <cotte@de.ibm.com> 7 + * 8 + * Interface for s390 root device 9 + */ 10 + 11 + #ifndef _S390_RDEV_H_ 12 + #define _S390_RDEV_H_ 13 + extern struct device *s390_root_dev_register(const char *); 14 + extern void s390_root_dev_unregister(struct device *); 15 + #endif /* _S390_RDEV_H_ */