xref: /linux/drivers/s390/cio/eadm_sch.c (revision 420f42ecf48a926ba775ec7d7294425f004b6ade)
1eadb86abSSebastian Ott /*
2eadb86abSSebastian Ott  * Driver for s390 eadm subchannels
3eadb86abSSebastian Ott  *
4eadb86abSSebastian Ott  * Copyright IBM Corp. 2012
5eadb86abSSebastian Ott  * Author(s): Sebastian Ott <sebott@linux.vnet.ibm.com>
6eadb86abSSebastian Ott  */
7eadb86abSSebastian Ott 
82e73c2cfSSebastian Ott #include <linux/kernel_stat.h>
9eadb86abSSebastian Ott #include <linux/workqueue.h>
10eadb86abSSebastian Ott #include <linux/spinlock.h>
11eadb86abSSebastian Ott #include <linux/device.h>
12eadb86abSSebastian Ott #include <linux/module.h>
13eadb86abSSebastian Ott #include <linux/timer.h>
14eadb86abSSebastian Ott #include <linux/slab.h>
15eadb86abSSebastian Ott #include <linux/list.h>
16eadb86abSSebastian Ott 
17eadb86abSSebastian Ott #include <asm/css_chars.h>
18eadb86abSSebastian Ott #include <asm/debug.h>
19eadb86abSSebastian Ott #include <asm/isc.h>
20eadb86abSSebastian Ott #include <asm/cio.h>
21eadb86abSSebastian Ott #include <asm/scsw.h>
22eadb86abSSebastian Ott #include <asm/eadm.h>
23eadb86abSSebastian Ott 
24eadb86abSSebastian Ott #include "eadm_sch.h"
25eadb86abSSebastian Ott #include "ioasm.h"
26eadb86abSSebastian Ott #include "cio.h"
27eadb86abSSebastian Ott #include "css.h"
28eadb86abSSebastian Ott #include "orb.h"
29eadb86abSSebastian Ott 
30eadb86abSSebastian Ott MODULE_DESCRIPTION("driver for s390 eadm subchannels");
31eadb86abSSebastian Ott MODULE_LICENSE("GPL");
32eadb86abSSebastian Ott 
33eadb86abSSebastian Ott #define EADM_TIMEOUT (5 * HZ)
34eadb86abSSebastian Ott static DEFINE_SPINLOCK(list_lock);
35eadb86abSSebastian Ott static LIST_HEAD(eadm_list);
36eadb86abSSebastian Ott 
37eadb86abSSebastian Ott static debug_info_t *eadm_debug;
38eadb86abSSebastian Ott 
39eadb86abSSebastian Ott #define EADM_LOG(imp, txt) do {					\
40eadb86abSSebastian Ott 		debug_text_event(eadm_debug, imp, txt);		\
41eadb86abSSebastian Ott 	} while (0)
42eadb86abSSebastian Ott 
43eadb86abSSebastian Ott static void EADM_LOG_HEX(int level, void *data, int length)
44eadb86abSSebastian Ott {
45eadb86abSSebastian Ott 	if (level > eadm_debug->level)
46eadb86abSSebastian Ott 		return;
47eadb86abSSebastian Ott 	while (length > 0) {
48eadb86abSSebastian Ott 		debug_event(eadm_debug, level, data, length);
49eadb86abSSebastian Ott 		length -= eadm_debug->buf_size;
50eadb86abSSebastian Ott 		data += eadm_debug->buf_size;
51eadb86abSSebastian Ott 	}
52eadb86abSSebastian Ott }
53eadb86abSSebastian Ott 
54eadb86abSSebastian Ott static void orb_init(union orb *orb)
55eadb86abSSebastian Ott {
56eadb86abSSebastian Ott 	memset(orb, 0, sizeof(union orb));
57eadb86abSSebastian Ott 	orb->eadm.compat1 = 1;
58eadb86abSSebastian Ott 	orb->eadm.compat2 = 1;
59eadb86abSSebastian Ott 	orb->eadm.fmt = 1;
60eadb86abSSebastian Ott 	orb->eadm.x = 1;
61eadb86abSSebastian Ott }
62eadb86abSSebastian Ott 
63eadb86abSSebastian Ott static int eadm_subchannel_start(struct subchannel *sch, struct aob *aob)
64eadb86abSSebastian Ott {
65eadb86abSSebastian Ott 	union orb *orb = &get_eadm_private(sch)->orb;
66eadb86abSSebastian Ott 	int cc;
67eadb86abSSebastian Ott 
68eadb86abSSebastian Ott 	orb_init(orb);
69eadb86abSSebastian Ott 	orb->eadm.aob = (u32)__pa(aob);
70eadb86abSSebastian Ott 	orb->eadm.intparm = (u32)(addr_t)sch;
71eadb86abSSebastian Ott 	orb->eadm.key = PAGE_DEFAULT_KEY >> 4;
72eadb86abSSebastian Ott 
73eadb86abSSebastian Ott 	EADM_LOG(6, "start");
74eadb86abSSebastian Ott 	EADM_LOG_HEX(6, &sch->schid, sizeof(sch->schid));
75eadb86abSSebastian Ott 
76eadb86abSSebastian Ott 	cc = ssch(sch->schid, orb);
77eadb86abSSebastian Ott 	switch (cc) {
78eadb86abSSebastian Ott 	case 0:
79eadb86abSSebastian Ott 		sch->schib.scsw.eadm.actl |= SCSW_ACTL_START_PEND;
80eadb86abSSebastian Ott 		break;
81eadb86abSSebastian Ott 	case 1:		/* status pending */
82eadb86abSSebastian Ott 	case 2:		/* busy */
83eadb86abSSebastian Ott 		return -EBUSY;
84eadb86abSSebastian Ott 	case 3:		/* not operational */
85eadb86abSSebastian Ott 		return -ENODEV;
86eadb86abSSebastian Ott 	}
87eadb86abSSebastian Ott 	return 0;
88eadb86abSSebastian Ott }
89eadb86abSSebastian Ott 
90eadb86abSSebastian Ott static int eadm_subchannel_clear(struct subchannel *sch)
91eadb86abSSebastian Ott {
92eadb86abSSebastian Ott 	int cc;
93eadb86abSSebastian Ott 
94eadb86abSSebastian Ott 	cc = csch(sch->schid);
95eadb86abSSebastian Ott 	if (cc)
96eadb86abSSebastian Ott 		return -ENODEV;
97eadb86abSSebastian Ott 
98eadb86abSSebastian Ott 	sch->schib.scsw.eadm.actl |= SCSW_ACTL_CLEAR_PEND;
99eadb86abSSebastian Ott 	return 0;
100eadb86abSSebastian Ott }
101eadb86abSSebastian Ott 
102eadb86abSSebastian Ott static void eadm_subchannel_timeout(unsigned long data)
103eadb86abSSebastian Ott {
104eadb86abSSebastian Ott 	struct subchannel *sch = (struct subchannel *) data;
105eadb86abSSebastian Ott 
106eadb86abSSebastian Ott 	spin_lock_irq(sch->lock);
107eadb86abSSebastian Ott 	EADM_LOG(1, "timeout");
108eadb86abSSebastian Ott 	EADM_LOG_HEX(1, &sch->schid, sizeof(sch->schid));
109eadb86abSSebastian Ott 	if (eadm_subchannel_clear(sch))
110eadb86abSSebastian Ott 		EADM_LOG(0, "clear failed");
111eadb86abSSebastian Ott 	spin_unlock_irq(sch->lock);
112eadb86abSSebastian Ott }
113eadb86abSSebastian Ott 
114eadb86abSSebastian Ott static void eadm_subchannel_set_timeout(struct subchannel *sch, int expires)
115eadb86abSSebastian Ott {
116eadb86abSSebastian Ott 	struct eadm_private *private = get_eadm_private(sch);
117eadb86abSSebastian Ott 
118eadb86abSSebastian Ott 	if (expires == 0) {
119eadb86abSSebastian Ott 		del_timer(&private->timer);
120eadb86abSSebastian Ott 		return;
121eadb86abSSebastian Ott 	}
122eadb86abSSebastian Ott 	if (timer_pending(&private->timer)) {
123eadb86abSSebastian Ott 		if (mod_timer(&private->timer, jiffies + expires))
124eadb86abSSebastian Ott 			return;
125eadb86abSSebastian Ott 	}
126eadb86abSSebastian Ott 	private->timer.function = eadm_subchannel_timeout;
127eadb86abSSebastian Ott 	private->timer.data = (unsigned long) sch;
128eadb86abSSebastian Ott 	private->timer.expires = jiffies + expires;
129eadb86abSSebastian Ott 	add_timer(&private->timer);
130eadb86abSSebastian Ott }
131eadb86abSSebastian Ott 
132eadb86abSSebastian Ott static void eadm_subchannel_irq(struct subchannel *sch)
133eadb86abSSebastian Ott {
134eadb86abSSebastian Ott 	struct eadm_private *private = get_eadm_private(sch);
135eadb86abSSebastian Ott 	struct eadm_scsw *scsw = &sch->schib.scsw.eadm;
136eadb86abSSebastian Ott 	struct irb *irb = (struct irb *)&S390_lowcore.irb;
137eadb86abSSebastian Ott 	int error = 0;
138eadb86abSSebastian Ott 
139eadb86abSSebastian Ott 	EADM_LOG(6, "irq");
140eadb86abSSebastian Ott 	EADM_LOG_HEX(6, irb, sizeof(*irb));
141eadb86abSSebastian Ott 
142*420f42ecSHeiko Carstens 	inc_irq_stat(IRQIO_ADM);
1432e73c2cfSSebastian Ott 
144eadb86abSSebastian Ott 	if ((scsw->stctl & (SCSW_STCTL_ALERT_STATUS | SCSW_STCTL_STATUS_PEND))
145eadb86abSSebastian Ott 	    && scsw->eswf == 1 && irb->esw.eadm.erw.r)
146eadb86abSSebastian Ott 		error = -EIO;
147eadb86abSSebastian Ott 
148eadb86abSSebastian Ott 	if (scsw->fctl & SCSW_FCTL_CLEAR_FUNC)
149eadb86abSSebastian Ott 		error = -ETIMEDOUT;
150eadb86abSSebastian Ott 
151eadb86abSSebastian Ott 	eadm_subchannel_set_timeout(sch, 0);
152eadb86abSSebastian Ott 
153eadb86abSSebastian Ott 	if (private->state != EADM_BUSY) {
154eadb86abSSebastian Ott 		EADM_LOG(1, "irq unsol");
155eadb86abSSebastian Ott 		EADM_LOG_HEX(1, irb, sizeof(*irb));
156eadb86abSSebastian Ott 		private->state = EADM_NOT_OPER;
157eadb86abSSebastian Ott 		css_sched_sch_todo(sch, SCH_TODO_EVAL);
158eadb86abSSebastian Ott 		return;
159eadb86abSSebastian Ott 	}
160eadb86abSSebastian Ott 	scm_irq_handler((struct aob *)(unsigned long)scsw->aob, error);
161eadb86abSSebastian Ott 	private->state = EADM_IDLE;
162eadb86abSSebastian Ott }
163eadb86abSSebastian Ott 
164eadb86abSSebastian Ott static struct subchannel *eadm_get_idle_sch(void)
165eadb86abSSebastian Ott {
166eadb86abSSebastian Ott 	struct eadm_private *private;
167eadb86abSSebastian Ott 	struct subchannel *sch;
168eadb86abSSebastian Ott 	unsigned long flags;
169eadb86abSSebastian Ott 
170eadb86abSSebastian Ott 	spin_lock_irqsave(&list_lock, flags);
171eadb86abSSebastian Ott 	list_for_each_entry(private, &eadm_list, head) {
172eadb86abSSebastian Ott 		sch = private->sch;
173eadb86abSSebastian Ott 		spin_lock(sch->lock);
174eadb86abSSebastian Ott 		if (private->state == EADM_IDLE) {
175eadb86abSSebastian Ott 			private->state = EADM_BUSY;
176eadb86abSSebastian Ott 			list_move_tail(&private->head, &eadm_list);
177eadb86abSSebastian Ott 			spin_unlock(sch->lock);
178eadb86abSSebastian Ott 			spin_unlock_irqrestore(&list_lock, flags);
179eadb86abSSebastian Ott 
180eadb86abSSebastian Ott 			return sch;
181eadb86abSSebastian Ott 		}
182eadb86abSSebastian Ott 		spin_unlock(sch->lock);
183eadb86abSSebastian Ott 	}
184eadb86abSSebastian Ott 	spin_unlock_irqrestore(&list_lock, flags);
185eadb86abSSebastian Ott 
186eadb86abSSebastian Ott 	return NULL;
187eadb86abSSebastian Ott }
188eadb86abSSebastian Ott 
189eadb86abSSebastian Ott static int eadm_start_aob(struct aob *aob)
190eadb86abSSebastian Ott {
191eadb86abSSebastian Ott 	struct eadm_private *private;
192eadb86abSSebastian Ott 	struct subchannel *sch;
193eadb86abSSebastian Ott 	unsigned long flags;
194eadb86abSSebastian Ott 	int ret;
195eadb86abSSebastian Ott 
196eadb86abSSebastian Ott 	sch = eadm_get_idle_sch();
197eadb86abSSebastian Ott 	if (!sch)
198eadb86abSSebastian Ott 		return -EBUSY;
199eadb86abSSebastian Ott 
200eadb86abSSebastian Ott 	spin_lock_irqsave(sch->lock, flags);
201eadb86abSSebastian Ott 	eadm_subchannel_set_timeout(sch, EADM_TIMEOUT);
202eadb86abSSebastian Ott 	ret = eadm_subchannel_start(sch, aob);
203eadb86abSSebastian Ott 	if (!ret)
204eadb86abSSebastian Ott 		goto out_unlock;
205eadb86abSSebastian Ott 
206eadb86abSSebastian Ott 	/* Handle start subchannel failure. */
207eadb86abSSebastian Ott 	eadm_subchannel_set_timeout(sch, 0);
208eadb86abSSebastian Ott 	private = get_eadm_private(sch);
209eadb86abSSebastian Ott 	private->state = EADM_NOT_OPER;
210eadb86abSSebastian Ott 	css_sched_sch_todo(sch, SCH_TODO_EVAL);
211eadb86abSSebastian Ott 
212eadb86abSSebastian Ott out_unlock:
213eadb86abSSebastian Ott 	spin_unlock_irqrestore(sch->lock, flags);
214eadb86abSSebastian Ott 
215eadb86abSSebastian Ott 	return ret;
216eadb86abSSebastian Ott }
217eadb86abSSebastian Ott 
218eadb86abSSebastian Ott static int eadm_subchannel_probe(struct subchannel *sch)
219eadb86abSSebastian Ott {
220eadb86abSSebastian Ott 	struct eadm_private *private;
221eadb86abSSebastian Ott 	int ret;
222eadb86abSSebastian Ott 
223eadb86abSSebastian Ott 	private = kzalloc(sizeof(*private), GFP_KERNEL | GFP_DMA);
224eadb86abSSebastian Ott 	if (!private)
225eadb86abSSebastian Ott 		return -ENOMEM;
226eadb86abSSebastian Ott 
227eadb86abSSebastian Ott 	INIT_LIST_HEAD(&private->head);
228eadb86abSSebastian Ott 	init_timer(&private->timer);
229eadb86abSSebastian Ott 
230eadb86abSSebastian Ott 	spin_lock_irq(sch->lock);
231eadb86abSSebastian Ott 	set_eadm_private(sch, private);
232eadb86abSSebastian Ott 	private->state = EADM_IDLE;
233eadb86abSSebastian Ott 	private->sch = sch;
234eadb86abSSebastian Ott 	sch->isc = EADM_SCH_ISC;
235eadb86abSSebastian Ott 	ret = cio_enable_subchannel(sch, (u32)(unsigned long)sch);
236eadb86abSSebastian Ott 	if (ret) {
237eadb86abSSebastian Ott 		set_eadm_private(sch, NULL);
238eadb86abSSebastian Ott 		spin_unlock_irq(sch->lock);
239eadb86abSSebastian Ott 		kfree(private);
240eadb86abSSebastian Ott 		goto out;
241eadb86abSSebastian Ott 	}
242eadb86abSSebastian Ott 	spin_unlock_irq(sch->lock);
243eadb86abSSebastian Ott 
244eadb86abSSebastian Ott 	spin_lock_irq(&list_lock);
245eadb86abSSebastian Ott 	list_add(&private->head, &eadm_list);
246eadb86abSSebastian Ott 	spin_unlock_irq(&list_lock);
247eadb86abSSebastian Ott 
248eadb86abSSebastian Ott 	if (dev_get_uevent_suppress(&sch->dev)) {
249eadb86abSSebastian Ott 		dev_set_uevent_suppress(&sch->dev, 0);
250eadb86abSSebastian Ott 		kobject_uevent(&sch->dev.kobj, KOBJ_ADD);
251eadb86abSSebastian Ott 	}
252eadb86abSSebastian Ott out:
253eadb86abSSebastian Ott 	return ret;
254eadb86abSSebastian Ott }
255eadb86abSSebastian Ott 
256eadb86abSSebastian Ott static void eadm_quiesce(struct subchannel *sch)
257eadb86abSSebastian Ott {
258eadb86abSSebastian Ott 	int ret;
259eadb86abSSebastian Ott 
260eadb86abSSebastian Ott 	do {
261eadb86abSSebastian Ott 		spin_lock_irq(sch->lock);
262eadb86abSSebastian Ott 		ret = cio_disable_subchannel(sch);
263eadb86abSSebastian Ott 		spin_unlock_irq(sch->lock);
264eadb86abSSebastian Ott 	} while (ret == -EBUSY);
265eadb86abSSebastian Ott }
266eadb86abSSebastian Ott 
267eadb86abSSebastian Ott static int eadm_subchannel_remove(struct subchannel *sch)
268eadb86abSSebastian Ott {
269eadb86abSSebastian Ott 	struct eadm_private *private = get_eadm_private(sch);
270eadb86abSSebastian Ott 
271eadb86abSSebastian Ott 	spin_lock_irq(&list_lock);
272eadb86abSSebastian Ott 	list_del(&private->head);
273eadb86abSSebastian Ott 	spin_unlock_irq(&list_lock);
274eadb86abSSebastian Ott 
275eadb86abSSebastian Ott 	eadm_quiesce(sch);
276eadb86abSSebastian Ott 
277eadb86abSSebastian Ott 	spin_lock_irq(sch->lock);
278eadb86abSSebastian Ott 	set_eadm_private(sch, NULL);
279eadb86abSSebastian Ott 	spin_unlock_irq(sch->lock);
280eadb86abSSebastian Ott 
281eadb86abSSebastian Ott 	kfree(private);
282eadb86abSSebastian Ott 
283eadb86abSSebastian Ott 	return 0;
284eadb86abSSebastian Ott }
285eadb86abSSebastian Ott 
286eadb86abSSebastian Ott static void eadm_subchannel_shutdown(struct subchannel *sch)
287eadb86abSSebastian Ott {
288eadb86abSSebastian Ott 	eadm_quiesce(sch);
289eadb86abSSebastian Ott }
290eadb86abSSebastian Ott 
291eadb86abSSebastian Ott static int eadm_subchannel_freeze(struct subchannel *sch)
292eadb86abSSebastian Ott {
293eadb86abSSebastian Ott 	return cio_disable_subchannel(sch);
294eadb86abSSebastian Ott }
295eadb86abSSebastian Ott 
296eadb86abSSebastian Ott static int eadm_subchannel_restore(struct subchannel *sch)
297eadb86abSSebastian Ott {
298eadb86abSSebastian Ott 	return cio_enable_subchannel(sch, (u32)(unsigned long)sch);
299eadb86abSSebastian Ott }
300eadb86abSSebastian Ott 
301eadb86abSSebastian Ott /**
302eadb86abSSebastian Ott  * eadm_subchannel_sch_event - process subchannel event
303eadb86abSSebastian Ott  * @sch: subchannel
304eadb86abSSebastian Ott  * @process: non-zero if function is called in process context
305eadb86abSSebastian Ott  *
306eadb86abSSebastian Ott  * An unspecified event occurred for this subchannel. Adjust data according
307eadb86abSSebastian Ott  * to the current operational state of the subchannel. Return zero when the
308eadb86abSSebastian Ott  * event has been handled sufficiently or -EAGAIN when this function should
309eadb86abSSebastian Ott  * be called again in process context.
310eadb86abSSebastian Ott  */
311eadb86abSSebastian Ott static int eadm_subchannel_sch_event(struct subchannel *sch, int process)
312eadb86abSSebastian Ott {
313eadb86abSSebastian Ott 	struct eadm_private *private;
314eadb86abSSebastian Ott 	unsigned long flags;
315eadb86abSSebastian Ott 	int ret = 0;
316eadb86abSSebastian Ott 
317eadb86abSSebastian Ott 	spin_lock_irqsave(sch->lock, flags);
318eadb86abSSebastian Ott 	if (!device_is_registered(&sch->dev))
319eadb86abSSebastian Ott 		goto out_unlock;
320eadb86abSSebastian Ott 
321eadb86abSSebastian Ott 	if (work_pending(&sch->todo_work))
322eadb86abSSebastian Ott 		goto out_unlock;
323eadb86abSSebastian Ott 
324eadb86abSSebastian Ott 	if (cio_update_schib(sch)) {
325eadb86abSSebastian Ott 		css_sched_sch_todo(sch, SCH_TODO_UNREG);
326eadb86abSSebastian Ott 		goto out_unlock;
327eadb86abSSebastian Ott 	}
328eadb86abSSebastian Ott 	private = get_eadm_private(sch);
329eadb86abSSebastian Ott 	if (private->state == EADM_NOT_OPER)
330eadb86abSSebastian Ott 		private->state = EADM_IDLE;
331eadb86abSSebastian Ott 
332eadb86abSSebastian Ott out_unlock:
333eadb86abSSebastian Ott 	spin_unlock_irqrestore(sch->lock, flags);
334eadb86abSSebastian Ott 
335eadb86abSSebastian Ott 	return ret;
336eadb86abSSebastian Ott }
337eadb86abSSebastian Ott 
338eadb86abSSebastian Ott static struct css_device_id eadm_subchannel_ids[] = {
339eadb86abSSebastian Ott 	{ .match_flags = 0x1, .type = SUBCHANNEL_TYPE_ADM, },
340eadb86abSSebastian Ott 	{ /* end of list */ },
341eadb86abSSebastian Ott };
342eadb86abSSebastian Ott MODULE_DEVICE_TABLE(css, eadm_subchannel_ids);
343eadb86abSSebastian Ott 
344eadb86abSSebastian Ott static struct css_driver eadm_subchannel_driver = {
345eadb86abSSebastian Ott 	.drv = {
346eadb86abSSebastian Ott 		.name = "eadm_subchannel",
347eadb86abSSebastian Ott 		.owner = THIS_MODULE,
348eadb86abSSebastian Ott 	},
349eadb86abSSebastian Ott 	.subchannel_type = eadm_subchannel_ids,
350eadb86abSSebastian Ott 	.irq = eadm_subchannel_irq,
351eadb86abSSebastian Ott 	.probe = eadm_subchannel_probe,
352eadb86abSSebastian Ott 	.remove = eadm_subchannel_remove,
353eadb86abSSebastian Ott 	.shutdown = eadm_subchannel_shutdown,
354eadb86abSSebastian Ott 	.sch_event = eadm_subchannel_sch_event,
355eadb86abSSebastian Ott 	.freeze = eadm_subchannel_freeze,
356eadb86abSSebastian Ott 	.thaw = eadm_subchannel_restore,
357eadb86abSSebastian Ott 	.restore = eadm_subchannel_restore,
358eadb86abSSebastian Ott };
359eadb86abSSebastian Ott 
360eadb86abSSebastian Ott static struct eadm_ops eadm_ops = {
361eadb86abSSebastian Ott 	.eadm_start = eadm_start_aob,
362eadb86abSSebastian Ott 	.owner = THIS_MODULE,
363eadb86abSSebastian Ott };
364eadb86abSSebastian Ott 
365eadb86abSSebastian Ott static int __init eadm_sch_init(void)
366eadb86abSSebastian Ott {
367eadb86abSSebastian Ott 	int ret;
368eadb86abSSebastian Ott 
369eadb86abSSebastian Ott 	if (!css_general_characteristics.eadm)
370eadb86abSSebastian Ott 		return -ENXIO;
371eadb86abSSebastian Ott 
372eadb86abSSebastian Ott 	eadm_debug = debug_register("eadm_log", 16, 1, 16);
373eadb86abSSebastian Ott 	if (!eadm_debug)
374eadb86abSSebastian Ott 		return -ENOMEM;
375eadb86abSSebastian Ott 
376eadb86abSSebastian Ott 	debug_register_view(eadm_debug, &debug_hex_ascii_view);
377eadb86abSSebastian Ott 	debug_set_level(eadm_debug, 2);
378eadb86abSSebastian Ott 
379eadb86abSSebastian Ott 	isc_register(EADM_SCH_ISC);
380eadb86abSSebastian Ott 	ret = css_driver_register(&eadm_subchannel_driver);
381eadb86abSSebastian Ott 	if (ret)
382eadb86abSSebastian Ott 		goto cleanup;
383eadb86abSSebastian Ott 
384eadb86abSSebastian Ott 	register_eadm_ops(&eadm_ops);
385eadb86abSSebastian Ott 	return ret;
386eadb86abSSebastian Ott 
387eadb86abSSebastian Ott cleanup:
388eadb86abSSebastian Ott 	isc_unregister(EADM_SCH_ISC);
389eadb86abSSebastian Ott 	debug_unregister(eadm_debug);
390eadb86abSSebastian Ott 	return ret;
391eadb86abSSebastian Ott }
392eadb86abSSebastian Ott 
393eadb86abSSebastian Ott static void __exit eadm_sch_exit(void)
394eadb86abSSebastian Ott {
395eadb86abSSebastian Ott 	unregister_eadm_ops(&eadm_ops);
396eadb86abSSebastian Ott 	css_driver_unregister(&eadm_subchannel_driver);
397eadb86abSSebastian Ott 	isc_unregister(EADM_SCH_ISC);
398eadb86abSSebastian Ott 	debug_unregister(eadm_debug);
399eadb86abSSebastian Ott }
400eadb86abSSebastian Ott module_init(eadm_sch_init);
401eadb86abSSebastian Ott module_exit(eadm_sch_exit);
402