aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/s390/CommonIO11
-rw-r--r--arch/s390/Kconfig1
-rw-r--r--arch/s390/include/asm/dasd.h13
-rw-r--r--arch/s390/include/asm/delay.h1
-rw-r--r--arch/s390/include/asm/pgtable.h45
-rw-r--r--arch/s390/include/asm/ptrace.h1
-rw-r--r--arch/s390/include/asm/qdio.h8
-rw-r--r--arch/s390/include/asm/syscall.h80
-rw-r--r--arch/s390/include/asm/thread_info.h2
-rw-r--r--arch/s390/kernel/compat_linux.c8
-rw-r--r--arch/s390/kernel/compat_linux.h1
-rw-r--r--arch/s390/kernel/compat_wrapper.S2
-rw-r--r--arch/s390/kernel/entry.S50
-rw-r--r--arch/s390/kernel/entry64.S42
-rw-r--r--arch/s390/kernel/ptrace.c61
-rw-r--r--arch/s390/kernel/signal.c13
-rw-r--r--arch/s390/kernel/syscalls.S2
-rw-r--r--arch/s390/kernel/time.c2
-rw-r--r--arch/s390/lib/delay.c13
-rw-r--r--arch/s390/mm/extmem.c251
-rw-r--r--drivers/s390/block/dasd.c32
-rw-r--r--drivers/s390/block/dasd_3990_erp.c2
-rw-r--r--drivers/s390/block/dasd_devmap.c28
-rw-r--r--drivers/s390/block/dasd_eckd.c132
-rw-r--r--drivers/s390/block/dasd_eer.c6
-rw-r--r--drivers/s390/block/dasd_fba.c4
-rw-r--r--drivers/s390/block/dasd_int.h4
-rw-r--r--drivers/s390/block/dasd_proc.c2
-rw-r--r--drivers/s390/block/dcssblk.c516
-rw-r--r--drivers/s390/block/xpram.c37
-rw-r--r--drivers/s390/char/con3215.c53
-rw-r--r--drivers/s390/char/con3270.c27
-rw-r--r--drivers/s390/char/raw3270.c4
-rw-r--r--drivers/s390/char/sclp_con.c24
-rw-r--r--drivers/s390/char/sclp_vt220.c26
-rw-r--r--drivers/s390/char/tape_3590.c132
-rw-r--r--drivers/s390/char/tape_block.c2
-rw-r--r--drivers/s390/char/tape_core.c21
-rw-r--r--drivers/s390/char/tape_proc.c2
-rw-r--r--drivers/s390/char/tape_std.c13
-rw-r--r--drivers/s390/char/vmlogrdr.c5
-rw-r--r--drivers/s390/char/vmur.c6
-rw-r--r--drivers/s390/cio/blacklist.c11
-rw-r--r--drivers/s390/cio/ccwgroup.c3
-rw-r--r--drivers/s390/cio/chp.c3
-rw-r--r--drivers/s390/cio/chsc_sch.c2
-rw-r--r--drivers/s390/cio/cio.c56
-rw-r--r--drivers/s390/cio/cio.h4
-rw-r--r--drivers/s390/cio/css.c4
-rw-r--r--drivers/s390/cio/device.c118
-rw-r--r--drivers/s390/cio/device.h1
-rw-r--r--drivers/s390/cio/device_fsm.c6
-rw-r--r--drivers/s390/cio/device_ops.c2
-rw-r--r--drivers/s390/cio/io_sch.h22
-rw-r--r--drivers/s390/cio/ioasm.h49
-rw-r--r--drivers/s390/cio/qdio.h11
-rw-r--r--drivers/s390/cio/qdio_debug.c2
-rw-r--r--drivers/s390/cio/qdio_main.c32
-rw-r--r--drivers/s390/crypto/ap_bus.c4
-rw-r--r--drivers/s390/kvm/kvm_virtio.c15
-rw-r--r--drivers/s390/net/claw.c36
-rw-r--r--drivers/s390/net/claw.h2
-rw-r--r--drivers/s390/net/ctcm_main.c22
-rw-r--r--drivers/s390/net/ctcm_main.h2
-rw-r--r--drivers/s390/net/lcs.c34
-rw-r--r--drivers/s390/net/netiucv.c2
-rw-r--r--drivers/s390/net/qeth_core.h10
-rw-r--r--drivers/s390/net/qeth_core_main.c10
-rw-r--r--drivers/s390/s390_rdev.c2
-rw-r--r--drivers/s390/scsi/zfcp_aux.c7
-rw-r--r--drivers/s390/scsi/zfcp_def.h4
-rw-r--r--drivers/s390/scsi/zfcp_erp.c2
-rw-r--r--drivers/s390/scsi/zfcp_sysfs.c2
-rwxr-xr-xscripts/checkstack.pl5
74 files changed, 1550 insertions, 620 deletions
diff --git a/Documentation/s390/CommonIO b/Documentation/s390/CommonIO
index bf0baa19ec24..339207d11d95 100644
--- a/Documentation/s390/CommonIO
+++ b/Documentation/s390/CommonIO
@@ -70,13 +70,19 @@ Command line parameters
70 70
71 Note: While already known devices can be added to the list of devices to be 71 Note: While already known devices can be added to the list of devices to be
72 ignored, there will be no effect on then. However, if such a device 72 ignored, there will be no effect on then. However, if such a device
73 disappears and then reappears, it will then be ignored. 73 disappears and then reappears, it will then be ignored. To make
74 known devices go away, you need the "purge" command (see below).
74 75
75 For example, 76 For example,
76 "echo add 0.0.a000-0.0.accc, 0.0.af00-0.0.afff > /proc/cio_ignore" 77 "echo add 0.0.a000-0.0.accc, 0.0.af00-0.0.afff > /proc/cio_ignore"
77 will add 0.0.a000-0.0.accc and 0.0.af00-0.0.afff to the list of ignored 78 will add 0.0.a000-0.0.accc and 0.0.af00-0.0.afff to the list of ignored
78 devices. 79 devices.
79 80
81 You can remove already known but now ignored devices via
82 "echo purge > /proc/cio_ignore"
83 All devices ignored but still registered and not online (= not in use)
84 will be deregistered and thus removed from the system.
85
80 The devices can be specified either by bus id (0.x.abcd) or, for 2.4 backward 86 The devices can be specified either by bus id (0.x.abcd) or, for 2.4 backward
81 compatibility, by the device number in hexadecimal (0xabcd or abcd). Device 87 compatibility, by the device number in hexadecimal (0xabcd or abcd). Device
82 numbers given as 0xabcd will be interpreted as 0.0.abcd. 88 numbers given as 0xabcd will be interpreted as 0.0.abcd.
@@ -98,8 +104,7 @@ debugfs entries
98 handling). 104 handling).
99 105
100 - /sys/kernel/debug/s390dbf/cio_msg/sprintf 106 - /sys/kernel/debug/s390dbf/cio_msg/sprintf
101 Various debug messages from the common I/O-layer, including messages 107 Various debug messages from the common I/O-layer.
102 printed when cio_msg=yes.
103 108
104 - /sys/kernel/debug/s390dbf/cio_trace/hex_ascii 109 - /sys/kernel/debug/s390dbf/cio_trace/hex_ascii
105 Logs the calling of functions in the common I/O-layer and, if applicable, 110 Logs the calling of functions in the common I/O-layer and, if applicable,
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 8d41908e2513..4c03049e7db9 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -74,6 +74,7 @@ config S390
74 select HAVE_KPROBES 74 select HAVE_KPROBES
75 select HAVE_KRETPROBES 75 select HAVE_KRETPROBES
76 select HAVE_KVM if 64BIT 76 select HAVE_KVM if 64BIT
77 select HAVE_ARCH_TRACEHOOK
77 78
78source "init/Kconfig" 79source "init/Kconfig"
79 80
diff --git a/arch/s390/include/asm/dasd.h b/arch/s390/include/asm/dasd.h
index 3f002e13d024..55b2b80cdf6e 100644
--- a/arch/s390/include/asm/dasd.h
+++ b/arch/s390/include/asm/dasd.h
@@ -3,6 +3,8 @@
3 * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com> 3 * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
4 * Bugreports.to..: <Linux390@de.ibm.com> 4 * Bugreports.to..: <Linux390@de.ibm.com>
5 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 5 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
6 * EMC Symmetrix ioctl Copyright EMC Corporation, 2008
7 * Author.........: Nigel Hislop <hislop_nigel@emc.com>
6 * 8 *
7 * This file is the interface of the DASD device driver, which is exported to user space 9 * This file is the interface of the DASD device driver, which is exported to user space
8 * any future changes wrt the API will result in a change of the APIVERSION reported 10 * any future changes wrt the API will result in a change of the APIVERSION reported
@@ -202,6 +204,16 @@ typedef struct attrib_data_t {
202#define DASD_SEQ_PRESTAGE 0x4 204#define DASD_SEQ_PRESTAGE 0x4
203#define DASD_REC_ACCESS 0x5 205#define DASD_REC_ACCESS 0x5
204 206
207/*
208 * Perform EMC Symmetrix I/O
209 */
210typedef struct dasd_symmio_parms {
211 unsigned char reserved[8]; /* compat with older releases */
212 unsigned long long psf_data; /* char * cast to u64 */
213 unsigned long long rssd_result; /* char * cast to u64 */
214 int psf_data_len;
215 int rssd_result_len;
216} __attribute__ ((packed)) dasd_symmio_parms_t;
205 217
206/******************************************************************************** 218/********************************************************************************
207 * SECTION: Definition of IOCTLs 219 * SECTION: Definition of IOCTLs
@@ -247,6 +259,7 @@ typedef struct attrib_data_t {
247/* Set Attributes (cache operations) */ 259/* Set Attributes (cache operations) */
248#define BIODASDSATTR _IOW(DASD_IOCTL_LETTER,2,attrib_data_t) 260#define BIODASDSATTR _IOW(DASD_IOCTL_LETTER,2,attrib_data_t)
249 261
262#define BIODASDSYMMIO _IOWR(DASD_IOCTL_LETTER, 240, dasd_symmio_parms_t)
250 263
251#endif /* DASD_H */ 264#endif /* DASD_H */
252 265
diff --git a/arch/s390/include/asm/delay.h b/arch/s390/include/asm/delay.h
index 78357314c450..a356c958e260 100644
--- a/arch/s390/include/asm/delay.h
+++ b/arch/s390/include/asm/delay.h
@@ -15,6 +15,7 @@
15#define _S390_DELAY_H 15#define _S390_DELAY_H
16 16
17extern void __udelay(unsigned long usecs); 17extern void __udelay(unsigned long usecs);
18extern void udelay_simple(unsigned long usecs);
18extern void __delay(unsigned long loops); 19extern void __delay(unsigned long loops);
19 20
20#define udelay(n) __udelay(n) 21#define udelay(n) __udelay(n)
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 0bdb704ae051..1a928f84afd6 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -281,6 +281,9 @@ extern char empty_zero_page[PAGE_SIZE];
281#define RCP_GR_BIT 50 281#define RCP_GR_BIT 50
282#define RCP_GC_BIT 49 282#define RCP_GC_BIT 49
283 283
284/* User dirty bit for KVM's migration feature */
285#define KVM_UD_BIT 47
286
284#ifndef __s390x__ 287#ifndef __s390x__
285 288
286/* Bits in the segment table address-space-control-element */ 289/* Bits in the segment table address-space-control-element */
@@ -575,12 +578,16 @@ static inline void ptep_rcp_copy(pte_t *ptep)
575 unsigned long *pgste = (unsigned long *) (ptep + PTRS_PER_PTE); 578 unsigned long *pgste = (unsigned long *) (ptep + PTRS_PER_PTE);
576 579
577 skey = page_get_storage_key(page_to_phys(page)); 580 skey = page_get_storage_key(page_to_phys(page));
578 if (skey & _PAGE_CHANGED) 581 if (skey & _PAGE_CHANGED) {
579 set_bit_simple(RCP_GC_BIT, pgste); 582 set_bit_simple(RCP_GC_BIT, pgste);
583 set_bit_simple(KVM_UD_BIT, pgste);
584 }
580 if (skey & _PAGE_REFERENCED) 585 if (skey & _PAGE_REFERENCED)
581 set_bit_simple(RCP_GR_BIT, pgste); 586 set_bit_simple(RCP_GR_BIT, pgste);
582 if (test_and_clear_bit_simple(RCP_HC_BIT, pgste)) 587 if (test_and_clear_bit_simple(RCP_HC_BIT, pgste)) {
583 SetPageDirty(page); 588 SetPageDirty(page);
589 set_bit_simple(KVM_UD_BIT, pgste);
590 }
584 if (test_and_clear_bit_simple(RCP_HR_BIT, pgste)) 591 if (test_and_clear_bit_simple(RCP_HR_BIT, pgste))
585 SetPageReferenced(page); 592 SetPageReferenced(page);
586#endif 593#endif
@@ -744,6 +751,40 @@ static inline pte_t pte_mkspecial(pte_t pte)
744 return pte; 751 return pte;
745} 752}
746 753
754#ifdef CONFIG_PGSTE
755/*
756 * Get (and clear) the user dirty bit for a PTE.
757 */
758static inline int kvm_s390_test_and_clear_page_dirty(struct mm_struct *mm,
759 pte_t *ptep)
760{
761 int dirty;
762 unsigned long *pgste;
763 struct page *page;
764 unsigned int skey;
765
766 if (!mm->context.pgstes)
767 return -EINVAL;
768 rcp_lock(ptep);
769 pgste = (unsigned long *) (ptep + PTRS_PER_PTE);
770 page = virt_to_page(pte_val(*ptep));
771 skey = page_get_storage_key(page_to_phys(page));
772 if (skey & _PAGE_CHANGED) {
773 set_bit_simple(RCP_GC_BIT, pgste);
774 set_bit_simple(KVM_UD_BIT, pgste);
775 }
776 if (test_and_clear_bit_simple(RCP_HC_BIT, pgste)) {
777 SetPageDirty(page);
778 set_bit_simple(KVM_UD_BIT, pgste);
779 }
780 dirty = test_and_clear_bit_simple(KVM_UD_BIT, pgste);
781 if (skey & _PAGE_CHANGED)
782 page_clear_dirty(page);
783 rcp_unlock(ptep);
784 return dirty;
785}
786#endif
787
747#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 788#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
748static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, 789static inline int ptep_test_and_clear_young(struct vm_area_struct *vma,
749 unsigned long addr, pte_t *ptep) 790 unsigned long addr, pte_t *ptep)
diff --git a/arch/s390/include/asm/ptrace.h b/arch/s390/include/asm/ptrace.h
index af2c9ac28a07..a7226f8143fb 100644
--- a/arch/s390/include/asm/ptrace.h
+++ b/arch/s390/include/asm/ptrace.h
@@ -490,6 +490,7 @@ extern void user_disable_single_step(struct task_struct *);
490 490
491#define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0) 491#define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0)
492#define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN) 492#define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN)
493#define user_stack_pointer(regs)((regs)->gprs[15])
493#define regs_return_value(regs)((regs)->gprs[2]) 494#define regs_return_value(regs)((regs)->gprs[2])
494#define profile_pc(regs) instruction_pointer(regs) 495#define profile_pc(regs) instruction_pointer(regs)
495extern void show_regs(struct pt_regs * regs); 496extern void show_regs(struct pt_regs * regs);
diff --git a/arch/s390/include/asm/qdio.h b/arch/s390/include/asm/qdio.h
index 6813772171f2..4734c3f05354 100644
--- a/arch/s390/include/asm/qdio.h
+++ b/arch/s390/include/asm/qdio.h
@@ -299,7 +299,13 @@ struct qdio_ssqd_desc {
299 u8 mbccnt; 299 u8 mbccnt;
300 u16 qdioac2; 300 u16 qdioac2;
301 u64 sch_token; 301 u64 sch_token;
302 u64:64; 302 u8 mro;
303 u8 mri;
304 u8:8;
305 u8 sbalic;
306 u16:16;
307 u8:8;
308 u8 mmwc;
303} __attribute__ ((packed)); 309} __attribute__ ((packed));
304 310
305/* params are: ccw_device, qdio_error, queue_number, 311/* params are: ccw_device, qdio_error, queue_number,
diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h
new file mode 100644
index 000000000000..6e623971fbb9
--- /dev/null
+++ b/arch/s390/include/asm/syscall.h
@@ -0,0 +1,80 @@
1/*
2 * Access to user system call parameters and results
3 *
4 * Copyright IBM Corp. 2008
5 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License (version 2 only)
9 * as published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_SYSCALL_H
13#define _ASM_SYSCALL_H 1
14
15#include <asm/ptrace.h>
16
17static inline long syscall_get_nr(struct task_struct *task,
18 struct pt_regs *regs)
19{
20 if (regs->trap != __LC_SVC_OLD_PSW)
21 return -1;
22 return regs->gprs[2];
23}
24
25static inline void syscall_rollback(struct task_struct *task,
26 struct pt_regs *regs)
27{
28 regs->gprs[2] = regs->orig_gpr2;
29}
30
31static inline long syscall_get_error(struct task_struct *task,
32 struct pt_regs *regs)
33{
34 return (regs->gprs[2] >= -4096UL) ? -regs->gprs[2] : 0;
35}
36
37static inline long syscall_get_return_value(struct task_struct *task,
38 struct pt_regs *regs)
39{
40 return regs->gprs[2];
41}
42
43static inline void syscall_set_return_value(struct task_struct *task,
44 struct pt_regs *regs,
45 int error, long val)
46{
47 regs->gprs[2] = error ? -error : val;
48}
49
50static inline void syscall_get_arguments(struct task_struct *task,
51 struct pt_regs *regs,
52 unsigned int i, unsigned int n,
53 unsigned long *args)
54{
55 BUG_ON(i + n > 6);
56#ifdef CONFIG_COMPAT
57 if (test_tsk_thread_flag(task, TIF_31BIT)) {
58 if (i + n == 6)
59 args[--n] = (u32) regs->args[0];
60 while (n-- > 0)
61 args[n] = (u32) regs->gprs[2 + i + n];
62 }
63#endif
64 if (i + n == 6)
65 args[--n] = regs->args[0];
66 memcpy(args, &regs->gprs[2 + i], n * sizeof(args[0]));
67}
68
69static inline void syscall_set_arguments(struct task_struct *task,
70 struct pt_regs *regs,
71 unsigned int i, unsigned int n,
72 const unsigned long *args)
73{
74 BUG_ON(i + n > 6);
75 if (i + n == 6)
76 regs->args[0] = args[--n];
77 memcpy(&regs->gprs[2 + i], args, n * sizeof(args[0]));
78}
79
80#endif /* _ASM_SYSCALL_H */
diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h
index 91a8f93ad355..ea40a9d690fc 100644
--- a/arch/s390/include/asm/thread_info.h
+++ b/arch/s390/include/asm/thread_info.h
@@ -86,6 +86,7 @@ static inline struct thread_info *current_thread_info(void)
86 * thread information flags bit numbers 86 * thread information flags bit numbers
87 */ 87 */
88#define TIF_SYSCALL_TRACE 0 /* syscall trace active */ 88#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
89#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
89#define TIF_SIGPENDING 2 /* signal pending */ 90#define TIF_SIGPENDING 2 /* signal pending */
90#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 91#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
91#define TIF_RESTART_SVC 4 /* restart svc with new svc number */ 92#define TIF_RESTART_SVC 4 /* restart svc with new svc number */
@@ -100,6 +101,7 @@ static inline struct thread_info *current_thread_info(void)
100#define TIF_RESTORE_SIGMASK 20 /* restore signal mask in do_signal() */ 101#define TIF_RESTORE_SIGMASK 20 /* restore signal mask in do_signal() */
101 102
102#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 103#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
104#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
103#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 105#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
104#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 106#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
105#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 107#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index d7f22226fc4e..98e246dc0233 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -608,14 +608,6 @@ asmlinkage long sys32_settimeofday(struct compat_timeval __user *tv, struct time
608 return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); 608 return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
609} 609}
610 610
611/* These are here just in case some old sparc32 binary calls it. */
612asmlinkage long sys32_pause(void)
613{
614 current->state = TASK_INTERRUPTIBLE;
615 schedule();
616 return -ERESTARTNOHAND;
617}
618
619asmlinkage long sys32_pread64(unsigned int fd, char __user *ubuf, 611asmlinkage long sys32_pread64(unsigned int fd, char __user *ubuf,
620 size_t count, u32 poshi, u32 poslo) 612 size_t count, u32 poshi, u32 poslo)
621{ 613{
diff --git a/arch/s390/kernel/compat_linux.h b/arch/s390/kernel/compat_linux.h
index 20723a062017..05f8516366ab 100644
--- a/arch/s390/kernel/compat_linux.h
+++ b/arch/s390/kernel/compat_linux.h
@@ -206,7 +206,6 @@ long sys32_gettimeofday(struct compat_timeval __user *tv,
206 struct timezone __user *tz); 206 struct timezone __user *tz);
207long sys32_settimeofday(struct compat_timeval __user *tv, 207long sys32_settimeofday(struct compat_timeval __user *tv,
208 struct timezone __user *tz); 208 struct timezone __user *tz);
209long sys32_pause(void);
210long sys32_pread64(unsigned int fd, char __user *ubuf, size_t count, 209long sys32_pread64(unsigned int fd, char __user *ubuf, size_t count,
211 u32 poshi, u32 poslo); 210 u32 poshi, u32 poslo);
212long sys32_pwrite64(unsigned int fd, const char __user *ubuf, 211long sys32_pwrite64(unsigned int fd, const char __user *ubuf,
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index 328a20e880b5..ee51ca9e23b5 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -128,8 +128,6 @@ sys32_alarm_wrapper:
128 llgfr %r2,%r2 # unsigned int 128 llgfr %r2,%r2 # unsigned int
129 jg sys_alarm # branch to system call 129 jg sys_alarm # branch to system call
130 130
131#sys32_pause_wrapper # void
132
133 .globl compat_sys_utime_wrapper 131 .globl compat_sys_utime_wrapper
134compat_sys_utime_wrapper: 132compat_sys_utime_wrapper:
135 llgtr %r2,%r2 # char * 133 llgtr %r2,%r2 # char *
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 708cf9cf9a35..ed500ef799b7 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -49,9 +49,9 @@ SP_ILC = STACK_FRAME_OVERHEAD + __PT_ILC
49SP_TRAP = STACK_FRAME_OVERHEAD + __PT_TRAP 49SP_TRAP = STACK_FRAME_OVERHEAD + __PT_TRAP
50SP_SIZE = STACK_FRAME_OVERHEAD + __PT_SIZE 50SP_SIZE = STACK_FRAME_OVERHEAD + __PT_SIZE
51 51
52_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \ 52_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \
53 _TIF_MCCK_PENDING | _TIF_RESTART_SVC | _TIF_SINGLE_STEP ) 53 _TIF_MCCK_PENDING | _TIF_RESTART_SVC | _TIF_SINGLE_STEP )
54_TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \ 54_TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \
55 _TIF_MCCK_PENDING) 55 _TIF_MCCK_PENDING)
56 56
57STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER 57STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER
@@ -318,6 +318,8 @@ sysc_work:
318 bo BASED(sysc_reschedule) 318 bo BASED(sysc_reschedule)
319 tm __TI_flags+3(%r9),_TIF_SIGPENDING 319 tm __TI_flags+3(%r9),_TIF_SIGPENDING
320 bnz BASED(sysc_sigpending) 320 bnz BASED(sysc_sigpending)
321 tm __TI_flags+3(%r9),_TIF_NOTIFY_RESUME
322 bnz BASED(sysc_notify_resume)
321 tm __TI_flags+3(%r9),_TIF_RESTART_SVC 323 tm __TI_flags+3(%r9),_TIF_RESTART_SVC
322 bo BASED(sysc_restart) 324 bo BASED(sysc_restart)
323 tm __TI_flags+3(%r9),_TIF_SINGLE_STEP 325 tm __TI_flags+3(%r9),_TIF_SINGLE_STEP
@@ -356,6 +358,16 @@ sysc_sigpending:
356 b BASED(sysc_work_loop) 358 b BASED(sysc_work_loop)
357 359
358# 360#
361# _TIF_NOTIFY_RESUME is set, call do_notify_resume
362#
363sysc_notify_resume:
364 la %r2,SP_PTREGS(%r15) # load pt_regs
365 l %r1,BASED(.Ldo_notify_resume)
366 la %r14,BASED(sysc_work_loop)
367 br %r1 # call do_notify_resume
368
369
370#
359# _TIF_RESTART_SVC is set, set up registers and restart svc 371# _TIF_RESTART_SVC is set, set up registers and restart svc
360# 372#
361sysc_restart: 373sysc_restart:
@@ -378,20 +390,21 @@ sysc_singlestep:
378 br %r1 # branch to do_single_step 390 br %r1 # branch to do_single_step
379 391
380# 392#
381# call trace before and after sys_call 393# call tracehook_report_syscall_entry/tracehook_report_syscall_exit before
394# and after the system call
382# 395#
383sysc_tracesys: 396sysc_tracesys:
384 l %r1,BASED(.Ltrace) 397 l %r1,BASED(.Ltrace_entry)
385 la %r2,SP_PTREGS(%r15) # load pt_regs 398 la %r2,SP_PTREGS(%r15) # load pt_regs
386 la %r3,0 399 la %r3,0
387 srl %r7,2 400 srl %r7,2
388 st %r7,SP_R2(%r15) 401 st %r7,SP_R2(%r15)
389 basr %r14,%r1 402 basr %r14,%r1
390 clc SP_R2(4,%r15),BASED(.Lnr_syscalls) 403 cl %r2,BASED(.Lnr_syscalls)
391 bnl BASED(sysc_tracenogo) 404 bnl BASED(sysc_tracenogo)
392 l %r8,BASED(.Lsysc_table) 405 l %r8,BASED(.Lsysc_table)
393 l %r7,SP_R2(%r15) # strace might have changed the 406 lr %r7,%r2
394 sll %r7,2 # system call 407 sll %r7,2 # *4
395 l %r8,0(%r7,%r8) 408 l %r8,0(%r7,%r8)
396sysc_tracego: 409sysc_tracego:
397 lm %r3,%r6,SP_R3(%r15) 410 lm %r3,%r6,SP_R3(%r15)
@@ -401,9 +414,8 @@ sysc_tracego:
401sysc_tracenogo: 414sysc_tracenogo:
402 tm __TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT) 415 tm __TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
403 bz BASED(sysc_return) 416 bz BASED(sysc_return)
404 l %r1,BASED(.Ltrace) 417 l %r1,BASED(.Ltrace_exit)
405 la %r2,SP_PTREGS(%r15) # load pt_regs 418 la %r2,SP_PTREGS(%r15) # load pt_regs
406 la %r3,1
407 la %r14,BASED(sysc_return) 419 la %r14,BASED(sysc_return)
408 br %r1 420 br %r1
409 421
@@ -666,6 +678,8 @@ io_work_loop:
666 bo BASED(io_reschedule) 678 bo BASED(io_reschedule)
667 tm __TI_flags+3(%r9),_TIF_SIGPENDING 679 tm __TI_flags+3(%r9),_TIF_SIGPENDING
668 bnz BASED(io_sigpending) 680 bnz BASED(io_sigpending)
681 tm __TI_flags+3(%r9),_TIF_NOTIFY_RESUME
682 bnz BASED(io_notify_resume)
669 b BASED(io_restore) 683 b BASED(io_restore)
670io_work_done: 684io_work_done:
671 685
@@ -704,6 +718,19 @@ io_sigpending:
704 TRACE_IRQS_OFF 718 TRACE_IRQS_OFF
705 b BASED(io_work_loop) 719 b BASED(io_work_loop)
706 720
721#
722# _TIF_SIGPENDING is set, call do_signal
723#
724io_notify_resume:
725 TRACE_IRQS_ON
726 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
727 la %r2,SP_PTREGS(%r15) # load pt_regs
728 l %r1,BASED(.Ldo_notify_resume)
729 basr %r14,%r1 # call do_signal
730 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts
731 TRACE_IRQS_OFF
732 b BASED(io_work_loop)
733
707/* 734/*
708 * External interrupt handler routine 735 * External interrupt handler routine
709 */ 736 */
@@ -1070,6 +1097,8 @@ cleanup_io_leave_insn:
1070.Ldo_IRQ: .long do_IRQ 1097.Ldo_IRQ: .long do_IRQ
1071.Ldo_extint: .long do_extint 1098.Ldo_extint: .long do_extint
1072.Ldo_signal: .long do_signal 1099.Ldo_signal: .long do_signal
1100.Ldo_notify_resume:
1101 .long do_notify_resume
1073.Lhandle_per: .long do_single_step 1102.Lhandle_per: .long do_single_step
1074.Ldo_execve: .long do_execve 1103.Ldo_execve: .long do_execve
1075.Lexecve_tail: .long execve_tail 1104.Lexecve_tail: .long execve_tail
@@ -1079,7 +1108,8 @@ cleanup_io_leave_insn:
1079.Lpreempt_schedule_irq: 1108.Lpreempt_schedule_irq:
1080 .long preempt_schedule_irq 1109 .long preempt_schedule_irq
1081#endif 1110#endif
1082.Ltrace: .long syscall_trace 1111.Ltrace_entry: .long do_syscall_trace_enter
1112.Ltrace_exit: .long do_syscall_trace_exit
1083.Lschedtail: .long schedule_tail 1113.Lschedtail: .long schedule_tail
1084.Lsysc_table: .long sys_call_table 1114.Lsysc_table: .long sys_call_table
1085#ifdef CONFIG_TRACE_IRQFLAGS 1115#ifdef CONFIG_TRACE_IRQFLAGS
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index fee10177dbfc..d7ce150453f2 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -52,9 +52,9 @@ SP_SIZE = STACK_FRAME_OVERHEAD + __PT_SIZE
52STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER 52STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER
53STACK_SIZE = 1 << STACK_SHIFT 53STACK_SIZE = 1 << STACK_SHIFT
54 54
55_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \ 55_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \
56 _TIF_MCCK_PENDING | _TIF_RESTART_SVC | _TIF_SINGLE_STEP ) 56 _TIF_MCCK_PENDING | _TIF_RESTART_SVC | _TIF_SINGLE_STEP )
57_TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \ 57_TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \
58 _TIF_MCCK_PENDING) 58 _TIF_MCCK_PENDING)
59 59
60#define BASED(name) name-system_call(%r13) 60#define BASED(name) name-system_call(%r13)
@@ -310,6 +310,8 @@ sysc_work:
310 jo sysc_reschedule 310 jo sysc_reschedule
311 tm __TI_flags+7(%r9),_TIF_SIGPENDING 311 tm __TI_flags+7(%r9),_TIF_SIGPENDING
312 jnz sysc_sigpending 312 jnz sysc_sigpending
313 tm __TI_flags+7(%r9),_TIF_NOTIFY_RESUME
314 jnz sysc_notify_resume
313 tm __TI_flags+7(%r9),_TIF_RESTART_SVC 315 tm __TI_flags+7(%r9),_TIF_RESTART_SVC
314 jo sysc_restart 316 jo sysc_restart
315 tm __TI_flags+7(%r9),_TIF_SINGLE_STEP 317 tm __TI_flags+7(%r9),_TIF_SINGLE_STEP
@@ -345,6 +347,14 @@ sysc_sigpending:
345 j sysc_work_loop 347 j sysc_work_loop
346 348
347# 349#
350# _TIF_NOTIFY_RESUME is set, call do_notify_resume
351#
352sysc_notify_resume:
353 la %r2,SP_PTREGS(%r15) # load pt_regs
354 larl %r14,sysc_work_loop
355 jg do_notify_resume # call do_notify_resume
356
357#
348# _TIF_RESTART_SVC is set, set up registers and restart svc 358# _TIF_RESTART_SVC is set, set up registers and restart svc
349# 359#
350sysc_restart: 360sysc_restart:
@@ -367,20 +377,19 @@ sysc_singlestep:
367 jg do_single_step # branch to do_sigtrap 377 jg do_single_step # branch to do_sigtrap
368 378
369# 379#
370# call syscall_trace before and after system call 380# call tracehook_report_syscall_entry/tracehook_report_syscall_exit before
371# special linkage: %r12 contains the return address for trace_svc 381# and after the system call
372# 382#
373sysc_tracesys: 383sysc_tracesys:
374 la %r2,SP_PTREGS(%r15) # load pt_regs 384 la %r2,SP_PTREGS(%r15) # load pt_regs
375 la %r3,0 385 la %r3,0
376 srl %r7,2 386 srl %r7,2
377 stg %r7,SP_R2(%r15) 387 stg %r7,SP_R2(%r15)
378 brasl %r14,syscall_trace 388 brasl %r14,do_syscall_trace_enter
379 lghi %r0,NR_syscalls 389 lghi %r0,NR_syscalls
380 clg %r0,SP_R2(%r15) 390 clgr %r0,%r2
381 jnh sysc_tracenogo 391 jnh sysc_tracenogo
382 lg %r7,SP_R2(%r15) # strace might have changed the 392 slag %r7,%r2,2 # *4
383 sll %r7,2 # system call
384 lgf %r8,0(%r7,%r10) 393 lgf %r8,0(%r7,%r10)
385sysc_tracego: 394sysc_tracego:
386 lmg %r3,%r6,SP_R3(%r15) 395 lmg %r3,%r6,SP_R3(%r15)
@@ -391,9 +400,8 @@ sysc_tracenogo:
391 tm __TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT) 400 tm __TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
392 jz sysc_return 401 jz sysc_return
393 la %r2,SP_PTREGS(%r15) # load pt_regs 402 la %r2,SP_PTREGS(%r15) # load pt_regs
394 la %r3,1
395 larl %r14,sysc_return # return point is sysc_return 403 larl %r14,sysc_return # return point is sysc_return
396 jg syscall_trace 404 jg do_syscall_trace_exit
397 405
398# 406#
399# a new process exits the kernel with ret_from_fork 407# a new process exits the kernel with ret_from_fork
@@ -672,6 +680,8 @@ io_work_loop:
672 jo io_reschedule 680 jo io_reschedule
673 tm __TI_flags+7(%r9),_TIF_SIGPENDING 681 tm __TI_flags+7(%r9),_TIF_SIGPENDING
674 jnz io_sigpending 682 jnz io_sigpending
683 tm __TI_flags+7(%r9),_TIF_NOTIFY_RESUME
684 jnz io_notify_resume
675 j io_restore 685 j io_restore
676io_work_done: 686io_work_done:
677 687
@@ -712,6 +722,18 @@ io_sigpending:
712 TRACE_IRQS_OFF 722 TRACE_IRQS_OFF
713 j io_work_loop 723 j io_work_loop
714 724
725#
726# _TIF_NOTIFY_RESUME or is set, call do_notify_resume
727#
728io_notify_resume:
729 TRACE_IRQS_ON
730 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
731 la %r2,SP_PTREGS(%r15) # load pt_regs
732 brasl %r14,do_notify_resume # call do_notify_resume
733 stnsm __SF_EMPTY(%r15),0xfc # disable I/O and ext. interrupts
734 TRACE_IRQS_OFF
735 j io_work_loop
736
715/* 737/*
716 * External interrupt handler routine 738 * External interrupt handler routine
717 */ 739 */
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index c8b08289eb87..1f31be1ecc4b 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -35,6 +35,7 @@
35#include <linux/signal.h> 35#include <linux/signal.h>
36#include <linux/elf.h> 36#include <linux/elf.h>
37#include <linux/regset.h> 37#include <linux/regset.h>
38#include <linux/tracehook.h>
38 39
39#include <asm/segment.h> 40#include <asm/segment.h>
40#include <asm/page.h> 41#include <asm/page.h>
@@ -639,40 +640,44 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
639} 640}
640#endif 641#endif
641 642
642asmlinkage void 643asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
643syscall_trace(struct pt_regs *regs, int entryexit)
644{ 644{
645 if (unlikely(current->audit_context) && entryexit) 645 long ret;
646 audit_syscall_exit(AUDITSC_RESULT(regs->gprs[2]), regs->gprs[2]);
647
648 if (!test_thread_flag(TIF_SYSCALL_TRACE))
649 goto out;
650 if (!(current->ptrace & PT_PTRACED))
651 goto out;
652 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
653 ? 0x80 : 0));
654 646
655 /* 647 /*
656 * If the debuffer has set an invalid system call number, 648 * The sysc_tracesys code in entry.S stored the system
657 * we prepare to skip the system call restart handling. 649 * call number to gprs[2].
658 */ 650 */
659 if (!entryexit && regs->gprs[2] >= NR_syscalls) 651 ret = regs->gprs[2];
652 if (test_thread_flag(TIF_SYSCALL_TRACE) &&
653 (tracehook_report_syscall_entry(regs) ||
654 regs->gprs[2] >= NR_syscalls)) {
655 /*
656 * Tracing decided this syscall should not happen or the
657 * debugger stored an invalid system call number. Skip
658 * the system call and the system call restart handling.
659 */
660 regs->trap = -1; 660 regs->trap = -1;
661 661 ret = -1;
662 /*
663 * this isn't the same as continuing with a signal, but it will do
664 * for normal use. strace only continues with a signal if the
665 * stopping signal is not SIGTRAP. -brl
666 */
667 if (current->exit_code) {
668 send_sig(current->exit_code, current, 1);
669 current->exit_code = 0;
670 } 662 }
671 out: 663
672 if (unlikely(current->audit_context) && !entryexit) 664 if (unlikely(current->audit_context))
673 audit_syscall_entry(test_thread_flag(TIF_31BIT)?AUDIT_ARCH_S390:AUDIT_ARCH_S390X, 665 audit_syscall_entry(test_thread_flag(TIF_31BIT) ?
674 regs->gprs[2], regs->orig_gpr2, regs->gprs[3], 666 AUDIT_ARCH_S390 : AUDIT_ARCH_S390X,
675 regs->gprs[4], regs->gprs[5]); 667 regs->gprs[2], regs->orig_gpr2,
668 regs->gprs[3], regs->gprs[4],
669 regs->gprs[5]);
670 return ret;
671}
672
673asmlinkage void do_syscall_trace_exit(struct pt_regs *regs)
674{
675 if (unlikely(current->audit_context))
676 audit_syscall_exit(AUDITSC_RESULT(regs->gprs[2]),
677 regs->gprs[2]);
678
679 if (test_thread_flag(TIF_SYSCALL_TRACE))
680 tracehook_report_syscall_exit(regs, 0);
676} 681}
677 682
678/* 683/*
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index b97682040215..4f7fc3059a8e 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -24,6 +24,7 @@
24#include <linux/tty.h> 24#include <linux/tty.h>
25#include <linux/personality.h> 25#include <linux/personality.h>
26#include <linux/binfmts.h> 26#include <linux/binfmts.h>
27#include <linux/tracehook.h>
27#include <asm/ucontext.h> 28#include <asm/ucontext.h>
28#include <asm/uaccess.h> 29#include <asm/uaccess.h>
29#include <asm/lowcore.h> 30#include <asm/lowcore.h>
@@ -507,6 +508,12 @@ void do_signal(struct pt_regs *regs)
507 */ 508 */
508 if (current->thread.per_info.single_step) 509 if (current->thread.per_info.single_step)
509 set_thread_flag(TIF_SINGLE_STEP); 510 set_thread_flag(TIF_SINGLE_STEP);
511
512 /*
513 * Let tracing know that we've done the handler setup.
514 */
515 tracehook_signal_handler(signr, &info, &ka, regs,
516 test_thread_flag(TIF_SINGLE_STEP));
510 } 517 }
511 return; 518 return;
512 } 519 }
@@ -526,3 +533,9 @@ void do_signal(struct pt_regs *regs)
526 set_thread_flag(TIF_RESTART_SVC); 533 set_thread_flag(TIF_RESTART_SVC);
527 } 534 }
528} 535}
536
537void do_notify_resume(struct pt_regs *regs)
538{
539 clear_thread_flag(TIF_NOTIFY_RESUME);
540 tracehook_notify_resume(regs);
541}
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index c66d35e55142..3ae303914b42 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -37,7 +37,7 @@ SYSCALL(sys_stime,sys_ni_syscall,sys32_stime_wrapper) /* 25 old stime syscall *
37SYSCALL(sys_ptrace,sys_ptrace,sys32_ptrace_wrapper) 37SYSCALL(sys_ptrace,sys_ptrace,sys32_ptrace_wrapper)
38SYSCALL(sys_alarm,sys_alarm,sys32_alarm_wrapper) 38SYSCALL(sys_alarm,sys_alarm,sys32_alarm_wrapper)
39NI_SYSCALL /* old fstat syscall */ 39NI_SYSCALL /* old fstat syscall */
40SYSCALL(sys_pause,sys_pause,sys32_pause) 40SYSCALL(sys_pause,sys_pause,sys_pause)
41SYSCALL(sys_utime,sys_utime,compat_sys_utime_wrapper) /* 30 */ 41SYSCALL(sys_utime,sys_utime,compat_sys_utime_wrapper) /* 30 */
42NI_SYSCALL /* old stty syscall */ 42NI_SYSCALL /* old stty syscall */
43NI_SYSCALL /* old gtty syscall */ 43NI_SYSCALL /* old gtty syscall */
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 06acb1a18bbc..b94e9e3b694a 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -1356,7 +1356,7 @@ static void __init stp_reset(void)
1356 1356
1357 stp_page = alloc_bootmem_pages(PAGE_SIZE); 1357 stp_page = alloc_bootmem_pages(PAGE_SIZE);
1358 rc = chsc_sstpc(stp_page, STP_OP_CTRL, 0x0000); 1358 rc = chsc_sstpc(stp_page, STP_OP_CTRL, 0x0000);
1359 if (rc == 1) 1359 if (rc == 0)
1360 set_bit(CLOCK_SYNC_HAS_STP, &clock_sync_flags); 1360 set_bit(CLOCK_SYNC_HAS_STP, &clock_sync_flags);
1361 else if (stp_online) { 1361 else if (stp_online) {
1362 printk(KERN_WARNING "Running on non STP capable machine.\n"); 1362 printk(KERN_WARNING "Running on non STP capable machine.\n");
diff --git a/arch/s390/lib/delay.c b/arch/s390/lib/delay.c
index 0953cee05efc..6ccb9fab055a 100644
--- a/arch/s390/lib/delay.c
+++ b/arch/s390/lib/delay.c
@@ -92,3 +92,16 @@ out:
92 local_irq_restore(flags); 92 local_irq_restore(flags);
93 preempt_enable(); 93 preempt_enable();
94} 94}
95
96/*
97 * Simple udelay variant. To be used on startup and reboot
98 * when the interrupt handler isn't working.
99 */
100void udelay_simple(unsigned long usecs)
101{
102 u64 end;
103
104 end = get_clock() + ((u64) usecs << 12);
105 while (get_clock() < end)
106 cpu_relax();
107}
diff --git a/arch/s390/mm/extmem.c b/arch/s390/mm/extmem.c
index f231f5ec74b6..580fc64cc735 100644
--- a/arch/s390/mm/extmem.c
+++ b/arch/s390/mm/extmem.c
@@ -43,20 +43,40 @@
43#define DCSS_FINDSEG 0x0c 43#define DCSS_FINDSEG 0x0c
44#define DCSS_LOADNOLY 0x10 44#define DCSS_LOADNOLY 0x10
45#define DCSS_SEGEXT 0x18 45#define DCSS_SEGEXT 0x18
46#define DCSS_LOADSHRX 0x20
47#define DCSS_LOADNSRX 0x24
48#define DCSS_FINDSEGX 0x2c
49#define DCSS_SEGEXTX 0x38
46#define DCSS_FINDSEGA 0x0c 50#define DCSS_FINDSEGA 0x0c
47 51
48struct qrange { 52struct qrange {
49 unsigned int start; // 3byte start address, 1 byte type 53 unsigned long start; /* last byte type */
50 unsigned int end; // 3byte end address, 1 byte reserved 54 unsigned long end; /* last byte reserved */
51}; 55};
52 56
53struct qout64 { 57struct qout64 {
58 unsigned long segstart;
59 unsigned long segend;
60 int segcnt;
61 int segrcnt;
62 struct qrange range[6];
63};
64
65#ifdef CONFIG_64BIT
66struct qrange_old {
67 unsigned int start; /* last byte type */
68 unsigned int end; /* last byte reserved */
69};
70
71/* output area format for the Diag x'64' old subcode x'18' */
72struct qout64_old {
54 int segstart; 73 int segstart;
55 int segend; 74 int segend;
56 int segcnt; 75 int segcnt;
57 int segrcnt; 76 int segrcnt;
58 struct qrange range[6]; 77 struct qrange_old range[6];
59}; 78};
79#endif
60 80
61struct qin64 { 81struct qin64 {
62 char qopcode; 82 char qopcode;
@@ -86,6 +106,55 @@ static DEFINE_MUTEX(dcss_lock);
86static LIST_HEAD(dcss_list); 106static LIST_HEAD(dcss_list);
87static char *segtype_string[] = { "SW", "EW", "SR", "ER", "SN", "EN", "SC", 107static char *segtype_string[] = { "SW", "EW", "SR", "ER", "SN", "EN", "SC",
88 "EW/EN-MIXED" }; 108 "EW/EN-MIXED" };
109static int loadshr_scode, loadnsr_scode, findseg_scode;
110static int segext_scode, purgeseg_scode;
111static int scode_set;
112
113/* set correct Diag x'64' subcodes. */
114static int
115dcss_set_subcodes(void)
116{
117#ifdef CONFIG_64BIT
118 char *name = kmalloc(8 * sizeof(char), GFP_DMA);
119 unsigned long rx, ry;
120 int rc;
121
122 if (name == NULL)
123 return -ENOMEM;
124
125 rx = (unsigned long) name;
126 ry = DCSS_FINDSEGX;
127
128 strcpy(name, "dummy");
129 asm volatile(
130 " diag %0,%1,0x64\n"
131 "0: ipm %2\n"
132 " srl %2,28\n"
133 " j 2f\n"
134 "1: la %2,3\n"
135 "2:\n"
136 EX_TABLE(0b, 1b)
137 : "+d" (rx), "+d" (ry), "=d" (rc) : : "cc");
138
139 kfree(name);
140 /* Diag x'64' new subcodes are supported, set to new subcodes */
141 if (rc != 3) {
142 loadshr_scode = DCSS_LOADSHRX;
143 loadnsr_scode = DCSS_LOADNSRX;
144 purgeseg_scode = DCSS_PURGESEG;
145 findseg_scode = DCSS_FINDSEGX;
146 segext_scode = DCSS_SEGEXTX;
147 return 0;
148 }
149#endif
150 /* Diag x'64' new subcodes are not supported, set to old subcodes */
151 loadshr_scode = DCSS_LOADNOLY;
152 loadnsr_scode = DCSS_LOADNSR;
153 purgeseg_scode = DCSS_PURGESEG;
154 findseg_scode = DCSS_FINDSEG;
155 segext_scode = DCSS_SEGEXT;
156 return 0;
157}
89 158
90/* 159/*
91 * Create the 8 bytes, ebcdic VM segment name from 160 * Create the 8 bytes, ebcdic VM segment name from
@@ -135,25 +204,45 @@ segment_by_name (char *name)
135 * Perform a function on a dcss segment. 204 * Perform a function on a dcss segment.
136 */ 205 */
137static inline int 206static inline int
138dcss_diag (__u8 func, void *parameter, 207dcss_diag(int *func, void *parameter,
139 unsigned long *ret1, unsigned long *ret2) 208 unsigned long *ret1, unsigned long *ret2)
140{ 209{
141 unsigned long rx, ry; 210 unsigned long rx, ry;
142 int rc; 211 int rc;
143 212
213 if (scode_set == 0) {
214 rc = dcss_set_subcodes();
215 if (rc < 0)
216 return rc;
217 scode_set = 1;
218 }
144 rx = (unsigned long) parameter; 219 rx = (unsigned long) parameter;
145 ry = (unsigned long) func; 220 ry = (unsigned long) *func;
146 asm volatile( 221
147#ifdef CONFIG_64BIT 222#ifdef CONFIG_64BIT
148 " sam31\n" 223 /* 64-bit Diag x'64' new subcode, keep in 64-bit addressing mode */
149 " diag %0,%1,0x64\n" 224 if (*func > DCSS_SEGEXT)
150 " sam64\n" 225 asm volatile(
226 " diag %0,%1,0x64\n"
227 " ipm %2\n"
228 " srl %2,28\n"
229 : "+d" (rx), "+d" (ry), "=d" (rc) : : "cc");
230 /* 31-bit Diag x'64' old subcode, switch to 31-bit addressing mode */
231 else
232 asm volatile(
233 " sam31\n"
234 " diag %0,%1,0x64\n"
235 " sam64\n"
236 " ipm %2\n"
237 " srl %2,28\n"
238 : "+d" (rx), "+d" (ry), "=d" (rc) : : "cc");
151#else 239#else
240 asm volatile(
152 " diag %0,%1,0x64\n" 241 " diag %0,%1,0x64\n"
153#endif
154 " ipm %2\n" 242 " ipm %2\n"
155 " srl %2,28\n" 243 " srl %2,28\n"
156 : "+d" (rx), "+d" (ry), "=d" (rc) : : "cc"); 244 : "+d" (rx), "+d" (ry), "=d" (rc) : : "cc");
245#endif
157 *ret1 = rx; 246 *ret1 = rx;
158 *ret2 = ry; 247 *ret2 = ry;
159 return rc; 248 return rc;
@@ -190,14 +279,45 @@ query_segment_type (struct dcss_segment *seg)
190 qin->qoutlen = sizeof(struct qout64); 279 qin->qoutlen = sizeof(struct qout64);
191 memcpy (qin->qname, seg->dcss_name, 8); 280 memcpy (qin->qname, seg->dcss_name, 8);
192 281
193 diag_cc = dcss_diag (DCSS_SEGEXT, qin, &dummy, &vmrc); 282 diag_cc = dcss_diag(&segext_scode, qin, &dummy, &vmrc);
194 283
284 if (diag_cc < 0) {
285 rc = diag_cc;
286 goto out_free;
287 }
195 if (diag_cc > 1) { 288 if (diag_cc > 1) {
196 PRINT_WARN ("segment_type: diag returned error %ld\n", vmrc); 289 PRINT_WARN ("segment_type: diag returned error %ld\n", vmrc);
197 rc = dcss_diag_translate_rc (vmrc); 290 rc = dcss_diag_translate_rc (vmrc);
198 goto out_free; 291 goto out_free;
199 } 292 }
200 293
294#ifdef CONFIG_64BIT
295 /* Only old format of output area of Diagnose x'64' is supported,
296 copy data for the new format. */
297 if (segext_scode == DCSS_SEGEXT) {
298 struct qout64_old *qout_old;
299 qout_old = kzalloc(sizeof(struct qout64_old), GFP_DMA);
300 if (qout_old == NULL) {
301 rc = -ENOMEM;
302 goto out_free;
303 }
304 memcpy(qout_old, qout, sizeof(struct qout64_old));
305 qout->segstart = (unsigned long) qout_old->segstart;
306 qout->segend = (unsigned long) qout_old->segend;
307 qout->segcnt = qout_old->segcnt;
308 qout->segrcnt = qout_old->segrcnt;
309
310 if (qout->segcnt > 6)
311 qout->segrcnt = 6;
312 for (i = 0; i < qout->segrcnt; i++) {
313 qout->range[i].start =
314 (unsigned long) qout_old->range[i].start;
315 qout->range[i].end =
316 (unsigned long) qout_old->range[i].end;
317 }
318 kfree(qout_old);
319 }
320#endif
201 if (qout->segcnt > 6) { 321 if (qout->segcnt > 6) {
202 rc = -ENOTSUPP; 322 rc = -ENOTSUPP;
203 goto out_free; 323 goto out_free;
@@ -269,6 +389,30 @@ segment_type (char* name)
269} 389}
270 390
271/* 391/*
392 * check if segment collides with other segments that are currently loaded
393 * returns 1 if this is the case, 0 if no collision was found
394 */
395static int
396segment_overlaps_others (struct dcss_segment *seg)
397{
398 struct list_head *l;
399 struct dcss_segment *tmp;
400
401 BUG_ON(!mutex_is_locked(&dcss_lock));
402 list_for_each(l, &dcss_list) {
403 tmp = list_entry(l, struct dcss_segment, list);
404 if ((tmp->start_addr >> 20) > (seg->end >> 20))
405 continue;
406 if ((tmp->end >> 20) < (seg->start_addr >> 20))
407 continue;
408 if (seg == tmp)
409 continue;
410 return 1;
411 }
412 return 0;
413}
414
415/*
272 * real segment loading function, called from segment_load 416 * real segment loading function, called from segment_load
273 */ 417 */
274static int 418static int
@@ -276,7 +420,8 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long
276{ 420{
277 struct dcss_segment *seg = kmalloc(sizeof(struct dcss_segment), 421 struct dcss_segment *seg = kmalloc(sizeof(struct dcss_segment),
278 GFP_DMA); 422 GFP_DMA);
279 int dcss_command, rc, diag_cc; 423 int rc, diag_cc;
424 unsigned long start_addr, end_addr, dummy;
280 425
281 if (seg == NULL) { 426 if (seg == NULL) {
282 rc = -ENOMEM; 427 rc = -ENOMEM;
@@ -287,6 +432,13 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long
287 if (rc < 0) 432 if (rc < 0)
288 goto out_free; 433 goto out_free;
289 434
435 if (loadshr_scode == DCSS_LOADSHRX) {
436 if (segment_overlaps_others(seg)) {
437 rc = -EBUSY;
438 goto out_free;
439 }
440 }
441
290 rc = vmem_add_mapping(seg->start_addr, seg->end - seg->start_addr + 1); 442 rc = vmem_add_mapping(seg->start_addr, seg->end - seg->start_addr + 1);
291 443
292 if (rc) 444 if (rc)
@@ -316,20 +468,28 @@ __segment_load (char *name, int do_nonshared, unsigned long *addr, unsigned long
316 } 468 }
317 469
318 if (do_nonshared) 470 if (do_nonshared)
319 dcss_command = DCSS_LOADNSR; 471 diag_cc = dcss_diag(&loadnsr_scode, seg->dcss_name,
472 &start_addr, &end_addr);
320 else 473 else
321 dcss_command = DCSS_LOADNOLY; 474 diag_cc = dcss_diag(&loadshr_scode, seg->dcss_name,
322 475 &start_addr, &end_addr);
323 diag_cc = dcss_diag(dcss_command, seg->dcss_name, 476 if (diag_cc < 0) {
324 &seg->start_addr, &seg->end); 477 dcss_diag(&purgeseg_scode, seg->dcss_name,
478 &dummy, &dummy);
479 rc = diag_cc;
480 goto out_resource;
481 }
325 if (diag_cc > 1) { 482 if (diag_cc > 1) {
326 PRINT_WARN ("segment_load: could not load segment %s - " 483 PRINT_WARN ("segment_load: could not load segment %s - "
327 "diag returned error (%ld)\n",name,seg->end); 484 "diag returned error (%ld)\n",
328 rc = dcss_diag_translate_rc (seg->end); 485 name, end_addr);
329 dcss_diag(DCSS_PURGESEG, seg->dcss_name, 486 rc = dcss_diag_translate_rc(end_addr);
330 &seg->start_addr, &seg->end); 487 dcss_diag(&purgeseg_scode, seg->dcss_name,
488 &dummy, &dummy);
331 goto out_resource; 489 goto out_resource;
332 } 490 }
491 seg->start_addr = start_addr;
492 seg->end = end_addr;
333 seg->do_nonshared = do_nonshared; 493 seg->do_nonshared = do_nonshared;
334 atomic_set(&seg->ref_count, 1); 494 atomic_set(&seg->ref_count, 1);
335 list_add(&seg->list, &dcss_list); 495 list_add(&seg->list, &dcss_list);
@@ -423,8 +583,8 @@ int
423segment_modify_shared (char *name, int do_nonshared) 583segment_modify_shared (char *name, int do_nonshared)
424{ 584{
425 struct dcss_segment *seg; 585 struct dcss_segment *seg;
426 unsigned long dummy; 586 unsigned long start_addr, end_addr, dummy;
427 int dcss_command, rc, diag_cc; 587 int rc, diag_cc;
428 588
429 mutex_lock(&dcss_lock); 589 mutex_lock(&dcss_lock);
430 seg = segment_by_name (name); 590 seg = segment_by_name (name);
@@ -445,38 +605,51 @@ segment_modify_shared (char *name, int do_nonshared)
445 goto out_unlock; 605 goto out_unlock;
446 } 606 }
447 release_resource(seg->res); 607 release_resource(seg->res);
448 if (do_nonshared) { 608 if (do_nonshared)
449 dcss_command = DCSS_LOADNSR;
450 seg->res->flags &= ~IORESOURCE_READONLY; 609 seg->res->flags &= ~IORESOURCE_READONLY;
451 } else { 610 else
452 dcss_command = DCSS_LOADNOLY;
453 if (seg->vm_segtype == SEG_TYPE_SR || 611 if (seg->vm_segtype == SEG_TYPE_SR ||
454 seg->vm_segtype == SEG_TYPE_ER) 612 seg->vm_segtype == SEG_TYPE_ER)
455 seg->res->flags |= IORESOURCE_READONLY; 613 seg->res->flags |= IORESOURCE_READONLY;
456 } 614
457 if (request_resource(&iomem_resource, seg->res)) { 615 if (request_resource(&iomem_resource, seg->res)) {
458 PRINT_WARN("segment_modify_shared: could not reload segment %s" 616 PRINT_WARN("segment_modify_shared: could not reload segment %s"
459 " - overlapping resources\n", name); 617 " - overlapping resources\n", name);
460 rc = -EBUSY; 618 rc = -EBUSY;
461 kfree(seg->res); 619 kfree(seg->res);
462 goto out_del; 620 goto out_del_mem;
621 }
622
623 dcss_diag(&purgeseg_scode, seg->dcss_name, &dummy, &dummy);
624 if (do_nonshared)
625 diag_cc = dcss_diag(&loadnsr_scode, seg->dcss_name,
626 &start_addr, &end_addr);
627 else
628 diag_cc = dcss_diag(&loadshr_scode, seg->dcss_name,
629 &start_addr, &end_addr);
630 if (diag_cc < 0) {
631 rc = diag_cc;
632 goto out_del_res;
463 } 633 }
464 dcss_diag(DCSS_PURGESEG, seg->dcss_name, &dummy, &dummy);
465 diag_cc = dcss_diag(dcss_command, seg->dcss_name,
466 &seg->start_addr, &seg->end);
467 if (diag_cc > 1) { 634 if (diag_cc > 1) {
468 PRINT_WARN ("segment_modify_shared: could not reload segment %s" 635 PRINT_WARN ("segment_modify_shared: could not reload segment %s"
469 " - diag returned error (%ld)\n",name,seg->end); 636 " - diag returned error (%ld)\n",
470 rc = dcss_diag_translate_rc (seg->end); 637 name, end_addr);
471 goto out_del; 638 rc = dcss_diag_translate_rc(end_addr);
639 goto out_del_res;
472 } 640 }
641 seg->start_addr = start_addr;
642 seg->end = end_addr;
473 seg->do_nonshared = do_nonshared; 643 seg->do_nonshared = do_nonshared;
474 rc = 0; 644 rc = 0;
475 goto out_unlock; 645 goto out_unlock;
476 out_del: 646 out_del_res:
647 release_resource(seg->res);
648 kfree(seg->res);
649 out_del_mem:
477 vmem_remove_mapping(seg->start_addr, seg->end - seg->start_addr + 1); 650 vmem_remove_mapping(seg->start_addr, seg->end - seg->start_addr + 1);
478 list_del(&seg->list); 651 list_del(&seg->list);
479 dcss_diag(DCSS_PURGESEG, seg->dcss_name, &dummy, &dummy); 652 dcss_diag(&purgeseg_scode, seg->dcss_name, &dummy, &dummy);
480 kfree(seg); 653 kfree(seg);
481 out_unlock: 654 out_unlock:
482 mutex_unlock(&dcss_lock); 655 mutex_unlock(&dcss_lock);
@@ -510,7 +683,7 @@ segment_unload(char *name)
510 kfree(seg->res); 683 kfree(seg->res);
511 vmem_remove_mapping(seg->start_addr, seg->end - seg->start_addr + 1); 684 vmem_remove_mapping(seg->start_addr, seg->end - seg->start_addr + 1);
512 list_del(&seg->list); 685 list_del(&seg->list);
513 dcss_diag(DCSS_PURGESEG, seg->dcss_name, &dummy, &dummy); 686 dcss_diag(&purgeseg_scode, seg->dcss_name, &dummy, &dummy);
514 kfree(seg); 687 kfree(seg);
515out_unlock: 688out_unlock:
516 mutex_unlock(&dcss_lock); 689 mutex_unlock(&dcss_lock);
@@ -545,7 +718,7 @@ segment_save(char *name)
545 endpfn = (seg->end) >> PAGE_SHIFT; 718 endpfn = (seg->end) >> PAGE_SHIFT;
546 sprintf(cmd1, "DEFSEG %s", name); 719 sprintf(cmd1, "DEFSEG %s", name);
547 for (i=0; i<seg->segcnt; i++) { 720 for (i=0; i<seg->segcnt; i++) {
548 sprintf(cmd1+strlen(cmd1), " %X-%X %s", 721 sprintf(cmd1+strlen(cmd1), " %lX-%lX %s",
549 seg->range[i].start >> PAGE_SHIFT, 722 seg->range[i].start >> PAGE_SHIFT,
550 seg->range[i].end >> PAGE_SHIFT, 723 seg->range[i].end >> PAGE_SHIFT,
551 segtype_string[seg->range[i].start & 0xff]); 724 segtype_string[seg->range[i].start & 0xff]);
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index acb78017e7d0..0a225ccda026 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -215,7 +215,7 @@ static int dasd_state_known_to_basic(struct dasd_device *device)
215 return rc; 215 return rc;
216 } 216 }
217 /* register 'device' debug area, used for all DBF_DEV_XXX calls */ 217 /* register 'device' debug area, used for all DBF_DEV_XXX calls */
218 device->debug_area = debug_register(device->cdev->dev.bus_id, 1, 1, 218 device->debug_area = debug_register(dev_name(&device->cdev->dev), 1, 1,
219 8 * sizeof(long)); 219 8 * sizeof(long));
220 debug_register_view(device->debug_area, &debug_sprintf_view); 220 debug_register_view(device->debug_area, &debug_sprintf_view);
221 debug_set_level(device->debug_area, DBF_WARNING); 221 debug_set_level(device->debug_area, DBF_WARNING);
@@ -933,7 +933,7 @@ static void dasd_handle_killed_request(struct ccw_device *cdev,
933 MESSAGE(KERN_DEBUG, 933 MESSAGE(KERN_DEBUG,
934 "invalid status in handle_killed_request: " 934 "invalid status in handle_killed_request: "
935 "bus_id %s, status %02x", 935 "bus_id %s, status %02x",
936 cdev->dev.bus_id, cqr->status); 936 dev_name(&cdev->dev), cqr->status);
937 return; 937 return;
938 } 938 }
939 939
@@ -942,7 +942,7 @@ static void dasd_handle_killed_request(struct ccw_device *cdev,
942 device != dasd_device_from_cdev_locked(cdev) || 942 device != dasd_device_from_cdev_locked(cdev) ||
943 strncmp(device->discipline->ebcname, (char *) &cqr->magic, 4)) { 943 strncmp(device->discipline->ebcname, (char *) &cqr->magic, 4)) {
944 MESSAGE(KERN_DEBUG, "invalid device in request: bus_id %s", 944 MESSAGE(KERN_DEBUG, "invalid device in request: bus_id %s",
945 cdev->dev.bus_id); 945 dev_name(&cdev->dev));
946 return; 946 return;
947 } 947 }
948 948
@@ -982,11 +982,11 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned long intparm,
982 break; 982 break;
983 case -ETIMEDOUT: 983 case -ETIMEDOUT:
984 printk(KERN_WARNING"%s(%s): request timed out\n", 984 printk(KERN_WARNING"%s(%s): request timed out\n",
985 __func__, cdev->dev.bus_id); 985 __func__, dev_name(&cdev->dev));
986 break; 986 break;
987 default: 987 default:
988 printk(KERN_WARNING"%s(%s): unknown error %ld\n", 988 printk(KERN_WARNING"%s(%s): unknown error %ld\n",
989 __func__, cdev->dev.bus_id, PTR_ERR(irb)); 989 __func__, dev_name(&cdev->dev), PTR_ERR(irb));
990 } 990 }
991 dasd_handle_killed_request(cdev, intparm); 991 dasd_handle_killed_request(cdev, intparm);
992 return; 992 return;
@@ -995,7 +995,7 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned long intparm,
995 now = get_clock(); 995 now = get_clock();
996 996
997 DBF_EVENT(DBF_ERR, "Interrupt: bus_id %s CS/DS %04x ip %08x", 997 DBF_EVENT(DBF_ERR, "Interrupt: bus_id %s CS/DS %04x ip %08x",
998 cdev->dev.bus_id, ((irb->scsw.cmd.cstat << 8) | 998 dev_name(&cdev->dev), ((irb->scsw.cmd.cstat << 8) |
999 irb->scsw.cmd.dstat), (unsigned int) intparm); 999 irb->scsw.cmd.dstat), (unsigned int) intparm);
1000 1000
1001 /* check for unsolicited interrupts */ 1001 /* check for unsolicited interrupts */
@@ -1019,7 +1019,7 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned long intparm,
1019 if (!device || 1019 if (!device ||
1020 strncmp(device->discipline->ebcname, (char *) &cqr->magic, 4)) { 1020 strncmp(device->discipline->ebcname, (char *) &cqr->magic, 4)) {
1021 MESSAGE(KERN_DEBUG, "invalid device in request: bus_id %s", 1021 MESSAGE(KERN_DEBUG, "invalid device in request: bus_id %s",
1022 cdev->dev.bus_id); 1022 dev_name(&cdev->dev));
1023 return; 1023 return;
1024 } 1024 }
1025 1025
@@ -1037,7 +1037,7 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned long intparm,
1037 if (cqr->status != DASD_CQR_IN_IO) { 1037 if (cqr->status != DASD_CQR_IN_IO) {
1038 MESSAGE(KERN_DEBUG, 1038 MESSAGE(KERN_DEBUG,
1039 "invalid status: bus_id %s, status %02x", 1039 "invalid status: bus_id %s, status %02x",
1040 cdev->dev.bus_id, cqr->status); 1040 dev_name(&cdev->dev), cqr->status);
1041 return; 1041 return;
1042 } 1042 }
1043 DBF_DEV_EVENT(DBF_DEBUG, device, "Int: CS/DS 0x%04x for cqr %p", 1043 DBF_DEV_EVENT(DBF_DEBUG, device, "Int: CS/DS 0x%04x for cqr %p",
@@ -2134,14 +2134,14 @@ int dasd_generic_probe(struct ccw_device *cdev,
2134 if (ret) { 2134 if (ret) {
2135 printk(KERN_WARNING 2135 printk(KERN_WARNING
2136 "dasd_generic_probe: could not set ccw-device options " 2136 "dasd_generic_probe: could not set ccw-device options "
2137 "for %s\n", cdev->dev.bus_id); 2137 "for %s\n", dev_name(&cdev->dev));
2138 return ret; 2138 return ret;
2139 } 2139 }
2140 ret = dasd_add_sysfs_files(cdev); 2140 ret = dasd_add_sysfs_files(cdev);
2141 if (ret) { 2141 if (ret) {
2142 printk(KERN_WARNING 2142 printk(KERN_WARNING
2143 "dasd_generic_probe: could not add sysfs entries " 2143 "dasd_generic_probe: could not add sysfs entries "
2144 "for %s\n", cdev->dev.bus_id); 2144 "for %s\n", dev_name(&cdev->dev));
2145 return ret; 2145 return ret;
2146 } 2146 }
2147 cdev->handler = &dasd_int_handler; 2147 cdev->handler = &dasd_int_handler;
@@ -2152,13 +2152,13 @@ int dasd_generic_probe(struct ccw_device *cdev,
2152 * initial probe. 2152 * initial probe.
2153 */ 2153 */
2154 if ((dasd_get_feature(cdev, DASD_FEATURE_INITIAL_ONLINE) > 0 ) || 2154 if ((dasd_get_feature(cdev, DASD_FEATURE_INITIAL_ONLINE) > 0 ) ||
2155 (dasd_autodetect && dasd_busid_known(cdev->dev.bus_id) != 0)) 2155 (dasd_autodetect && dasd_busid_known(dev_name(&cdev->dev)) != 0))
2156 ret = ccw_device_set_online(cdev); 2156 ret = ccw_device_set_online(cdev);
2157 if (ret) 2157 if (ret)
2158 printk(KERN_WARNING 2158 printk(KERN_WARNING
2159 "dasd_generic_probe: could not initially " 2159 "dasd_generic_probe: could not initially "
2160 "online ccw-device %s; return code: %d\n", 2160 "online ccw-device %s; return code: %d\n",
2161 cdev->dev.bus_id, ret); 2161 dev_name(&cdev->dev), ret);
2162 return 0; 2162 return 0;
2163} 2163}
2164 2164
@@ -2224,7 +2224,7 @@ int dasd_generic_set_online(struct ccw_device *cdev,
2224 printk (KERN_WARNING 2224 printk (KERN_WARNING
2225 "dasd_generic couldn't online device %s " 2225 "dasd_generic couldn't online device %s "
2226 "- discipline DIAG not available\n", 2226 "- discipline DIAG not available\n",
2227 cdev->dev.bus_id); 2227 dev_name(&cdev->dev));
2228 dasd_delete_device(device); 2228 dasd_delete_device(device);
2229 return -ENODEV; 2229 return -ENODEV;
2230 } 2230 }
@@ -2248,7 +2248,7 @@ int dasd_generic_set_online(struct ccw_device *cdev,
2248 printk (KERN_WARNING 2248 printk (KERN_WARNING
2249 "dasd_generic couldn't online device %s " 2249 "dasd_generic couldn't online device %s "
2250 "with discipline %s rc=%i\n", 2250 "with discipline %s rc=%i\n",
2251 cdev->dev.bus_id, discipline->name, rc); 2251 dev_name(&cdev->dev), discipline->name, rc);
2252 module_put(discipline->owner); 2252 module_put(discipline->owner);
2253 module_put(base_discipline->owner); 2253 module_put(base_discipline->owner);
2254 dasd_delete_device(device); 2254 dasd_delete_device(device);
@@ -2259,7 +2259,7 @@ int dasd_generic_set_online(struct ccw_device *cdev,
2259 if (device->state <= DASD_STATE_KNOWN) { 2259 if (device->state <= DASD_STATE_KNOWN) {
2260 printk (KERN_WARNING 2260 printk (KERN_WARNING
2261 "dasd_generic discipline not found for %s\n", 2261 "dasd_generic discipline not found for %s\n",
2262 cdev->dev.bus_id); 2262 dev_name(&cdev->dev));
2263 rc = -ENODEV; 2263 rc = -ENODEV;
2264 dasd_set_target_state(device, DASD_STATE_NEW); 2264 dasd_set_target_state(device, DASD_STATE_NEW);
2265 if (device->block) 2265 if (device->block)
@@ -2267,7 +2267,7 @@ int dasd_generic_set_online(struct ccw_device *cdev,
2267 dasd_delete_device(device); 2267 dasd_delete_device(device);
2268 } else 2268 } else
2269 pr_debug("dasd_generic device %s found\n", 2269 pr_debug("dasd_generic device %s found\n",
2270 cdev->dev.bus_id); 2270 dev_name(&cdev->dev));
2271 2271
2272 /* FIXME: we have to wait for the root device but we don't want 2272 /* FIXME: we have to wait for the root device but we don't want
2273 * to wait for each single device but for all at once. */ 2273 * to wait for each single device but for all at once. */
diff --git a/drivers/s390/block/dasd_3990_erp.c b/drivers/s390/block/dasd_3990_erp.c
index 5c6e6f331cb0..b8f9c00633f3 100644
--- a/drivers/s390/block/dasd_3990_erp.c
+++ b/drivers/s390/block/dasd_3990_erp.c
@@ -1397,7 +1397,7 @@ static struct dasd_ccw_req *dasd_3990_erp_inspect_alias(
1397 DEV_MESSAGE(KERN_ERR, cqr->startdev, 1397 DEV_MESSAGE(KERN_ERR, cqr->startdev,
1398 "ERP on alias device for request %p," 1398 "ERP on alias device for request %p,"
1399 " recover on base device %s", cqr, 1399 " recover on base device %s", cqr,
1400 cqr->block->base->cdev->dev.bus_id); 1400 dev_name(&cqr->block->base->cdev->dev));
1401 } 1401 }
1402 dasd_eckd_reset_ccw_to_base_io(cqr); 1402 dasd_eckd_reset_ccw_to_base_io(cqr);
1403 erp->startdev = cqr->block->base; 1403 erp->startdev = cqr->block->base;
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c
index cd3335c1c307..921443b01d16 100644
--- a/drivers/s390/block/dasd_devmap.c
+++ b/drivers/s390/block/dasd_devmap.c
@@ -515,9 +515,9 @@ dasd_devmap_from_cdev(struct ccw_device *cdev)
515{ 515{
516 struct dasd_devmap *devmap; 516 struct dasd_devmap *devmap;
517 517
518 devmap = dasd_find_busid(cdev->dev.bus_id); 518 devmap = dasd_find_busid(dev_name(&cdev->dev));
519 if (IS_ERR(devmap)) 519 if (IS_ERR(devmap))
520 devmap = dasd_add_busid(cdev->dev.bus_id, 520 devmap = dasd_add_busid(dev_name(&cdev->dev),
521 DASD_FEATURE_DEFAULT); 521 DASD_FEATURE_DEFAULT);
522 return devmap; 522 return devmap;
523} 523}
@@ -584,7 +584,7 @@ dasd_delete_device(struct dasd_device *device)
584 unsigned long flags; 584 unsigned long flags;
585 585
586 /* First remove device pointer from devmap. */ 586 /* First remove device pointer from devmap. */
587 devmap = dasd_find_busid(device->cdev->dev.bus_id); 587 devmap = dasd_find_busid(dev_name(&device->cdev->dev));
588 BUG_ON(IS_ERR(devmap)); 588 BUG_ON(IS_ERR(devmap));
589 spin_lock(&dasd_devmap_lock); 589 spin_lock(&dasd_devmap_lock);
590 if (devmap->device != device) { 590 if (devmap->device != device) {
@@ -674,7 +674,7 @@ dasd_ro_show(struct device *dev, struct device_attribute *attr, char *buf)
674 struct dasd_devmap *devmap; 674 struct dasd_devmap *devmap;
675 int ro_flag; 675 int ro_flag;
676 676
677 devmap = dasd_find_busid(dev->bus_id); 677 devmap = dasd_find_busid(dev_name(dev));
678 if (!IS_ERR(devmap)) 678 if (!IS_ERR(devmap))
679 ro_flag = (devmap->features & DASD_FEATURE_READONLY) != 0; 679 ro_flag = (devmap->features & DASD_FEATURE_READONLY) != 0;
680 else 680 else
@@ -723,7 +723,7 @@ dasd_erplog_show(struct device *dev, struct device_attribute *attr, char *buf)
723 struct dasd_devmap *devmap; 723 struct dasd_devmap *devmap;
724 int erplog; 724 int erplog;
725 725
726 devmap = dasd_find_busid(dev->bus_id); 726 devmap = dasd_find_busid(dev_name(dev));
727 if (!IS_ERR(devmap)) 727 if (!IS_ERR(devmap))
728 erplog = (devmap->features & DASD_FEATURE_ERPLOG) != 0; 728 erplog = (devmap->features & DASD_FEATURE_ERPLOG) != 0;
729 else 729 else
@@ -770,7 +770,7 @@ dasd_use_diag_show(struct device *dev, struct device_attribute *attr, char *buf)
770 struct dasd_devmap *devmap; 770 struct dasd_devmap *devmap;
771 int use_diag; 771 int use_diag;
772 772
773 devmap = dasd_find_busid(dev->bus_id); 773 devmap = dasd_find_busid(dev_name(dev));
774 if (!IS_ERR(devmap)) 774 if (!IS_ERR(devmap))
775 use_diag = (devmap->features & DASD_FEATURE_USEDIAG) != 0; 775 use_diag = (devmap->features & DASD_FEATURE_USEDIAG) != 0;
776 else 776 else
@@ -876,7 +876,7 @@ dasd_alias_show(struct device *dev, struct device_attribute *attr, char *buf)
876 struct dasd_devmap *devmap; 876 struct dasd_devmap *devmap;
877 int alias; 877 int alias;
878 878
879 devmap = dasd_find_busid(dev->bus_id); 879 devmap = dasd_find_busid(dev_name(dev));
880 spin_lock(&dasd_devmap_lock); 880 spin_lock(&dasd_devmap_lock);
881 if (IS_ERR(devmap) || strlen(devmap->uid.vendor) == 0) { 881 if (IS_ERR(devmap) || strlen(devmap->uid.vendor) == 0) {
882 spin_unlock(&dasd_devmap_lock); 882 spin_unlock(&dasd_devmap_lock);
@@ -899,7 +899,7 @@ dasd_vendor_show(struct device *dev, struct device_attribute *attr, char *buf)
899 struct dasd_devmap *devmap; 899 struct dasd_devmap *devmap;
900 char *vendor; 900 char *vendor;
901 901
902 devmap = dasd_find_busid(dev->bus_id); 902 devmap = dasd_find_busid(dev_name(dev));
903 spin_lock(&dasd_devmap_lock); 903 spin_lock(&dasd_devmap_lock);
904 if (!IS_ERR(devmap) && strlen(devmap->uid.vendor) > 0) 904 if (!IS_ERR(devmap) && strlen(devmap->uid.vendor) > 0)
905 vendor = devmap->uid.vendor; 905 vendor = devmap->uid.vendor;
@@ -924,7 +924,7 @@ dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf)
924 char ua_string[3]; 924 char ua_string[3];
925 struct dasd_uid *uid; 925 struct dasd_uid *uid;
926 926
927 devmap = dasd_find_busid(dev->bus_id); 927 devmap = dasd_find_busid(dev_name(dev));
928 spin_lock(&dasd_devmap_lock); 928 spin_lock(&dasd_devmap_lock);
929 if (IS_ERR(devmap) || strlen(devmap->uid.vendor) == 0) { 929 if (IS_ERR(devmap) || strlen(devmap->uid.vendor) == 0) {
930 spin_unlock(&dasd_devmap_lock); 930 spin_unlock(&dasd_devmap_lock);
@@ -972,7 +972,7 @@ dasd_eer_show(struct device *dev, struct device_attribute *attr, char *buf)
972 struct dasd_devmap *devmap; 972 struct dasd_devmap *devmap;
973 int eer_flag; 973 int eer_flag;
974 974
975 devmap = dasd_find_busid(dev->bus_id); 975 devmap = dasd_find_busid(dev_name(dev));
976 if (!IS_ERR(devmap) && devmap->device) 976 if (!IS_ERR(devmap) && devmap->device)
977 eer_flag = dasd_eer_enabled(devmap->device); 977 eer_flag = dasd_eer_enabled(devmap->device);
978 else 978 else
@@ -1034,7 +1034,7 @@ dasd_get_uid(struct ccw_device *cdev, struct dasd_uid *uid)
1034{ 1034{
1035 struct dasd_devmap *devmap; 1035 struct dasd_devmap *devmap;
1036 1036
1037 devmap = dasd_find_busid(cdev->dev.bus_id); 1037 devmap = dasd_find_busid(dev_name(&cdev->dev));
1038 if (IS_ERR(devmap)) 1038 if (IS_ERR(devmap))
1039 return PTR_ERR(devmap); 1039 return PTR_ERR(devmap);
1040 spin_lock(&dasd_devmap_lock); 1040 spin_lock(&dasd_devmap_lock);
@@ -1057,7 +1057,7 @@ dasd_set_uid(struct ccw_device *cdev, struct dasd_uid *uid)
1057{ 1057{
1058 struct dasd_devmap *devmap; 1058 struct dasd_devmap *devmap;
1059 1059
1060 devmap = dasd_find_busid(cdev->dev.bus_id); 1060 devmap = dasd_find_busid(dev_name(&cdev->dev));
1061 if (IS_ERR(devmap)) 1061 if (IS_ERR(devmap))
1062 return PTR_ERR(devmap); 1062 return PTR_ERR(devmap);
1063 1063
@@ -1077,7 +1077,7 @@ dasd_get_feature(struct ccw_device *cdev, int feature)
1077{ 1077{
1078 struct dasd_devmap *devmap; 1078 struct dasd_devmap *devmap;
1079 1079
1080 devmap = dasd_find_busid(cdev->dev.bus_id); 1080 devmap = dasd_find_busid(dev_name(&cdev->dev));
1081 if (IS_ERR(devmap)) 1081 if (IS_ERR(devmap))
1082 return PTR_ERR(devmap); 1082 return PTR_ERR(devmap);
1083 1083
@@ -1093,7 +1093,7 @@ dasd_set_feature(struct ccw_device *cdev, int feature, int flag)
1093{ 1093{
1094 struct dasd_devmap *devmap; 1094 struct dasd_devmap *devmap;
1095 1095
1096 devmap = dasd_find_busid(cdev->dev.bus_id); 1096 devmap = dasd_find_busid(dev_name(&cdev->dev));
1097 if (IS_ERR(devmap)) 1097 if (IS_ERR(devmap))
1098 return PTR_ERR(devmap); 1098 return PTR_ERR(devmap);
1099 1099
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 773b3fe275b2..49f9d221e23d 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -6,6 +6,8 @@
6 * Martin Schwidefsky <schwidefsky@de.ibm.com> 6 * Martin Schwidefsky <schwidefsky@de.ibm.com>
7 * Bugreports.to..: <Linux390@de.ibm.com> 7 * Bugreports.to..: <Linux390@de.ibm.com>
8 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 8 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
9 * EMC Symmetrix ioctl Copyright EMC Corporation, 2008
10 * Author.........: Nigel Hislop <hislop_nigel@emc.com>
9 * 11 *
10 */ 12 */
11 13
@@ -84,7 +86,7 @@ dasd_eckd_probe (struct ccw_device *cdev)
84 if (ret) { 86 if (ret) {
85 printk(KERN_WARNING 87 printk(KERN_WARNING
86 "dasd_eckd_probe: could not set ccw-device options " 88 "dasd_eckd_probe: could not set ccw-device options "
87 "for %s\n", cdev->dev.bus_id); 89 "for %s\n", dev_name(&cdev->dev));
88 return ret; 90 return ret;
89 } 91 }
90 ret = dasd_generic_probe(cdev, &dasd_eckd_discipline); 92 ret = dasd_generic_probe(cdev, &dasd_eckd_discipline);
@@ -1501,12 +1503,27 @@ static void dasd_eckd_handle_unsolicited_interrupt(struct dasd_device *device,
1501 return; 1503 return;
1502 } 1504 }
1503 1505
1504 /* just report other unsolicited interrupts */ 1506 if ((irb->scsw.cmd.cc == 1) &&
1505 DEV_MESSAGE(KERN_DEBUG, device, "%s", 1507 (irb->scsw.cmd.fctl & SCSW_FCTL_START_FUNC) &&
1506 "unsolicited interrupt received"); 1508 (irb->scsw.cmd.actl & SCSW_ACTL_START_PEND) &&
1507 device->discipline->dump_sense(device, NULL, irb); 1509 (irb->scsw.cmd.stctl & SCSW_STCTL_STATUS_PEND)) {
1508 dasd_schedule_device_bh(device); 1510 /* fake irb do nothing, they are handled elsewhere */
1511 dasd_schedule_device_bh(device);
1512 return;
1513 }
1514
1515 if (!(irb->esw.esw0.erw.cons)) {
1516 /* just report other unsolicited interrupts */
1517 DEV_MESSAGE(KERN_ERR, device, "%s",
1518 "unsolicited interrupt received");
1519 } else {
1520 DEV_MESSAGE(KERN_ERR, device, "%s",
1521 "unsolicited interrupt received "
1522 "(sense available)");
1523 device->discipline->dump_sense(device, NULL, irb);
1524 }
1509 1525
1526 dasd_schedule_device_bh(device);
1510 return; 1527 return;
1511}; 1528};
1512 1529
@@ -2068,6 +2085,103 @@ dasd_eckd_set_attrib(struct dasd_device *device, void __user *argp)
2068 return 0; 2085 return 0;
2069} 2086}
2070 2087
2088/*
2089 * Issue syscall I/O to EMC Symmetrix array.
2090 * CCWs are PSF and RSSD
2091 */
2092static int dasd_symm_io(struct dasd_device *device, void __user *argp)
2093{
2094 struct dasd_symmio_parms usrparm;
2095 char *psf_data, *rssd_result;
2096 struct dasd_ccw_req *cqr;
2097 struct ccw1 *ccw;
2098 int rc;
2099
2100 /* Copy parms from caller */
2101 rc = -EFAULT;
2102 if (copy_from_user(&usrparm, argp, sizeof(usrparm)))
2103 goto out;
2104#ifndef CONFIG_64BIT
2105 /* Make sure pointers are sane even on 31 bit. */
2106 if ((usrparm.psf_data >> 32) != 0 || (usrparm.rssd_result >> 32) != 0) {
2107 rc = -EINVAL;
2108 goto out;
2109 }
2110#endif
2111 /* alloc I/O data area */
2112 psf_data = kzalloc(usrparm.psf_data_len, GFP_KERNEL | GFP_DMA);
2113 rssd_result = kzalloc(usrparm.rssd_result_len, GFP_KERNEL | GFP_DMA);
2114 if (!psf_data || !rssd_result) {
2115 rc = -ENOMEM;
2116 goto out_free;
2117 }
2118
2119 /* get syscall header from user space */
2120 rc = -EFAULT;
2121 if (copy_from_user(psf_data,
2122 (void __user *)(unsigned long) usrparm.psf_data,
2123 usrparm.psf_data_len))
2124 goto out_free;
2125
2126 /* sanity check on syscall header */
2127 if (psf_data[0] != 0x17 && psf_data[1] != 0xce) {
2128 rc = -EINVAL;
2129 goto out_free;
2130 }
2131
2132 /* setup CCWs for PSF + RSSD */
2133 cqr = dasd_smalloc_request("ECKD", 2 , 0, device);
2134 if (IS_ERR(cqr)) {
2135 DEV_MESSAGE(KERN_WARNING, device, "%s",
2136 "Could not allocate initialization request");
2137 rc = PTR_ERR(cqr);
2138 goto out_free;
2139 }
2140
2141 cqr->startdev = device;
2142 cqr->memdev = device;
2143 cqr->retries = 3;
2144 cqr->expires = 10 * HZ;
2145 cqr->buildclk = get_clock();
2146 cqr->status = DASD_CQR_FILLED;
2147
2148 /* Build the ccws */
2149 ccw = cqr->cpaddr;
2150
2151 /* PSF ccw */
2152 ccw->cmd_code = DASD_ECKD_CCW_PSF;
2153 ccw->count = usrparm.psf_data_len;
2154 ccw->flags |= CCW_FLAG_CC;
2155 ccw->cda = (__u32)(addr_t) psf_data;
2156
2157 ccw++;
2158
2159 /* RSSD ccw */
2160 ccw->cmd_code = DASD_ECKD_CCW_RSSD;
2161 ccw->count = usrparm.rssd_result_len;
2162 ccw->flags = CCW_FLAG_SLI ;
2163 ccw->cda = (__u32)(addr_t) rssd_result;
2164
2165 rc = dasd_sleep_on(cqr);
2166 if (rc)
2167 goto out_sfree;
2168
2169 rc = -EFAULT;
2170 if (copy_to_user((void __user *)(unsigned long) usrparm.rssd_result,
2171 rssd_result, usrparm.rssd_result_len))
2172 goto out_sfree;
2173 rc = 0;
2174
2175out_sfree:
2176 dasd_sfree_request(cqr, cqr->memdev);
2177out_free:
2178 kfree(rssd_result);
2179 kfree(psf_data);
2180out:
2181 DBF_DEV_EVENT(DBF_WARNING, device, "Symmetrix ioctl: rc=%d", rc);
2182 return rc;
2183}
2184
2071static int 2185static int
2072dasd_eckd_ioctl(struct dasd_block *block, unsigned int cmd, void __user *argp) 2186dasd_eckd_ioctl(struct dasd_block *block, unsigned int cmd, void __user *argp)
2073{ 2187{
@@ -2086,6 +2200,8 @@ dasd_eckd_ioctl(struct dasd_block *block, unsigned int cmd, void __user *argp)
2086 return dasd_eckd_reserve(device); 2200 return dasd_eckd_reserve(device);
2087 case BIODASDSLCK: 2201 case BIODASDSLCK:
2088 return dasd_eckd_steal_lock(device); 2202 return dasd_eckd_steal_lock(device);
2203 case BIODASDSYMMIO:
2204 return dasd_symm_io(device, argp);
2089 default: 2205 default:
2090 return -ENOIOCTLCMD; 2206 return -ENOIOCTLCMD;
2091 } 2207 }
@@ -2145,13 +2261,13 @@ static void dasd_eckd_dump_sense(struct dasd_device *device,
2145 /* dump the sense data */ 2261 /* dump the sense data */
2146 len = sprintf(page, KERN_ERR PRINTK_HEADER 2262 len = sprintf(page, KERN_ERR PRINTK_HEADER
2147 " I/O status report for device %s:\n", 2263 " I/O status report for device %s:\n",
2148 device->cdev->dev.bus_id); 2264 dev_name(&device->cdev->dev));
2149 len += sprintf(page + len, KERN_ERR PRINTK_HEADER 2265 len += sprintf(page + len, KERN_ERR PRINTK_HEADER
2150 " in req: %p CS: 0x%02X DS: 0x%02X\n", req, 2266 " in req: %p CS: 0x%02X DS: 0x%02X\n", req,
2151 irb->scsw.cmd.cstat, irb->scsw.cmd.dstat); 2267 irb->scsw.cmd.cstat, irb->scsw.cmd.dstat);
2152 len += sprintf(page + len, KERN_ERR PRINTK_HEADER 2268 len += sprintf(page + len, KERN_ERR PRINTK_HEADER
2153 " device %s: Failing CCW: %p\n", 2269 " device %s: Failing CCW: %p\n",
2154 device->cdev->dev.bus_id, 2270 dev_name(&device->cdev->dev),
2155 (void *) (addr_t) irb->scsw.cmd.cpa); 2271 (void *) (addr_t) irb->scsw.cmd.cpa);
2156 if (irb->esw.esw0.erw.cons) { 2272 if (irb->esw.esw0.erw.cons) {
2157 for (sl = 0; sl < 4; sl++) { 2273 for (sl = 0; sl < 4; sl++) {
diff --git a/drivers/s390/block/dasd_eer.c b/drivers/s390/block/dasd_eer.c
index bf512ac75b9e..892e2878d61b 100644
--- a/drivers/s390/block/dasd_eer.c
+++ b/drivers/s390/block/dasd_eer.c
@@ -309,7 +309,8 @@ static void dasd_eer_write_standard_trigger(struct dasd_device *device,
309 do_gettimeofday(&tv); 309 do_gettimeofday(&tv);
310 header.tv_sec = tv.tv_sec; 310 header.tv_sec = tv.tv_sec;
311 header.tv_usec = tv.tv_usec; 311 header.tv_usec = tv.tv_usec;
312 strncpy(header.busid, device->cdev->dev.bus_id, DASD_EER_BUSID_SIZE); 312 strncpy(header.busid, dev_name(&device->cdev->dev),
313 DASD_EER_BUSID_SIZE);
313 314
314 spin_lock_irqsave(&bufferlock, flags); 315 spin_lock_irqsave(&bufferlock, flags);
315 list_for_each_entry(eerb, &bufferlist, list) { 316 list_for_each_entry(eerb, &bufferlist, list) {
@@ -349,7 +350,8 @@ static void dasd_eer_write_snss_trigger(struct dasd_device *device,
349 do_gettimeofday(&tv); 350 do_gettimeofday(&tv);
350 header.tv_sec = tv.tv_sec; 351 header.tv_sec = tv.tv_sec;
351 header.tv_usec = tv.tv_usec; 352 header.tv_usec = tv.tv_usec;
352 strncpy(header.busid, device->cdev->dev.bus_id, DASD_EER_BUSID_SIZE); 353 strncpy(header.busid, dev_name(&device->cdev->dev),
354 DASD_EER_BUSID_SIZE);
353 355
354 spin_lock_irqsave(&bufferlock, flags); 356 spin_lock_irqsave(&bufferlock, flags);
355 list_for_each_entry(eerb, &bufferlist, list) { 357 list_for_each_entry(eerb, &bufferlist, list) {
diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c
index aa0c533423a5..93d9b6452a94 100644
--- a/drivers/s390/block/dasd_fba.c
+++ b/drivers/s390/block/dasd_fba.c
@@ -451,13 +451,13 @@ dasd_fba_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req,
451 } 451 }
452 len = sprintf(page, KERN_ERR PRINTK_HEADER 452 len = sprintf(page, KERN_ERR PRINTK_HEADER
453 " I/O status report for device %s:\n", 453 " I/O status report for device %s:\n",
454 device->cdev->dev.bus_id); 454 dev_name(&device->cdev->dev));
455 len += sprintf(page + len, KERN_ERR PRINTK_HEADER 455 len += sprintf(page + len, KERN_ERR PRINTK_HEADER
456 " in req: %p CS: 0x%02X DS: 0x%02X\n", req, 456 " in req: %p CS: 0x%02X DS: 0x%02X\n", req,
457 irb->scsw.cmd.cstat, irb->scsw.cmd.dstat); 457 irb->scsw.cmd.cstat, irb->scsw.cmd.dstat);
458 len += sprintf(page + len, KERN_ERR PRINTK_HEADER 458 len += sprintf(page + len, KERN_ERR PRINTK_HEADER
459 " device %s: Failing CCW: %p\n", 459 " device %s: Failing CCW: %p\n",
460 device->cdev->dev.bus_id, 460 dev_name(&device->cdev->dev),
461 (void *) (addr_t) irb->scsw.cmd.cpa); 461 (void *) (addr_t) irb->scsw.cmd.cpa);
462 if (irb->esw.esw0.erw.cons) { 462 if (irb->esw.esw0.erw.cons) {
463 for (sl = 0; sl < 4; sl++) { 463 for (sl = 0; sl < 4; sl++) {
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h
index 31ecaa4a40e4..489d5fe488fb 100644
--- a/drivers/s390/block/dasd_int.h
+++ b/drivers/s390/block/dasd_int.h
@@ -126,7 +126,7 @@ do { \
126#define DEV_MESSAGE(d_loglevel,d_device,d_string,d_args...)\ 126#define DEV_MESSAGE(d_loglevel,d_device,d_string,d_args...)\
127do { \ 127do { \
128 printk(d_loglevel PRINTK_HEADER " %s: " d_string "\n", \ 128 printk(d_loglevel PRINTK_HEADER " %s: " d_string "\n", \
129 d_device->cdev->dev.bus_id, d_args); \ 129 dev_name(&d_device->cdev->dev), d_args); \
130 DBF_DEV_EVENT(DBF_ALERT, d_device, d_string, d_args); \ 130 DBF_DEV_EVENT(DBF_ALERT, d_device, d_string, d_args); \
131} while(0) 131} while(0)
132 132
@@ -140,7 +140,7 @@ do { \
140#define DEV_MESSAGE_LOG(d_loglevel,d_device,d_string,d_args...)\ 140#define DEV_MESSAGE_LOG(d_loglevel,d_device,d_string,d_args...)\
141do { \ 141do { \
142 printk(d_loglevel PRINTK_HEADER " %s: " d_string "\n", \ 142 printk(d_loglevel PRINTK_HEADER " %s: " d_string "\n", \
143 d_device->cdev->dev.bus_id, d_args); \ 143 dev_name(&d_device->cdev->dev), d_args); \
144} while(0) 144} while(0)
145 145
146#define MESSAGE_LOG(d_loglevel,d_string,d_args...)\ 146#define MESSAGE_LOG(d_loglevel,d_string,d_args...)\
diff --git a/drivers/s390/block/dasd_proc.c b/drivers/s390/block/dasd_proc.c
index e3b5c4d3036e..9088de84b45d 100644
--- a/drivers/s390/block/dasd_proc.c
+++ b/drivers/s390/block/dasd_proc.c
@@ -67,7 +67,7 @@ dasd_devices_show(struct seq_file *m, void *v)
67 return 0; 67 return 0;
68 } 68 }
69 /* Print device number. */ 69 /* Print device number. */
70 seq_printf(m, "%s", device->cdev->dev.bus_id); 70 seq_printf(m, "%s", dev_name(&device->cdev->dev));
71 /* Print discipline string. */ 71 /* Print discipline string. */
72 if (device != NULL && device->discipline != NULL) 72 if (device != NULL && device->discipline != NULL)
73 seq_printf(m, "(%s)", device->discipline->name); 73 seq_printf(m, "(%s)", device->discipline->name);
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
index 9481e4a3f76e..a7ff167d5b81 100644
--- a/drivers/s390/block/dcssblk.c
+++ b/drivers/s390/block/dcssblk.c
@@ -31,7 +31,6 @@
31#define PRINT_WARN(x...) printk(KERN_WARNING DCSSBLK_NAME " warning: " x) 31#define PRINT_WARN(x...) printk(KERN_WARNING DCSSBLK_NAME " warning: " x)
32#define PRINT_ERR(x...) printk(KERN_ERR DCSSBLK_NAME " error: " x) 32#define PRINT_ERR(x...) printk(KERN_ERR DCSSBLK_NAME " error: " x)
33 33
34
35static int dcssblk_open(struct inode *inode, struct file *filp); 34static int dcssblk_open(struct inode *inode, struct file *filp);
36static int dcssblk_release(struct inode *inode, struct file *filp); 35static int dcssblk_release(struct inode *inode, struct file *filp);
37static int dcssblk_make_request(struct request_queue *q, struct bio *bio); 36static int dcssblk_make_request(struct request_queue *q, struct bio *bio);
@@ -48,6 +47,30 @@ static struct block_device_operations dcssblk_devops = {
48 .direct_access = dcssblk_direct_access, 47 .direct_access = dcssblk_direct_access,
49}; 48};
50 49
50struct dcssblk_dev_info {
51 struct list_head lh;
52 struct device dev;
53 char segment_name[BUS_ID_SIZE];
54 atomic_t use_count;
55 struct gendisk *gd;
56 unsigned long start;
57 unsigned long end;
58 int segment_type;
59 unsigned char save_pending;
60 unsigned char is_shared;
61 struct request_queue *dcssblk_queue;
62 int num_of_segments;
63 struct list_head seg_list;
64};
65
66struct segment_info {
67 struct list_head lh;
68 char segment_name[BUS_ID_SIZE];
69 unsigned long start;
70 unsigned long end;
71 int segment_type;
72};
73
51static ssize_t dcssblk_add_store(struct device * dev, struct device_attribute *attr, const char * buf, 74static ssize_t dcssblk_add_store(struct device * dev, struct device_attribute *attr, const char * buf,
52 size_t count); 75 size_t count);
53static ssize_t dcssblk_remove_store(struct device * dev, struct device_attribute *attr, const char * buf, 76static ssize_t dcssblk_remove_store(struct device * dev, struct device_attribute *attr, const char * buf,
@@ -58,30 +81,20 @@ static ssize_t dcssblk_save_show(struct device *dev, struct device_attribute *at
58static ssize_t dcssblk_shared_store(struct device * dev, struct device_attribute *attr, const char * buf, 81static ssize_t dcssblk_shared_store(struct device * dev, struct device_attribute *attr, const char * buf,
59 size_t count); 82 size_t count);
60static ssize_t dcssblk_shared_show(struct device *dev, struct device_attribute *attr, char *buf); 83static ssize_t dcssblk_shared_show(struct device *dev, struct device_attribute *attr, char *buf);
84static ssize_t dcssblk_seglist_show(struct device *dev,
85 struct device_attribute *attr,
86 char *buf);
61 87
62static DEVICE_ATTR(add, S_IWUSR, NULL, dcssblk_add_store); 88static DEVICE_ATTR(add, S_IWUSR, NULL, dcssblk_add_store);
63static DEVICE_ATTR(remove, S_IWUSR, NULL, dcssblk_remove_store); 89static DEVICE_ATTR(remove, S_IWUSR, NULL, dcssblk_remove_store);
64static DEVICE_ATTR(save, S_IWUSR | S_IRUGO, dcssblk_save_show, 90static DEVICE_ATTR(save, S_IWUSR | S_IRUSR, dcssblk_save_show,
65 dcssblk_save_store); 91 dcssblk_save_store);
66static DEVICE_ATTR(shared, S_IWUSR | S_IRUGO, dcssblk_shared_show, 92static DEVICE_ATTR(shared, S_IWUSR | S_IRUSR, dcssblk_shared_show,
67 dcssblk_shared_store); 93 dcssblk_shared_store);
94static DEVICE_ATTR(seglist, S_IRUSR, dcssblk_seglist_show, NULL);
68 95
69static struct device *dcssblk_root_dev; 96static struct device *dcssblk_root_dev;
70 97
71struct dcssblk_dev_info {
72 struct list_head lh;
73 struct device dev;
74 char segment_name[BUS_ID_SIZE];
75 atomic_t use_count;
76 struct gendisk *gd;
77 unsigned long start;
78 unsigned long end;
79 int segment_type;
80 unsigned char save_pending;
81 unsigned char is_shared;
82 struct request_queue *dcssblk_queue;
83};
84
85static LIST_HEAD(dcssblk_devices); 98static LIST_HEAD(dcssblk_devices);
86static struct rw_semaphore dcssblk_devices_sem; 99static struct rw_semaphore dcssblk_devices_sem;
87 100
@@ -91,8 +104,15 @@ static struct rw_semaphore dcssblk_devices_sem;
91static void 104static void
92dcssblk_release_segment(struct device *dev) 105dcssblk_release_segment(struct device *dev)
93{ 106{
94 PRINT_DEBUG("segment release fn called for %s\n", dev->bus_id); 107 struct dcssblk_dev_info *dev_info;
95 kfree(container_of(dev, struct dcssblk_dev_info, dev)); 108 struct segment_info *entry, *temp;
109
110 dev_info = container_of(dev, struct dcssblk_dev_info, dev);
111 list_for_each_entry_safe(entry, temp, &dev_info->seg_list, lh) {
112 list_del(&entry->lh);
113 kfree(entry);
114 }
115 kfree(dev_info);
96 module_put(THIS_MODULE); 116 module_put(THIS_MODULE);
97} 117}
98 118
@@ -142,6 +162,169 @@ dcssblk_get_device_by_name(char *name)
142 return NULL; 162 return NULL;
143} 163}
144 164
165/*
166 * get the struct segment_info from seg_list
167 * for the given name.
168 * down_read(&dcssblk_devices_sem) must be held.
169 */
170static struct segment_info *
171dcssblk_get_segment_by_name(char *name)
172{
173 struct dcssblk_dev_info *dev_info;
174 struct segment_info *entry;
175
176 list_for_each_entry(dev_info, &dcssblk_devices, lh) {
177 list_for_each_entry(entry, &dev_info->seg_list, lh) {
178 if (!strcmp(name, entry->segment_name))
179 return entry;
180 }
181 }
182 return NULL;
183}
184
185/*
186 * get the highest address of the multi-segment block.
187 */
188static unsigned long
189dcssblk_find_highest_addr(struct dcssblk_dev_info *dev_info)
190{
191 unsigned long highest_addr;
192 struct segment_info *entry;
193
194 highest_addr = 0;
195 list_for_each_entry(entry, &dev_info->seg_list, lh) {
196 if (highest_addr < entry->end)
197 highest_addr = entry->end;
198 }
199 return highest_addr;
200}
201
202/*
203 * get the lowest address of the multi-segment block.
204 */
205static unsigned long
206dcssblk_find_lowest_addr(struct dcssblk_dev_info *dev_info)
207{
208 int set_first;
209 unsigned long lowest_addr;
210 struct segment_info *entry;
211
212 set_first = 0;
213 lowest_addr = 0;
214 list_for_each_entry(entry, &dev_info->seg_list, lh) {
215 if (set_first == 0) {
216 lowest_addr = entry->start;
217 set_first = 1;
218 } else {
219 if (lowest_addr > entry->start)
220 lowest_addr = entry->start;
221 }
222 }
223 return lowest_addr;
224}
225
226/*
227 * Check continuity of segments.
228 */
229static int
230dcssblk_is_continuous(struct dcssblk_dev_info *dev_info)
231{
232 int i, j, rc;
233 struct segment_info *sort_list, *entry, temp;
234
235 if (dev_info->num_of_segments <= 1)
236 return 0;
237
238 sort_list = kzalloc(
239 sizeof(struct segment_info) * dev_info->num_of_segments,
240 GFP_KERNEL);
241 if (sort_list == NULL)
242 return -ENOMEM;
243 i = 0;
244 list_for_each_entry(entry, &dev_info->seg_list, lh) {
245 memcpy(&sort_list[i], entry, sizeof(struct segment_info));
246 i++;
247 }
248
249 /* sort segments */
250 for (i = 0; i < dev_info->num_of_segments; i++)
251 for (j = 0; j < dev_info->num_of_segments; j++)
252 if (sort_list[j].start > sort_list[i].start) {
253 memcpy(&temp, &sort_list[i],
254 sizeof(struct segment_info));
255 memcpy(&sort_list[i], &sort_list[j],
256 sizeof(struct segment_info));
257 memcpy(&sort_list[j], &temp,
258 sizeof(struct segment_info));
259 }
260
261 /* check continuity */
262 for (i = 0; i < dev_info->num_of_segments - 1; i++) {
263 if ((sort_list[i].end + 1) != sort_list[i+1].start) {
264 PRINT_ERR("Segment %s is not contiguous with "
265 "segment %s\n",
266 sort_list[i].segment_name,
267 sort_list[i+1].segment_name);
268 rc = -EINVAL;
269 goto out;
270 }
271 /* EN and EW are allowed in a block device */
272 if (sort_list[i].segment_type != sort_list[i+1].segment_type) {
273 if (!(sort_list[i].segment_type & SEGMENT_EXCLUSIVE) ||
274 (sort_list[i].segment_type == SEG_TYPE_ER) ||
275 !(sort_list[i+1].segment_type &
276 SEGMENT_EXCLUSIVE) ||
277 (sort_list[i+1].segment_type == SEG_TYPE_ER)) {
278 PRINT_ERR("Segment %s has different type from "
279 "segment %s\n",
280 sort_list[i].segment_name,
281 sort_list[i+1].segment_name);
282 rc = -EINVAL;
283 goto out;
284 }
285 }
286 }
287 rc = 0;
288out:
289 kfree(sort_list);
290 return rc;
291}
292
293/*
294 * Load a segment
295 */
296static int
297dcssblk_load_segment(char *name, struct segment_info **seg_info)
298{
299 int rc;
300
301 /* already loaded? */
302 down_read(&dcssblk_devices_sem);
303 *seg_info = dcssblk_get_segment_by_name(name);
304 up_read(&dcssblk_devices_sem);
305 if (*seg_info != NULL)
306 return -EEXIST;
307
308 /* get a struct segment_info */
309 *seg_info = kzalloc(sizeof(struct segment_info), GFP_KERNEL);
310 if (*seg_info == NULL)
311 return -ENOMEM;
312
313 strcpy((*seg_info)->segment_name, name);
314
315 /* load the segment */
316 rc = segment_load(name, SEGMENT_SHARED,
317 &(*seg_info)->start, &(*seg_info)->end);
318 if (rc < 0) {
319 segment_warning(rc, (*seg_info)->segment_name);
320 kfree(*seg_info);
321 } else {
322 INIT_LIST_HEAD(&(*seg_info)->lh);
323 (*seg_info)->segment_type = rc;
324 }
325 return rc;
326}
327
145static void dcssblk_unregister_callback(struct device *dev) 328static void dcssblk_unregister_callback(struct device *dev)
146{ 329{
147 device_unregister(dev); 330 device_unregister(dev);
@@ -165,6 +348,7 @@ static ssize_t
165dcssblk_shared_store(struct device *dev, struct device_attribute *attr, const char *inbuf, size_t count) 348dcssblk_shared_store(struct device *dev, struct device_attribute *attr, const char *inbuf, size_t count)
166{ 349{
167 struct dcssblk_dev_info *dev_info; 350 struct dcssblk_dev_info *dev_info;
351 struct segment_info *entry, *temp;
168 int rc; 352 int rc;
169 353
170 if ((count > 1) && (inbuf[1] != '\n') && (inbuf[1] != '\0')) 354 if ((count > 1) && (inbuf[1] != '\n') && (inbuf[1] != '\0'))
@@ -172,46 +356,46 @@ dcssblk_shared_store(struct device *dev, struct device_attribute *attr, const ch
172 down_write(&dcssblk_devices_sem); 356 down_write(&dcssblk_devices_sem);
173 dev_info = container_of(dev, struct dcssblk_dev_info, dev); 357 dev_info = container_of(dev, struct dcssblk_dev_info, dev);
174 if (atomic_read(&dev_info->use_count)) { 358 if (atomic_read(&dev_info->use_count)) {
175 PRINT_ERR("share: segment %s is busy!\n",
176 dev_info->segment_name);
177 rc = -EBUSY; 359 rc = -EBUSY;
178 goto out; 360 goto out;
179 } 361 }
180 if (inbuf[0] == '1') { 362 if (inbuf[0] == '1') {
181 // reload segment in shared mode 363 /* reload segments in shared mode */
182 rc = segment_modify_shared(dev_info->segment_name, 364 list_for_each_entry(entry, &dev_info->seg_list, lh) {
183 SEGMENT_SHARED); 365 rc = segment_modify_shared(entry->segment_name,
184 if (rc < 0) { 366 SEGMENT_SHARED);
185 BUG_ON(rc == -EINVAL); 367 if (rc < 0) {
186 if (rc != -EAGAIN) 368 BUG_ON(rc == -EINVAL);
187 goto removeseg; 369 if (rc != -EAGAIN)
188 } else { 370 goto removeseg;
189 dev_info->is_shared = 1;
190 switch (dev_info->segment_type) {
191 case SEG_TYPE_SR:
192 case SEG_TYPE_ER:
193 case SEG_TYPE_SC:
194 set_disk_ro(dev_info->gd,1);
195 } 371 }
196 } 372 }
373 dev_info->is_shared = 1;
374 switch (dev_info->segment_type) {
375 case SEG_TYPE_SR:
376 case SEG_TYPE_ER:
377 case SEG_TYPE_SC:
378 set_disk_ro(dev_info->gd, 1);
379 }
197 } else if (inbuf[0] == '0') { 380 } else if (inbuf[0] == '0') {
198 // reload segment in exclusive mode 381 /* reload segments in exclusive mode */
199 if (dev_info->segment_type == SEG_TYPE_SC) { 382 if (dev_info->segment_type == SEG_TYPE_SC) {
200 PRINT_ERR("Segment type SC (%s) cannot be loaded in " 383 PRINT_ERR("Segment type SC (%s) cannot be loaded in "
201 "non-shared mode\n", dev_info->segment_name); 384 "non-shared mode\n", dev_info->segment_name);
202 rc = -EINVAL; 385 rc = -EINVAL;
203 goto out; 386 goto out;
204 } 387 }
205 rc = segment_modify_shared(dev_info->segment_name, 388 list_for_each_entry(entry, &dev_info->seg_list, lh) {
206 SEGMENT_EXCLUSIVE); 389 rc = segment_modify_shared(entry->segment_name,
207 if (rc < 0) { 390 SEGMENT_EXCLUSIVE);
208 BUG_ON(rc == -EINVAL); 391 if (rc < 0) {
209 if (rc != -EAGAIN) 392 BUG_ON(rc == -EINVAL);
210 goto removeseg; 393 if (rc != -EAGAIN)
211 } else { 394 goto removeseg;
212 dev_info->is_shared = 0; 395 }
213 set_disk_ro(dev_info->gd, 0);
214 } 396 }
397 dev_info->is_shared = 0;
398 set_disk_ro(dev_info->gd, 0);
215 } else { 399 } else {
216 rc = -EINVAL; 400 rc = -EINVAL;
217 goto out; 401 goto out;
@@ -220,8 +404,14 @@ dcssblk_shared_store(struct device *dev, struct device_attribute *attr, const ch
220 goto out; 404 goto out;
221 405
222removeseg: 406removeseg:
223 PRINT_ERR("Could not reload segment %s, removing it now!\n", 407 PRINT_ERR("Could not reload segment(s) of the device %s, removing "
224 dev_info->segment_name); 408 "segment(s) now!\n",
409 dev_info->segment_name);
410 temp = entry;
411 list_for_each_entry(entry, &dev_info->seg_list, lh) {
412 if (entry != temp)
413 segment_unload(entry->segment_name);
414 }
225 list_del(&dev_info->lh); 415 list_del(&dev_info->lh);
226 416
227 del_gendisk(dev_info->gd); 417 del_gendisk(dev_info->gd);
@@ -254,6 +444,7 @@ static ssize_t
254dcssblk_save_store(struct device *dev, struct device_attribute *attr, const char *inbuf, size_t count) 444dcssblk_save_store(struct device *dev, struct device_attribute *attr, const char *inbuf, size_t count)
255{ 445{
256 struct dcssblk_dev_info *dev_info; 446 struct dcssblk_dev_info *dev_info;
447 struct segment_info *entry;
257 448
258 if ((count > 1) && (inbuf[1] != '\n') && (inbuf[1] != '\0')) 449 if ((count > 1) && (inbuf[1] != '\n') && (inbuf[1] != '\0'))
259 return -EINVAL; 450 return -EINVAL;
@@ -263,14 +454,16 @@ dcssblk_save_store(struct device *dev, struct device_attribute *attr, const char
263 if (inbuf[0] == '1') { 454 if (inbuf[0] == '1') {
264 if (atomic_read(&dev_info->use_count) == 0) { 455 if (atomic_read(&dev_info->use_count) == 0) {
265 // device is idle => we save immediately 456 // device is idle => we save immediately
266 PRINT_INFO("Saving segment %s\n", 457 PRINT_INFO("Saving segment(s) of the device %s\n",
267 dev_info->segment_name); 458 dev_info->segment_name);
268 segment_save(dev_info->segment_name); 459 list_for_each_entry(entry, &dev_info->seg_list, lh) {
460 segment_save(entry->segment_name);
461 }
269 } else { 462 } else {
270 // device is busy => we save it when it becomes 463 // device is busy => we save it when it becomes
271 // idle in dcssblk_release 464 // idle in dcssblk_release
272 PRINT_INFO("Segment %s is currently busy, it will " 465 PRINT_INFO("Device %s is currently busy, segment(s) "
273 "be saved when it becomes idle...\n", 466 "will be saved when it becomes idle...\n",
274 dev_info->segment_name); 467 dev_info->segment_name);
275 dev_info->save_pending = 1; 468 dev_info->save_pending = 1;
276 } 469 }
@@ -279,7 +472,8 @@ dcssblk_save_store(struct device *dev, struct device_attribute *attr, const char
279 // device is busy & the user wants to undo his save 472 // device is busy & the user wants to undo his save
280 // request 473 // request
281 dev_info->save_pending = 0; 474 dev_info->save_pending = 0;
282 PRINT_INFO("Pending save for segment %s deactivated\n", 475 PRINT_INFO("Pending save for segment(s) of the device "
476 "%s deactivated\n",
283 dev_info->segment_name); 477 dev_info->segment_name);
284 } 478 }
285 } else { 479 } else {
@@ -291,66 +485,123 @@ dcssblk_save_store(struct device *dev, struct device_attribute *attr, const char
291} 485}
292 486
293/* 487/*
488 * device attribute for showing all segments in a device
489 */
490static ssize_t
491dcssblk_seglist_show(struct device *dev, struct device_attribute *attr,
492 char *buf)
493{
494 int i;
495
496 struct dcssblk_dev_info *dev_info;
497 struct segment_info *entry;
498
499 down_read(&dcssblk_devices_sem);
500 dev_info = container_of(dev, struct dcssblk_dev_info, dev);
501 i = 0;
502 buf[0] = '\0';
503 list_for_each_entry(entry, &dev_info->seg_list, lh) {
504 strcpy(&buf[i], entry->segment_name);
505 i += strlen(entry->segment_name);
506 buf[i] = '\n';
507 i++;
508 }
509 up_read(&dcssblk_devices_sem);
510 return i;
511}
512
513/*
294 * device attribute for adding devices 514 * device attribute for adding devices
295 */ 515 */
296static ssize_t 516static ssize_t
297dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 517dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
298{ 518{
299 int rc, i; 519 int rc, i, j, num_of_segments;
300 struct dcssblk_dev_info *dev_info; 520 struct dcssblk_dev_info *dev_info;
521 struct segment_info *seg_info, *temp;
301 char *local_buf; 522 char *local_buf;
302 unsigned long seg_byte_size; 523 unsigned long seg_byte_size;
303 524
304 dev_info = NULL; 525 dev_info = NULL;
526 seg_info = NULL;
305 if (dev != dcssblk_root_dev) { 527 if (dev != dcssblk_root_dev) {
306 rc = -EINVAL; 528 rc = -EINVAL;
307 goto out_nobuf; 529 goto out_nobuf;
308 } 530 }
531 if ((count < 1) || (buf[0] == '\0') || (buf[0] == '\n')) {
532 rc = -ENAMETOOLONG;
533 goto out_nobuf;
534 }
535
309 local_buf = kmalloc(count + 1, GFP_KERNEL); 536 local_buf = kmalloc(count + 1, GFP_KERNEL);
310 if (local_buf == NULL) { 537 if (local_buf == NULL) {
311 rc = -ENOMEM; 538 rc = -ENOMEM;
312 goto out_nobuf; 539 goto out_nobuf;
313 } 540 }
541
314 /* 542 /*
315 * parse input 543 * parse input
316 */ 544 */
545 num_of_segments = 0;
317 for (i = 0; ((buf[i] != '\0') && (buf[i] != '\n') && i < count); i++) { 546 for (i = 0; ((buf[i] != '\0') && (buf[i] != '\n') && i < count); i++) {
318 local_buf[i] = toupper(buf[i]); 547 for (j = i; (buf[j] != ':') &&
548 (buf[j] != '\0') &&
549 (buf[j] != '\n') &&
550 j < count; j++) {
551 local_buf[j-i] = toupper(buf[j]);
552 }
553 local_buf[j-i] = '\0';
554 if (((j - i) == 0) || ((j - i) > 8)) {
555 rc = -ENAMETOOLONG;
556 goto seg_list_del;
557 }
558
559 rc = dcssblk_load_segment(local_buf, &seg_info);
560 if (rc < 0)
561 goto seg_list_del;
562 /*
563 * get a struct dcssblk_dev_info
564 */
565 if (num_of_segments == 0) {
566 dev_info = kzalloc(sizeof(struct dcssblk_dev_info),
567 GFP_KERNEL);
568 if (dev_info == NULL) {
569 rc = -ENOMEM;
570 goto out;
571 }
572 strcpy(dev_info->segment_name, local_buf);
573 dev_info->segment_type = seg_info->segment_type;
574 INIT_LIST_HEAD(&dev_info->seg_list);
575 }
576 list_add_tail(&seg_info->lh, &dev_info->seg_list);
577 num_of_segments++;
578 i = j;
579
580 if ((buf[j] == '\0') || (buf[j] == '\n'))
581 break;
319 } 582 }
320 local_buf[i] = '\0'; 583
321 if ((i == 0) || (i > 8)) { 584 /* no trailing colon at the end of the input */
585 if ((i > 0) && (buf[i-1] == ':')) {
322 rc = -ENAMETOOLONG; 586 rc = -ENAMETOOLONG;
323 goto out; 587 goto seg_list_del;
324 }
325 /*
326 * already loaded?
327 */
328 down_read(&dcssblk_devices_sem);
329 dev_info = dcssblk_get_device_by_name(local_buf);
330 up_read(&dcssblk_devices_sem);
331 if (dev_info != NULL) {
332 PRINT_WARN("Segment %s already loaded!\n", local_buf);
333 rc = -EEXIST;
334 goto out;
335 }
336 /*
337 * get a struct dcssblk_dev_info
338 */
339 dev_info = kzalloc(sizeof(struct dcssblk_dev_info), GFP_KERNEL);
340 if (dev_info == NULL) {
341 rc = -ENOMEM;
342 goto out;
343 } 588 }
589 strlcpy(local_buf, buf, i + 1);
590 dev_info->num_of_segments = num_of_segments;
591 rc = dcssblk_is_continuous(dev_info);
592 if (rc < 0)
593 goto seg_list_del;
594
595 dev_info->start = dcssblk_find_lowest_addr(dev_info);
596 dev_info->end = dcssblk_find_highest_addr(dev_info);
344 597
345 strcpy(dev_info->segment_name, local_buf); 598 dev_set_name(&dev_info->dev, dev_info->segment_name);
346 strlcpy(dev_info->dev.bus_id, local_buf, BUS_ID_SIZE);
347 dev_info->dev.release = dcssblk_release_segment; 599 dev_info->dev.release = dcssblk_release_segment;
348 INIT_LIST_HEAD(&dev_info->lh); 600 INIT_LIST_HEAD(&dev_info->lh);
349
350 dev_info->gd = alloc_disk(DCSSBLK_MINORS_PER_DISK); 601 dev_info->gd = alloc_disk(DCSSBLK_MINORS_PER_DISK);
351 if (dev_info->gd == NULL) { 602 if (dev_info->gd == NULL) {
352 rc = -ENOMEM; 603 rc = -ENOMEM;
353 goto free_dev_info; 604 goto seg_list_del;
354 } 605 }
355 dev_info->gd->major = dcssblk_major; 606 dev_info->gd->major = dcssblk_major;
356 dev_info->gd->fops = &dcssblk_devops; 607 dev_info->gd->fops = &dcssblk_devops;
@@ -360,59 +611,43 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
360 dev_info->gd->driverfs_dev = &dev_info->dev; 611 dev_info->gd->driverfs_dev = &dev_info->dev;
361 blk_queue_make_request(dev_info->dcssblk_queue, dcssblk_make_request); 612 blk_queue_make_request(dev_info->dcssblk_queue, dcssblk_make_request);
362 blk_queue_hardsect_size(dev_info->dcssblk_queue, 4096); 613 blk_queue_hardsect_size(dev_info->dcssblk_queue, 4096);
363 /* 614
364 * load the segment
365 */
366 rc = segment_load(local_buf, SEGMENT_SHARED,
367 &dev_info->start, &dev_info->end);
368 if (rc < 0) {
369 segment_warning(rc, dev_info->segment_name);
370 goto dealloc_gendisk;
371 }
372 seg_byte_size = (dev_info->end - dev_info->start + 1); 615 seg_byte_size = (dev_info->end - dev_info->start + 1);
373 set_capacity(dev_info->gd, seg_byte_size >> 9); // size in sectors 616 set_capacity(dev_info->gd, seg_byte_size >> 9); // size in sectors
374 PRINT_INFO("Loaded segment %s, size = %lu Byte, " 617 PRINT_INFO("Loaded segment(s) %s, size = %lu Byte, "
375 "capacity = %lu (512 Byte) sectors\n", local_buf, 618 "capacity = %lu (512 Byte) sectors\n", local_buf,
376 seg_byte_size, seg_byte_size >> 9); 619 seg_byte_size, seg_byte_size >> 9);
377 620
378 dev_info->segment_type = rc;
379 dev_info->save_pending = 0; 621 dev_info->save_pending = 0;
380 dev_info->is_shared = 1; 622 dev_info->is_shared = 1;
381 dev_info->dev.parent = dcssblk_root_dev; 623 dev_info->dev.parent = dcssblk_root_dev;
382 624
383 /* 625 /*
384 * get minor, add to list 626 *get minor, add to list
385 */ 627 */
386 down_write(&dcssblk_devices_sem); 628 down_write(&dcssblk_devices_sem);
387 if (dcssblk_get_device_by_name(local_buf)) { 629 if (dcssblk_get_segment_by_name(local_buf)) {
388 up_write(&dcssblk_devices_sem);
389 rc = -EEXIST; 630 rc = -EEXIST;
390 goto unload_seg; 631 goto release_gd;
391 } 632 }
392 rc = dcssblk_assign_free_minor(dev_info); 633 rc = dcssblk_assign_free_minor(dev_info);
393 if (rc) { 634 if (rc)
394 up_write(&dcssblk_devices_sem); 635 goto release_gd;
395 PRINT_ERR("No free minor number available! "
396 "Unloading segment...\n");
397 goto unload_seg;
398 }
399 sprintf(dev_info->gd->disk_name, "dcssblk%d", 636 sprintf(dev_info->gd->disk_name, "dcssblk%d",
400 MINOR(disk_devt(dev_info->gd))); 637 MINOR(disk_devt(dev_info->gd)));
401 list_add_tail(&dev_info->lh, &dcssblk_devices); 638 list_add_tail(&dev_info->lh, &dcssblk_devices);
402 639
403 if (!try_module_get(THIS_MODULE)) { 640 if (!try_module_get(THIS_MODULE)) {
404 rc = -ENODEV; 641 rc = -ENODEV;
405 goto list_del; 642 goto dev_list_del;
406 } 643 }
407 /* 644 /*
408 * register the device 645 * register the device
409 */ 646 */
410 rc = device_register(&dev_info->dev); 647 rc = device_register(&dev_info->dev);
411 if (rc) { 648 if (rc) {
412 PRINT_ERR("Segment %s could not be registered RC=%d\n",
413 local_buf, rc);
414 module_put(THIS_MODULE); 649 module_put(THIS_MODULE);
415 goto list_del; 650 goto dev_list_del;
416 } 651 }
417 get_device(&dev_info->dev); 652 get_device(&dev_info->dev);
418 rc = device_create_file(&dev_info->dev, &dev_attr_shared); 653 rc = device_create_file(&dev_info->dev, &dev_attr_shared);
@@ -421,6 +656,9 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
421 rc = device_create_file(&dev_info->dev, &dev_attr_save); 656 rc = device_create_file(&dev_info->dev, &dev_attr_save);
422 if (rc) 657 if (rc)
423 goto unregister_dev; 658 goto unregister_dev;
659 rc = device_create_file(&dev_info->dev, &dev_attr_seglist);
660 if (rc)
661 goto unregister_dev;
424 662
425 add_disk(dev_info->gd); 663 add_disk(dev_info->gd);
426 664
@@ -434,7 +672,6 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
434 set_disk_ro(dev_info->gd,0); 672 set_disk_ro(dev_info->gd,0);
435 break; 673 break;
436 } 674 }
437 PRINT_DEBUG("Segment %s loaded successfully\n", local_buf);
438 up_write(&dcssblk_devices_sem); 675 up_write(&dcssblk_devices_sem);
439 rc = count; 676 rc = count;
440 goto out; 677 goto out;
@@ -445,20 +682,27 @@ unregister_dev:
445 dev_info->gd->queue = NULL; 682 dev_info->gd->queue = NULL;
446 put_disk(dev_info->gd); 683 put_disk(dev_info->gd);
447 device_unregister(&dev_info->dev); 684 device_unregister(&dev_info->dev);
448 segment_unload(dev_info->segment_name); 685 list_for_each_entry(seg_info, &dev_info->seg_list, lh) {
686 segment_unload(seg_info->segment_name);
687 }
449 put_device(&dev_info->dev); 688 put_device(&dev_info->dev);
450 up_write(&dcssblk_devices_sem); 689 up_write(&dcssblk_devices_sem);
451 goto out; 690 goto out;
452list_del: 691dev_list_del:
453 list_del(&dev_info->lh); 692 list_del(&dev_info->lh);
454 up_write(&dcssblk_devices_sem); 693release_gd:
455unload_seg:
456 segment_unload(local_buf);
457dealloc_gendisk:
458 blk_cleanup_queue(dev_info->dcssblk_queue); 694 blk_cleanup_queue(dev_info->dcssblk_queue);
459 dev_info->gd->queue = NULL; 695 dev_info->gd->queue = NULL;
460 put_disk(dev_info->gd); 696 put_disk(dev_info->gd);
461free_dev_info: 697 up_write(&dcssblk_devices_sem);
698seg_list_del:
699 if (dev_info == NULL)
700 goto out;
701 list_for_each_entry_safe(seg_info, temp, &dev_info->seg_list, lh) {
702 list_del(&seg_info->lh);
703 segment_unload(seg_info->segment_name);
704 kfree(seg_info);
705 }
462 kfree(dev_info); 706 kfree(dev_info);
463out: 707out:
464 kfree(local_buf); 708 kfree(local_buf);
@@ -473,6 +717,7 @@ static ssize_t
473dcssblk_remove_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 717dcssblk_remove_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
474{ 718{
475 struct dcssblk_dev_info *dev_info; 719 struct dcssblk_dev_info *dev_info;
720 struct segment_info *entry;
476 int rc, i; 721 int rc, i;
477 char *local_buf; 722 char *local_buf;
478 723
@@ -499,26 +744,28 @@ dcssblk_remove_store(struct device *dev, struct device_attribute *attr, const ch
499 dev_info = dcssblk_get_device_by_name(local_buf); 744 dev_info = dcssblk_get_device_by_name(local_buf);
500 if (dev_info == NULL) { 745 if (dev_info == NULL) {
501 up_write(&dcssblk_devices_sem); 746 up_write(&dcssblk_devices_sem);
502 PRINT_WARN("Segment %s is not loaded!\n", local_buf); 747 PRINT_WARN("Device %s is not loaded!\n", local_buf);
503 rc = -ENODEV; 748 rc = -ENODEV;
504 goto out_buf; 749 goto out_buf;
505 } 750 }
506 if (atomic_read(&dev_info->use_count) != 0) { 751 if (atomic_read(&dev_info->use_count) != 0) {
507 up_write(&dcssblk_devices_sem); 752 up_write(&dcssblk_devices_sem);
508 PRINT_WARN("Segment %s is in use!\n", local_buf); 753 PRINT_WARN("Device %s is in use!\n", local_buf);
509 rc = -EBUSY; 754 rc = -EBUSY;
510 goto out_buf; 755 goto out_buf;
511 } 756 }
512 list_del(&dev_info->lh);
513 757
758 list_del(&dev_info->lh);
514 del_gendisk(dev_info->gd); 759 del_gendisk(dev_info->gd);
515 blk_cleanup_queue(dev_info->dcssblk_queue); 760 blk_cleanup_queue(dev_info->dcssblk_queue);
516 dev_info->gd->queue = NULL; 761 dev_info->gd->queue = NULL;
517 put_disk(dev_info->gd); 762 put_disk(dev_info->gd);
518 device_unregister(&dev_info->dev); 763 device_unregister(&dev_info->dev);
519 segment_unload(dev_info->segment_name); 764
520 PRINT_DEBUG("Segment %s unloaded successfully\n", 765 /* unload all related segments */
521 dev_info->segment_name); 766 list_for_each_entry(entry, &dev_info->seg_list, lh)
767 segment_unload(entry->segment_name);
768
522 put_device(&dev_info->dev); 769 put_device(&dev_info->dev);
523 up_write(&dcssblk_devices_sem); 770 up_write(&dcssblk_devices_sem);
524 771
@@ -550,6 +797,7 @@ static int
550dcssblk_release(struct inode *inode, struct file *filp) 797dcssblk_release(struct inode *inode, struct file *filp)
551{ 798{
552 struct dcssblk_dev_info *dev_info; 799 struct dcssblk_dev_info *dev_info;
800 struct segment_info *entry;
553 int rc; 801 int rc;
554 802
555 dev_info = inode->i_bdev->bd_disk->private_data; 803 dev_info = inode->i_bdev->bd_disk->private_data;
@@ -560,9 +808,11 @@ dcssblk_release(struct inode *inode, struct file *filp)
560 down_write(&dcssblk_devices_sem); 808 down_write(&dcssblk_devices_sem);
561 if (atomic_dec_and_test(&dev_info->use_count) 809 if (atomic_dec_and_test(&dev_info->use_count)
562 && (dev_info->save_pending)) { 810 && (dev_info->save_pending)) {
563 PRINT_INFO("Segment %s became idle and is being saved now\n", 811 PRINT_INFO("Device %s became idle and is being saved now\n",
564 dev_info->segment_name); 812 dev_info->segment_name);
565 segment_save(dev_info->segment_name); 813 list_for_each_entry(entry, &dev_info->seg_list, lh) {
814 segment_save(entry->segment_name);
815 }
566 dev_info->save_pending = 0; 816 dev_info->save_pending = 0;
567 } 817 }
568 up_write(&dcssblk_devices_sem); 818 up_write(&dcssblk_devices_sem);
@@ -602,7 +852,8 @@ dcssblk_make_request(struct request_queue *q, struct bio *bio)
602 case SEG_TYPE_SC: 852 case SEG_TYPE_SC:
603 /* cannot write to these segments */ 853 /* cannot write to these segments */
604 if (bio_data_dir(bio) == WRITE) { 854 if (bio_data_dir(bio) == WRITE) {
605 PRINT_WARN("rejecting write to ro segment %s\n", dev_info->dev.bus_id); 855 PRINT_WARN("rejecting write to ro device %s\n",
856 dev_name(&dev_info->dev));
606 goto fail; 857 goto fail;
607 } 858 }
608 } 859 }
@@ -657,7 +908,7 @@ static void
657dcssblk_check_params(void) 908dcssblk_check_params(void)
658{ 909{
659 int rc, i, j, k; 910 int rc, i, j, k;
660 char buf[9]; 911 char buf[DCSSBLK_PARM_LEN + 1];
661 struct dcssblk_dev_info *dev_info; 912 struct dcssblk_dev_info *dev_info;
662 913
663 for (i = 0; (i < DCSSBLK_PARM_LEN) && (dcssblk_segments[i] != '\0'); 914 for (i = 0; (i < DCSSBLK_PARM_LEN) && (dcssblk_segments[i] != '\0');
@@ -665,15 +916,16 @@ dcssblk_check_params(void)
665 for (j = i; (dcssblk_segments[j] != ',') && 916 for (j = i; (dcssblk_segments[j] != ',') &&
666 (dcssblk_segments[j] != '\0') && 917 (dcssblk_segments[j] != '\0') &&
667 (dcssblk_segments[j] != '(') && 918 (dcssblk_segments[j] != '(') &&
668 (j - i) < 8; j++) 919 (j < DCSSBLK_PARM_LEN); j++)
669 { 920 {
670 buf[j-i] = dcssblk_segments[j]; 921 buf[j-i] = dcssblk_segments[j];
671 } 922 }
672 buf[j-i] = '\0'; 923 buf[j-i] = '\0';
673 rc = dcssblk_add_store(dcssblk_root_dev, NULL, buf, j-i); 924 rc = dcssblk_add_store(dcssblk_root_dev, NULL, buf, j-i);
674 if ((rc >= 0) && (dcssblk_segments[j] == '(')) { 925 if ((rc >= 0) && (dcssblk_segments[j] == '(')) {
675 for (k = 0; buf[k] != '\0'; k++) 926 for (k = 0; (buf[k] != ':') && (buf[k] != '\0'); k++)
676 buf[k] = toupper(buf[k]); 927 buf[k] = toupper(buf[k]);
928 buf[k] = '\0';
677 if (!strncmp(&dcssblk_segments[j], "(local)", 7)) { 929 if (!strncmp(&dcssblk_segments[j], "(local)", 7)) {
678 down_read(&dcssblk_devices_sem); 930 down_read(&dcssblk_devices_sem);
679 dev_info = dcssblk_get_device_by_name(buf); 931 dev_info = dcssblk_get_device_by_name(buf);
@@ -740,10 +992,12 @@ module_exit(dcssblk_exit);
740 992
741module_param_string(segments, dcssblk_segments, DCSSBLK_PARM_LEN, 0444); 993module_param_string(segments, dcssblk_segments, DCSSBLK_PARM_LEN, 0444);
742MODULE_PARM_DESC(segments, "Name of DCSS segment(s) to be loaded, " 994MODULE_PARM_DESC(segments, "Name of DCSS segment(s) to be loaded, "
743 "comma-separated list, each name max. 8 chars.\n" 995 "comma-separated list, names in each set separated "
744 "Adding \"(local)\" to segment name equals echoing 0 to " 996 "by commas are separated by colons, each set contains "
745 "/sys/devices/dcssblk/<segment name>/shared after loading " 997 "names of contiguous segments and each name max. 8 chars.\n"
746 "the segment - \n" 998 "Adding \"(local)\" to the end of each set equals echoing 0 "
747 "e.g. segments=\"mydcss1,mydcss2,mydcss3(local)\""); 999 "to /sys/devices/dcssblk/<device name>/shared after loading "
1000 "the contiguous segments - \n"
1001 "e.g. segments=\"mydcss1,mydcss2:mydcss3,mydcss4(local)\"");
748 1002
749MODULE_LICENSE("GPL"); 1003MODULE_LICENSE("GPL");
diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c
index dd9b986389a2..03916989ed2d 100644
--- a/drivers/s390/block/xpram.c
+++ b/drivers/s390/block/xpram.c
@@ -56,6 +56,7 @@ typedef struct {
56static xpram_device_t xpram_devices[XPRAM_MAX_DEVS]; 56static xpram_device_t xpram_devices[XPRAM_MAX_DEVS];
57static unsigned int xpram_sizes[XPRAM_MAX_DEVS]; 57static unsigned int xpram_sizes[XPRAM_MAX_DEVS];
58static struct gendisk *xpram_disks[XPRAM_MAX_DEVS]; 58static struct gendisk *xpram_disks[XPRAM_MAX_DEVS];
59static struct request_queue *xpram_queues[XPRAM_MAX_DEVS];
59static unsigned int xpram_pages; 60static unsigned int xpram_pages;
60static int xpram_devs; 61static int xpram_devs;
61 62
@@ -330,18 +331,22 @@ static int __init xpram_setup_sizes(unsigned long pages)
330 return 0; 331 return 0;
331} 332}
332 333
333static struct request_queue *xpram_queue;
334
335static int __init xpram_setup_blkdev(void) 334static int __init xpram_setup_blkdev(void)
336{ 335{
337 unsigned long offset; 336 unsigned long offset;
338 int i, rc = -ENOMEM; 337 int i, rc = -ENOMEM;
339 338
340 for (i = 0; i < xpram_devs; i++) { 339 for (i = 0; i < xpram_devs; i++) {
341 struct gendisk *disk = alloc_disk(1); 340 xpram_disks[i] = alloc_disk(1);
342 if (!disk) 341 if (!xpram_disks[i])
342 goto out;
343 xpram_queues[i] = blk_alloc_queue(GFP_KERNEL);
344 if (!xpram_queues[i]) {
345 put_disk(xpram_disks[i]);
343 goto out; 346 goto out;
344 xpram_disks[i] = disk; 347 }
348 blk_queue_make_request(xpram_queues[i], xpram_make_request);
349 blk_queue_hardsect_size(xpram_queues[i], 4096);
345 } 350 }
346 351
347 /* 352 /*
@@ -352,18 +357,6 @@ static int __init xpram_setup_blkdev(void)
352 goto out; 357 goto out;
353 358
354 /* 359 /*
355 * Assign the other needed values: make request function, sizes and
356 * hardsect size. All the minor devices feature the same value.
357 */
358 xpram_queue = blk_alloc_queue(GFP_KERNEL);
359 if (!xpram_queue) {
360 rc = -ENOMEM;
361 goto out_unreg;
362 }
363 blk_queue_make_request(xpram_queue, xpram_make_request);
364 blk_queue_hardsect_size(xpram_queue, 4096);
365
366 /*
367 * Setup device structures. 360 * Setup device structures.
368 */ 361 */
369 offset = 0; 362 offset = 0;
@@ -377,18 +370,18 @@ static int __init xpram_setup_blkdev(void)
377 disk->first_minor = i; 370 disk->first_minor = i;
378 disk->fops = &xpram_devops; 371 disk->fops = &xpram_devops;
379 disk->private_data = &xpram_devices[i]; 372 disk->private_data = &xpram_devices[i];
380 disk->queue = xpram_queue; 373 disk->queue = xpram_queues[i];
381 sprintf(disk->disk_name, "slram%d", i); 374 sprintf(disk->disk_name, "slram%d", i);
382 set_capacity(disk, xpram_sizes[i] << 1); 375 set_capacity(disk, xpram_sizes[i] << 1);
383 add_disk(disk); 376 add_disk(disk);
384 } 377 }
385 378
386 return 0; 379 return 0;
387out_unreg:
388 unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME);
389out: 380out:
390 while (i--) 381 while (i--) {
382 blk_cleanup_queue(xpram_queues[i]);
391 put_disk(xpram_disks[i]); 383 put_disk(xpram_disks[i]);
384 }
392 return rc; 385 return rc;
393} 386}
394 387
@@ -400,10 +393,10 @@ static void __exit xpram_exit(void)
400 int i; 393 int i;
401 for (i = 0; i < xpram_devs; i++) { 394 for (i = 0; i < xpram_devs; i++) {
402 del_gendisk(xpram_disks[i]); 395 del_gendisk(xpram_disks[i]);
396 blk_cleanup_queue(xpram_queues[i]);
403 put_disk(xpram_disks[i]); 397 put_disk(xpram_disks[i]);
404 } 398 }
405 unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME); 399 unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME);
406 blk_cleanup_queue(xpram_queue);
407} 400}
408 401
409static int __init xpram_init(void) 402static int __init xpram_init(void)
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
index d3ec9b55ab35..9ab06e0dad40 100644
--- a/drivers/s390/char/con3215.c
+++ b/drivers/s390/char/con3215.c
@@ -21,6 +21,7 @@
21#include <linux/console.h> 21#include <linux/console.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/err.h> 23#include <linux/err.h>
24#include <linux/reboot.h>
24 25
25#include <linux/slab.h> 26#include <linux/slab.h>
26#include <linux/bootmem.h> 27#include <linux/bootmem.h>
@@ -88,7 +89,6 @@ struct raw3215_info {
88 int count; /* number of bytes in output buffer */ 89 int count; /* number of bytes in output buffer */
89 int written; /* number of bytes in write requests */ 90 int written; /* number of bytes in write requests */
90 struct tty_struct *tty; /* pointer to tty structure if present */ 91 struct tty_struct *tty; /* pointer to tty structure if present */
91 struct tasklet_struct tasklet;
92 struct raw3215_req *queued_read; /* pointer to queued read requests */ 92 struct raw3215_req *queued_read; /* pointer to queued read requests */
93 struct raw3215_req *queued_write;/* pointer to queued write requests */ 93 struct raw3215_req *queued_write;/* pointer to queued write requests */
94 wait_queue_head_t empty_wait; /* wait queue for flushing */ 94 wait_queue_head_t empty_wait; /* wait queue for flushing */
@@ -341,21 +341,14 @@ raw3215_try_io(struct raw3215_info *raw)
341} 341}
342 342
343/* 343/*
344 * The bottom half handler routine for 3215 devices. It tries to start 344 * Try to start the next IO and wake up processes waiting on the tty.
345 * the next IO and wakes up processes waiting on the tty.
346 */ 345 */
347static void 346static void raw3215_next_io(struct raw3215_info *raw)
348raw3215_tasklet(void *data)
349{ 347{
350 struct raw3215_info *raw;
351 struct tty_struct *tty; 348 struct tty_struct *tty;
352 unsigned long flags;
353 349
354 raw = (struct raw3215_info *) data;
355 spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
356 raw3215_mk_write_req(raw); 350 raw3215_mk_write_req(raw);
357 raw3215_try_io(raw); 351 raw3215_try_io(raw);
358 spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
359 tty = raw->tty; 352 tty = raw->tty;
360 if (tty != NULL && 353 if (tty != NULL &&
361 RAW3215_BUFFER_SIZE - raw->count >= RAW3215_MIN_SPACE) { 354 RAW3215_BUFFER_SIZE - raw->count >= RAW3215_MIN_SPACE) {
@@ -380,7 +373,7 @@ raw3215_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
380 cstat = irb->scsw.cmd.cstat; 373 cstat = irb->scsw.cmd.cstat;
381 dstat = irb->scsw.cmd.dstat; 374 dstat = irb->scsw.cmd.dstat;
382 if (cstat != 0) 375 if (cstat != 0)
383 tasklet_schedule(&raw->tasklet); 376 raw3215_next_io(raw);
384 if (dstat & 0x01) { /* we got a unit exception */ 377 if (dstat & 0x01) { /* we got a unit exception */
385 dstat &= ~0x01; /* we can ignore it */ 378 dstat &= ~0x01; /* we can ignore it */
386 } 379 }
@@ -390,7 +383,7 @@ raw3215_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
390 break; 383 break;
391 /* Attention interrupt, someone hit the enter key */ 384 /* Attention interrupt, someone hit the enter key */
392 raw3215_mk_read_req(raw); 385 raw3215_mk_read_req(raw);
393 tasklet_schedule(&raw->tasklet); 386 raw3215_next_io(raw);
394 break; 387 break;
395 case 0x08: 388 case 0x08:
396 case 0x0C: 389 case 0x0C:
@@ -448,7 +441,7 @@ raw3215_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
448 raw->queued_read == NULL) { 441 raw->queued_read == NULL) {
449 wake_up_interruptible(&raw->empty_wait); 442 wake_up_interruptible(&raw->empty_wait);
450 } 443 }
451 tasklet_schedule(&raw->tasklet); 444 raw3215_next_io(raw);
452 break; 445 break;
453 default: 446 default:
454 /* Strange interrupt, I'll do my best to clean up */ 447 /* Strange interrupt, I'll do my best to clean up */
@@ -460,7 +453,7 @@ raw3215_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
460 raw->flags &= ~RAW3215_WORKING; 453 raw->flags &= ~RAW3215_WORKING;
461 raw3215_free_req(req); 454 raw3215_free_req(req);
462 } 455 }
463 tasklet_schedule(&raw->tasklet); 456 raw3215_next_io(raw);
464 } 457 }
465 return; 458 return;
466} 459}
@@ -674,9 +667,6 @@ raw3215_probe (struct ccw_device *cdev)
674 kfree(raw); 667 kfree(raw);
675 return -ENOMEM; 668 return -ENOMEM;
676 } 669 }
677 tasklet_init(&raw->tasklet,
678 (void (*)(unsigned long)) raw3215_tasklet,
679 (unsigned long) raw);
680 init_waitqueue_head(&raw->empty_wait); 670 init_waitqueue_head(&raw->empty_wait);
681 671
682 cdev->dev.driver_data = raw; 672 cdev->dev.driver_data = raw;
@@ -775,11 +765,11 @@ static struct tty_driver *con3215_device(struct console *c, int *index)
775} 765}
776 766
777/* 767/*
778 * panic() calls console_unblank before the system enters a 768 * panic() calls con3215_flush through a panic_notifier
779 * disabled, endless loop. 769 * before the system enters a disabled, endless loop.
780 */ 770 */
781static void 771static void
782con3215_unblank(void) 772con3215_flush(void)
783{ 773{
784 struct raw3215_info *raw; 774 struct raw3215_info *raw;
785 unsigned long flags; 775 unsigned long flags;
@@ -790,6 +780,23 @@ con3215_unblank(void)
790 spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); 780 spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
791} 781}
792 782
783static int con3215_notify(struct notifier_block *self,
784 unsigned long event, void *data)
785{
786 con3215_flush();
787 return NOTIFY_OK;
788}
789
790static struct notifier_block on_panic_nb = {
791 .notifier_call = con3215_notify,
792 .priority = 0,
793};
794
795static struct notifier_block on_reboot_nb = {
796 .notifier_call = con3215_notify,
797 .priority = 0,
798};
799
793/* 800/*
794 * The console structure for the 3215 console 801 * The console structure for the 3215 console
795 */ 802 */
@@ -797,7 +804,6 @@ static struct console con3215 = {
797 .name = "ttyS", 804 .name = "ttyS",
798 .write = con3215_write, 805 .write = con3215_write,
799 .device = con3215_device, 806 .device = con3215_device,
800 .unblank = con3215_unblank,
801 .flags = CON_PRINTBUFFER, 807 .flags = CON_PRINTBUFFER,
802}; 808};
803 809
@@ -846,9 +852,6 @@ con3215_init(void)
846 cdev->handler = raw3215_irq; 852 cdev->handler = raw3215_irq;
847 853
848 raw->flags |= RAW3215_FIXED; 854 raw->flags |= RAW3215_FIXED;
849 tasklet_init(&raw->tasklet,
850 (void (*)(unsigned long)) raw3215_tasklet,
851 (unsigned long) raw);
852 init_waitqueue_head(&raw->empty_wait); 855 init_waitqueue_head(&raw->empty_wait);
853 856
854 /* Request the console irq */ 857 /* Request the console irq */
@@ -859,6 +862,8 @@ con3215_init(void)
859 raw3215[0] = NULL; 862 raw3215[0] = NULL;
860 return -ENODEV; 863 return -ENODEV;
861 } 864 }
865 atomic_notifier_chain_register(&panic_notifier_list, &on_panic_nb);
866 register_reboot_notifier(&on_reboot_nb);
862 register_console(&con3215); 867 register_console(&con3215);
863 return 0; 868 return 0;
864} 869}
diff --git a/drivers/s390/char/con3270.c b/drivers/s390/char/con3270.c
index 3c07974886ed..d028d2ee83dd 100644
--- a/drivers/s390/char/con3270.c
+++ b/drivers/s390/char/con3270.c
@@ -15,6 +15,7 @@
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/err.h> 17#include <linux/err.h>
18#include <linux/reboot.h>
18 19
19#include <asm/ccwdev.h> 20#include <asm/ccwdev.h>
20#include <asm/cio.h> 21#include <asm/cio.h>
@@ -528,11 +529,11 @@ con3270_wait_write(struct con3270 *cp)
528} 529}
529 530
530/* 531/*
531 * panic() calls console_unblank before the system enters a 532 * panic() calls con3270_flush through a panic_notifier
532 * disabled, endless loop. 533 * before the system enters a disabled, endless loop.
533 */ 534 */
534static void 535static void
535con3270_unblank(void) 536con3270_flush(void)
536{ 537{
537 struct con3270 *cp; 538 struct con3270 *cp;
538 unsigned long flags; 539 unsigned long flags;
@@ -554,6 +555,23 @@ con3270_unblank(void)
554 spin_unlock_irqrestore(&cp->view.lock, flags); 555 spin_unlock_irqrestore(&cp->view.lock, flags);
555} 556}
556 557
558static int con3270_notify(struct notifier_block *self,
559 unsigned long event, void *data)
560{
561 con3270_flush();
562 return NOTIFY_OK;
563}
564
565static struct notifier_block on_panic_nb = {
566 .notifier_call = con3270_notify,
567 .priority = 0,
568};
569
570static struct notifier_block on_reboot_nb = {
571 .notifier_call = con3270_notify,
572 .priority = 0,
573};
574
557/* 575/*
558 * The console structure for the 3270 console 576 * The console structure for the 3270 console
559 */ 577 */
@@ -561,7 +579,6 @@ static struct console con3270 = {
561 .name = "tty3270", 579 .name = "tty3270",
562 .write = con3270_write, 580 .write = con3270_write,
563 .device = con3270_device, 581 .device = con3270_device,
564 .unblank = con3270_unblank,
565 .flags = CON_PRINTBUFFER, 582 .flags = CON_PRINTBUFFER,
566}; 583};
567 584
@@ -623,6 +640,8 @@ con3270_init(void)
623 condev->cline->len = 0; 640 condev->cline->len = 0;
624 con3270_create_status(condev); 641 con3270_create_status(condev);
625 condev->input = alloc_string(&condev->freemem, 80); 642 condev->input = alloc_string(&condev->freemem, 80);
643 atomic_notifier_chain_register(&panic_notifier_list, &on_panic_nb);
644 register_reboot_notifier(&on_reboot_nb);
626 register_console(&con3270); 645 register_console(&con3270);
627 return 0; 646 return 0;
628} 647}
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c
index c3dee900a5c8..1792b2c0130e 100644
--- a/drivers/s390/char/raw3270.c
+++ b/drivers/s390/char/raw3270.c
@@ -1171,7 +1171,7 @@ static int raw3270_create_attributes(struct raw3270 *rp)
1171 rp->clttydev = device_create_drvdata(class3270, &rp->cdev->dev, 1171 rp->clttydev = device_create_drvdata(class3270, &rp->cdev->dev,
1172 MKDEV(IBM_TTY3270_MAJOR, rp->minor), 1172 MKDEV(IBM_TTY3270_MAJOR, rp->minor),
1173 NULL, 1173 NULL,
1174 "tty%s", rp->cdev->dev.bus_id); 1174 "tty%s", dev_name(&rp->cdev->dev));
1175 if (IS_ERR(rp->clttydev)) { 1175 if (IS_ERR(rp->clttydev)) {
1176 rc = PTR_ERR(rp->clttydev); 1176 rc = PTR_ERR(rp->clttydev);
1177 goto out_ttydev; 1177 goto out_ttydev;
@@ -1180,7 +1180,7 @@ static int raw3270_create_attributes(struct raw3270 *rp)
1180 rp->cltubdev = device_create_drvdata(class3270, &rp->cdev->dev, 1180 rp->cltubdev = device_create_drvdata(class3270, &rp->cdev->dev,
1181 MKDEV(IBM_FS3270_MAJOR, rp->minor), 1181 MKDEV(IBM_FS3270_MAJOR, rp->minor),
1182 NULL, 1182 NULL,
1183 "tub%s", rp->cdev->dev.bus_id); 1183 "tub%s", dev_name(&rp->cdev->dev));
1184 if (!IS_ERR(rp->cltubdev)) 1184 if (!IS_ERR(rp->cltubdev))
1185 goto out; 1185 goto out;
1186 1186
diff --git a/drivers/s390/char/sclp_con.c b/drivers/s390/char/sclp_con.c
index 7e619c534bf4..9a25c4bd1421 100644
--- a/drivers/s390/char/sclp_con.c
+++ b/drivers/s390/char/sclp_con.c
@@ -16,6 +16,7 @@
16#include <linux/bootmem.h> 16#include <linux/bootmem.h>
17#include <linux/termios.h> 17#include <linux/termios.h>
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/reboot.h>
19 20
20#include "sclp.h" 21#include "sclp.h"
21#include "sclp_rw.h" 22#include "sclp_rw.h"
@@ -172,7 +173,7 @@ sclp_console_device(struct console *c, int *index)
172 * will be flushed to the SCLP. 173 * will be flushed to the SCLP.
173 */ 174 */
174static void 175static void
175sclp_console_unblank(void) 176sclp_console_flush(void)
176{ 177{
177 unsigned long flags; 178 unsigned long flags;
178 179
@@ -188,6 +189,24 @@ sclp_console_unblank(void)
188 spin_unlock_irqrestore(&sclp_con_lock, flags); 189 spin_unlock_irqrestore(&sclp_con_lock, flags);
189} 190}
190 191
192static int
193sclp_console_notify(struct notifier_block *self,
194 unsigned long event, void *data)
195{
196 sclp_console_flush();
197 return NOTIFY_OK;
198}
199
200static struct notifier_block on_panic_nb = {
201 .notifier_call = sclp_console_notify,
202 .priority = 1,
203};
204
205static struct notifier_block on_reboot_nb = {
206 .notifier_call = sclp_console_notify,
207 .priority = 1,
208};
209
191/* 210/*
192 * used to register the SCLP console to the kernel and to 211 * used to register the SCLP console to the kernel and to
193 * give printk necessary information 212 * give printk necessary information
@@ -197,7 +216,6 @@ static struct console sclp_console =
197 .name = sclp_console_name, 216 .name = sclp_console_name,
198 .write = sclp_console_write, 217 .write = sclp_console_write,
199 .device = sclp_console_device, 218 .device = sclp_console_device,
200 .unblank = sclp_console_unblank,
201 .flags = CON_PRINTBUFFER, 219 .flags = CON_PRINTBUFFER,
202 .index = 0 /* ttyS0 */ 220 .index = 0 /* ttyS0 */
203}; 221};
@@ -241,6 +259,8 @@ sclp_console_init(void)
241 sclp_con_width_htab = 8; 259 sclp_con_width_htab = 8;
242 260
243 /* enable printk-access to this driver */ 261 /* enable printk-access to this driver */
262 atomic_notifier_chain_register(&panic_notifier_list, &on_panic_nb);
263 register_reboot_notifier(&on_reboot_nb);
244 register_console(&sclp_console); 264 register_console(&sclp_console);
245 return 0; 265 return 0;
246} 266}
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c
index ad51738c4261..9854f19f5e62 100644
--- a/drivers/s390/char/sclp_vt220.c
+++ b/drivers/s390/char/sclp_vt220.c
@@ -24,6 +24,8 @@
24#include <linux/bootmem.h> 24#include <linux/bootmem.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/reboot.h>
28
27#include <asm/uaccess.h> 29#include <asm/uaccess.h>
28#include "sclp.h" 30#include "sclp.h"
29 31
@@ -743,24 +745,30 @@ sclp_vt220_con_device(struct console *c, int *index)
743 return sclp_vt220_driver; 745 return sclp_vt220_driver;
744} 746}
745 747
746/* 748static int
747 * This routine is called from panic when the kernel is going to give up. 749sclp_vt220_notify(struct notifier_block *self,
748 * We have to make sure that all buffers will be flushed to the SCLP. 750 unsigned long event, void *data)
749 * Note that this function may be called from within an interrupt context.
750 */
751static void
752sclp_vt220_con_unblank(void)
753{ 751{
754 __sclp_vt220_flush_buffer(); 752 __sclp_vt220_flush_buffer();
753 return NOTIFY_OK;
755} 754}
756 755
756static struct notifier_block on_panic_nb = {
757 .notifier_call = sclp_vt220_notify,
758 .priority = 1,
759};
760
761static struct notifier_block on_reboot_nb = {
762 .notifier_call = sclp_vt220_notify,
763 .priority = 1,
764};
765
757/* Structure needed to register with printk */ 766/* Structure needed to register with printk */
758static struct console sclp_vt220_console = 767static struct console sclp_vt220_console =
759{ 768{
760 .name = SCLP_VT220_CONSOLE_NAME, 769 .name = SCLP_VT220_CONSOLE_NAME,
761 .write = sclp_vt220_con_write, 770 .write = sclp_vt220_con_write,
762 .device = sclp_vt220_con_device, 771 .device = sclp_vt220_con_device,
763 .unblank = sclp_vt220_con_unblank,
764 .flags = CON_PRINTBUFFER, 772 .flags = CON_PRINTBUFFER,
765 .index = SCLP_VT220_CONSOLE_INDEX 773 .index = SCLP_VT220_CONSOLE_INDEX
766}; 774};
@@ -776,6 +784,8 @@ sclp_vt220_con_init(void)
776 if (rc) 784 if (rc)
777 return rc; 785 return rc;
778 /* Attach linux console */ 786 /* Attach linux console */
787 atomic_notifier_chain_register(&panic_notifier_list, &on_panic_nb);
788 register_reboot_notifier(&on_reboot_nb);
779 register_console(&sclp_vt220_console); 789 register_console(&sclp_vt220_console);
780 return 0; 790 return 0;
781} 791}
diff --git a/drivers/s390/char/tape_3590.c b/drivers/s390/char/tape_3590.c
index 839987618ffd..4005c44a404c 100644
--- a/drivers/s390/char/tape_3590.c
+++ b/drivers/s390/char/tape_3590.c
@@ -910,7 +910,7 @@ tape_3590_erp_swap(struct tape_device *device, struct tape_request *request,
910 * should proceed with the new tape... this 910 * should proceed with the new tape... this
911 * should probably be done in user space! 911 * should probably be done in user space!
912 */ 912 */
913 PRINT_WARN("(%s): Swap Tape Device!\n", device->cdev->dev.bus_id); 913 PRINT_WARN("(%s): Swap Tape Device!\n", dev_name(&device->cdev->dev));
914 return tape_3590_erp_basic(device, request, irb, -EIO); 914 return tape_3590_erp_basic(device, request, irb, -EIO);
915} 915}
916 916
@@ -1003,40 +1003,43 @@ tape_3590_print_mim_msg_f0(struct tape_device *device, struct irb *irb)
1003 /* Exception Message */ 1003 /* Exception Message */
1004 switch (sense->fmt.f70.emc) { 1004 switch (sense->fmt.f70.emc) {
1005 case 0x02: 1005 case 0x02:
1006 PRINT_WARN("(%s): Data degraded\n", device->cdev->dev.bus_id); 1006 PRINT_WARN("(%s): Data degraded\n",
1007 dev_name(&device->cdev->dev));
1007 break; 1008 break;
1008 case 0x03: 1009 case 0x03:
1009 PRINT_WARN("(%s): Data degraded in partion %i\n", 1010 PRINT_WARN("(%s): Data degraded in partion %i\n",
1010 device->cdev->dev.bus_id, sense->fmt.f70.mp); 1011 dev_name(&device->cdev->dev), sense->fmt.f70.mp);
1011 break; 1012 break;
1012 case 0x04: 1013 case 0x04:
1013 PRINT_WARN("(%s): Medium degraded\n", device->cdev->dev.bus_id); 1014 PRINT_WARN("(%s): Medium degraded\n",
1015 dev_name(&device->cdev->dev));
1014 break; 1016 break;
1015 case 0x05: 1017 case 0x05:
1016 PRINT_WARN("(%s): Medium degraded in partition %i\n", 1018 PRINT_WARN("(%s): Medium degraded in partition %i\n",
1017 device->cdev->dev.bus_id, sense->fmt.f70.mp); 1019 dev_name(&device->cdev->dev), sense->fmt.f70.mp);
1018 break; 1020 break;
1019 case 0x06: 1021 case 0x06:
1020 PRINT_WARN("(%s): Block 0 Error\n", device->cdev->dev.bus_id); 1022 PRINT_WARN("(%s): Block 0 Error\n",
1023 dev_name(&device->cdev->dev));
1021 break; 1024 break;
1022 case 0x07: 1025 case 0x07:
1023 PRINT_WARN("(%s): Medium Exception 0x%02x\n", 1026 PRINT_WARN("(%s): Medium Exception 0x%02x\n",
1024 device->cdev->dev.bus_id, sense->fmt.f70.md); 1027 dev_name(&device->cdev->dev), sense->fmt.f70.md);
1025 break; 1028 break;
1026 default: 1029 default:
1027 PRINT_WARN("(%s): MIM ExMsg: 0x%02x\n", 1030 PRINT_WARN("(%s): MIM ExMsg: 0x%02x\n",
1028 device->cdev->dev.bus_id, sense->fmt.f70.emc); 1031 dev_name(&device->cdev->dev), sense->fmt.f70.emc);
1029 break; 1032 break;
1030 } 1033 }
1031 /* Service Message */ 1034 /* Service Message */
1032 switch (sense->fmt.f70.smc) { 1035 switch (sense->fmt.f70.smc) {
1033 case 0x02: 1036 case 0x02:
1034 PRINT_WARN("(%s): Reference Media maintenance procedure %i\n", 1037 PRINT_WARN("(%s): Reference Media maintenance procedure %i\n",
1035 device->cdev->dev.bus_id, sense->fmt.f70.md); 1038 dev_name(&device->cdev->dev), sense->fmt.f70.md);
1036 break; 1039 break;
1037 default: 1040 default:
1038 PRINT_WARN("(%s): MIM ServiceMsg: 0x%02x\n", 1041 PRINT_WARN("(%s): MIM ServiceMsg: 0x%02x\n",
1039 device->cdev->dev.bus_id, sense->fmt.f70.smc); 1042 dev_name(&device->cdev->dev), sense->fmt.f70.smc);
1040 break; 1043 break;
1041 } 1044 }
1042} 1045}
@@ -1054,101 +1057,101 @@ tape_3590_print_io_sim_msg_f1(struct tape_device *device, struct irb *irb)
1054 switch (sense->fmt.f71.emc) { 1057 switch (sense->fmt.f71.emc) {
1055 case 0x01: 1058 case 0x01:
1056 PRINT_WARN("(%s): Effect of failure is unknown\n", 1059 PRINT_WARN("(%s): Effect of failure is unknown\n",
1057 device->cdev->dev.bus_id); 1060 dev_name(&device->cdev->dev));
1058 break; 1061 break;
1059 case 0x02: 1062 case 0x02:
1060 PRINT_WARN("(%s): CU Exception - no performance impact\n", 1063 PRINT_WARN("(%s): CU Exception - no performance impact\n",
1061 device->cdev->dev.bus_id); 1064 dev_name(&device->cdev->dev));
1062 break; 1065 break;
1063 case 0x03: 1066 case 0x03:
1064 PRINT_WARN("(%s): CU Exception on channel interface 0x%02x\n", 1067 PRINT_WARN("(%s): CU Exception on channel interface 0x%02x\n",
1065 device->cdev->dev.bus_id, sense->fmt.f71.md[0]); 1068 dev_name(&device->cdev->dev), sense->fmt.f71.md[0]);
1066 break; 1069 break;
1067 case 0x04: 1070 case 0x04:
1068 PRINT_WARN("(%s): CU Exception on device path 0x%02x\n", 1071 PRINT_WARN("(%s): CU Exception on device path 0x%02x\n",
1069 device->cdev->dev.bus_id, sense->fmt.f71.md[0]); 1072 dev_name(&device->cdev->dev), sense->fmt.f71.md[0]);
1070 break; 1073 break;
1071 case 0x05: 1074 case 0x05:
1072 PRINT_WARN("(%s): CU Exception on library path 0x%02x\n", 1075 PRINT_WARN("(%s): CU Exception on library path 0x%02x\n",
1073 device->cdev->dev.bus_id, sense->fmt.f71.md[0]); 1076 dev_name(&device->cdev->dev), sense->fmt.f71.md[0]);
1074 break; 1077 break;
1075 case 0x06: 1078 case 0x06:
1076 PRINT_WARN("(%s): CU Exception on node 0x%02x\n", 1079 PRINT_WARN("(%s): CU Exception on node 0x%02x\n",
1077 device->cdev->dev.bus_id, sense->fmt.f71.md[0]); 1080 dev_name(&device->cdev->dev), sense->fmt.f71.md[0]);
1078 break; 1081 break;
1079 case 0x07: 1082 case 0x07:
1080 PRINT_WARN("(%s): CU Exception on partition 0x%02x\n", 1083 PRINT_WARN("(%s): CU Exception on partition 0x%02x\n",
1081 device->cdev->dev.bus_id, sense->fmt.f71.md[0]); 1084 dev_name(&device->cdev->dev), sense->fmt.f71.md[0]);
1082 break; 1085 break;
1083 default: 1086 default:
1084 PRINT_WARN("(%s): SIM ExMsg: 0x%02x\n", 1087 PRINT_WARN("(%s): SIM ExMsg: 0x%02x\n",
1085 device->cdev->dev.bus_id, sense->fmt.f71.emc); 1088 dev_name(&device->cdev->dev), sense->fmt.f71.emc);
1086 } 1089 }
1087 /* Service Message */ 1090 /* Service Message */
1088 switch (sense->fmt.f71.smc) { 1091 switch (sense->fmt.f71.smc) {
1089 case 0x01: 1092 case 0x01:
1090 PRINT_WARN("(%s): Repair impact is unknown\n", 1093 PRINT_WARN("(%s): Repair impact is unknown\n",
1091 device->cdev->dev.bus_id); 1094 dev_name(&device->cdev->dev));
1092 break; 1095 break;
1093 case 0x02: 1096 case 0x02:
1094 PRINT_WARN("(%s): Repair will not impact cu performance\n", 1097 PRINT_WARN("(%s): Repair will not impact cu performance\n",
1095 device->cdev->dev.bus_id); 1098 dev_name(&device->cdev->dev));
1096 break; 1099 break;
1097 case 0x03: 1100 case 0x03:
1098 if (sense->fmt.f71.mdf == 0) 1101 if (sense->fmt.f71.mdf == 0)
1099 PRINT_WARN("(%s): Repair will disable node " 1102 PRINT_WARN("(%s): Repair will disable node "
1100 "0x%x on CU\n", 1103 "0x%x on CU\n",
1101 device->cdev->dev.bus_id, 1104 dev_name(&device->cdev->dev),
1102 sense->fmt.f71.md[1]); 1105 sense->fmt.f71.md[1]);
1103 else 1106 else
1104 PRINT_WARN("(%s): Repair will disable nodes " 1107 PRINT_WARN("(%s): Repair will disable nodes "
1105 "(0x%x-0x%x) on CU\n", 1108 "(0x%x-0x%x) on CU\n",
1106 device->cdev->dev.bus_id, 1109 dev_name(&device->cdev->dev),
1107 sense->fmt.f71.md[1], sense->fmt.f71.md[2]); 1110 sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
1108 break; 1111 break;
1109 case 0x04: 1112 case 0x04:
1110 if (sense->fmt.f71.mdf == 0) 1113 if (sense->fmt.f71.mdf == 0)
1111 PRINT_WARN("(%s): Repair will disable cannel path " 1114 PRINT_WARN("(%s): Repair will disable cannel path "
1112 "0x%x on CU\n", 1115 "0x%x on CU\n",
1113 device->cdev->dev.bus_id, 1116 dev_name(&device->cdev->dev),
1114 sense->fmt.f71.md[1]); 1117 sense->fmt.f71.md[1]);
1115 else 1118 else
1116 PRINT_WARN("(%s): Repair will disable cannel paths " 1119 PRINT_WARN("(%s): Repair will disable cannel paths "
1117 "(0x%x-0x%x) on CU\n", 1120 "(0x%x-0x%x) on CU\n",
1118 device->cdev->dev.bus_id, 1121 dev_name(&device->cdev->dev),
1119 sense->fmt.f71.md[1], sense->fmt.f71.md[2]); 1122 sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
1120 break; 1123 break;
1121 case 0x05: 1124 case 0x05:
1122 if (sense->fmt.f71.mdf == 0) 1125 if (sense->fmt.f71.mdf == 0)
1123 PRINT_WARN("(%s): Repair will disable device path " 1126 PRINT_WARN("(%s): Repair will disable device path "
1124 "0x%x on CU\n", 1127 "0x%x on CU\n",
1125 device->cdev->dev.bus_id, 1128 dev_name(&device->cdev->dev),
1126 sense->fmt.f71.md[1]); 1129 sense->fmt.f71.md[1]);
1127 else 1130 else
1128 PRINT_WARN("(%s): Repair will disable device paths " 1131 PRINT_WARN("(%s): Repair will disable device paths "
1129 "(0x%x-0x%x) on CU\n", 1132 "(0x%x-0x%x) on CU\n",
1130 device->cdev->dev.bus_id, 1133 dev_name(&device->cdev->dev),
1131 sense->fmt.f71.md[1], sense->fmt.f71.md[2]); 1134 sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
1132 break; 1135 break;
1133 case 0x06: 1136 case 0x06:
1134 if (sense->fmt.f71.mdf == 0) 1137 if (sense->fmt.f71.mdf == 0)
1135 PRINT_WARN("(%s): Repair will disable library path " 1138 PRINT_WARN("(%s): Repair will disable library path "
1136 "0x%x on CU\n", 1139 "0x%x on CU\n",
1137 device->cdev->dev.bus_id, 1140 dev_name(&device->cdev->dev),
1138 sense->fmt.f71.md[1]); 1141 sense->fmt.f71.md[1]);
1139 else 1142 else
1140 PRINT_WARN("(%s): Repair will disable library paths " 1143 PRINT_WARN("(%s): Repair will disable library paths "
1141 "(0x%x-0x%x) on CU\n", 1144 "(0x%x-0x%x) on CU\n",
1142 device->cdev->dev.bus_id, 1145 dev_name(&device->cdev->dev),
1143 sense->fmt.f71.md[1], sense->fmt.f71.md[2]); 1146 sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
1144 break; 1147 break;
1145 case 0x07: 1148 case 0x07:
1146 PRINT_WARN("(%s): Repair will disable access to CU\n", 1149 PRINT_WARN("(%s): Repair will disable access to CU\n",
1147 device->cdev->dev.bus_id); 1150 dev_name(&device->cdev->dev));
1148 break; 1151 break;
1149 default: 1152 default:
1150 PRINT_WARN("(%s): SIM ServiceMsg: 0x%02x\n", 1153 PRINT_WARN("(%s): SIM ServiceMsg: 0x%02x\n",
1151 device->cdev->dev.bus_id, sense->fmt.f71.smc); 1154 dev_name(&device->cdev->dev), sense->fmt.f71.smc);
1152 } 1155 }
1153} 1156}
1154 1157
@@ -1165,104 +1168,104 @@ tape_3590_print_dev_sim_msg_f2(struct tape_device *device, struct irb *irb)
1165 switch (sense->fmt.f71.emc) { 1168 switch (sense->fmt.f71.emc) {
1166 case 0x01: 1169 case 0x01:
1167 PRINT_WARN("(%s): Effect of failure is unknown\n", 1170 PRINT_WARN("(%s): Effect of failure is unknown\n",
1168 device->cdev->dev.bus_id); 1171 dev_name(&device->cdev->dev));
1169 break; 1172 break;
1170 case 0x02: 1173 case 0x02:
1171 PRINT_WARN("(%s): DV Exception - no performance impact\n", 1174 PRINT_WARN("(%s): DV Exception - no performance impact\n",
1172 device->cdev->dev.bus_id); 1175 dev_name(&device->cdev->dev));
1173 break; 1176 break;
1174 case 0x03: 1177 case 0x03:
1175 PRINT_WARN("(%s): DV Exception on channel interface 0x%02x\n", 1178 PRINT_WARN("(%s): DV Exception on channel interface 0x%02x\n",
1176 device->cdev->dev.bus_id, sense->fmt.f71.md[0]); 1179 dev_name(&device->cdev->dev), sense->fmt.f71.md[0]);
1177 break; 1180 break;
1178 case 0x04: 1181 case 0x04:
1179 PRINT_WARN("(%s): DV Exception on loader 0x%02x\n", 1182 PRINT_WARN("(%s): DV Exception on loader 0x%02x\n",
1180 device->cdev->dev.bus_id, sense->fmt.f71.md[0]); 1183 dev_name(&device->cdev->dev), sense->fmt.f71.md[0]);
1181 break; 1184 break;
1182 case 0x05: 1185 case 0x05:
1183 PRINT_WARN("(%s): DV Exception on message display 0x%02x\n", 1186 PRINT_WARN("(%s): DV Exception on message display 0x%02x\n",
1184 device->cdev->dev.bus_id, sense->fmt.f71.md[0]); 1187 dev_name(&device->cdev->dev), sense->fmt.f71.md[0]);
1185 break; 1188 break;
1186 case 0x06: 1189 case 0x06:
1187 PRINT_WARN("(%s): DV Exception in tape path\n", 1190 PRINT_WARN("(%s): DV Exception in tape path\n",
1188 device->cdev->dev.bus_id); 1191 dev_name(&device->cdev->dev));
1189 break; 1192 break;
1190 case 0x07: 1193 case 0x07:
1191 PRINT_WARN("(%s): DV Exception in drive\n", 1194 PRINT_WARN("(%s): DV Exception in drive\n",
1192 device->cdev->dev.bus_id); 1195 dev_name(&device->cdev->dev));
1193 break; 1196 break;
1194 default: 1197 default:
1195 PRINT_WARN("(%s): DSIM ExMsg: 0x%02x\n", 1198 PRINT_WARN("(%s): DSIM ExMsg: 0x%02x\n",
1196 device->cdev->dev.bus_id, sense->fmt.f71.emc); 1199 dev_name(&device->cdev->dev), sense->fmt.f71.emc);
1197 } 1200 }
1198 /* Service Message */ 1201 /* Service Message */
1199 switch (sense->fmt.f71.smc) { 1202 switch (sense->fmt.f71.smc) {
1200 case 0x01: 1203 case 0x01:
1201 PRINT_WARN("(%s): Repair impact is unknown\n", 1204 PRINT_WARN("(%s): Repair impact is unknown\n",
1202 device->cdev->dev.bus_id); 1205 dev_name(&device->cdev->dev));
1203 break; 1206 break;
1204 case 0x02: 1207 case 0x02:
1205 PRINT_WARN("(%s): Repair will not impact device performance\n", 1208 PRINT_WARN("(%s): Repair will not impact device performance\n",
1206 device->cdev->dev.bus_id); 1209 dev_name(&device->cdev->dev));
1207 break; 1210 break;
1208 case 0x03: 1211 case 0x03:
1209 if (sense->fmt.f71.mdf == 0) 1212 if (sense->fmt.f71.mdf == 0)
1210 PRINT_WARN("(%s): Repair will disable channel path " 1213 PRINT_WARN("(%s): Repair will disable channel path "
1211 "0x%x on DV\n", 1214 "0x%x on DV\n",
1212 device->cdev->dev.bus_id, 1215 dev_name(&device->cdev->dev),
1213 sense->fmt.f71.md[1]); 1216 sense->fmt.f71.md[1]);
1214 else 1217 else
1215 PRINT_WARN("(%s): Repair will disable channel path " 1218 PRINT_WARN("(%s): Repair will disable channel path "
1216 "(0x%x-0x%x) on DV\n", 1219 "(0x%x-0x%x) on DV\n",
1217 device->cdev->dev.bus_id, 1220 dev_name(&device->cdev->dev),
1218 sense->fmt.f71.md[1], sense->fmt.f71.md[2]); 1221 sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
1219 break; 1222 break;
1220 case 0x04: 1223 case 0x04:
1221 if (sense->fmt.f71.mdf == 0) 1224 if (sense->fmt.f71.mdf == 0)
1222 PRINT_WARN("(%s): Repair will disable interface 0x%x " 1225 PRINT_WARN("(%s): Repair will disable interface 0x%x "
1223 "on DV\n", 1226 "on DV\n",
1224 device->cdev->dev.bus_id, 1227 dev_name(&device->cdev->dev),
1225 sense->fmt.f71.md[1]); 1228 sense->fmt.f71.md[1]);
1226 else 1229 else
1227 PRINT_WARN("(%s): Repair will disable interfaces " 1230 PRINT_WARN("(%s): Repair will disable interfaces "
1228 "(0x%x-0x%x) on DV\n", 1231 "(0x%x-0x%x) on DV\n",
1229 device->cdev->dev.bus_id, 1232 dev_name(&device->cdev->dev),
1230 sense->fmt.f71.md[1], sense->fmt.f71.md[2]); 1233 sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
1231 break; 1234 break;
1232 case 0x05: 1235 case 0x05:
1233 if (sense->fmt.f71.mdf == 0) 1236 if (sense->fmt.f71.mdf == 0)
1234 PRINT_WARN("(%s): Repair will disable loader 0x%x " 1237 PRINT_WARN("(%s): Repair will disable loader 0x%x "
1235 "on DV\n", 1238 "on DV\n",
1236 device->cdev->dev.bus_id, 1239 dev_name(&device->cdev->dev),
1237 sense->fmt.f71.md[1]); 1240 sense->fmt.f71.md[1]);
1238 else 1241 else
1239 PRINT_WARN("(%s): Repair will disable loader " 1242 PRINT_WARN("(%s): Repair will disable loader "
1240 "(0x%x-0x%x) on DV\n", 1243 "(0x%x-0x%x) on DV\n",
1241 device->cdev->dev.bus_id, 1244 dev_name(&device->cdev->dev),
1242 sense->fmt.f71.md[1], sense->fmt.f71.md[2]); 1245 sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
1243 break; 1246 break;
1244 case 0x07: 1247 case 0x07:
1245 PRINT_WARN("(%s): Repair will disable access to DV\n", 1248 PRINT_WARN("(%s): Repair will disable access to DV\n",
1246 device->cdev->dev.bus_id); 1249 dev_name(&device->cdev->dev));
1247 break; 1250 break;
1248 case 0x08: 1251 case 0x08:
1249 if (sense->fmt.f71.mdf == 0) 1252 if (sense->fmt.f71.mdf == 0)
1250 PRINT_WARN("(%s): Repair will disable message " 1253 PRINT_WARN("(%s): Repair will disable message "
1251 "display 0x%x on DV\n", 1254 "display 0x%x on DV\n",
1252 device->cdev->dev.bus_id, 1255 dev_name(&device->cdev->dev),
1253 sense->fmt.f71.md[1]); 1256 sense->fmt.f71.md[1]);
1254 else 1257 else
1255 PRINT_WARN("(%s): Repair will disable message " 1258 PRINT_WARN("(%s): Repair will disable message "
1256 "displays (0x%x-0x%x) on DV\n", 1259 "displays (0x%x-0x%x) on DV\n",
1257 device->cdev->dev.bus_id, 1260 dev_name(&device->cdev->dev),
1258 sense->fmt.f71.md[1], sense->fmt.f71.md[2]); 1261 sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
1259 break; 1262 break;
1260 case 0x09: 1263 case 0x09:
1261 PRINT_WARN("(%s): Clean DV\n", device->cdev->dev.bus_id); 1264 PRINT_WARN("(%s): Clean DV\n", dev_name(&device->cdev->dev));
1262 break; 1265 break;
1263 default: 1266 default:
1264 PRINT_WARN("(%s): DSIM ServiceMsg: 0x%02x\n", 1267 PRINT_WARN("(%s): DSIM ServiceMsg: 0x%02x\n",
1265 device->cdev->dev.bus_id, sense->fmt.f71.smc); 1268 dev_name(&device->cdev->dev), sense->fmt.f71.smc);
1266 } 1269 }
1267} 1270}
1268 1271
@@ -1279,18 +1282,18 @@ tape_3590_print_era_msg(struct tape_device *device, struct irb *irb)
1279 return; 1282 return;
1280 if ((sense->mc > 0) && (sense->mc < TAPE_3590_MAX_MSG)) { 1283 if ((sense->mc > 0) && (sense->mc < TAPE_3590_MAX_MSG)) {
1281 if (tape_3590_msg[sense->mc] != NULL) 1284 if (tape_3590_msg[sense->mc] != NULL)
1282 PRINT_WARN("(%s): %s\n", device->cdev->dev.bus_id, 1285 PRINT_WARN("(%s): %s\n", dev_name(&device->cdev->dev),
1283 tape_3590_msg[sense->mc]); 1286 tape_3590_msg[sense->mc]);
1284 else { 1287 else {
1285 PRINT_WARN("(%s): Message Code 0x%x\n", 1288 PRINT_WARN("(%s): Message Code 0x%x\n",
1286 device->cdev->dev.bus_id, sense->mc); 1289 dev_name(&device->cdev->dev), sense->mc);
1287 } 1290 }
1288 return; 1291 return;
1289 } 1292 }
1290 if (sense->mc == 0xf0) { 1293 if (sense->mc == 0xf0) {
1291 /* Standard Media Information Message */ 1294 /* Standard Media Information Message */
1292 PRINT_WARN("(%s): MIM SEV=%i, MC=%02x, ES=%x/%x, " 1295 PRINT_WARN("(%s): MIM SEV=%i, MC=%02x, ES=%x/%x, "
1293 "RC=%02x-%04x-%02x\n", device->cdev->dev.bus_id, 1296 "RC=%02x-%04x-%02x\n", dev_name(&device->cdev->dev),
1294 sense->fmt.f70.sev, sense->mc, 1297 sense->fmt.f70.sev, sense->mc,
1295 sense->fmt.f70.emc, sense->fmt.f70.smc, 1298 sense->fmt.f70.emc, sense->fmt.f70.smc,
1296 sense->fmt.f70.refcode, sense->fmt.f70.mid, 1299 sense->fmt.f70.refcode, sense->fmt.f70.mid,
@@ -1302,7 +1305,7 @@ tape_3590_print_era_msg(struct tape_device *device, struct irb *irb)
1302 /* Standard I/O Subsystem Service Information Message */ 1305 /* Standard I/O Subsystem Service Information Message */
1303 PRINT_WARN("(%s): IOSIM SEV=%i, DEVTYPE=3590/%02x, " 1306 PRINT_WARN("(%s): IOSIM SEV=%i, DEVTYPE=3590/%02x, "
1304 "MC=%02x, ES=%x/%x, REF=0x%04x-0x%04x-0x%04x\n", 1307 "MC=%02x, ES=%x/%x, REF=0x%04x-0x%04x-0x%04x\n",
1305 device->cdev->dev.bus_id, sense->fmt.f71.sev, 1308 dev_name(&device->cdev->dev), sense->fmt.f71.sev,
1306 device->cdev->id.dev_model, 1309 device->cdev->id.dev_model,
1307 sense->mc, sense->fmt.f71.emc, 1310 sense->mc, sense->fmt.f71.emc,
1308 sense->fmt.f71.smc, sense->fmt.f71.refcode1, 1311 sense->fmt.f71.smc, sense->fmt.f71.refcode1,
@@ -1314,7 +1317,7 @@ tape_3590_print_era_msg(struct tape_device *device, struct irb *irb)
1314 /* Standard Device Service Information Message */ 1317 /* Standard Device Service Information Message */
1315 PRINT_WARN("(%s): DEVSIM SEV=%i, DEVTYPE=3590/%02x, " 1318 PRINT_WARN("(%s): DEVSIM SEV=%i, DEVTYPE=3590/%02x, "
1316 "MC=%02x, ES=%x/%x, REF=0x%04x-0x%04x-0x%04x\n", 1319 "MC=%02x, ES=%x/%x, REF=0x%04x-0x%04x-0x%04x\n",
1317 device->cdev->dev.bus_id, sense->fmt.f71.sev, 1320 dev_name(&device->cdev->dev), sense->fmt.f71.sev,
1318 device->cdev->id.dev_model, 1321 device->cdev->id.dev_model,
1319 sense->mc, sense->fmt.f71.emc, 1322 sense->mc, sense->fmt.f71.emc,
1320 sense->fmt.f71.smc, sense->fmt.f71.refcode1, 1323 sense->fmt.f71.smc, sense->fmt.f71.refcode1,
@@ -1327,7 +1330,7 @@ tape_3590_print_era_msg(struct tape_device *device, struct irb *irb)
1327 return; 1330 return;
1328 } 1331 }
1329 PRINT_WARN("(%s): Device Message(%x)\n", 1332 PRINT_WARN("(%s): Device Message(%x)\n",
1330 device->cdev->dev.bus_id, sense->mc); 1333 dev_name(&device->cdev->dev), sense->mc);
1331} 1334}
1332 1335
1333static int tape_3590_crypt_error(struct tape_device *device, 1336static int tape_3590_crypt_error(struct tape_device *device,
@@ -1336,10 +1339,11 @@ static int tape_3590_crypt_error(struct tape_device *device,
1336 u8 cu_rc, ekm_rc1; 1339 u8 cu_rc, ekm_rc1;
1337 u16 ekm_rc2; 1340 u16 ekm_rc2;
1338 u32 drv_rc; 1341 u32 drv_rc;
1339 char *bus_id, *sense; 1342 const char *bus_id;
1343 char *sense;
1340 1344
1341 sense = ((struct tape_3590_sense *) irb->ecw)->fmt.data; 1345 sense = ((struct tape_3590_sense *) irb->ecw)->fmt.data;
1342 bus_id = device->cdev->dev.bus_id; 1346 bus_id = dev_name(&device->cdev->dev);
1343 cu_rc = sense[0]; 1347 cu_rc = sense[0];
1344 drv_rc = *((u32*) &sense[5]) & 0xffffff; 1348 drv_rc = *((u32*) &sense[5]) & 0xffffff;
1345 ekm_rc1 = sense[9]; 1349 ekm_rc1 = sense[9];
@@ -1440,7 +1444,7 @@ tape_3590_unit_check(struct tape_device *device, struct tape_request *request,
1440 * "device intervention" is not very meaningfull 1444 * "device intervention" is not very meaningfull
1441 */ 1445 */
1442 PRINT_WARN("(%s): Tape operation when medium not loaded\n", 1446 PRINT_WARN("(%s): Tape operation when medium not loaded\n",
1443 device->cdev->dev.bus_id); 1447 dev_name(&device->cdev->dev));
1444 tape_med_state_set(device, MS_UNLOADED); 1448 tape_med_state_set(device, MS_UNLOADED);
1445 tape_3590_schedule_work(device, TO_CRYPT_OFF); 1449 tape_3590_schedule_work(device, TO_CRYPT_OFF);
1446 return tape_3590_erp_basic(device, request, irb, -ENOMEDIUM); 1450 return tape_3590_erp_basic(device, request, irb, -ENOMEDIUM);
@@ -1487,18 +1491,18 @@ tape_3590_unit_check(struct tape_device *device, struct tape_request *request,
1487 1491
1488 case 0x6020: 1492 case 0x6020:
1489 PRINT_WARN("(%s): Cartridge of wrong type ?\n", 1493 PRINT_WARN("(%s): Cartridge of wrong type ?\n",
1490 device->cdev->dev.bus_id); 1494 dev_name(&device->cdev->dev));
1491 return tape_3590_erp_basic(device, request, irb, -EMEDIUMTYPE); 1495 return tape_3590_erp_basic(device, request, irb, -EMEDIUMTYPE);
1492 1496
1493 case 0x8011: 1497 case 0x8011:
1494 PRINT_WARN("(%s): Another host has reserved the tape device\n", 1498 PRINT_WARN("(%s): Another host has reserved the tape device\n",
1495 device->cdev->dev.bus_id); 1499 dev_name(&device->cdev->dev));
1496 return tape_3590_erp_basic(device, request, irb, -EPERM); 1500 return tape_3590_erp_basic(device, request, irb, -EPERM);
1497 case 0x8013: 1501 case 0x8013:
1498 PRINT_WARN("(%s): Another host has privileged access to the " 1502 PRINT_WARN("(%s): Another host has privileged access to the "
1499 "tape device\n", device->cdev->dev.bus_id); 1503 "tape device\n", dev_name(&device->cdev->dev));
1500 PRINT_WARN("(%s): To solve the problem unload the current " 1504 PRINT_WARN("(%s): To solve the problem unload the current "
1501 "cartridge!\n", device->cdev->dev.bus_id); 1505 "cartridge!\n", dev_name(&device->cdev->dev));
1502 return tape_3590_erp_basic(device, request, irb, -EPERM); 1506 return tape_3590_erp_basic(device, request, irb, -EPERM);
1503 default: 1507 default:
1504 return tape_3590_erp_basic(device, request, irb, -EIO); 1508 return tape_3590_erp_basic(device, request, irb, -EIO);
diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c
index 95da72bc17e8..a25b8bf54f41 100644
--- a/drivers/s390/char/tape_block.c
+++ b/drivers/s390/char/tape_block.c
@@ -278,7 +278,7 @@ tapeblock_cleanup_device(struct tape_device *device)
278 278
279 if (!device->blk_data.disk) { 279 if (!device->blk_data.disk) {
280 PRINT_ERR("(%s): No gendisk to clean up!\n", 280 PRINT_ERR("(%s): No gendisk to clean up!\n",
281 device->cdev->dev.bus_id); 281 dev_name(&device->cdev->dev));
282 goto cleanup_queue; 282 goto cleanup_queue;
283 } 283 }
284 284
diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c
index 181a5441af16..d7073dbf825c 100644
--- a/drivers/s390/char/tape_core.c
+++ b/drivers/s390/char/tape_core.c
@@ -215,12 +215,12 @@ tape_med_state_set(struct tape_device *device, enum tape_medium_state newstate)
215 case MS_UNLOADED: 215 case MS_UNLOADED:
216 device->tape_generic_status |= GMT_DR_OPEN(~0); 216 device->tape_generic_status |= GMT_DR_OPEN(~0);
217 PRINT_INFO("(%s): Tape is unloaded\n", 217 PRINT_INFO("(%s): Tape is unloaded\n",
218 device->cdev->dev.bus_id); 218 dev_name(&device->cdev->dev));
219 break; 219 break;
220 case MS_LOADED: 220 case MS_LOADED:
221 device->tape_generic_status &= ~GMT_DR_OPEN(~0); 221 device->tape_generic_status &= ~GMT_DR_OPEN(~0);
222 PRINT_INFO("(%s): Tape has been mounted\n", 222 PRINT_INFO("(%s): Tape has been mounted\n",
223 device->cdev->dev.bus_id); 223 dev_name(&device->cdev->dev));
224 break; 224 break;
225 default: 225 default:
226 // print nothing 226 // print nothing
@@ -415,7 +415,7 @@ tape_generic_offline(struct tape_device *device)
415 device->cdev_id); 415 device->cdev_id);
416 PRINT_WARN("(%s): Set offline failed " 416 PRINT_WARN("(%s): Set offline failed "
417 "- drive in use.\n", 417 "- drive in use.\n",
418 device->cdev->dev.bus_id); 418 dev_name(&device->cdev->dev));
419 spin_unlock_irq(get_ccwdev_lock(device->cdev)); 419 spin_unlock_irq(get_ccwdev_lock(device->cdev));
420 return -EBUSY; 420 return -EBUSY;
421 } 421 }
@@ -538,7 +538,8 @@ tape_generic_probe(struct ccw_device *cdev)
538 ret = sysfs_create_group(&cdev->dev.kobj, &tape_attr_group); 538 ret = sysfs_create_group(&cdev->dev.kobj, &tape_attr_group);
539 if (ret) { 539 if (ret) {
540 tape_put_device(device); 540 tape_put_device(device);
541 PRINT_ERR("probe failed for tape device %s\n", cdev->dev.bus_id); 541 PRINT_ERR("probe failed for tape device %s\n",
542 dev_name(&cdev->dev));
542 return ret; 543 return ret;
543 } 544 }
544 cdev->dev.driver_data = device; 545 cdev->dev.driver_data = device;
@@ -546,7 +547,7 @@ tape_generic_probe(struct ccw_device *cdev)
546 device->cdev = cdev; 547 device->cdev = cdev;
547 ccw_device_get_id(cdev, &dev_id); 548 ccw_device_get_id(cdev, &dev_id);
548 device->cdev_id = devid_to_int(&dev_id); 549 device->cdev_id = devid_to_int(&dev_id);
549 PRINT_INFO("tape device %s found\n", cdev->dev.bus_id); 550 PRINT_INFO("tape device %s found\n", dev_name(&cdev->dev));
550 return ret; 551 return ret;
551} 552}
552 553
@@ -616,7 +617,7 @@ tape_generic_remove(struct ccw_device *cdev)
616 device->cdev_id); 617 device->cdev_id);
617 PRINT_WARN("(%s): Drive in use vanished - " 618 PRINT_WARN("(%s): Drive in use vanished - "
618 "expect trouble!\n", 619 "expect trouble!\n",
619 device->cdev->dev.bus_id); 620 dev_name(&device->cdev->dev));
620 PRINT_WARN("State was %i\n", device->tape_state); 621 PRINT_WARN("State was %i\n", device->tape_state);
621 tape_state_set(device, TS_NOT_OPER); 622 tape_state_set(device, TS_NOT_OPER);
622 __tape_discard_requests(device); 623 __tape_discard_requests(device);
@@ -840,7 +841,7 @@ tape_dump_sense(struct tape_device* device, struct tape_request *request,
840 PRINT_INFO("-------------------------------------------------\n"); 841 PRINT_INFO("-------------------------------------------------\n");
841 PRINT_INFO("DSTAT : %02x CSTAT: %02x CPA: %04x\n", 842 PRINT_INFO("DSTAT : %02x CSTAT: %02x CPA: %04x\n",
842 irb->scsw.cmd.dstat, irb->scsw.cmd.cstat, irb->scsw.cmd.cpa); 843 irb->scsw.cmd.dstat, irb->scsw.cmd.cstat, irb->scsw.cmd.cpa);
843 PRINT_INFO("DEVICE: %s\n", device->cdev->dev.bus_id); 844 PRINT_INFO("DEVICE: %s\n", dev_name(&device->cdev->dev));
844 if (request != NULL) 845 if (request != NULL)
845 PRINT_INFO("OP : %s\n", tape_op_verbose[request->op]); 846 PRINT_INFO("OP : %s\n", tape_op_verbose[request->op]);
846 847
@@ -1051,7 +1052,7 @@ __tape_do_irq (struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
1051 device = (struct tape_device *) cdev->dev.driver_data; 1052 device = (struct tape_device *) cdev->dev.driver_data;
1052 if (device == NULL) { 1053 if (device == NULL) {
1053 PRINT_ERR("could not get device structure for %s " 1054 PRINT_ERR("could not get device structure for %s "
1054 "in interrupt\n", cdev->dev.bus_id); 1055 "in interrupt\n", dev_name(&cdev->dev));
1055 return; 1056 return;
1056 } 1057 }
1057 request = (struct tape_request *) intparm; 1058 request = (struct tape_request *) intparm;
@@ -1064,13 +1065,13 @@ __tape_do_irq (struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
1064 switch (PTR_ERR(irb)) { 1065 switch (PTR_ERR(irb)) {
1065 case -ETIMEDOUT: 1066 case -ETIMEDOUT:
1066 PRINT_WARN("(%s): Request timed out\n", 1067 PRINT_WARN("(%s): Request timed out\n",
1067 cdev->dev.bus_id); 1068 dev_name(&cdev->dev));
1068 case -EIO: 1069 case -EIO:
1069 __tape_end_request(device, request, -EIO); 1070 __tape_end_request(device, request, -EIO);
1070 break; 1071 break;
1071 default: 1072 default:
1072 PRINT_ERR("(%s): Unexpected i/o error %li\n", 1073 PRINT_ERR("(%s): Unexpected i/o error %li\n",
1073 cdev->dev.bus_id, 1074 dev_name(&cdev->dev),
1074 PTR_ERR(irb)); 1075 PTR_ERR(irb));
1075 } 1076 }
1076 return; 1077 return;
diff --git a/drivers/s390/char/tape_proc.c b/drivers/s390/char/tape_proc.c
index e7c888c14e71..8a376af926a7 100644
--- a/drivers/s390/char/tape_proc.c
+++ b/drivers/s390/char/tape_proc.c
@@ -52,7 +52,7 @@ static int tape_proc_show(struct seq_file *m, void *v)
52 return 0; 52 return 0;
53 spin_lock_irq(get_ccwdev_lock(device->cdev)); 53 spin_lock_irq(get_ccwdev_lock(device->cdev));
54 seq_printf(m, "%d\t", (int) n); 54 seq_printf(m, "%d\t", (int) n);
55 seq_printf(m, "%-10.10s ", device->cdev->dev.bus_id); 55 seq_printf(m, "%-10.10s ", dev_name(&device->cdev->dev));
56 seq_printf(m, "%04X/", device->cdev->id.cu_type); 56 seq_printf(m, "%04X/", device->cdev->id.cu_type);
57 seq_printf(m, "%02X\t", device->cdev->id.cu_model); 57 seq_printf(m, "%02X\t", device->cdev->id.cu_model);
58 seq_printf(m, "%04X/", device->cdev->id.dev_type); 58 seq_printf(m, "%04X/", device->cdev->id.dev_type);
diff --git a/drivers/s390/char/tape_std.c b/drivers/s390/char/tape_std.c
index cc8fd781ee22..5bd573d144d6 100644
--- a/drivers/s390/char/tape_std.c
+++ b/drivers/s390/char/tape_std.c
@@ -47,7 +47,7 @@ tape_std_assign_timeout(unsigned long data)
47 rc = tape_cancel_io(device, request); 47 rc = tape_cancel_io(device, request);
48 if(rc) 48 if(rc)
49 PRINT_ERR("(%s): Assign timeout: Cancel failed with rc = %i\n", 49 PRINT_ERR("(%s): Assign timeout: Cancel failed with rc = %i\n",
50 device->cdev->dev.bus_id, rc); 50 dev_name(&device->cdev->dev), rc);
51 51
52} 52}
53 53
@@ -83,7 +83,7 @@ tape_std_assign(struct tape_device *device)
83 83
84 if (rc != 0) { 84 if (rc != 0) {
85 PRINT_WARN("%s: assign failed - device might be busy\n", 85 PRINT_WARN("%s: assign failed - device might be busy\n",
86 device->cdev->dev.bus_id); 86 dev_name(&device->cdev->dev));
87 DBF_EVENT(3, "%08x: assign failed - device might be busy\n", 87 DBF_EVENT(3, "%08x: assign failed - device might be busy\n",
88 device->cdev_id); 88 device->cdev_id);
89 } else { 89 } else {
@@ -106,7 +106,7 @@ tape_std_unassign (struct tape_device *device)
106 DBF_EVENT(3, "(%08x): Can't unassign device\n", 106 DBF_EVENT(3, "(%08x): Can't unassign device\n",
107 device->cdev_id); 107 device->cdev_id);
108 PRINT_WARN("(%s): Can't unassign device - device gone\n", 108 PRINT_WARN("(%s): Can't unassign device - device gone\n",
109 device->cdev->dev.bus_id); 109 dev_name(&device->cdev->dev));
110 return -EIO; 110 return -EIO;
111 } 111 }
112 112
@@ -120,7 +120,8 @@ tape_std_unassign (struct tape_device *device)
120 120
121 if ((rc = tape_do_io(device, request)) != 0) { 121 if ((rc = tape_do_io(device, request)) != 0) {
122 DBF_EVENT(3, "%08x: Unassign failed\n", device->cdev_id); 122 DBF_EVENT(3, "%08x: Unassign failed\n", device->cdev_id);
123 PRINT_WARN("%s: Unassign failed\n", device->cdev->dev.bus_id); 123 PRINT_WARN("%s: Unassign failed\n",
124 dev_name(&device->cdev->dev));
124 } else { 125 } else {
125 DBF_EVENT(3, "%08x: Tape unassigned\n", device->cdev_id); 126 DBF_EVENT(3, "%08x: Tape unassigned\n", device->cdev_id);
126 } 127 }
@@ -634,10 +635,10 @@ tape_std_mtcompression(struct tape_device *device, int mt_count)
634 DBF_EXCEPTION(6, "xcom parm\n"); 635 DBF_EXCEPTION(6, "xcom parm\n");
635 if (*device->modeset_byte & 0x08) 636 if (*device->modeset_byte & 0x08)
636 PRINT_INFO("(%s) Compression is currently on\n", 637 PRINT_INFO("(%s) Compression is currently on\n",
637 device->cdev->dev.bus_id); 638 dev_name(&device->cdev->dev));
638 else 639 else
639 PRINT_INFO("(%s) Compression is currently off\n", 640 PRINT_INFO("(%s) Compression is currently off\n",
640 device->cdev->dev.bus_id); 641 dev_name(&device->cdev->dev));
641 PRINT_INFO("Use 1 to switch compression on, 0 to " 642 PRINT_INFO("Use 1 to switch compression on, 0 to "
642 "switch it off\n"); 643 "switch it off\n");
643 return -EINVAL; 644 return -EINVAL;
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c
index c31faefa2b3b..42173cc34610 100644
--- a/drivers/s390/char/vmlogrdr.c
+++ b/drivers/s390/char/vmlogrdr.c
@@ -724,8 +724,7 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv)
724 724
725 dev = kzalloc(sizeof(struct device), GFP_KERNEL); 725 dev = kzalloc(sizeof(struct device), GFP_KERNEL);
726 if (dev) { 726 if (dev) {
727 snprintf(dev->bus_id, BUS_ID_SIZE, "%s", 727 dev_set_name(dev, priv->internal_name);
728 priv->internal_name);
729 dev->bus = &iucv_bus; 728 dev->bus = &iucv_bus;
730 dev->parent = iucv_root; 729 dev->parent = iucv_root;
731 dev->driver = &vmlogrdr_driver; 730 dev->driver = &vmlogrdr_driver;
@@ -751,7 +750,7 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv)
751 priv->class_device = device_create_drvdata(vmlogrdr_class, dev, 750 priv->class_device = device_create_drvdata(vmlogrdr_class, dev,
752 MKDEV(vmlogrdr_major, 751 MKDEV(vmlogrdr_major,
753 priv->minor_num), 752 priv->minor_num),
754 priv, "%s", dev->bus_id); 753 priv, "%s", dev_name(dev));
755 if (IS_ERR(priv->class_device)) { 754 if (IS_ERR(priv->class_device)) {
756 ret = PTR_ERR(priv->class_device); 755 ret = PTR_ERR(priv->class_device);
757 priv->class_device=NULL; 756 priv->class_device=NULL;
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c
index c1f352b84868..6fdfa5ddeca8 100644
--- a/drivers/s390/char/vmur.c
+++ b/drivers/s390/char/vmur.c
@@ -886,11 +886,11 @@ static int ur_set_online(struct ccw_device *cdev)
886 goto fail_free_cdev; 886 goto fail_free_cdev;
887 if (urd->cdev->id.cu_type == READER_PUNCH_DEVTYPE) { 887 if (urd->cdev->id.cu_type == READER_PUNCH_DEVTYPE) {
888 if (urd->class == DEV_CLASS_UR_I) 888 if (urd->class == DEV_CLASS_UR_I)
889 sprintf(node_id, "vmrdr-%s", cdev->dev.bus_id); 889 sprintf(node_id, "vmrdr-%s", dev_name(&cdev->dev));
890 if (urd->class == DEV_CLASS_UR_O) 890 if (urd->class == DEV_CLASS_UR_O)
891 sprintf(node_id, "vmpun-%s", cdev->dev.bus_id); 891 sprintf(node_id, "vmpun-%s", dev_name(&cdev->dev));
892 } else if (urd->cdev->id.cu_type == PRINTER_DEVTYPE) { 892 } else if (urd->cdev->id.cu_type == PRINTER_DEVTYPE) {
893 sprintf(node_id, "vmprt-%s", cdev->dev.bus_id); 893 sprintf(node_id, "vmprt-%s", dev_name(&cdev->dev));
894 } else { 894 } else {
895 rc = -EOPNOTSUPP; 895 rc = -EOPNOTSUPP;
896 goto fail_free_cdev; 896 goto fail_free_cdev;
diff --git a/drivers/s390/cio/blacklist.c b/drivers/s390/cio/blacklist.c
index 0bfcbbe375c4..2f547b840ef0 100644
--- a/drivers/s390/cio/blacklist.c
+++ b/drivers/s390/cio/blacklist.c
@@ -24,6 +24,7 @@
24#include "cio.h" 24#include "cio.h"
25#include "cio_debug.h" 25#include "cio_debug.h"
26#include "css.h" 26#include "css.h"
27#include "device.h"
27 28
28/* 29/*
29 * "Blacklisting" of certain devices: 30 * "Blacklisting" of certain devices:
@@ -191,9 +192,9 @@ static int blacklist_parse_parameters(char *str, range_action action,
191 rc = blacklist_range(ra, from_ssid, to_ssid, from, to, 192 rc = blacklist_range(ra, from_ssid, to_ssid, from, to,
192 msgtrigger); 193 msgtrigger);
193 if (rc) 194 if (rc)
194 totalrc = 1; 195 totalrc = -EINVAL;
195 } else 196 } else
196 totalrc = 1; 197 totalrc = -EINVAL;
197 } 198 }
198 199
199 return totalrc; 200 return totalrc;
@@ -240,8 +241,10 @@ static int blacklist_parse_proc_parameters(char *buf)
240 rc = blacklist_parse_parameters(buf, free, 0); 241 rc = blacklist_parse_parameters(buf, free, 0);
241 else if (strcmp("add", parm) == 0) 242 else if (strcmp("add", parm) == 0)
242 rc = blacklist_parse_parameters(buf, add, 0); 243 rc = blacklist_parse_parameters(buf, add, 0);
244 else if (strcmp("purge", parm) == 0)
245 return ccw_purge_blacklisted();
243 else 246 else
244 return 1; 247 return -EINVAL;
245 248
246 css_schedule_reprobe(); 249 css_schedule_reprobe();
247 250
@@ -353,7 +356,7 @@ cio_ignore_write(struct file *file, const char __user *user_buf,
353 } 356 }
354 ret = blacklist_parse_proc_parameters(buf); 357 ret = blacklist_parse_proc_parameters(buf);
355 if (ret) 358 if (ret)
356 rc = -EINVAL; 359 rc = ret;
357 else 360 else
358 rc = user_len; 361 rc = user_len;
359 362
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
index 9a50f245774b..3ac2c2019f5e 100644
--- a/drivers/s390/cio/ccwgroup.c
+++ b/drivers/s390/cio/ccwgroup.c
@@ -269,8 +269,7 @@ int ccwgroup_create_from_string(struct device *root, unsigned int creator_id,
269 goto error; 269 goto error;
270 } 270 }
271 271
272 snprintf (gdev->dev.bus_id, BUS_ID_SIZE, "%s", 272 dev_set_name(&gdev->dev, "%s", dev_name(&gdev->cdev[0]->dev));
273 gdev->cdev[0]->dev.bus_id);
274 273
275 rc = device_add(&gdev->dev); 274 rc = device_add(&gdev->dev);
276 if (rc) 275 if (rc)
diff --git a/drivers/s390/cio/chp.c b/drivers/s390/cio/chp.c
index f1216cf6fa8f..1246f61a5338 100644
--- a/drivers/s390/cio/chp.c
+++ b/drivers/s390/cio/chp.c
@@ -393,8 +393,7 @@ int chp_new(struct chp_id chpid)
393 chp->state = 1; 393 chp->state = 1;
394 chp->dev.parent = &channel_subsystems[chpid.cssid]->device; 394 chp->dev.parent = &channel_subsystems[chpid.cssid]->device;
395 chp->dev.release = chp_release; 395 chp->dev.release = chp_release;
396 snprintf(chp->dev.bus_id, BUS_ID_SIZE, "chp%x.%02x", chpid.cssid, 396 dev_set_name(&chp->dev, "chp%x.%02x", chpid.cssid, chpid.id);
397 chpid.id);
398 397
399 /* Obtain channel path description and fill it in. */ 398 /* Obtain channel path description and fill it in. */
400 ret = chsc_determine_base_channel_path_desc(chpid, &chp->desc); 399 ret = chsc_determine_base_channel_path_desc(chpid, &chp->desc);
diff --git a/drivers/s390/cio/chsc_sch.c b/drivers/s390/cio/chsc_sch.c
index 91ca87aa9f97..f49f0e502b8d 100644
--- a/drivers/s390/cio/chsc_sch.c
+++ b/drivers/s390/cio/chsc_sch.c
@@ -261,7 +261,7 @@ static int chsc_examine_irb(struct chsc_request *request)
261{ 261{
262 int backed_up; 262 int backed_up;
263 263
264 if (!scsw_stctl(&request->irb.scsw) & SCSW_STCTL_STATUS_PEND) 264 if (!(scsw_stctl(&request->irb.scsw) & SCSW_STCTL_STATUS_PEND))
265 return -EIO; 265 return -EIO;
266 backed_up = scsw_cstat(&request->irb.scsw) & SCHN_STAT_CHAIN_CHECK; 266 backed_up = scsw_cstat(&request->irb.scsw) & SCHN_STAT_CHAIN_CHECK;
267 request->irb.scsw.cmd.cstat &= ~SCHN_STAT_CHAIN_CHECK; 267 request->irb.scsw.cmd.cstat &= ~SCHN_STAT_CHAIN_CHECK;
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c
index 326f4cc7f92c..3db2c386546f 100644
--- a/drivers/s390/cio/cio.c
+++ b/drivers/s390/cio/cio.c
@@ -114,6 +114,7 @@ cio_tpi(void)
114 struct tpi_info *tpi_info; 114 struct tpi_info *tpi_info;
115 struct subchannel *sch; 115 struct subchannel *sch;
116 struct irb *irb; 116 struct irb *irb;
117 int irq_context;
117 118
118 tpi_info = (struct tpi_info *) __LC_SUBCHANNEL_ID; 119 tpi_info = (struct tpi_info *) __LC_SUBCHANNEL_ID;
119 if (tpi (NULL) != 1) 120 if (tpi (NULL) != 1)
@@ -126,7 +127,9 @@ cio_tpi(void)
126 sch = (struct subchannel *)(unsigned long)tpi_info->intparm; 127 sch = (struct subchannel *)(unsigned long)tpi_info->intparm;
127 if (!sch) 128 if (!sch)
128 return 1; 129 return 1;
129 local_bh_disable(); 130 irq_context = in_interrupt();
131 if (!irq_context)
132 local_bh_disable();
130 irq_enter (); 133 irq_enter ();
131 spin_lock(sch->lock); 134 spin_lock(sch->lock);
132 memcpy(&sch->schib.scsw, &irb->scsw, sizeof(union scsw)); 135 memcpy(&sch->schib.scsw, &irb->scsw, sizeof(union scsw));
@@ -134,7 +137,8 @@ cio_tpi(void)
134 sch->driver->irq(sch); 137 sch->driver->irq(sch);
135 spin_unlock(sch->lock); 138 spin_unlock(sch->lock);
136 irq_exit (); 139 irq_exit ();
137 _local_bh_enable(); 140 if (!irq_context)
141 _local_bh_enable();
138 return 1; 142 return 1;
139} 143}
140 144
@@ -153,7 +157,7 @@ cio_start_handle_notoper(struct subchannel *sch, __u8 lpm)
153 CIO_MSG_EVENT(2, "cio_start: 'not oper' status for " 157 CIO_MSG_EVENT(2, "cio_start: 'not oper' status for "
154 "subchannel 0.%x.%04x!\n", sch->schid.ssid, 158 "subchannel 0.%x.%04x!\n", sch->schid.ssid,
155 sch->schid.sch_no); 159 sch->schid.sch_no);
156 sprintf(dbf_text, "no%s", sch->dev.bus_id); 160 sprintf(dbf_text, "no%s", dev_name(&sch->dev));
157 CIO_TRACE_EVENT(0, dbf_text); 161 CIO_TRACE_EVENT(0, dbf_text);
158 CIO_HEX_EVENT(0, &sch->schib, sizeof (struct schib)); 162 CIO_HEX_EVENT(0, &sch->schib, sizeof (struct schib));
159 163
@@ -171,7 +175,7 @@ cio_start_key (struct subchannel *sch, /* subchannel structure */
171 union orb *orb; 175 union orb *orb;
172 176
173 CIO_TRACE_EVENT(4, "stIO"); 177 CIO_TRACE_EVENT(4, "stIO");
174 CIO_TRACE_EVENT(4, sch->dev.bus_id); 178 CIO_TRACE_EVENT(4, dev_name(&sch->dev));
175 179
176 orb = &to_io_private(sch)->orb; 180 orb = &to_io_private(sch)->orb;
177 memset(orb, 0, sizeof(union orb)); 181 memset(orb, 0, sizeof(union orb));
@@ -232,7 +236,7 @@ cio_resume (struct subchannel *sch)
232 int ccode; 236 int ccode;
233 237
234 CIO_TRACE_EVENT (4, "resIO"); 238 CIO_TRACE_EVENT (4, "resIO");
235 CIO_TRACE_EVENT (4, sch->dev.bus_id); 239 CIO_TRACE_EVENT(4, dev_name(&sch->dev));
236 240
237 ccode = rsch (sch->schid); 241 ccode = rsch (sch->schid);
238 242
@@ -269,7 +273,7 @@ cio_halt(struct subchannel *sch)
269 return -ENODEV; 273 return -ENODEV;
270 274
271 CIO_TRACE_EVENT (2, "haltIO"); 275 CIO_TRACE_EVENT (2, "haltIO");
272 CIO_TRACE_EVENT (2, sch->dev.bus_id); 276 CIO_TRACE_EVENT(2, dev_name(&sch->dev));
273 277
274 /* 278 /*
275 * Issue "Halt subchannel" and process condition code 279 * Issue "Halt subchannel" and process condition code
@@ -304,7 +308,7 @@ cio_clear(struct subchannel *sch)
304 return -ENODEV; 308 return -ENODEV;
305 309
306 CIO_TRACE_EVENT (2, "clearIO"); 310 CIO_TRACE_EVENT (2, "clearIO");
307 CIO_TRACE_EVENT (2, sch->dev.bus_id); 311 CIO_TRACE_EVENT(2, dev_name(&sch->dev));
308 312
309 /* 313 /*
310 * Issue "Clear subchannel" and process condition code 314 * Issue "Clear subchannel" and process condition code
@@ -340,7 +344,7 @@ cio_cancel (struct subchannel *sch)
340 return -ENODEV; 344 return -ENODEV;
341 345
342 CIO_TRACE_EVENT (2, "cancelIO"); 346 CIO_TRACE_EVENT (2, "cancelIO");
343 CIO_TRACE_EVENT (2, sch->dev.bus_id); 347 CIO_TRACE_EVENT(2, dev_name(&sch->dev));
344 348
345 ccode = xsch (sch->schid); 349 ccode = xsch (sch->schid);
346 350
@@ -404,7 +408,7 @@ int cio_enable_subchannel(struct subchannel *sch, u32 intparm)
404 int ret; 408 int ret;
405 409
406 CIO_TRACE_EVENT (2, "ensch"); 410 CIO_TRACE_EVENT (2, "ensch");
407 CIO_TRACE_EVENT (2, sch->dev.bus_id); 411 CIO_TRACE_EVENT(2, dev_name(&sch->dev));
408 412
409 if (sch_is_pseudo_sch(sch)) 413 if (sch_is_pseudo_sch(sch))
410 return -EINVAL; 414 return -EINVAL;
@@ -454,7 +458,7 @@ int cio_disable_subchannel(struct subchannel *sch)
454 int ret; 458 int ret;
455 459
456 CIO_TRACE_EVENT (2, "dissch"); 460 CIO_TRACE_EVENT (2, "dissch");
457 CIO_TRACE_EVENT (2, sch->dev.bus_id); 461 CIO_TRACE_EVENT(2, dev_name(&sch->dev));
458 462
459 if (sch_is_pseudo_sch(sch)) 463 if (sch_is_pseudo_sch(sch))
460 return 0; 464 return 0;
@@ -571,8 +575,10 @@ int cio_validate_subchannel(struct subchannel *sch, struct subchannel_id schid)
571 } 575 }
572 mutex_init(&sch->reg_mutex); 576 mutex_init(&sch->reg_mutex);
573 /* Set a name for the subchannel */ 577 /* Set a name for the subchannel */
574 snprintf (sch->dev.bus_id, BUS_ID_SIZE, "0.%x.%04x", schid.ssid, 578 if (cio_is_console(schid))
575 schid.sch_no); 579 sch->dev.init_name = cio_get_console_sch_name(schid);
580 else
581 dev_set_name(&sch->dev, "0.%x.%04x", schid.ssid, schid.sch_no);
576 582
577 /* 583 /*
578 * The first subchannel that is not-operational (ccode==3) 584 * The first subchannel that is not-operational (ccode==3)
@@ -677,6 +683,7 @@ do_IRQ (struct pt_regs *regs)
677 683
678#ifdef CONFIG_CCW_CONSOLE 684#ifdef CONFIG_CCW_CONSOLE
679static struct subchannel console_subchannel; 685static struct subchannel console_subchannel;
686static char console_sch_name[10] = "0.x.xxxx";
680static struct io_subchannel_private console_priv; 687static struct io_subchannel_private console_priv;
681static int console_subchannel_in_use; 688static int console_subchannel_in_use;
682 689
@@ -827,6 +834,12 @@ cio_get_console_subchannel(void)
827 return &console_subchannel; 834 return &console_subchannel;
828} 835}
829 836
837const char *cio_get_console_sch_name(struct subchannel_id schid)
838{
839 snprintf(console_sch_name, 10, "0.%x.%04x", schid.ssid, schid.sch_no);
840 return (const char *)console_sch_name;
841}
842
830#endif 843#endif
831static int 844static int
832__disable_subchannel_easy(struct subchannel_id schid, struct schib *schib) 845__disable_subchannel_easy(struct subchannel_id schid, struct schib *schib)
@@ -846,19 +859,6 @@ __disable_subchannel_easy(struct subchannel_id schid, struct schib *schib)
846 return -EBUSY; /* uhm... */ 859 return -EBUSY; /* uhm... */
847} 860}
848 861
849/* we can't use the normal udelay here, since it enables external interrupts */
850
851static void udelay_reset(unsigned long usecs)
852{
853 uint64_t start_cc, end_cc;
854
855 asm volatile ("STCK %0" : "=m" (start_cc));
856 do {
857 cpu_relax();
858 asm volatile ("STCK %0" : "=m" (end_cc));
859 } while (((end_cc - start_cc)/4096) < usecs);
860}
861
862static int 862static int
863__clear_io_subchannel_easy(struct subchannel_id schid) 863__clear_io_subchannel_easy(struct subchannel_id schid)
864{ 864{
@@ -874,7 +874,7 @@ __clear_io_subchannel_easy(struct subchannel_id schid)
874 if (schid_equal(&ti.schid, &schid)) 874 if (schid_equal(&ti.schid, &schid))
875 return 0; 875 return 0;
876 } 876 }
877 udelay_reset(100); 877 udelay_simple(100);
878 } 878 }
879 return -EBUSY; 879 return -EBUSY;
880} 880}
@@ -882,7 +882,7 @@ __clear_io_subchannel_easy(struct subchannel_id schid)
882static void __clear_chsc_subchannel_easy(void) 882static void __clear_chsc_subchannel_easy(void)
883{ 883{
884 /* It seems we can only wait for a bit here :/ */ 884 /* It seems we can only wait for a bit here :/ */
885 udelay_reset(100); 885 udelay_simple(100);
886} 886}
887 887
888static int pgm_check_occured; 888static int pgm_check_occured;
@@ -892,7 +892,7 @@ static void cio_reset_pgm_check_handler(void)
892 pgm_check_occured = 1; 892 pgm_check_occured = 1;
893} 893}
894 894
895static int stsch_reset(struct subchannel_id schid, volatile struct schib *addr) 895static int stsch_reset(struct subchannel_id schid, struct schib *addr)
896{ 896{
897 int rc; 897 int rc;
898 898
diff --git a/drivers/s390/cio/cio.h b/drivers/s390/cio/cio.h
index 3b236d20e835..0fb24784e925 100644
--- a/drivers/s390/cio/cio.h
+++ b/drivers/s390/cio/cio.h
@@ -117,11 +117,15 @@ extern int cio_is_console(struct subchannel_id);
117extern struct subchannel *cio_get_console_subchannel(void); 117extern struct subchannel *cio_get_console_subchannel(void);
118extern spinlock_t * cio_get_console_lock(void); 118extern spinlock_t * cio_get_console_lock(void);
119extern void *cio_get_console_priv(void); 119extern void *cio_get_console_priv(void);
120extern const char *cio_get_console_sch_name(struct subchannel_id schid);
121extern const char *cio_get_console_cdev_name(struct subchannel *sch);
120#else 122#else
121#define cio_is_console(schid) 0 123#define cio_is_console(schid) 0
122#define cio_get_console_subchannel() NULL 124#define cio_get_console_subchannel() NULL
123#define cio_get_console_lock() NULL 125#define cio_get_console_lock() NULL
124#define cio_get_console_priv() NULL 126#define cio_get_console_priv() NULL
127#define cio_get_console_sch_name(schid) NULL
128#define cio_get_console_cdev_name(sch) NULL
125#endif 129#endif
126 130
127#endif 131#endif
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index 1261e1a9e8cd..76bbb1e74c29 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -698,7 +698,7 @@ static int __init setup_css(int nr)
698 return -ENOMEM; 698 return -ENOMEM;
699 css->pseudo_subchannel->dev.parent = &css->device; 699 css->pseudo_subchannel->dev.parent = &css->device;
700 css->pseudo_subchannel->dev.release = css_subchannel_release; 700 css->pseudo_subchannel->dev.release = css_subchannel_release;
701 sprintf(css->pseudo_subchannel->dev.bus_id, "defunct"); 701 dev_set_name(&css->pseudo_subchannel->dev, "defunct");
702 ret = cio_create_sch_lock(css->pseudo_subchannel); 702 ret = cio_create_sch_lock(css->pseudo_subchannel);
703 if (ret) { 703 if (ret) {
704 kfree(css->pseudo_subchannel); 704 kfree(css->pseudo_subchannel);
@@ -707,7 +707,7 @@ static int __init setup_css(int nr)
707 mutex_init(&css->mutex); 707 mutex_init(&css->mutex);
708 css->valid = 1; 708 css->valid = 1;
709 css->cssid = nr; 709 css->cssid = nr;
710 sprintf(css->device.bus_id, "css%x", nr); 710 dev_set_name(&css->device, "css%x", nr);
711 css->device.release = channel_subsystem_release; 711 css->device.release = channel_subsystem_release;
712 tod_high = (u32) (get_clock() >> 32); 712 tod_high = (u32) (get_clock() >> 32);
713 css_generate_pgid(css, tod_high); 713 css_generate_pgid(css, tod_high);
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 28221030b886..4e78c82194b4 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -31,6 +31,7 @@
31#include "device.h" 31#include "device.h"
32#include "ioasm.h" 32#include "ioasm.h"
33#include "io_sch.h" 33#include "io_sch.h"
34#include "blacklist.h"
34 35
35static struct timer_list recovery_timer; 36static struct timer_list recovery_timer;
36static DEFINE_SPINLOCK(recovery_lock); 37static DEFINE_SPINLOCK(recovery_lock);
@@ -296,36 +297,33 @@ static void ccw_device_unregister(struct ccw_device *cdev)
296 device_del(&cdev->dev); 297 device_del(&cdev->dev);
297} 298}
298 299
299static void ccw_device_remove_orphan_cb(struct device *dev) 300static void ccw_device_remove_orphan_cb(struct work_struct *work)
300{ 301{
301 struct ccw_device *cdev = to_ccwdev(dev); 302 struct ccw_device_private *priv;
303 struct ccw_device *cdev;
302 304
305 priv = container_of(work, struct ccw_device_private, kick_work);
306 cdev = priv->cdev;
303 ccw_device_unregister(cdev); 307 ccw_device_unregister(cdev);
304 put_device(&cdev->dev); 308 put_device(&cdev->dev);
309 /* Release cdev reference for workqueue processing. */
310 put_device(&cdev->dev);
305} 311}
306 312
307static void ccw_device_remove_sch_cb(struct device *dev) 313static void ccw_device_call_sch_unregister(struct work_struct *work);
308{
309 struct subchannel *sch;
310
311 sch = to_subchannel(dev);
312 css_sch_device_unregister(sch);
313 /* Reset intparm to zeroes. */
314 sch->schib.pmcw.intparm = 0;
315 cio_modify(sch);
316 put_device(&sch->dev);
317}
318 314
319static void 315static void
320ccw_device_remove_disconnected(struct ccw_device *cdev) 316ccw_device_remove_disconnected(struct ccw_device *cdev)
321{ 317{
322 unsigned long flags; 318 unsigned long flags;
323 int rc;
324 319
325 /* 320 /*
326 * Forced offline in disconnected state means 321 * Forced offline in disconnected state means
327 * 'throw away device'. 322 * 'throw away device'.
328 */ 323 */
324 /* Get cdev reference for workqueue processing. */
325 if (!get_device(&cdev->dev))
326 return;
329 if (ccw_device_is_orphan(cdev)) { 327 if (ccw_device_is_orphan(cdev)) {
330 /* 328 /*
331 * Deregister ccw device. 329 * Deregister ccw device.
@@ -335,23 +333,13 @@ ccw_device_remove_disconnected(struct ccw_device *cdev)
335 spin_lock_irqsave(cdev->ccwlock, flags); 333 spin_lock_irqsave(cdev->ccwlock, flags);
336 cdev->private->state = DEV_STATE_NOT_OPER; 334 cdev->private->state = DEV_STATE_NOT_OPER;
337 spin_unlock_irqrestore(cdev->ccwlock, flags); 335 spin_unlock_irqrestore(cdev->ccwlock, flags);
338 rc = device_schedule_callback(&cdev->dev, 336 PREPARE_WORK(&cdev->private->kick_work,
339 ccw_device_remove_orphan_cb); 337 ccw_device_remove_orphan_cb);
340 if (rc) 338 } else
341 CIO_MSG_EVENT(0, "Couldn't unregister orphan " 339 /* Deregister subchannel, which will kill the ccw device. */
342 "0.%x.%04x\n", 340 PREPARE_WORK(&cdev->private->kick_work,
343 cdev->private->dev_id.ssid, 341 ccw_device_call_sch_unregister);
344 cdev->private->dev_id.devno); 342 queue_work(slow_path_wq, &cdev->private->kick_work);
345 return;
346 }
347 /* Deregister subchannel, which will kill the ccw device. */
348 rc = device_schedule_callback(cdev->dev.parent,
349 ccw_device_remove_sch_cb);
350 if (rc)
351 CIO_MSG_EVENT(0, "Couldn't unregister disconnected device "
352 "0.%x.%04x\n",
353 cdev->private->dev_id.ssid,
354 cdev->private->dev_id.devno);
355} 343}
356 344
357/** 345/**
@@ -970,12 +958,17 @@ static void ccw_device_call_sch_unregister(struct work_struct *work)
970 958
971 priv = container_of(work, struct ccw_device_private, kick_work); 959 priv = container_of(work, struct ccw_device_private, kick_work);
972 cdev = priv->cdev; 960 cdev = priv->cdev;
961 /* Get subchannel reference for local processing. */
962 if (!get_device(cdev->dev.parent))
963 return;
973 sch = to_subchannel(cdev->dev.parent); 964 sch = to_subchannel(cdev->dev.parent);
974 css_sch_device_unregister(sch); 965 css_sch_device_unregister(sch);
975 /* Reset intparm to zeroes. */ 966 /* Reset intparm to zeroes. */
976 sch->schib.pmcw.intparm = 0; 967 sch->schib.pmcw.intparm = 0;
977 cio_modify(sch); 968 cio_modify(sch);
969 /* Release cdev reference for workqueue processing.*/
978 put_device(&cdev->dev); 970 put_device(&cdev->dev);
971 /* Release subchannel reference for local processing. */
979 put_device(&sch->dev); 972 put_device(&sch->dev);
980} 973}
981 974
@@ -1001,6 +994,8 @@ io_subchannel_recog_done(struct ccw_device *cdev)
1001 PREPARE_WORK(&cdev->private->kick_work, 994 PREPARE_WORK(&cdev->private->kick_work,
1002 ccw_device_call_sch_unregister); 995 ccw_device_call_sch_unregister);
1003 queue_work(slow_path_wq, &cdev->private->kick_work); 996 queue_work(slow_path_wq, &cdev->private->kick_work);
997 /* Release subchannel reference for asynchronous recognition. */
998 put_device(&sch->dev);
1004 if (atomic_dec_and_test(&ccw_device_init_count)) 999 if (atomic_dec_and_test(&ccw_device_init_count))
1005 wake_up(&ccw_device_init_wq); 1000 wake_up(&ccw_device_init_wq);
1006 break; 1001 break;
@@ -1040,8 +1035,11 @@ io_subchannel_recog(struct ccw_device *cdev, struct subchannel *sch)
1040 init_timer(&priv->timer); 1035 init_timer(&priv->timer);
1041 1036
1042 /* Set an initial name for the device. */ 1037 /* Set an initial name for the device. */
1043 snprintf (cdev->dev.bus_id, BUS_ID_SIZE, "0.%x.%04x", 1038 if (cio_is_console(sch->schid))
1044 sch->schid.ssid, sch->schib.pmcw.dev); 1039 cdev->dev.init_name = cio_get_console_cdev_name(sch);
1040 else
1041 dev_set_name(&cdev->dev, "0.%x.%04x",
1042 sch->schid.ssid, sch->schib.pmcw.dev);
1045 1043
1046 /* Increase counter of devices currently in recognition. */ 1044 /* Increase counter of devices currently in recognition. */
1047 atomic_inc(&ccw_device_init_count); 1045 atomic_inc(&ccw_device_init_count);
@@ -1106,7 +1104,7 @@ static void io_subchannel_irq(struct subchannel *sch)
1106 cdev = sch_get_cdev(sch); 1104 cdev = sch_get_cdev(sch);
1107 1105
1108 CIO_TRACE_EVENT(3, "IRQ"); 1106 CIO_TRACE_EVENT(3, "IRQ");
1109 CIO_TRACE_EVENT(3, sch->dev.bus_id); 1107 CIO_TRACE_EVENT(3, dev_name(&sch->dev));
1110 if (cdev) 1108 if (cdev)
1111 dev_fsm_event(cdev, DEV_EVENT_INTERRUPT); 1109 dev_fsm_event(cdev, DEV_EVENT_INTERRUPT);
1112} 1110}
@@ -1476,6 +1474,45 @@ static void ccw_device_schedule_recovery(void)
1476 spin_unlock_irqrestore(&recovery_lock, flags); 1474 spin_unlock_irqrestore(&recovery_lock, flags);
1477} 1475}
1478 1476
1477static int purge_fn(struct device *dev, void *data)
1478{
1479 struct ccw_device *cdev = to_ccwdev(dev);
1480 struct ccw_device_private *priv = cdev->private;
1481 int unreg;
1482
1483 spin_lock_irq(cdev->ccwlock);
1484 unreg = is_blacklisted(priv->dev_id.ssid, priv->dev_id.devno) &&
1485 (priv->state == DEV_STATE_OFFLINE);
1486 spin_unlock_irq(cdev->ccwlock);
1487 if (!unreg)
1488 goto out;
1489 if (!get_device(&cdev->dev))
1490 goto out;
1491 CIO_MSG_EVENT(3, "ccw: purging 0.%x.%04x\n", priv->dev_id.ssid,
1492 priv->dev_id.devno);
1493 PREPARE_WORK(&cdev->private->kick_work, ccw_device_call_sch_unregister);
1494 queue_work(slow_path_wq, &cdev->private->kick_work);
1495
1496out:
1497 /* Abort loop in case of pending signal. */
1498 if (signal_pending(current))
1499 return -EINTR;
1500
1501 return 0;
1502}
1503
1504/**
1505 * ccw_purge_blacklisted - purge unused, blacklisted devices
1506 *
1507 * Unregister all ccw devices that are offline and on the blacklist.
1508 */
1509int ccw_purge_blacklisted(void)
1510{
1511 CIO_MSG_EVENT(2, "ccw: purging blacklisted devices\n");
1512 bus_for_each_dev(&ccw_bus_type, NULL, NULL, purge_fn);
1513 return 0;
1514}
1515
1479static void device_set_disconnected(struct ccw_device *cdev) 1516static void device_set_disconnected(struct ccw_device *cdev)
1480{ 1517{
1481 if (!cdev) 1518 if (!cdev)
@@ -1492,7 +1529,7 @@ void ccw_device_set_notoper(struct ccw_device *cdev)
1492 struct subchannel *sch = to_subchannel(cdev->dev.parent); 1529 struct subchannel *sch = to_subchannel(cdev->dev.parent);
1493 1530
1494 CIO_TRACE_EVENT(2, "notoper"); 1531 CIO_TRACE_EVENT(2, "notoper");
1495 CIO_TRACE_EVENT(2, sch->dev.bus_id); 1532 CIO_TRACE_EVENT(2, dev_name(&sch->dev));
1496 ccw_device_set_timeout(cdev, 0); 1533 ccw_device_set_timeout(cdev, 0);
1497 cio_disable_subchannel(sch); 1534 cio_disable_subchannel(sch);
1498 cdev->private->state = DEV_STATE_NOT_OPER; 1535 cdev->private->state = DEV_STATE_NOT_OPER;
@@ -1591,6 +1628,7 @@ static int io_subchannel_sch_event(struct subchannel *sch, int slow)
1591 1628
1592#ifdef CONFIG_CCW_CONSOLE 1629#ifdef CONFIG_CCW_CONSOLE
1593static struct ccw_device console_cdev; 1630static struct ccw_device console_cdev;
1631static char console_cdev_name[10] = "0.x.xxxx";
1594static struct ccw_device_private console_private; 1632static struct ccw_device_private console_private;
1595static int console_cdev_in_use; 1633static int console_cdev_in_use;
1596 1634
@@ -1661,6 +1699,14 @@ ccw_device_probe_console(void)
1661 console_cdev.online = 1; 1699 console_cdev.online = 1;
1662 return &console_cdev; 1700 return &console_cdev;
1663} 1701}
1702
1703
1704const char *cio_get_console_cdev_name(struct subchannel *sch)
1705{
1706 snprintf(console_cdev_name, 10, "0.%x.%04x",
1707 sch->schid.ssid, sch->schib.pmcw.dev);
1708 return (const char *)console_cdev_name;
1709}
1664#endif 1710#endif
1665 1711
1666/* 1712/*
@@ -1673,7 +1719,7 @@ __ccwdev_check_busid(struct device *dev, void *id)
1673 1719
1674 bus_id = id; 1720 bus_id = id;
1675 1721
1676 return (strncmp(bus_id, dev->bus_id, BUS_ID_SIZE) == 0); 1722 return (strncmp(bus_id, dev_name(dev), BUS_ID_SIZE) == 0);
1677} 1723}
1678 1724
1679 1725
diff --git a/drivers/s390/cio/device.h b/drivers/s390/cio/device.h
index 6f5c3f2b3587..104ed669db43 100644
--- a/drivers/s390/cio/device.h
+++ b/drivers/s390/cio/device.h
@@ -86,6 +86,7 @@ int ccw_device_is_orphan(struct ccw_device *);
86int ccw_device_recognition(struct ccw_device *); 86int ccw_device_recognition(struct ccw_device *);
87int ccw_device_online(struct ccw_device *); 87int ccw_device_online(struct ccw_device *);
88int ccw_device_offline(struct ccw_device *); 88int ccw_device_offline(struct ccw_device *);
89int ccw_purge_blacklisted(void);
89 90
90/* Function prototypes for device status and basic sense stuff. */ 91/* Function prototypes for device status and basic sense stuff. */
91void ccw_device_accumulate_irb(struct ccw_device *, struct irb *); 92void ccw_device_accumulate_irb(struct ccw_device *, struct irb *);
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c
index 84cc9ea346db..10bc03940fb3 100644
--- a/drivers/s390/cio/device_fsm.c
+++ b/drivers/s390/cio/device_fsm.c
@@ -52,8 +52,10 @@ static void ccw_timeout_log(struct ccw_device *cdev)
52 printk(KERN_WARNING "cio: orb:\n"); 52 printk(KERN_WARNING "cio: orb:\n");
53 print_hex_dump(KERN_WARNING, "cio: ", DUMP_PREFIX_NONE, 16, 1, 53 print_hex_dump(KERN_WARNING, "cio: ", DUMP_PREFIX_NONE, 16, 1,
54 orb, sizeof(*orb), 0); 54 orb, sizeof(*orb), 0);
55 printk(KERN_WARNING "cio: ccw device bus id: %s\n", cdev->dev.bus_id); 55 printk(KERN_WARNING "cio: ccw device bus id: %s\n",
56 printk(KERN_WARNING "cio: subchannel bus id: %s\n", sch->dev.bus_id); 56 dev_name(&cdev->dev));
57 printk(KERN_WARNING "cio: subchannel bus id: %s\n",
58 dev_name(&sch->dev));
57 printk(KERN_WARNING "cio: subchannel lpm: %02x, opm: %02x, " 59 printk(KERN_WARNING "cio: subchannel lpm: %02x, opm: %02x, "
58 "vpm: %02x\n", sch->lpm, sch->opm, sch->vpm); 60 "vpm: %02x\n", sch->lpm, sch->opm, sch->vpm);
59 61
diff --git a/drivers/s390/cio/device_ops.c b/drivers/s390/cio/device_ops.c
index ee1a28310fbb..eabcc42d63df 100644
--- a/drivers/s390/cio/device_ops.c
+++ b/drivers/s390/cio/device_ops.c
@@ -498,7 +498,7 @@ ccw_device_stlck(struct ccw_device *cdev)
498 sch = to_subchannel(cdev->dev.parent); 498 sch = to_subchannel(cdev->dev.parent);
499 499
500 CIO_TRACE_EVENT(2, "stl lock"); 500 CIO_TRACE_EVENT(2, "stl lock");
501 CIO_TRACE_EVENT(2, cdev->dev.bus_id); 501 CIO_TRACE_EVENT(2, dev_name(&cdev->dev));
502 502
503 buf = kmalloc(32*sizeof(char), GFP_DMA|GFP_KERNEL); 503 buf = kmalloc(32*sizeof(char), GFP_DMA|GFP_KERNEL);
504 if (!buf) 504 if (!buf)
diff --git a/drivers/s390/cio/io_sch.h b/drivers/s390/cio/io_sch.h
index 3f8f1cf69c76..c4f3e7c9a854 100644
--- a/drivers/s390/cio/io_sch.h
+++ b/drivers/s390/cio/io_sch.h
@@ -123,7 +123,7 @@ struct ccw_device_private {
123 void *cmb_wait; /* deferred cmb enable/disable */ 123 void *cmb_wait; /* deferred cmb enable/disable */
124}; 124};
125 125
126static inline int ssch(struct subchannel_id schid, volatile union orb *addr) 126static inline int ssch(struct subchannel_id schid, union orb *addr)
127{ 127{
128 register struct subchannel_id reg1 asm("1") = schid; 128 register struct subchannel_id reg1 asm("1") = schid;
129 int ccode = -EIO; 129 int ccode = -EIO;
@@ -134,7 +134,9 @@ static inline int ssch(struct subchannel_id schid, volatile union orb *addr)
134 " srl %0,28\n" 134 " srl %0,28\n"
135 "1:\n" 135 "1:\n"
136 EX_TABLE(0b, 1b) 136 EX_TABLE(0b, 1b)
137 : "+d" (ccode) : "d" (reg1), "a" (addr), "m" (*addr) : "cc"); 137 : "+d" (ccode)
138 : "d" (reg1), "a" (addr), "m" (*addr)
139 : "cc", "memory");
138 return ccode; 140 return ccode;
139} 141}
140 142
@@ -147,7 +149,9 @@ static inline int rsch(struct subchannel_id schid)
147 " rsch\n" 149 " rsch\n"
148 " ipm %0\n" 150 " ipm %0\n"
149 " srl %0,28" 151 " srl %0,28"
150 : "=d" (ccode) : "d" (reg1) : "cc"); 152 : "=d" (ccode)
153 : "d" (reg1)
154 : "cc", "memory");
151 return ccode; 155 return ccode;
152} 156}
153 157
@@ -160,7 +164,9 @@ static inline int csch(struct subchannel_id schid)
160 " csch\n" 164 " csch\n"
161 " ipm %0\n" 165 " ipm %0\n"
162 " srl %0,28" 166 " srl %0,28"
163 : "=d" (ccode) : "d" (reg1) : "cc"); 167 : "=d" (ccode)
168 : "d" (reg1)
169 : "cc");
164 return ccode; 170 return ccode;
165} 171}
166 172
@@ -173,7 +179,9 @@ static inline int hsch(struct subchannel_id schid)
173 " hsch\n" 179 " hsch\n"
174 " ipm %0\n" 180 " ipm %0\n"
175 " srl %0,28" 181 " srl %0,28"
176 : "=d" (ccode) : "d" (reg1) : "cc"); 182 : "=d" (ccode)
183 : "d" (reg1)
184 : "cc");
177 return ccode; 185 return ccode;
178} 186}
179 187
@@ -186,7 +194,9 @@ static inline int xsch(struct subchannel_id schid)
186 " .insn rre,0xb2760000,%1,0\n" 194 " .insn rre,0xb2760000,%1,0\n"
187 " ipm %0\n" 195 " ipm %0\n"
188 " srl %0,28" 196 " srl %0,28"
189 : "=d" (ccode) : "d" (reg1) : "cc"); 197 : "=d" (ccode)
198 : "d" (reg1)
199 : "cc");
190 return ccode; 200 return ccode;
191} 201}
192 202
diff --git a/drivers/s390/cio/ioasm.h b/drivers/s390/cio/ioasm.h
index 9fa2ac13ac85..759262792633 100644
--- a/drivers/s390/cio/ioasm.h
+++ b/drivers/s390/cio/ioasm.h
@@ -23,38 +23,39 @@ struct tpi_info {
23 * Some S390 specific IO instructions as inline 23 * Some S390 specific IO instructions as inline
24 */ 24 */
25 25
26static inline int stsch(struct subchannel_id schid, 26static inline int stsch(struct subchannel_id schid, struct schib *addr)
27 volatile struct schib *addr)
28{ 27{
29 register struct subchannel_id reg1 asm ("1") = schid; 28 register struct subchannel_id reg1 asm ("1") = schid;
30 int ccode; 29 int ccode;
31 30
32 asm volatile( 31 asm volatile(
33 " stsch 0(%2)\n" 32 " stsch 0(%3)\n"
34 " ipm %0\n" 33 " ipm %0\n"
35 " srl %0,28" 34 " srl %0,28"
36 : "=d" (ccode) : "d" (reg1), "a" (addr), "m" (*addr) : "cc"); 35 : "=d" (ccode), "=m" (*addr)
36 : "d" (reg1), "a" (addr)
37 : "cc");
37 return ccode; 38 return ccode;
38} 39}
39 40
40static inline int stsch_err(struct subchannel_id schid, 41static inline int stsch_err(struct subchannel_id schid, struct schib *addr)
41 volatile struct schib *addr)
42{ 42{
43 register struct subchannel_id reg1 asm ("1") = schid; 43 register struct subchannel_id reg1 asm ("1") = schid;
44 int ccode = -EIO; 44 int ccode = -EIO;
45 45
46 asm volatile( 46 asm volatile(
47 " stsch 0(%2)\n" 47 " stsch 0(%3)\n"
48 "0: ipm %0\n" 48 "0: ipm %0\n"
49 " srl %0,28\n" 49 " srl %0,28\n"
50 "1:\n" 50 "1:\n"
51 EX_TABLE(0b,1b) 51 EX_TABLE(0b,1b)
52 : "+d" (ccode) : "d" (reg1), "a" (addr), "m" (*addr) : "cc"); 52 : "+d" (ccode), "=m" (*addr)
53 : "d" (reg1), "a" (addr)
54 : "cc");
53 return ccode; 55 return ccode;
54} 56}
55 57
56static inline int msch(struct subchannel_id schid, 58static inline int msch(struct subchannel_id schid, struct schib *addr)
57 volatile struct schib *addr)
58{ 59{
59 register struct subchannel_id reg1 asm ("1") = schid; 60 register struct subchannel_id reg1 asm ("1") = schid;
60 int ccode; 61 int ccode;
@@ -63,12 +64,13 @@ static inline int msch(struct subchannel_id schid,
63 " msch 0(%2)\n" 64 " msch 0(%2)\n"
64 " ipm %0\n" 65 " ipm %0\n"
65 " srl %0,28" 66 " srl %0,28"
66 : "=d" (ccode) : "d" (reg1), "a" (addr), "m" (*addr) : "cc"); 67 : "=d" (ccode)
68 : "d" (reg1), "a" (addr), "m" (*addr)
69 : "cc");
67 return ccode; 70 return ccode;
68} 71}
69 72
70static inline int msch_err(struct subchannel_id schid, 73static inline int msch_err(struct subchannel_id schid, struct schib *addr)
71 volatile struct schib *addr)
72{ 74{
73 register struct subchannel_id reg1 asm ("1") = schid; 75 register struct subchannel_id reg1 asm ("1") = schid;
74 int ccode = -EIO; 76 int ccode = -EIO;
@@ -79,33 +81,38 @@ static inline int msch_err(struct subchannel_id schid,
79 " srl %0,28\n" 81 " srl %0,28\n"
80 "1:\n" 82 "1:\n"
81 EX_TABLE(0b,1b) 83 EX_TABLE(0b,1b)
82 : "+d" (ccode) : "d" (reg1), "a" (addr), "m" (*addr) : "cc"); 84 : "+d" (ccode)
85 : "d" (reg1), "a" (addr), "m" (*addr)
86 : "cc");
83 return ccode; 87 return ccode;
84} 88}
85 89
86static inline int tsch(struct subchannel_id schid, 90static inline int tsch(struct subchannel_id schid, struct irb *addr)
87 volatile struct irb *addr)
88{ 91{
89 register struct subchannel_id reg1 asm ("1") = schid; 92 register struct subchannel_id reg1 asm ("1") = schid;
90 int ccode; 93 int ccode;
91 94
92 asm volatile( 95 asm volatile(
93 " tsch 0(%2)\n" 96 " tsch 0(%3)\n"
94 " ipm %0\n" 97 " ipm %0\n"
95 " srl %0,28" 98 " srl %0,28"
96 : "=d" (ccode) : "d" (reg1), "a" (addr), "m" (*addr) : "cc"); 99 : "=d" (ccode), "=m" (*addr)
100 : "d" (reg1), "a" (addr)
101 : "cc");
97 return ccode; 102 return ccode;
98} 103}
99 104
100static inline int tpi( volatile struct tpi_info *addr) 105static inline int tpi(struct tpi_info *addr)
101{ 106{
102 int ccode; 107 int ccode;
103 108
104 asm volatile( 109 asm volatile(
105 " tpi 0(%1)\n" 110 " tpi 0(%2)\n"
106 " ipm %0\n" 111 " ipm %0\n"
107 " srl %0,28" 112 " srl %0,28"
108 : "=d" (ccode) : "a" (addr), "m" (*addr) : "cc"); 113 : "=d" (ccode), "=m" (*addr)
114 : "a" (addr)
115 : "cc");
109 return ccode; 116 return ccode;
110} 117}
111 118
diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h
index c1a70985abfa..e3ea1d5f2810 100644
--- a/drivers/s390/cio/qdio.h
+++ b/drivers/s390/cio/qdio.h
@@ -16,6 +16,14 @@
16#define QDIO_BUSY_BIT_GIVE_UP 2000000 /* 2 seconds = eternity */ 16#define QDIO_BUSY_BIT_GIVE_UP 2000000 /* 2 seconds = eternity */
17#define QDIO_INPUT_THRESHOLD 500 /* 500 microseconds */ 17#define QDIO_INPUT_THRESHOLD 500 /* 500 microseconds */
18 18
19/*
20 * if an asynchronous HiperSockets queue runs full, the 10 seconds timer wait
21 * till next initiative to give transmitted skbs back to the stack is too long.
22 * Therefore polling is started in case of multicast queue is filled more
23 * than 50 percent.
24 */
25#define QDIO_IQDIO_POLL_LVL 65 /* HS multicast queue */
26
19enum qdio_irq_states { 27enum qdio_irq_states {
20 QDIO_IRQ_STATE_INACTIVE, 28 QDIO_IRQ_STATE_INACTIVE,
21 QDIO_IRQ_STATE_ESTABLISHED, 29 QDIO_IRQ_STATE_ESTABLISHED,
@@ -195,6 +203,9 @@ struct qdio_output_q {
195 /* PCIs are enabled for the queue */ 203 /* PCIs are enabled for the queue */
196 int pci_out_enabled; 204 int pci_out_enabled;
197 205
206 /* IQDIO: output multiple buffers (enhanced SIGA) */
207 int use_enh_siga;
208
198 /* timer to check for more outbound work */ 209 /* timer to check for more outbound work */
199 struct timer_list timer; 210 struct timer_list timer;
200}; 211};
diff --git a/drivers/s390/cio/qdio_debug.c b/drivers/s390/cio/qdio_debug.c
index 337aa3087a78..b5390821434f 100644
--- a/drivers/s390/cio/qdio_debug.c
+++ b/drivers/s390/cio/qdio_debug.c
@@ -155,7 +155,7 @@ static int qstat_seq_open(struct inode *inode, struct file *filp)
155static void get_queue_name(struct qdio_q *q, struct ccw_device *cdev, char *name) 155static void get_queue_name(struct qdio_q *q, struct ccw_device *cdev, char *name)
156{ 156{
157 memset(name, 0, sizeof(name)); 157 memset(name, 0, sizeof(name));
158 sprintf(name, "%s", cdev->dev.bus_id); 158 sprintf(name, "%s", dev_name(&cdev->dev));
159 if (q->is_input_q) 159 if (q->is_input_q)
160 sprintf(name + strlen(name), "_input"); 160 sprintf(name + strlen(name), "_input");
161 else 161 else
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
index e6eabc853422..a50682d2a0fa 100644
--- a/drivers/s390/cio/qdio_main.c
+++ b/drivers/s390/cio/qdio_main.c
@@ -316,6 +316,9 @@ static inline int qdio_do_siga_output(struct qdio_q *q, unsigned int *busy_bit)
316 unsigned int fc = 0; 316 unsigned int fc = 0;
317 unsigned long schid; 317 unsigned long schid;
318 318
319 if (q->u.out.use_enh_siga) {
320 fc = 3;
321 }
319 if (!is_qebsm(q)) 322 if (!is_qebsm(q))
320 schid = *((u32 *)&q->irq_ptr->schid); 323 schid = *((u32 *)&q->irq_ptr->schid);
321 else { 324 else {
@@ -851,6 +854,12 @@ static void __qdio_outbound_processing(struct qdio_q *q)
851 if (queue_type(q) == QDIO_IQDIO_QFMT && !multicast_outbound(q)) 854 if (queue_type(q) == QDIO_IQDIO_QFMT && !multicast_outbound(q))
852 return; 855 return;
853 856
857 if ((queue_type(q) == QDIO_IQDIO_QFMT) &&
858 (atomic_read(&q->nr_buf_used)) > QDIO_IQDIO_POLL_LVL) {
859 tasklet_schedule(&q->tasklet);
860 return;
861 }
862
854 if (q->u.out.pci_out_enabled) 863 if (q->u.out.pci_out_enabled)
855 return; 864 return;
856 865
@@ -956,7 +965,7 @@ static void qdio_handle_activate_check(struct ccw_device *cdev,
956 char dbf_text[15]; 965 char dbf_text[15];
957 966
958 QDIO_DBF_TEXT2(1, trace, "ick2"); 967 QDIO_DBF_TEXT2(1, trace, "ick2");
959 sprintf(dbf_text, "%s", cdev->dev.bus_id); 968 sprintf(dbf_text, "%s", dev_name(&cdev->dev));
960 QDIO_DBF_TEXT2(1, trace, dbf_text); 969 QDIO_DBF_TEXT2(1, trace, dbf_text);
961 QDIO_DBF_HEX2(0, trace, &intparm, sizeof(int)); 970 QDIO_DBF_HEX2(0, trace, &intparm, sizeof(int));
962 QDIO_DBF_HEX2(0, trace, &dstat, sizeof(int)); 971 QDIO_DBF_HEX2(0, trace, &dstat, sizeof(int));
@@ -1443,6 +1452,8 @@ int qdio_establish(struct qdio_initialize *init_data)
1443 } 1452 }
1444 1453
1445 qdio_setup_ssqd_info(irq_ptr); 1454 qdio_setup_ssqd_info(irq_ptr);
1455 sprintf(dbf_text, "qDmmwc%2x", irq_ptr->ssqd_desc.mmwc);
1456 QDIO_DBF_TEXT2(0, setup, dbf_text);
1446 sprintf(dbf_text, "qib ac%2x", irq_ptr->qib.ac); 1457 sprintf(dbf_text, "qib ac%2x", irq_ptr->qib.ac);
1447 QDIO_DBF_TEXT2(0, setup, dbf_text); 1458 QDIO_DBF_TEXT2(0, setup, dbf_text);
1448 1459
@@ -1615,12 +1626,21 @@ static void handle_outbound(struct qdio_q *q, unsigned int callflags,
1615 if (multicast_outbound(q)) 1626 if (multicast_outbound(q))
1616 qdio_kick_outbound_q(q); 1627 qdio_kick_outbound_q(q);
1617 else 1628 else
1618 /* 1629 if ((q->irq_ptr->ssqd_desc.mmwc > 1) &&
1619 * One siga-w per buffer required for unicast 1630 (count > 1) &&
1620 * HiperSockets. 1631 (count <= q->irq_ptr->ssqd_desc.mmwc)) {
1621 */ 1632 /* exploit enhanced SIGA */
1622 while (count--) 1633 q->u.out.use_enh_siga = 1;
1623 qdio_kick_outbound_q(q); 1634 qdio_kick_outbound_q(q);
1635 } else {
1636 /*
1637 * One siga-w per buffer required for unicast
1638 * HiperSockets.
1639 */
1640 q->u.out.use_enh_siga = 0;
1641 while (count--)
1642 qdio_kick_outbound_q(q);
1643 }
1624 goto out; 1644 goto out;
1625 } 1645 }
1626 1646
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index 62b6b55230d0..326db1e827c4 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -892,8 +892,8 @@ static void ap_scan_bus(struct work_struct *unused)
892 892
893 ap_dev->device.bus = &ap_bus_type; 893 ap_dev->device.bus = &ap_bus_type;
894 ap_dev->device.parent = ap_root_device; 894 ap_dev->device.parent = ap_root_device;
895 snprintf(ap_dev->device.bus_id, BUS_ID_SIZE, "card%02x", 895 dev_set_name(&ap_dev->device, "card%02x",
896 AP_QID_DEVICE(ap_dev->qid)); 896 AP_QID_DEVICE(ap_dev->qid));
897 ap_dev->device.release = ap_device_release; 897 ap_dev->device.release = ap_device_release;
898 rc = device_register(&ap_dev->device); 898 rc = device_register(&ap_dev->device);
899 if (rc) { 899 if (rc) {
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c
index 292b60da6dc7..ff4a6931bb8e 100644
--- a/drivers/s390/kvm/kvm_virtio.c
+++ b/drivers/s390/kvm/kvm_virtio.c
@@ -24,6 +24,7 @@
24#include <asm/kvm_virtio.h> 24#include <asm/kvm_virtio.h>
25#include <asm/setup.h> 25#include <asm/setup.h>
26#include <asm/s390_ext.h> 26#include <asm/s390_ext.h>
27#include <asm/s390_rdev.h>
27 28
28#define VIRTIO_SUBCODE_64 0x0D00 29#define VIRTIO_SUBCODE_64 0x0D00
29 30
@@ -241,10 +242,7 @@ static struct virtio_config_ops kvm_vq_configspace_ops = {
241 * The root device for the kvm virtio devices. 242 * The root device for the kvm virtio devices.
242 * This makes them appear as /sys/devices/kvm_s390/0,1,2 not /sys/devices/0,1,2. 243 * This makes them appear as /sys/devices/kvm_s390/0,1,2 not /sys/devices/0,1,2.
243 */ 244 */
244static struct device kvm_root = { 245static struct device *kvm_root;
245 .parent = NULL,
246 .bus_id = "kvm_s390",
247};
248 246
249/* 247/*
250 * adds a new device and register it with virtio 248 * adds a new device and register it with virtio
@@ -261,7 +259,7 @@ static void add_kvm_device(struct kvm_device_desc *d, unsigned int offset)
261 return; 259 return;
262 } 260 }
263 261
264 kdev->vdev.dev.parent = &kvm_root; 262 kdev->vdev.dev.parent = kvm_root;
265 kdev->vdev.id.device = d->type; 263 kdev->vdev.id.device = d->type;
266 kdev->vdev.config = &kvm_vq_configspace_ops; 264 kdev->vdev.config = &kvm_vq_configspace_ops;
267 kdev->desc = d; 265 kdev->desc = d;
@@ -317,15 +315,16 @@ static int __init kvm_devices_init(void)
317 if (!MACHINE_IS_KVM) 315 if (!MACHINE_IS_KVM)
318 return -ENODEV; 316 return -ENODEV;
319 317
320 rc = device_register(&kvm_root); 318 kvm_root = s390_root_dev_register("kvm_s390");
321 if (rc) { 319 if (IS_ERR(kvm_root)) {
320 rc = PTR_ERR(kvm_root);
322 printk(KERN_ERR "Could not register kvm_s390 root device"); 321 printk(KERN_ERR "Could not register kvm_s390 root device");
323 return rc; 322 return rc;
324 } 323 }
325 324
326 rc = vmem_add_mapping(PFN_PHYS(max_pfn), PAGE_SIZE); 325 rc = vmem_add_mapping(PFN_PHYS(max_pfn), PAGE_SIZE);
327 if (rc) { 326 if (rc) {
328 device_unregister(&kvm_root); 327 s390_root_dev_unregister(kvm_root);
329 return rc; 328 return rc;
330 } 329 }
331 330
diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c
index e10ac9ab2d44..8f83fc994f50 100644
--- a/drivers/s390/net/claw.c
+++ b/drivers/s390/net/claw.c
@@ -299,7 +299,7 @@ claw_probe(struct ccwgroup_device *cgdev)
299 probe_error(cgdev); 299 probe_error(cgdev);
300 put_device(&cgdev->dev); 300 put_device(&cgdev->dev);
301 printk(KERN_WARNING "add_files failed %s %s Exit Line %d \n", 301 printk(KERN_WARNING "add_files failed %s %s Exit Line %d \n",
302 cgdev->cdev[0]->dev.bus_id,__func__,__LINE__); 302 dev_name(&cgdev->cdev[0]->dev), __func__, __LINE__);
303 CLAW_DBF_TEXT_(2, setup, "probex%d", rc); 303 CLAW_DBF_TEXT_(2, setup, "probex%d", rc);
304 return rc; 304 return rc;
305 } 305 }
@@ -584,7 +584,7 @@ claw_irq_handler(struct ccw_device *cdev,
584 if (!cdev->dev.driver_data) { 584 if (!cdev->dev.driver_data) {
585 printk(KERN_WARNING "claw: unsolicited interrupt for device:" 585 printk(KERN_WARNING "claw: unsolicited interrupt for device:"
586 "%s received c-%02x d-%02x\n", 586 "%s received c-%02x d-%02x\n",
587 cdev->dev.bus_id, irb->scsw.cmd.cstat, 587 dev_name(&cdev->dev), irb->scsw.cmd.cstat,
588 irb->scsw.cmd.dstat); 588 irb->scsw.cmd.dstat);
589 CLAW_DBF_TEXT(2, trace, "badirq"); 589 CLAW_DBF_TEXT(2, trace, "badirq");
590 return; 590 return;
@@ -598,7 +598,7 @@ claw_irq_handler(struct ccw_device *cdev,
598 p_ch = &privptr->channel[WRITE]; 598 p_ch = &privptr->channel[WRITE];
599 else { 599 else {
600 printk(KERN_WARNING "claw: Can't determine channel for " 600 printk(KERN_WARNING "claw: Can't determine channel for "
601 "interrupt, device %s\n", cdev->dev.bus_id); 601 "interrupt, device %s\n", dev_name(&cdev->dev));
602 CLAW_DBF_TEXT(2, trace, "badchan"); 602 CLAW_DBF_TEXT(2, trace, "badchan");
603 return; 603 return;
604 } 604 }
@@ -662,7 +662,7 @@ claw_irq_handler(struct ccw_device *cdev,
662 printk(KERN_WARNING "claw: unsolicited " 662 printk(KERN_WARNING "claw: unsolicited "
663 "interrupt for device:" 663 "interrupt for device:"
664 "%s received c-%02x d-%02x\n", 664 "%s received c-%02x d-%02x\n",
665 cdev->dev.bus_id, 665 dev_name(&cdev->dev),
666 irb->scsw.cmd.cstat, 666 irb->scsw.cmd.cstat,
667 irb->scsw.cmd.dstat); 667 irb->scsw.cmd.dstat);
668 return; 668 return;
@@ -1136,19 +1136,20 @@ ccw_check_return_code(struct ccw_device *cdev, int return_code)
1136 break; 1136 break;
1137 case -ENODEV: 1137 case -ENODEV:
1138 printk(KERN_EMERG "%s: Missing device called " 1138 printk(KERN_EMERG "%s: Missing device called "
1139 "for IO ENODEV\n", cdev->dev.bus_id); 1139 "for IO ENODEV\n", dev_name(&cdev->dev));
1140 break; 1140 break;
1141 case -EIO: 1141 case -EIO:
1142 printk(KERN_EMERG "%s: Status pending... EIO \n", 1142 printk(KERN_EMERG "%s: Status pending... EIO \n",
1143 cdev->dev.bus_id); 1143 dev_name(&cdev->dev));
1144 break; 1144 break;
1145 case -EINVAL: 1145 case -EINVAL:
1146 printk(KERN_EMERG "%s: Invalid Dev State EINVAL \n", 1146 printk(KERN_EMERG "%s: Invalid Dev State EINVAL \n",
1147 cdev->dev.bus_id); 1147 dev_name(&cdev->dev));
1148 break; 1148 break;
1149 default: 1149 default:
1150 printk(KERN_EMERG "%s: Unknown error in " 1150 printk(KERN_EMERG "%s: Unknown error in "
1151 "Do_IO %d\n",cdev->dev.bus_id, return_code); 1151 "Do_IO %d\n", dev_name(&cdev->dev),
1152 return_code);
1152 } 1153 }
1153 } 1154 }
1154 CLAW_DBF_TEXT(4, trace, "ccwret"); 1155 CLAW_DBF_TEXT(4, trace, "ccwret");
@@ -2848,11 +2849,11 @@ add_channel(struct ccw_device *cdev,int i,struct claw_privbk *privptr)
2848 struct chbk *p_ch; 2849 struct chbk *p_ch;
2849 struct ccw_dev_id dev_id; 2850 struct ccw_dev_id dev_id;
2850 2851
2851 CLAW_DBF_TEXT_(2, setup, "%s", cdev->dev.bus_id); 2852 CLAW_DBF_TEXT_(2, setup, "%s", dev_name(&cdev->dev));
2852 privptr->channel[i].flag = i+1; /* Read is 1 Write is 2 */ 2853 privptr->channel[i].flag = i+1; /* Read is 1 Write is 2 */
2853 p_ch = &privptr->channel[i]; 2854 p_ch = &privptr->channel[i];
2854 p_ch->cdev = cdev; 2855 p_ch->cdev = cdev;
2855 snprintf(p_ch->id, CLAW_ID_SIZE, "cl-%s", cdev->dev.bus_id); 2856 snprintf(p_ch->id, CLAW_ID_SIZE, "cl-%s", dev_name(&cdev->dev));
2856 ccw_device_get_id(cdev, &dev_id); 2857 ccw_device_get_id(cdev, &dev_id);
2857 p_ch->devno = dev_id.devno; 2858 p_ch->devno = dev_id.devno;
2858 if ((p_ch->irb = kzalloc(sizeof (struct irb),GFP_KERNEL)) == NULL) { 2859 if ((p_ch->irb = kzalloc(sizeof (struct irb),GFP_KERNEL)) == NULL) {
@@ -2879,7 +2880,8 @@ claw_new_device(struct ccwgroup_device *cgdev)
2879 int ret; 2880 int ret;
2880 struct ccw_dev_id dev_id; 2881 struct ccw_dev_id dev_id;
2881 2882
2882 printk(KERN_INFO "claw: add for %s\n",cgdev->cdev[READ]->dev.bus_id); 2883 printk(KERN_INFO "claw: add for %s\n",
2884 dev_name(&cgdev->cdev[READ]->dev));
2883 CLAW_DBF_TEXT(2, setup, "new_dev"); 2885 CLAW_DBF_TEXT(2, setup, "new_dev");
2884 privptr = cgdev->dev.driver_data; 2886 privptr = cgdev->dev.driver_data;
2885 cgdev->cdev[READ]->dev.driver_data = privptr; 2887 cgdev->cdev[READ]->dev.driver_data = privptr;
@@ -2903,14 +2905,16 @@ claw_new_device(struct ccwgroup_device *cgdev)
2903 if (ret != 0) { 2905 if (ret != 0) {
2904 printk(KERN_WARNING 2906 printk(KERN_WARNING
2905 "claw: ccw_device_set_online %s READ failed " 2907 "claw: ccw_device_set_online %s READ failed "
2906 "with ret = %d\n",cgdev->cdev[READ]->dev.bus_id,ret); 2908 "with ret = %d\n", dev_name(&cgdev->cdev[READ]->dev),
2909 ret);
2907 goto out; 2910 goto out;
2908 } 2911 }
2909 ret = ccw_device_set_online(cgdev->cdev[WRITE]); 2912 ret = ccw_device_set_online(cgdev->cdev[WRITE]);
2910 if (ret != 0) { 2913 if (ret != 0) {
2911 printk(KERN_WARNING 2914 printk(KERN_WARNING
2912 "claw: ccw_device_set_online %s WRITE failed " 2915 "claw: ccw_device_set_online %s WRITE failed "
2913 "with ret = %d\n",cgdev->cdev[WRITE]->dev.bus_id, ret); 2916 "with ret = %d\n", dev_name(&cgdev->cdev[WRITE]->dev)
2917 ret);
2914 goto out; 2918 goto out;
2915 } 2919 }
2916 dev = alloc_netdev(0,"claw%d",claw_init_netdevice); 2920 dev = alloc_netdev(0,"claw%d",claw_init_netdevice);
@@ -2986,7 +2990,7 @@ claw_shutdown_device(struct ccwgroup_device *cgdev)
2986 struct net_device *ndev; 2990 struct net_device *ndev;
2987 int ret; 2991 int ret;
2988 2992
2989 CLAW_DBF_TEXT_(2, setup, "%s", cgdev->dev.bus_id); 2993 CLAW_DBF_TEXT_(2, setup, "%s", dev_name(&cgdev->dev));
2990 priv = cgdev->dev.driver_data; 2994 priv = cgdev->dev.driver_data;
2991 if (!priv) 2995 if (!priv)
2992 return -ENODEV; 2996 return -ENODEV;
@@ -3016,11 +3020,11 @@ claw_remove_device(struct ccwgroup_device *cgdev)
3016 struct claw_privbk *priv; 3020 struct claw_privbk *priv;
3017 3021
3018 BUG_ON(!cgdev); 3022 BUG_ON(!cgdev);
3019 CLAW_DBF_TEXT_(2, setup, "%s", cgdev->dev.bus_id); 3023 CLAW_DBF_TEXT_(2, setup, "%s", dev_name(&cgdev->dev));
3020 priv = cgdev->dev.driver_data; 3024 priv = cgdev->dev.driver_data;
3021 BUG_ON(!priv); 3025 BUG_ON(!priv);
3022 printk(KERN_INFO "claw: %s() called %s will be removed.\n", 3026 printk(KERN_INFO "claw: %s() called %s will be removed.\n",
3023 __func__,cgdev->cdev[0]->dev.bus_id); 3027 __func__, dev_name(&cgdev->cdev[0]->dev));
3024 if (cgdev->state == CCWGROUP_ONLINE) 3028 if (cgdev->state == CCWGROUP_ONLINE)
3025 claw_shutdown_device(cgdev); 3029 claw_shutdown_device(cgdev);
3026 claw_remove_files(&cgdev->dev); 3030 claw_remove_files(&cgdev->dev);
diff --git a/drivers/s390/net/claw.h b/drivers/s390/net/claw.h
index 1a89d989f348..005072c420d3 100644
--- a/drivers/s390/net/claw.h
+++ b/drivers/s390/net/claw.h
@@ -85,7 +85,7 @@
85#define CLAW_MAX_DEV 256 /* max claw devices */ 85#define CLAW_MAX_DEV 256 /* max claw devices */
86#define MAX_NAME_LEN 8 /* host name, adapter name length */ 86#define MAX_NAME_LEN 8 /* host name, adapter name length */
87#define CLAW_FRAME_SIZE 4096 87#define CLAW_FRAME_SIZE 4096
88#define CLAW_ID_SIZE BUS_ID_SIZE+3 88#define CLAW_ID_SIZE 20+3
89 89
90/* state machine codes used in claw_irq_handler */ 90/* state machine codes used in claw_irq_handler */
91 91
diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c
index b11fec24c7d2..a4e29836a2aa 100644
--- a/drivers/s390/net/ctcm_main.c
+++ b/drivers/s390/net/ctcm_main.c
@@ -277,18 +277,18 @@ static long ctcm_check_irb_error(struct ccw_device *cdev, struct irb *irb)
277 277
278 CTCM_DBF_TEXT_(ERROR, CTC_DBF_WARN, 278 CTCM_DBF_TEXT_(ERROR, CTC_DBF_WARN,
279 "irb error %ld on device %s\n", 279 "irb error %ld on device %s\n",
280 PTR_ERR(irb), cdev->dev.bus_id); 280 PTR_ERR(irb), dev_name(&cdev->dev));
281 281
282 switch (PTR_ERR(irb)) { 282 switch (PTR_ERR(irb)) {
283 case -EIO: 283 case -EIO:
284 ctcm_pr_warn("i/o-error on device %s\n", cdev->dev.bus_id); 284 ctcm_pr_warn("i/o-error on device %s\n", dev_name(&cdev->dev));
285 break; 285 break;
286 case -ETIMEDOUT: 286 case -ETIMEDOUT:
287 ctcm_pr_warn("timeout on device %s\n", cdev->dev.bus_id); 287 ctcm_pr_warn("timeout on device %s\n", dev_name(&cdev->dev));
288 break; 288 break;
289 default: 289 default:
290 ctcm_pr_warn("unknown error %ld on device %s\n", 290 ctcm_pr_warn("unknown error %ld on device %s\n",
291 PTR_ERR(irb), cdev->dev.bus_id); 291 PTR_ERR(irb), dev_name(&cdev->dev));
292 } 292 }
293 return PTR_ERR(irb); 293 return PTR_ERR(irb);
294} 294}
@@ -1182,7 +1182,7 @@ static void ctcm_irq_handler(struct ccw_device *cdev,
1182 int dstat; 1182 int dstat;
1183 1183
1184 CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, 1184 CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG,
1185 "Enter %s(%s)", CTCM_FUNTAIL, &cdev->dev.bus_id); 1185 "Enter %s(%s)", CTCM_FUNTAIL, dev_name(&cdev->dev));
1186 1186
1187 if (ctcm_check_irb_error(cdev, irb)) 1187 if (ctcm_check_irb_error(cdev, irb))
1188 return; 1188 return;
@@ -1208,14 +1208,14 @@ static void ctcm_irq_handler(struct ccw_device *cdev,
1208 ch = priv->channel[WRITE]; 1208 ch = priv->channel[WRITE];
1209 else { 1209 else {
1210 ctcm_pr_err("ctcm: Can't determine channel for interrupt, " 1210 ctcm_pr_err("ctcm: Can't determine channel for interrupt, "
1211 "device %s\n", cdev->dev.bus_id); 1211 "device %s\n", dev_name(&cdev->dev));
1212 return; 1212 return;
1213 } 1213 }
1214 1214
1215 dev = ch->netdev; 1215 dev = ch->netdev;
1216 if (dev == NULL) { 1216 if (dev == NULL) {
1217 ctcm_pr_crit("ctcm: %s dev=NULL bus_id=%s, ch=0x%p\n", 1217 ctcm_pr_crit("ctcm: %s dev=NULL bus_id=%s, ch=0x%p\n",
1218 __func__, cdev->dev.bus_id, ch); 1218 __func__, dev_name(&cdev->dev), ch);
1219 return; 1219 return;
1220 } 1220 }
1221 1221
@@ -1329,7 +1329,7 @@ static int add_channel(struct ccw_device *cdev, enum channel_types type,
1329 1329
1330 CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, 1330 CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO,
1331 "%s(%s), type %d, proto %d", 1331 "%s(%s), type %d, proto %d",
1332 __func__, cdev->dev.bus_id, type, priv->protocol); 1332 __func__, dev_name(&cdev->dev), type, priv->protocol);
1333 1333
1334 ch = kzalloc(sizeof(struct channel), GFP_KERNEL); 1334 ch = kzalloc(sizeof(struct channel), GFP_KERNEL);
1335 if (ch == NULL) 1335 if (ch == NULL)
@@ -1358,7 +1358,7 @@ static int add_channel(struct ccw_device *cdev, enum channel_types type,
1358 goto nomem_return; 1358 goto nomem_return;
1359 1359
1360 ch->cdev = cdev; 1360 ch->cdev = cdev;
1361 snprintf(ch->id, CTCM_ID_SIZE, "ch-%s", cdev->dev.bus_id); 1361 snprintf(ch->id, CTCM_ID_SIZE, "ch-%s", dev_name(&cdev->dev));
1362 ch->type = type; 1362 ch->type = type;
1363 1363
1364 /** 1364 /**
@@ -1518,8 +1518,8 @@ static int ctcm_new_device(struct ccwgroup_device *cgdev)
1518 1518
1519 type = get_channel_type(&cdev0->id); 1519 type = get_channel_type(&cdev0->id);
1520 1520
1521 snprintf(read_id, CTCM_ID_SIZE, "ch-%s", cdev0->dev.bus_id); 1521 snprintf(read_id, CTCM_ID_SIZE, "ch-%s", dev_name(&cdev0->dev));
1522 snprintf(write_id, CTCM_ID_SIZE, "ch-%s", cdev1->dev.bus_id); 1522 snprintf(write_id, CTCM_ID_SIZE, "ch-%s", dev_name(&cdev1->dev));
1523 1523
1524 ret = add_channel(cdev0, type, priv); 1524 ret = add_channel(cdev0, type, priv);
1525 if (ret) 1525 if (ret)
diff --git a/drivers/s390/net/ctcm_main.h b/drivers/s390/net/ctcm_main.h
index 8e10ee86a5ee..d77cce3fe4d4 100644
--- a/drivers/s390/net/ctcm_main.h
+++ b/drivers/s390/net/ctcm_main.h
@@ -104,7 +104,7 @@
104#define READ 0 104#define READ 0
105#define WRITE 1 105#define WRITE 1
106 106
107#define CTCM_ID_SIZE BUS_ID_SIZE+3 107#define CTCM_ID_SIZE 20+3
108 108
109struct ctcm_profile { 109struct ctcm_profile {
110 unsigned long maxmulti; 110 unsigned long maxmulti;
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c
index 9bcfa04d863b..0825be87e5a0 100644
--- a/drivers/s390/net/lcs.c
+++ b/drivers/s390/net/lcs.c
@@ -492,7 +492,7 @@ lcs_start_channel(struct lcs_channel *channel)
492 unsigned long flags; 492 unsigned long flags;
493 int rc; 493 int rc;
494 494
495 LCS_DBF_TEXT_(4,trace,"ssch%s", channel->ccwdev->dev.bus_id); 495 LCS_DBF_TEXT_(4, trace,"ssch%s", dev_name(&channel->ccwdev->dev));
496 spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); 496 spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags);
497 rc = ccw_device_start(channel->ccwdev, 497 rc = ccw_device_start(channel->ccwdev,
498 channel->ccws + channel->io_idx, 0, 0, 498 channel->ccws + channel->io_idx, 0, 0,
@@ -501,7 +501,8 @@ lcs_start_channel(struct lcs_channel *channel)
501 channel->state = LCS_CH_STATE_RUNNING; 501 channel->state = LCS_CH_STATE_RUNNING;
502 spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); 502 spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags);
503 if (rc) { 503 if (rc) {
504 LCS_DBF_TEXT_(4,trace,"essh%s", channel->ccwdev->dev.bus_id); 504 LCS_DBF_TEXT_(4,trace,"essh%s",
505 dev_name(&channel->ccwdev->dev));
505 PRINT_ERR("Error in starting channel, rc=%d!\n", rc); 506 PRINT_ERR("Error in starting channel, rc=%d!\n", rc);
506 } 507 }
507 return rc; 508 return rc;
@@ -514,12 +515,13 @@ lcs_clear_channel(struct lcs_channel *channel)
514 int rc; 515 int rc;
515 516
516 LCS_DBF_TEXT(4,trace,"clearch"); 517 LCS_DBF_TEXT(4,trace,"clearch");
517 LCS_DBF_TEXT_(4,trace,"%s", channel->ccwdev->dev.bus_id); 518 LCS_DBF_TEXT_(4, trace, "%s", dev_name(&channel->ccwdev->dev));
518 spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); 519 spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags);
519 rc = ccw_device_clear(channel->ccwdev, (addr_t) channel); 520 rc = ccw_device_clear(channel->ccwdev, (addr_t) channel);
520 spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); 521 spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags);
521 if (rc) { 522 if (rc) {
522 LCS_DBF_TEXT_(4,trace,"ecsc%s", channel->ccwdev->dev.bus_id); 523 LCS_DBF_TEXT_(4, trace, "ecsc%s",
524 dev_name(&channel->ccwdev->dev));
523 return rc; 525 return rc;
524 } 526 }
525 wait_event(channel->wait_q, (channel->state == LCS_CH_STATE_CLEARED)); 527 wait_event(channel->wait_q, (channel->state == LCS_CH_STATE_CLEARED));
@@ -540,13 +542,14 @@ lcs_stop_channel(struct lcs_channel *channel)
540 if (channel->state == LCS_CH_STATE_STOPPED) 542 if (channel->state == LCS_CH_STATE_STOPPED)
541 return 0; 543 return 0;
542 LCS_DBF_TEXT(4,trace,"haltsch"); 544 LCS_DBF_TEXT(4,trace,"haltsch");
543 LCS_DBF_TEXT_(4,trace,"%s", channel->ccwdev->dev.bus_id); 545 LCS_DBF_TEXT_(4, trace, "%s", dev_name(&channel->ccwdev->dev));
544 channel->state = LCS_CH_STATE_INIT; 546 channel->state = LCS_CH_STATE_INIT;
545 spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); 547 spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags);
546 rc = ccw_device_halt(channel->ccwdev, (addr_t) channel); 548 rc = ccw_device_halt(channel->ccwdev, (addr_t) channel);
547 spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); 549 spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags);
548 if (rc) { 550 if (rc) {
549 LCS_DBF_TEXT_(4,trace,"ehsc%s", channel->ccwdev->dev.bus_id); 551 LCS_DBF_TEXT_(4, trace, "ehsc%s",
552 dev_name(&channel->ccwdev->dev));
550 return rc; 553 return rc;
551 } 554 }
552 /* Asynchronous halt initialted. Wait for its completion. */ 555 /* Asynchronous halt initialted. Wait for its completion. */
@@ -632,10 +635,11 @@ __lcs_resume_channel(struct lcs_channel *channel)
632 return 0; 635 return 0;
633 if (channel->ccws[channel->io_idx].flags & CCW_FLAG_SUSPEND) 636 if (channel->ccws[channel->io_idx].flags & CCW_FLAG_SUSPEND)
634 return 0; 637 return 0;
635 LCS_DBF_TEXT_(5, trace, "rsch%s", channel->ccwdev->dev.bus_id); 638 LCS_DBF_TEXT_(5, trace, "rsch%s", dev_name(&channel->ccwdev->dev));
636 rc = ccw_device_resume(channel->ccwdev); 639 rc = ccw_device_resume(channel->ccwdev);
637 if (rc) { 640 if (rc) {
638 LCS_DBF_TEXT_(4, trace, "ersc%s", channel->ccwdev->dev.bus_id); 641 LCS_DBF_TEXT_(4, trace, "ersc%s",
642 dev_name(&channel->ccwdev->dev));
639 PRINT_ERR("Error in lcs_resume_channel: rc=%d\n",rc); 643 PRINT_ERR("Error in lcs_resume_channel: rc=%d\n",rc);
640 } else 644 } else
641 channel->state = LCS_CH_STATE_RUNNING; 645 channel->state = LCS_CH_STATE_RUNNING;
@@ -1302,18 +1306,18 @@ lcs_check_irb_error(struct ccw_device *cdev, struct irb *irb)
1302 1306
1303 switch (PTR_ERR(irb)) { 1307 switch (PTR_ERR(irb)) {
1304 case -EIO: 1308 case -EIO:
1305 PRINT_WARN("i/o-error on device %s\n", cdev->dev.bus_id); 1309 PRINT_WARN("i/o-error on device %s\n", dev_name(&cdev->dev));
1306 LCS_DBF_TEXT(2, trace, "ckirberr"); 1310 LCS_DBF_TEXT(2, trace, "ckirberr");
1307 LCS_DBF_TEXT_(2, trace, " rc%d", -EIO); 1311 LCS_DBF_TEXT_(2, trace, " rc%d", -EIO);
1308 break; 1312 break;
1309 case -ETIMEDOUT: 1313 case -ETIMEDOUT:
1310 PRINT_WARN("timeout on device %s\n", cdev->dev.bus_id); 1314 PRINT_WARN("timeout on device %s\n", dev_name(&cdev->dev));
1311 LCS_DBF_TEXT(2, trace, "ckirberr"); 1315 LCS_DBF_TEXT(2, trace, "ckirberr");
1312 LCS_DBF_TEXT_(2, trace, " rc%d", -ETIMEDOUT); 1316 LCS_DBF_TEXT_(2, trace, " rc%d", -ETIMEDOUT);
1313 break; 1317 break;
1314 default: 1318 default:
1315 PRINT_WARN("unknown error %ld on device %s\n", PTR_ERR(irb), 1319 PRINT_WARN("unknown error %ld on device %s\n", PTR_ERR(irb),
1316 cdev->dev.bus_id); 1320 dev_name(&cdev->dev));
1317 LCS_DBF_TEXT(2, trace, "ckirberr"); 1321 LCS_DBF_TEXT(2, trace, "ckirberr");
1318 LCS_DBF_TEXT(2, trace, " rc???"); 1322 LCS_DBF_TEXT(2, trace, " rc???");
1319 } 1323 }
@@ -1390,7 +1394,7 @@ lcs_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
1390 1394
1391 cstat = irb->scsw.cmd.cstat; 1395 cstat = irb->scsw.cmd.cstat;
1392 dstat = irb->scsw.cmd.dstat; 1396 dstat = irb->scsw.cmd.dstat;
1393 LCS_DBF_TEXT_(5, trace, "Rint%s",cdev->dev.bus_id); 1397 LCS_DBF_TEXT_(5, trace, "Rint%s", dev_name(&cdev->dev));
1394 LCS_DBF_TEXT_(5, trace, "%4x%4x", irb->scsw.cmd.cstat, 1398 LCS_DBF_TEXT_(5, trace, "%4x%4x", irb->scsw.cmd.cstat,
1395 irb->scsw.cmd.dstat); 1399 irb->scsw.cmd.dstat);
1396 LCS_DBF_TEXT_(5, trace, "%4x%4x", irb->scsw.cmd.fctl, 1400 LCS_DBF_TEXT_(5, trace, "%4x%4x", irb->scsw.cmd.fctl,
@@ -1400,7 +1404,7 @@ lcs_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
1400 rc = lcs_get_problem(cdev, irb); 1404 rc = lcs_get_problem(cdev, irb);
1401 if (rc || (dstat & DEV_STAT_UNIT_EXCEP)) { 1405 if (rc || (dstat & DEV_STAT_UNIT_EXCEP)) {
1402 PRINT_WARN("check on device %s, dstat=0x%X, cstat=0x%X \n", 1406 PRINT_WARN("check on device %s, dstat=0x%X, cstat=0x%X \n",
1403 cdev->dev.bus_id, dstat, cstat); 1407 dev_name(&cdev->dev), dstat, cstat);
1404 if (rc) { 1408 if (rc) {
1405 channel->state = LCS_CH_STATE_ERROR; 1409 channel->state = LCS_CH_STATE_ERROR;
1406 } 1410 }
@@ -1463,7 +1467,7 @@ lcs_tasklet(unsigned long data)
1463 int rc; 1467 int rc;
1464 1468
1465 channel = (struct lcs_channel *) data; 1469 channel = (struct lcs_channel *) data;
1466 LCS_DBF_TEXT_(5, trace, "tlet%s",channel->ccwdev->dev.bus_id); 1470 LCS_DBF_TEXT_(5, trace, "tlet%s", dev_name(&channel->ccwdev->dev));
1467 1471
1468 /* Check for processed buffers. */ 1472 /* Check for processed buffers. */
1469 iob = channel->iob; 1473 iob = channel->iob;
@@ -2244,7 +2248,7 @@ lcs_recovery(void *ptr)
2244 return 0; 2248 return 0;
2245 LCS_DBF_TEXT(4, trace, "recover2"); 2249 LCS_DBF_TEXT(4, trace, "recover2");
2246 gdev = card->gdev; 2250 gdev = card->gdev;
2247 PRINT_WARN("Recovery of device %s started...\n", gdev->dev.bus_id); 2251 PRINT_WARN("Recovery of device %s started...\n", dev_name(&gdev->dev));
2248 rc = __lcs_shutdown_device(gdev, 1); 2252 rc = __lcs_shutdown_device(gdev, 1);
2249 rc = lcs_new_device(gdev); 2253 rc = lcs_new_device(gdev);
2250 if (!rc) 2254 if (!rc)
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c
index 9242b5acc66b..0fea51e34b57 100644
--- a/drivers/s390/net/netiucv.c
+++ b/drivers/s390/net/netiucv.c
@@ -1724,7 +1724,7 @@ static int netiucv_register_device(struct net_device *ndev)
1724 IUCV_DBF_TEXT(trace, 3, __func__); 1724 IUCV_DBF_TEXT(trace, 3, __func__);
1725 1725
1726 if (dev) { 1726 if (dev) {
1727 snprintf(dev->bus_id, BUS_ID_SIZE, "net%s", ndev->name); 1727 dev_set_name(dev, "net%s", ndev->name);
1728 dev->bus = &iucv_bus; 1728 dev->bus = &iucv_bus;
1729 dev->parent = iucv_root; 1729 dev->parent = iucv_root;
1730 /* 1730 /*
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
index bf8a75c92f28..af6d60458513 100644
--- a/drivers/s390/net/qeth_core.h
+++ b/drivers/s390/net/qeth_core.h
@@ -90,11 +90,11 @@ struct qeth_dbf_info {
90#define CARD_RDEV(card) card->read.ccwdev 90#define CARD_RDEV(card) card->read.ccwdev
91#define CARD_WDEV(card) card->write.ccwdev 91#define CARD_WDEV(card) card->write.ccwdev
92#define CARD_DDEV(card) card->data.ccwdev 92#define CARD_DDEV(card) card->data.ccwdev
93#define CARD_BUS_ID(card) card->gdev->dev.bus_id 93#define CARD_BUS_ID(card) dev_name(&card->gdev->dev)
94#define CARD_RDEV_ID(card) card->read.ccwdev->dev.bus_id 94#define CARD_RDEV_ID(card) dev_name(&card->read.ccwdev->dev)
95#define CARD_WDEV_ID(card) card->write.ccwdev->dev.bus_id 95#define CARD_WDEV_ID(card) dev_name(&card->write.ccwdev->dev)
96#define CARD_DDEV_ID(card) card->data.ccwdev->dev.bus_id 96#define CARD_DDEV_ID(card) dev_name(&card->data.ccwdev->dev)
97#define CHANNEL_ID(channel) channel->ccwdev->dev.bus_id 97#define CHANNEL_ID(channel) dev_name(&channel->ccwdev->dev)
98 98
99/** 99/**
100 * card stuff 100 * card stuff
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index c7ab1b864516..141b2bb7b3cf 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -745,7 +745,7 @@ static int qeth_get_problem(struct ccw_device *cdev, struct irb *irb)
745 SCHN_STAT_PROT_CHECK | SCHN_STAT_PROG_CHECK)) { 745 SCHN_STAT_PROT_CHECK | SCHN_STAT_PROG_CHECK)) {
746 QETH_DBF_TEXT(TRACE, 2, "CGENCHK"); 746 QETH_DBF_TEXT(TRACE, 2, "CGENCHK");
747 PRINT_WARN("check on device %s, dstat=x%x, cstat=x%x ", 747 PRINT_WARN("check on device %s, dstat=x%x, cstat=x%x ",
748 cdev->dev.bus_id, dstat, cstat); 748 dev_name(&cdev->dev), dstat, cstat);
749 print_hex_dump(KERN_WARNING, "qeth: irb ", DUMP_PREFIX_OFFSET, 749 print_hex_dump(KERN_WARNING, "qeth: irb ", DUMP_PREFIX_OFFSET,
750 16, 1, irb, 64, 1); 750 16, 1, irb, 64, 1);
751 return 1; 751 return 1;
@@ -784,12 +784,12 @@ static long __qeth_check_irb_error(struct ccw_device *cdev,
784 784
785 switch (PTR_ERR(irb)) { 785 switch (PTR_ERR(irb)) {
786 case -EIO: 786 case -EIO:
787 PRINT_WARN("i/o-error on device %s\n", cdev->dev.bus_id); 787 PRINT_WARN("i/o-error on device %s\n", dev_name(&cdev->dev));
788 QETH_DBF_TEXT(TRACE, 2, "ckirberr"); 788 QETH_DBF_TEXT(TRACE, 2, "ckirberr");
789 QETH_DBF_TEXT_(TRACE, 2, " rc%d", -EIO); 789 QETH_DBF_TEXT_(TRACE, 2, " rc%d", -EIO);
790 break; 790 break;
791 case -ETIMEDOUT: 791 case -ETIMEDOUT:
792 PRINT_WARN("timeout on device %s\n", cdev->dev.bus_id); 792 PRINT_WARN("timeout on device %s\n", dev_name(&cdev->dev));
793 QETH_DBF_TEXT(TRACE, 2, "ckirberr"); 793 QETH_DBF_TEXT(TRACE, 2, "ckirberr");
794 QETH_DBF_TEXT_(TRACE, 2, " rc%d", -ETIMEDOUT); 794 QETH_DBF_TEXT_(TRACE, 2, " rc%d", -ETIMEDOUT);
795 if (intparm == QETH_RCD_PARM) { 795 if (intparm == QETH_RCD_PARM) {
@@ -803,7 +803,7 @@ static long __qeth_check_irb_error(struct ccw_device *cdev,
803 break; 803 break;
804 default: 804 default:
805 PRINT_WARN("unknown error %ld on device %s\n", PTR_ERR(irb), 805 PRINT_WARN("unknown error %ld on device %s\n", PTR_ERR(irb),
806 cdev->dev.bus_id); 806 dev_name(&cdev->dev));
807 QETH_DBF_TEXT(TRACE, 2, "ckirberr"); 807 QETH_DBF_TEXT(TRACE, 2, "ckirberr");
808 QETH_DBF_TEXT(TRACE, 2, " rc???"); 808 QETH_DBF_TEXT(TRACE, 2, " rc???");
809 } 809 }
@@ -4081,7 +4081,7 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev)
4081 if (!get_device(dev)) 4081 if (!get_device(dev))
4082 return -ENODEV; 4082 return -ENODEV;
4083 4083
4084 QETH_DBF_TEXT_(SETUP, 2, "%s", gdev->dev.bus_id); 4084 QETH_DBF_TEXT_(SETUP, 2, "%s", dev_name(&gdev->dev));
4085 4085
4086 card = qeth_alloc_card(); 4086 card = qeth_alloc_card();
4087 if (!card) { 4087 if (!card) {
diff --git a/drivers/s390/s390_rdev.c b/drivers/s390/s390_rdev.c
index 3c7145d9f9a1..64371c05a3b3 100644
--- a/drivers/s390/s390_rdev.c
+++ b/drivers/s390/s390_rdev.c
@@ -30,7 +30,7 @@ s390_root_dev_register(const char *name)
30 dev = kzalloc(sizeof(struct device), GFP_KERNEL); 30 dev = kzalloc(sizeof(struct device), GFP_KERNEL);
31 if (!dev) 31 if (!dev)
32 return ERR_PTR(-ENOMEM); 32 return ERR_PTR(-ENOMEM);
33 strncpy(dev->bus_id, name, min(strlen(name), (size_t)BUS_ID_SIZE)); 33 dev_set_name(dev, name);
34 dev->release = s390_root_dev_release; 34 dev->release = s390_root_dev_release;
35 ret = device_register(dev); 35 ret = device_register(dev);
36 if (ret) { 36 if (ret) {
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 24255e42dc30..3b56220fb900 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -283,8 +283,8 @@ struct zfcp_unit *zfcp_unit_enqueue(struct zfcp_port *port, u64 fcp_lun)
283 unit->port = port; 283 unit->port = port;
284 unit->fcp_lun = fcp_lun; 284 unit->fcp_lun = fcp_lun;
285 285
286 snprintf(unit->sysfs_device.bus_id, BUS_ID_SIZE, "0x%016llx", 286 dev_set_name(&unit->sysfs_device, "0x%016llx",
287 (unsigned long long) fcp_lun); 287 (unsigned long long) fcp_lun);
288 unit->sysfs_device.parent = &port->sysfs_device; 288 unit->sysfs_device.parent = &port->sysfs_device;
289 unit->sysfs_device.release = zfcp_sysfs_unit_release; 289 unit->sysfs_device.release = zfcp_sysfs_unit_release;
290 dev_set_drvdata(&unit->sysfs_device, unit); 290 dev_set_drvdata(&unit->sysfs_device, unit);
@@ -610,8 +610,7 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn,
610 atomic_set_mask(status | ZFCP_STATUS_COMMON_REMOVE, &port->status); 610 atomic_set_mask(status | ZFCP_STATUS_COMMON_REMOVE, &port->status);
611 atomic_set(&port->refcount, 0); 611 atomic_set(&port->refcount, 0);
612 612
613 snprintf(port->sysfs_device.bus_id, BUS_ID_SIZE, "0x%016llx", 613 dev_set_name(&port->sysfs_device, "0x%016llx", wwpn);
614 (unsigned long long) wwpn);
615 port->sysfs_device.parent = &adapter->ccw_device->dev; 614 port->sysfs_device.parent = &adapter->ccw_device->dev;
616 615
617 port->sysfs_device.release = zfcp_sysfs_port_release; 616 port->sysfs_device.release = zfcp_sysfs_port_release;
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 73eb41580f25..8a13071c444c 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -596,7 +596,7 @@ struct zfcp_data {
596 struct semaphore config_sema; /* serialises configuration 596 struct semaphore config_sema; /* serialises configuration
597 changes */ 597 changes */
598 atomic_t loglevel; /* current loglevel */ 598 atomic_t loglevel; /* current loglevel */
599 char init_busid[BUS_ID_SIZE]; 599 char init_busid[20];
600 u64 init_wwpn; 600 u64 init_wwpn;
601 u64 init_fcp_lun; 601 u64 init_fcp_lun;
602 struct kmem_cache *fsf_req_qtcb_cache; 602 struct kmem_cache *fsf_req_qtcb_cache;
@@ -619,7 +619,7 @@ struct zfcp_fsf_req_qtcb {
619#define ZFCP_SET 0x00000100 619#define ZFCP_SET 0x00000100
620#define ZFCP_CLEAR 0x00000200 620#define ZFCP_CLEAR 0x00000200
621 621
622#define zfcp_get_busid_by_adapter(adapter) (adapter->ccw_device->dev.bus_id) 622#define zfcp_get_busid_by_adapter(adapter) (dev_name(&adapter->ccw_device->dev))
623 623
624/* 624/*
625 * Helper functions for request ID management. 625 * Helper functions for request ID management.
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 782313131870..9040f738ff33 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -1376,7 +1376,7 @@ static int zfcp_erp_thread(void *data)
1376 struct zfcp_erp_action *act; 1376 struct zfcp_erp_action *act;
1377 unsigned long flags; 1377 unsigned long flags;
1378 1378
1379 daemonize("zfcperp%s", adapter->ccw_device->dev.bus_id); 1379 daemonize("zfcperp%s", dev_name(&adapter->ccw_device->dev));
1380 /* Block all signals */ 1380 /* Block all signals */
1381 siginitsetinv(&current->blocked, 0); 1381 siginitsetinv(&current->blocked, 0);
1382 atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, &adapter->status); 1382 atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, &adapter->status);
diff --git a/drivers/s390/scsi/zfcp_sysfs.c b/drivers/s390/scsi/zfcp_sysfs.c
index 2809d789b55c..ca9293ba1766 100644
--- a/drivers/s390/scsi/zfcp_sysfs.c
+++ b/drivers/s390/scsi/zfcp_sysfs.c
@@ -381,7 +381,7 @@ static ssize_t zfcp_sysfs_scsi_##_name##_show(struct device *dev, \
381static DEVICE_ATTR(_name, S_IRUGO, zfcp_sysfs_scsi_##_name##_show, NULL); 381static DEVICE_ATTR(_name, S_IRUGO, zfcp_sysfs_scsi_##_name##_show, NULL);
382 382
383ZFCP_DEFINE_SCSI_ATTR(hba_id, "%s\n", 383ZFCP_DEFINE_SCSI_ATTR(hba_id, "%s\n",
384 unit->port->adapter->ccw_device->dev.bus_id); 384 dev_name(&unit->port->adapter->ccw_device->dev));
385ZFCP_DEFINE_SCSI_ATTR(wwpn, "0x%016llx\n", 385ZFCP_DEFINE_SCSI_ATTR(wwpn, "0x%016llx\n",
386 (unsigned long long) unit->port->wwpn); 386 (unsigned long long) unit->port->wwpn);
387ZFCP_DEFINE_SCSI_ATTR(fcp_lun, "0x%016llx\n", 387ZFCP_DEFINE_SCSI_ATTR(fcp_lun, "0x%016llx\n",
diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl
index 3eca62566d6b..f7e8e93ff30d 100755
--- a/scripts/checkstack.pl
+++ b/scripts/checkstack.pl
@@ -81,7 +81,10 @@ my (@stack, $re, $dre, $x, $xs);
81 $re = qr/.*st[dw]u.*r1,-($x{1,8})\(r1\)/o; 81 $re = qr/.*st[dw]u.*r1,-($x{1,8})\(r1\)/o;
82 } elsif ($arch =~ /^s390x?$/) { 82 } elsif ($arch =~ /^s390x?$/) {
83 # 11160: a7 fb ff 60 aghi %r15,-160 83 # 11160: a7 fb ff 60 aghi %r15,-160
84 $re = qr/.*ag?hi.*\%r15,-(([0-9]{2}|[3-9])[0-9]{2})/o; 84 # or
85 # 100092: e3 f0 ff c8 ff 71 lay %r15,-56(%r15)
86 $re = qr/.*(?:lay|ag?hi).*\%r15,-(([0-9]{2}|[3-9])[0-9]{2})
87 (?:\(\%r15\))?$/ox;
85 } elsif ($arch =~ /^sh64$/) { 88 } elsif ($arch =~ /^sh64$/) {
86 #XXX: we only check for the immediate case presently, 89 #XXX: we only check for the immediate case presently,
87 # though we will want to check for the movi/sub 90 # though we will want to check for the movi/sub