]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/s390/cio/css.c
ac5ceb933896dc4088df1d9f6c600dd91ad0a2dd
[linux-2.6-omap-h63xx.git] / drivers / s390 / cio / css.c
1 /*
2  *  drivers/s390/cio/css.c
3  *  driver for channel subsystem
4  *
5  *    Copyright (C) 2002 IBM Deutschland Entwicklung GmbH,
6  *                       IBM Corporation
7  *    Author(s): Arnd Bergmann (arndb@de.ibm.com)
8  *               Cornelia Huck (cornelia.huck@de.ibm.com)
9  */
10 #include <linux/module.h>
11 #include <linux/init.h>
12 #include <linux/device.h>
13 #include <linux/slab.h>
14 #include <linux/errno.h>
15 #include <linux/list.h>
16
17 #include "css.h"
18 #include "cio.h"
19 #include "cio_debug.h"
20 #include "ioasm.h"
21 #include "chsc.h"
22 #include "device.h"
23 #include "idset.h"
24 #include "chp.h"
25
26 int css_init_done = 0;
27 static int need_reprobe = 0;
28 static int max_ssid = 0;
29
30 struct channel_subsystem *css[__MAX_CSSID + 1];
31
32 int css_characteristics_avail = 0;
33
34 int
35 for_each_subchannel(int(*fn)(struct subchannel_id, void *), void *data)
36 {
37         struct subchannel_id schid;
38         int ret;
39
40         init_subchannel_id(&schid);
41         ret = -ENODEV;
42         do {
43                 do {
44                         ret = fn(schid, data);
45                         if (ret)
46                                 break;
47                 } while (schid.sch_no++ < __MAX_SUBCHANNEL);
48                 schid.sch_no = 0;
49         } while (schid.ssid++ < max_ssid);
50         return ret;
51 }
52
53 static struct subchannel *
54 css_alloc_subchannel(struct subchannel_id schid)
55 {
56         struct subchannel *sch;
57         int ret;
58
59         sch = kmalloc (sizeof (*sch), GFP_KERNEL | GFP_DMA);
60         if (sch == NULL)
61                 return ERR_PTR(-ENOMEM);
62         ret = cio_validate_subchannel (sch, schid);
63         if (ret < 0) {
64                 kfree(sch);
65                 return ERR_PTR(ret);
66         }
67
68         if (sch->st != SUBCHANNEL_TYPE_IO) {
69                 /* For now we ignore all non-io subchannels. */
70                 kfree(sch);
71                 return ERR_PTR(-EINVAL);
72         }
73
74         /* 
75          * Set intparm to subchannel address.
76          * This is fine even on 64bit since the subchannel is always located
77          * under 2G.
78          */
79         sch->schib.pmcw.intparm = (__u32)(unsigned long)sch;
80         ret = cio_modify(sch);
81         if (ret) {
82                 kfree(sch);
83                 return ERR_PTR(ret);
84         }
85         return sch;
86 }
87
88 static void
89 css_free_subchannel(struct subchannel *sch)
90 {
91         if (sch) {
92                 /* Reset intparm to zeroes. */
93                 sch->schib.pmcw.intparm = 0;
94                 cio_modify(sch);
95                 kfree(sch->lock);
96                 kfree(sch);
97         }
98 }
99
100 static void
101 css_subchannel_release(struct device *dev)
102 {
103         struct subchannel *sch;
104
105         sch = to_subchannel(dev);
106         if (!cio_is_console(sch->schid)) {
107                 kfree(sch->lock);
108                 kfree(sch);
109         }
110 }
111
112 static int css_sch_device_register(struct subchannel *sch)
113 {
114         int ret;
115
116         mutex_lock(&sch->reg_mutex);
117         ret = device_register(&sch->dev);
118         mutex_unlock(&sch->reg_mutex);
119         return ret;
120 }
121
122 void css_sch_device_unregister(struct subchannel *sch)
123 {
124         mutex_lock(&sch->reg_mutex);
125         device_unregister(&sch->dev);
126         mutex_unlock(&sch->reg_mutex);
127 }
128
129 static void ssd_from_pmcw(struct chsc_ssd_info *ssd, struct pmcw *pmcw)
130 {
131         int i;
132         int mask;
133
134         memset(ssd, 0, sizeof(struct chsc_ssd_info));
135         ssd->path_mask = pmcw->pim;
136         for (i = 0; i < 8; i++) {
137                 mask = 0x80 >> i;
138                 if (pmcw->pim & mask) {
139                         chp_id_init(&ssd->chpid[i]);
140                         ssd->chpid[i].id = pmcw->chpid[i];
141                 }
142         }
143 }
144
145 static void ssd_register_chpids(struct chsc_ssd_info *ssd)
146 {
147         int i;
148         int mask;
149
150         for (i = 0; i < 8; i++) {
151                 mask = 0x80 >> i;
152                 if (ssd->path_mask & mask)
153                         if (!chp_is_registered(ssd->chpid[i]))
154                                 chp_new(ssd->chpid[i]);
155         }
156 }
157
158 void css_update_ssd_info(struct subchannel *sch)
159 {
160         int ret;
161
162         if (cio_is_console(sch->schid)) {
163                 /* Console is initialized too early for functions requiring
164                  * memory allocation. */
165                 ssd_from_pmcw(&sch->ssd_info, &sch->schib.pmcw);
166         } else {
167                 ret = chsc_get_ssd_info(sch->schid, &sch->ssd_info);
168                 if (ret)
169                         ssd_from_pmcw(&sch->ssd_info, &sch->schib.pmcw);
170                 ssd_register_chpids(&sch->ssd_info);
171         }
172 }
173
174 static int css_register_subchannel(struct subchannel *sch)
175 {
176         int ret;
177
178         /* Initialize the subchannel structure */
179         sch->dev.parent = &css[0]->device;
180         sch->dev.bus = &css_bus_type;
181         sch->dev.release = &css_subchannel_release;
182         sch->dev.groups = subch_attr_groups;
183         css_update_ssd_info(sch);
184         /* make it known to the system */
185         ret = css_sch_device_register(sch);
186         if (ret) {
187                 CIO_MSG_EVENT(0, "Could not register sch 0.%x.%04x: %d\n",
188                               sch->schid.ssid, sch->schid.sch_no, ret);
189                 return ret;
190         }
191         return ret;
192 }
193
194 static int css_probe_device(struct subchannel_id schid)
195 {
196         int ret;
197         struct subchannel *sch;
198
199         sch = css_alloc_subchannel(schid);
200         if (IS_ERR(sch))
201                 return PTR_ERR(sch);
202         ret = css_register_subchannel(sch);
203         if (ret)
204                 css_free_subchannel(sch);
205         return ret;
206 }
207
208 static int
209 check_subchannel(struct device * dev, void * data)
210 {
211         struct subchannel *sch;
212         struct subchannel_id *schid = data;
213
214         sch = to_subchannel(dev);
215         return schid_equal(&sch->schid, schid);
216 }
217
218 struct subchannel *
219 get_subchannel_by_schid(struct subchannel_id schid)
220 {
221         struct device *dev;
222
223         dev = bus_find_device(&css_bus_type, NULL,
224                               &schid, check_subchannel);
225
226         return dev ? to_subchannel(dev) : NULL;
227 }
228
229 static int css_get_subchannel_status(struct subchannel *sch)
230 {
231         struct schib schib;
232
233         if (stsch(sch->schid, &schib) || !schib.pmcw.dnv)
234                 return CIO_GONE;
235         if (sch->schib.pmcw.dnv && (schib.pmcw.dev != sch->schib.pmcw.dev))
236                 return CIO_REVALIDATE;
237         if (!sch->lpm)
238                 return CIO_NO_PATH;
239         return CIO_OPER;
240 }
241
242 static int css_evaluate_known_subchannel(struct subchannel *sch, int slow)
243 {
244         int event, ret, disc;
245         unsigned long flags;
246         enum { NONE, UNREGISTER, UNREGISTER_PROBE, REPROBE } action;
247
248         spin_lock_irqsave(sch->lock, flags);
249         disc = device_is_disconnected(sch);
250         if (disc && slow) {
251                 /* Disconnected devices are evaluated directly only.*/
252                 spin_unlock_irqrestore(sch->lock, flags);
253                 return 0;
254         }
255         /* No interrupt after machine check - kill pending timers. */
256         device_kill_pending_timer(sch);
257         if (!disc && !slow) {
258                 /* Non-disconnected devices are evaluated on the slow path. */
259                 spin_unlock_irqrestore(sch->lock, flags);
260                 return -EAGAIN;
261         }
262         event = css_get_subchannel_status(sch);
263         CIO_MSG_EVENT(4, "Evaluating schid 0.%x.%04x, event %d, %s, %s path.\n",
264                       sch->schid.ssid, sch->schid.sch_no, event,
265                       disc ? "disconnected" : "normal",
266                       slow ? "slow" : "fast");
267         /* Analyze subchannel status. */
268         action = NONE;
269         switch (event) {
270         case CIO_NO_PATH:
271                 if (disc) {
272                         /* Check if paths have become available. */
273                         action = REPROBE;
274                         break;
275                 }
276                 /* fall through */
277         case CIO_GONE:
278                 /* Prevent unwanted effects when opening lock. */
279                 cio_disable_subchannel(sch);
280                 device_set_disconnected(sch);
281                 /* Ask driver what to do with device. */
282                 action = UNREGISTER;
283                 if (sch->driver && sch->driver->notify) {
284                         spin_unlock_irqrestore(sch->lock, flags);
285                         ret = sch->driver->notify(&sch->dev, event);
286                         spin_lock_irqsave(sch->lock, flags);
287                         if (ret)
288                                 action = NONE;
289                 }
290                 break;
291         case CIO_REVALIDATE:
292                 /* Device will be removed, so no notify necessary. */
293                 if (disc)
294                         /* Reprobe because immediate unregister might block. */
295                         action = REPROBE;
296                 else
297                         action = UNREGISTER_PROBE;
298                 break;
299         case CIO_OPER:
300                 if (disc)
301                         /* Get device operational again. */
302                         action = REPROBE;
303                 break;
304         }
305         /* Perform action. */
306         ret = 0;
307         switch (action) {
308         case UNREGISTER:
309         case UNREGISTER_PROBE:
310                 /* Unregister device (will use subchannel lock). */
311                 spin_unlock_irqrestore(sch->lock, flags);
312                 css_sch_device_unregister(sch);
313                 spin_lock_irqsave(sch->lock, flags);
314
315                 /* Reset intparm to zeroes. */
316                 sch->schib.pmcw.intparm = 0;
317                 cio_modify(sch);
318                 break;
319         case REPROBE:
320                 device_trigger_reprobe(sch);
321                 break;
322         default:
323                 break;
324         }
325         spin_unlock_irqrestore(sch->lock, flags);
326         /* Probe if necessary. */
327         if (action == UNREGISTER_PROBE)
328                 ret = css_probe_device(sch->schid);
329
330         return ret;
331 }
332
333 static int css_evaluate_new_subchannel(struct subchannel_id schid, int slow)
334 {
335         struct schib schib;
336
337         if (!slow) {
338                 /* Will be done on the slow path. */
339                 return -EAGAIN;
340         }
341         if (stsch_err(schid, &schib) || !schib.pmcw.dnv) {
342                 /* Unusable - ignore. */
343                 return 0;
344         }
345         CIO_MSG_EVENT(4, "Evaluating schid 0.%x.%04x, event %d, unknown, "
346                          "slow path.\n", schid.ssid, schid.sch_no, CIO_OPER);
347
348         return css_probe_device(schid);
349 }
350
351 static void css_evaluate_subchannel(struct subchannel_id schid, int slow)
352 {
353         struct subchannel *sch;
354         int ret;
355
356         sch = get_subchannel_by_schid(schid);
357         if (sch) {
358                 ret = css_evaluate_known_subchannel(sch, slow);
359                 put_device(&sch->dev);
360         } else
361                 ret = css_evaluate_new_subchannel(schid, slow);
362         if (ret == -EAGAIN)
363                 css_schedule_eval(schid);
364 }
365
366 static struct idset *slow_subchannel_set;
367 static spinlock_t slow_subchannel_lock;
368
369 static int __init slow_subchannel_init(void)
370 {
371         spin_lock_init(&slow_subchannel_lock);
372         slow_subchannel_set = idset_sch_new();
373         if (!slow_subchannel_set) {
374                 CIO_MSG_EVENT(0, "could not allocate slow subchannel set\n");
375                 return -ENOMEM;
376         }
377         return 0;
378 }
379
380 subsys_initcall(slow_subchannel_init);
381
382 static void css_slow_path_func(struct work_struct *unused)
383 {
384         struct subchannel_id schid;
385
386         CIO_TRACE_EVENT(4, "slowpath");
387         spin_lock_irq(&slow_subchannel_lock);
388         init_subchannel_id(&schid);
389         while (idset_sch_get_first(slow_subchannel_set, &schid)) {
390                 idset_sch_del(slow_subchannel_set, schid);
391                 spin_unlock_irq(&slow_subchannel_lock);
392                 css_evaluate_subchannel(schid, 1);
393                 spin_lock_irq(&slow_subchannel_lock);
394         }
395         spin_unlock_irq(&slow_subchannel_lock);
396 }
397
398 static DECLARE_WORK(slow_path_work, css_slow_path_func);
399 struct workqueue_struct *slow_path_wq;
400
401 void css_schedule_eval(struct subchannel_id schid)
402 {
403         unsigned long flags;
404
405         spin_lock_irqsave(&slow_subchannel_lock, flags);
406         idset_sch_add(slow_subchannel_set, schid);
407         queue_work(slow_path_wq, &slow_path_work);
408         spin_unlock_irqrestore(&slow_subchannel_lock, flags);
409 }
410
411 void css_schedule_eval_all(void)
412 {
413         unsigned long flags;
414
415         spin_lock_irqsave(&slow_subchannel_lock, flags);
416         idset_fill(slow_subchannel_set);
417         queue_work(slow_path_wq, &slow_path_work);
418         spin_unlock_irqrestore(&slow_subchannel_lock, flags);
419 }
420
421 /* Reprobe subchannel if unregistered. */
422 static int reprobe_subchannel(struct subchannel_id schid, void *data)
423 {
424         struct subchannel *sch;
425         int ret;
426
427         CIO_MSG_EVENT(6, "cio: reprobe 0.%x.%04x\n",
428                       schid.ssid, schid.sch_no);
429         if (need_reprobe)
430                 return -EAGAIN;
431
432         sch = get_subchannel_by_schid(schid);
433         if (sch) {
434                 /* Already known. */
435                 put_device(&sch->dev);
436                 return 0;
437         }
438
439         ret = css_probe_device(schid);
440         switch (ret) {
441         case 0:
442                 break;
443         case -ENXIO:
444         case -ENOMEM:
445                 /* These should abort looping */
446                 break;
447         default:
448                 ret = 0;
449         }
450
451         return ret;
452 }
453
454 /* Work function used to reprobe all unregistered subchannels. */
455 static void reprobe_all(struct work_struct *unused)
456 {
457         int ret;
458
459         CIO_MSG_EVENT(2, "reprobe start\n");
460
461         need_reprobe = 0;
462         /* Make sure initial subchannel scan is done. */
463         wait_event(ccw_device_init_wq,
464                    atomic_read(&ccw_device_init_count) == 0);
465         ret = for_each_subchannel(reprobe_subchannel, NULL);
466
467         CIO_MSG_EVENT(2, "reprobe done (rc=%d, need_reprobe=%d)\n", ret,
468                       need_reprobe);
469 }
470
471 static DECLARE_WORK(css_reprobe_work, reprobe_all);
472
473 /* Schedule reprobing of all unregistered subchannels. */
474 void css_schedule_reprobe(void)
475 {
476         need_reprobe = 1;
477         queue_work(ccw_device_work, &css_reprobe_work);
478 }
479
480 EXPORT_SYMBOL_GPL(css_schedule_reprobe);
481
482 /*
483  * Called from the machine check handler for subchannel report words.
484  */
485 void css_process_crw(int rsid1, int rsid2)
486 {
487         struct subchannel_id mchk_schid;
488
489         CIO_CRW_EVENT(2, "source is subchannel %04X, subsystem id %x\n",
490                       rsid1, rsid2);
491         init_subchannel_id(&mchk_schid);
492         mchk_schid.sch_no = rsid1;
493         if (rsid2 != 0)
494                 mchk_schid.ssid = (rsid2 >> 8) & 3;
495
496         /* 
497          * Since we are always presented with IPI in the CRW, we have to
498          * use stsch() to find out if the subchannel in question has come
499          * or gone.
500          */
501         css_evaluate_subchannel(mchk_schid, 0);
502 }
503
504 static int __init
505 __init_channel_subsystem(struct subchannel_id schid, void *data)
506 {
507         struct subchannel *sch;
508         int ret;
509
510         if (cio_is_console(schid))
511                 sch = cio_get_console_subchannel();
512         else {
513                 sch = css_alloc_subchannel(schid);
514                 if (IS_ERR(sch))
515                         ret = PTR_ERR(sch);
516                 else
517                         ret = 0;
518                 switch (ret) {
519                 case 0:
520                         break;
521                 case -ENOMEM:
522                         panic("Out of memory in init_channel_subsystem\n");
523                 /* -ENXIO: no more subchannels. */
524                 case -ENXIO:
525                         return ret;
526                 /* -EIO: this subchannel set not supported. */
527                 case -EIO:
528                         return ret;
529                 default:
530                         return 0;
531                 }
532         }
533         /*
534          * We register ALL valid subchannels in ioinfo, even those
535          * that have been present before init_channel_subsystem.
536          * These subchannels can't have been registered yet (kmalloc
537          * not working) so we do it now. This is true e.g. for the
538          * console subchannel.
539          */
540         css_register_subchannel(sch);
541         return 0;
542 }
543
544 static void __init
545 css_generate_pgid(struct channel_subsystem *css, u32 tod_high)
546 {
547         if (css_characteristics_avail && css_general_characteristics.mcss) {
548                 css->global_pgid.pgid_high.ext_cssid.version = 0x80;
549                 css->global_pgid.pgid_high.ext_cssid.cssid = css->cssid;
550         } else {
551 #ifdef CONFIG_SMP
552                 css->global_pgid.pgid_high.cpu_addr = hard_smp_processor_id();
553 #else
554                 css->global_pgid.pgid_high.cpu_addr = 0;
555 #endif
556         }
557         css->global_pgid.cpu_id = ((cpuid_t *) __LC_CPUID)->ident;
558         css->global_pgid.cpu_model = ((cpuid_t *) __LC_CPUID)->machine;
559         css->global_pgid.tod_high = tod_high;
560
561 }
562
563 static void
564 channel_subsystem_release(struct device *dev)
565 {
566         struct channel_subsystem *css;
567
568         css = to_css(dev);
569         mutex_destroy(&css->mutex);
570         kfree(css);
571 }
572
573 static ssize_t
574 css_cm_enable_show(struct device *dev, struct device_attribute *attr,
575                    char *buf)
576 {
577         struct channel_subsystem *css = to_css(dev);
578
579         if (!css)
580                 return 0;
581         return sprintf(buf, "%x\n", css->cm_enabled);
582 }
583
584 static ssize_t
585 css_cm_enable_store(struct device *dev, struct device_attribute *attr,
586                     const char *buf, size_t count)
587 {
588         struct channel_subsystem *css = to_css(dev);
589         int ret;
590
591         switch (buf[0]) {
592         case '0':
593                 ret = css->cm_enabled ? chsc_secm(css, 0) : 0;
594                 break;
595         case '1':
596                 ret = css->cm_enabled ? 0 : chsc_secm(css, 1);
597                 break;
598         default:
599                 ret = -EINVAL;
600         }
601         return ret < 0 ? ret : count;
602 }
603
604 static DEVICE_ATTR(cm_enable, 0644, css_cm_enable_show, css_cm_enable_store);
605
606 static int __init setup_css(int nr)
607 {
608         u32 tod_high;
609         int ret;
610
611         memset(css[nr], 0, sizeof(struct channel_subsystem));
612         css[nr]->pseudo_subchannel =
613                 kzalloc(sizeof(*css[nr]->pseudo_subchannel), GFP_KERNEL);
614         if (!css[nr]->pseudo_subchannel)
615                 return -ENOMEM;
616         css[nr]->pseudo_subchannel->dev.parent = &css[nr]->device;
617         css[nr]->pseudo_subchannel->dev.release = css_subchannel_release;
618         sprintf(css[nr]->pseudo_subchannel->dev.bus_id, "defunct");
619         ret = cio_create_sch_lock(css[nr]->pseudo_subchannel);
620         if (ret) {
621                 kfree(css[nr]->pseudo_subchannel);
622                 return ret;
623         }
624         mutex_init(&css[nr]->mutex);
625         css[nr]->valid = 1;
626         css[nr]->cssid = nr;
627         sprintf(css[nr]->device.bus_id, "css%x", nr);
628         css[nr]->device.release = channel_subsystem_release;
629         tod_high = (u32) (get_clock() >> 32);
630         css_generate_pgid(css[nr], tod_high);
631         return 0;
632 }
633
634 /*
635  * Now that the driver core is running, we can setup our channel subsystem.
636  * The struct subchannel's are created during probing (except for the
637  * static console subchannel).
638  */
639 static int __init
640 init_channel_subsystem (void)
641 {
642         int ret, i;
643
644         if (chsc_determine_css_characteristics() == 0)
645                 css_characteristics_avail = 1;
646
647         if ((ret = bus_register(&css_bus_type)))
648                 goto out;
649
650         /* Try to enable MSS. */
651         ret = chsc_enable_facility(CHSC_SDA_OC_MSS);
652         switch (ret) {
653         case 0: /* Success. */
654                 max_ssid = __MAX_SSID;
655                 break;
656         case -ENOMEM:
657                 goto out_bus;
658         default:
659                 max_ssid = 0;
660         }
661         /* Setup css structure. */
662         for (i = 0; i <= __MAX_CSSID; i++) {
663                 css[i] = kmalloc(sizeof(struct channel_subsystem), GFP_KERNEL);
664                 if (!css[i]) {
665                         ret = -ENOMEM;
666                         goto out_unregister;
667                 }
668                 ret = setup_css(i);
669                 if (ret)
670                         goto out_free;
671                 ret = device_register(&css[i]->device);
672                 if (ret)
673                         goto out_free_all;
674                 if (css_characteristics_avail &&
675                     css_chsc_characteristics.secm) {
676                         ret = device_create_file(&css[i]->device,
677                                                  &dev_attr_cm_enable);
678                         if (ret)
679                                 goto out_device;
680                 }
681                 ret = device_register(&css[i]->pseudo_subchannel->dev);
682                 if (ret)
683                         goto out_file;
684         }
685         css_init_done = 1;
686
687         ctl_set_bit(6, 28);
688
689         for_each_subchannel(__init_channel_subsystem, NULL);
690         return 0;
691 out_file:
692         device_remove_file(&css[i]->device, &dev_attr_cm_enable);
693 out_device:
694         device_unregister(&css[i]->device);
695 out_free_all:
696         kfree(css[i]->pseudo_subchannel->lock);
697         kfree(css[i]->pseudo_subchannel);
698 out_free:
699         kfree(css[i]);
700 out_unregister:
701         while (i > 0) {
702                 i--;
703                 device_unregister(&css[i]->pseudo_subchannel->dev);
704                 if (css_characteristics_avail && css_chsc_characteristics.secm)
705                         device_remove_file(&css[i]->device,
706                                            &dev_attr_cm_enable);
707                 device_unregister(&css[i]->device);
708         }
709 out_bus:
710         bus_unregister(&css_bus_type);
711 out:
712         return ret;
713 }
714
715 int sch_is_pseudo_sch(struct subchannel *sch)
716 {
717         return sch == to_css(sch->dev.parent)->pseudo_subchannel;
718 }
719
720 /*
721  * find a driver for a subchannel. They identify by the subchannel
722  * type with the exception that the console subchannel driver has its own
723  * subchannel type although the device is an i/o subchannel
724  */
725 static int
726 css_bus_match (struct device *dev, struct device_driver *drv)
727 {
728         struct subchannel *sch = container_of (dev, struct subchannel, dev);
729         struct css_driver *driver = container_of (drv, struct css_driver, drv);
730
731         if (sch->st == driver->subchannel_type)
732                 return 1;
733
734         return 0;
735 }
736
737 static int
738 css_probe (struct device *dev)
739 {
740         struct subchannel *sch;
741
742         sch = to_subchannel(dev);
743         sch->driver = container_of (dev->driver, struct css_driver, drv);
744         return (sch->driver->probe ? sch->driver->probe(sch) : 0);
745 }
746
747 static int
748 css_remove (struct device *dev)
749 {
750         struct subchannel *sch;
751
752         sch = to_subchannel(dev);
753         return (sch->driver->remove ? sch->driver->remove(sch) : 0);
754 }
755
756 static void
757 css_shutdown (struct device *dev)
758 {
759         struct subchannel *sch;
760
761         sch = to_subchannel(dev);
762         if (sch->driver->shutdown)
763                 sch->driver->shutdown(sch);
764 }
765
766 struct bus_type css_bus_type = {
767         .name     = "css",
768         .match    = css_bus_match,
769         .probe    = css_probe,
770         .remove   = css_remove,
771         .shutdown = css_shutdown,
772 };
773
774 subsys_initcall(init_channel_subsystem);
775
776 MODULE_LICENSE("GPL");
777 EXPORT_SYMBOL(css_bus_type);
778 EXPORT_SYMBOL_GPL(css_characteristics_avail);