This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / drivers / s390 / block / dasd_devmap.c
1 /*
2  * File...........: linux/drivers/s390/block/dasd_devmap.c
3  * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
4  *                  Horst Hummel <Horst.Hummel@de.ibm.com>
5  *                  Carsten Otte <Cotte@de.ibm.com>
6  *                  Martin Schwidefsky <schwidefsky@de.ibm.com>
7  * Bugreports.to..: <Linux390@de.ibm.com>
8  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999-2001
9  *
10  * Device mapping and dasd= parameter parsing functions. All devmap
11  * functions may not be called from interrupt context. In particular
12  * dasd_get_device is a no-no from interrupt context.
13  *
14  * $Revision: 1.33 $
15  */
16
17 #include <linux/config.h>
18 #include <linux/ctype.h>
19 #include <linux/init.h>
20
21 #include <asm/debug.h>
22 #include <asm/uaccess.h>
23
24 /* This is ugly... */
25 #define PRINTK_HEADER "dasd_devmap:"
26
27 #include "dasd_int.h"
28
29 kmem_cache_t *dasd_page_cache;
30 EXPORT_SYMBOL(dasd_page_cache);
31
32 /*
33  * dasd_devmap_t is used to store the features and the relation
34  * between device number and device index. To find a dasd_devmap_t
35  * that corresponds to a device number of a device index each
36  * dasd_devmap_t is added to two linked lists, one to search by
37  * the device number and one to search by the device index. As
38  * soon as big minor numbers are available the device index list
39  * can be removed since the device number will then be identical
40  * to the device index.
41  */
42 struct dasd_devmap {
43         struct list_head list;
44         char bus_id[BUS_ID_SIZE];
45         unsigned int devindex;
46         unsigned short features;
47         struct dasd_device *device;
48 };
49
50 /*
51  * Parameter parsing functions for dasd= parameter. The syntax is:
52  *   <devno>            : (0x)?[0-9a-fA-F]+
53  *   <busid>            : [0-0a-f]\.[0-9a-f]\.(0x)?[0-9a-fA-F]+
54  *   <feature>          : ro
55  *   <feature_list>     : \(<feature>(:<feature>)*\)
56  *   <devno-range>      : <devno>(-<devno>)?<feature_list>?
57  *   <busid-range>      : <busid>(-<busid>)?<feature_list>?
58  *   <devices>          : <devno-range>|<busid-range>
59  *   <dasd_module>      : dasd_diag_mod|dasd_eckd_mod|dasd_fba_mod
60  *
61  *   <dasd>             : autodetect|probeonly|<devices>(,<devices>)*
62  */
63
64 int dasd_probeonly =  0;        /* is true, when probeonly mode is active */
65 int dasd_autodetect = 0;        /* is true, when autodetection is active */
66
67 /*
68  * char *dasd[] is intended to hold the ranges supplied by the dasd= statement
69  * it is named 'dasd' to directly be filled by insmod with the comma separated
70  * strings when running as a module.
71  */
72 static char *dasd[256];
73
74 /*
75  * Single spinlock to protect devmap structures and lists.
76  */
77 static spinlock_t dasd_devmap_lock = SPIN_LOCK_UNLOCKED;
78
79 /*
80  * Hash lists for devmap structures.
81  */
82 static struct list_head dasd_hashlists[256];
83 int dasd_max_devindex;
84
85 static struct dasd_devmap *dasd_add_busid(char *, int);
86
87 static inline int
88 dasd_hash_busid(char *bus_id)
89 {
90         int hash, i;
91
92         hash = 0;
93         for (i = 0; (i < BUS_ID_SIZE) && *bus_id; i++, bus_id++)
94                 hash += *bus_id;
95         return hash & 0xff;
96 }
97
98 #ifndef MODULE
99 /*
100  * The parameter parsing functions for builtin-drivers are called
101  * before kmalloc works. Store the pointers to the parameters strings
102  * into dasd[] for later processing.
103  */
104 static int __init
105 dasd_call_setup(char *str)
106 {
107         static int count = 0;
108
109         if (count < 256)
110                 dasd[count++] = str;
111         return 1;
112 }
113
114 __setup ("dasd=", dasd_call_setup);
115 #endif  /* #ifndef MODULE */
116
117 /*
118  * Read a device busid/devno from a string.
119  */
120 static inline int
121 dasd_busid(char **str, int *id0, int *id1, int *devno)
122 {
123         int val, old_style;
124  
125         /* check for leading '0x' */
126         old_style = 0;
127         if ((*str)[0] == '0' && (*str)[1] == 'x') {
128                 *str += 2;
129                 old_style = 1;
130         }
131         if (!isxdigit((*str)[0]))       /* We require at least one hex digit */
132                 return -EINVAL;
133         val = simple_strtoul(*str, str, 16);
134         if (old_style || (*str)[0] != '.') {
135                 *id0 = *id1 = 0;
136                 if (val < 0 || val > 0xffff)
137                         return -EINVAL;
138                 *devno = val;
139                 return 0;
140         }
141         /* New style x.y.z busid */
142         if (val < 0 || val > 0xff)
143                 return -EINVAL;
144         *id0 = val;
145         (*str)++;
146         if (!isxdigit((*str)[0]))       /* We require at least one hex digit */
147                 return -EINVAL;
148         val = simple_strtoul(*str, str, 16);
149         if (val < 0 || val > 0xff || (*str)++[0] != '.')
150                 return -EINVAL;
151         *id1 = val;
152         if (!isxdigit((*str)[0]))       /* We require at least one hex digit */
153                 return -EINVAL;
154         val = simple_strtoul(*str, str, 16);
155         if (val < 0 || val > 0xffff)
156                 return -EINVAL;
157         *devno = val;
158         return 0;
159 }
160
161 /*
162  * Read colon separated list of dasd features. Currently there is
163  * only one: "ro" for read-only devices. The default feature set
164  * is empty (value 0).
165  */
166 static inline int
167 dasd_feature_list(char *str, char **endp)
168 {
169         int features, len, rc;
170
171         rc = 0;
172         if (*str != '(') {
173                 *endp = str;
174                 return DASD_FEATURE_DEFAULT;
175         }
176         str++;
177         features = 0;
178
179         while (1) {
180                 for (len = 0; 
181                      str[len] && str[len] != ':' && str[len] != ')'; len++);
182                 if (len == 2 && !strncmp(str, "ro", 2))
183                         features |= DASD_FEATURE_READONLY;
184                 else if (len == 4 && !strncmp(str, "diag", 4))
185                         features |= DASD_FEATURE_USEDIAG;
186                 else {
187                         MESSAGE(KERN_WARNING,
188                                 "unsupported feature: %*s, "
189                                 "ignoring setting", len, str);
190                         rc = -EINVAL;
191                 }
192                 str += len;
193                 if (*str != ':')
194                         break;
195                 str++;
196         }
197         if (*str != ')') {
198                 MESSAGE(KERN_WARNING, "%s",
199                         "missing ')' in dasd parameter string\n");
200                 rc = -EINVAL;
201         } else
202                 str++;
203         *endp = str;
204         if (rc != 0)
205                 return rc;
206         return features;
207 }
208
209 /*
210  * Try to match the first element on the comma separated parse string
211  * with one of the known keywords. If a keyword is found, take the approprate
212  * action and return a pointer to the residual string. If the first element
213  * could not be matched to any keyword then return an error code.
214  */
215 static char *
216 dasd_parse_keyword( char *parsestring ) {
217
218         char *nextcomma, *residual_str;
219         int length;
220
221         nextcomma = strchr(parsestring,',');
222         if (nextcomma) {
223                 length = nextcomma - parsestring;
224                 residual_str = nextcomma + 1;
225         } else {
226                 length = strlen(parsestring);
227                 residual_str = parsestring + length;
228         }
229         if (strncmp ("autodetect", parsestring, length) == 0) {
230                 dasd_autodetect = 1;
231                 MESSAGE (KERN_INFO, "%s",
232                          "turning to autodetection mode");
233                 return residual_str;
234         }
235         if (strncmp ("probeonly", parsestring, length) == 0) {
236                 dasd_probeonly = 1;
237                 MESSAGE(KERN_INFO, "%s",
238                         "turning to probeonly mode");
239                 return residual_str;
240         }
241         if (strncmp ("fixedbuffers", parsestring, length) == 0) {
242                 dasd_page_cache =
243                         kmem_cache_create("dasd_page_cache", PAGE_SIZE, 0,
244                                           SLAB_CACHE_DMA, NULL, NULL );
245                 if (!dasd_page_cache)
246                         MESSAGE(KERN_WARNING, "%s", "Failed to create slab, "
247                                 "fixed buffer mode disabled.");
248                 else
249                         MESSAGE (KERN_INFO, "%s",
250                                  "turning on fixed buffer mode");
251                 return residual_str;
252         }
253         return ERR_PTR(-EINVAL);
254 }
255
256 /*
257  * Try to interprete the first element on the comma separated parse string
258  * as a device number or a range of devices. If the interpretation is
259  * successfull, create the matching dasd_devmap entries and return a pointer
260  * to the residual string.
261  * If interpretation fails or in case of an error, return an error code.
262  */
263 static char *
264 dasd_parse_range( char *parsestring ) {
265
266         struct dasd_devmap *devmap;
267         int from, from_id0, from_id1;
268         int to, to_id0, to_id1;
269         int features, rc;
270         char bus_id[BUS_ID_SIZE+1], *str;
271
272         str = parsestring;
273         rc = dasd_busid(&str, &from_id0, &from_id1, &from);
274         if (rc == 0) {
275                 to = from;
276                 to_id0 = from_id0;
277                 to_id1 = from_id1;
278                 if (*str == '-') {
279                         str++;
280                         rc = dasd_busid(&str, &to_id0, &to_id1, &to);
281                 }
282         }
283         if (rc == 0 &&
284             (from_id0 != to_id0 || from_id1 != to_id1 || from > to))
285                 rc = -EINVAL;
286         if (rc) {
287                 MESSAGE(KERN_ERR, "Invalid device range %s", parsestring);
288                 return ERR_PTR(rc);
289         }
290         features = dasd_feature_list(str, &str);
291         if (features < 0)
292                 return ERR_PTR(-EINVAL);
293         while (from <= to) {
294                 sprintf(bus_id, "%01x.%01x.%04x",
295                         from_id0, from_id1, from++);
296                 devmap = dasd_add_busid(bus_id, features);
297                 if (IS_ERR(devmap))
298                         return (char *)devmap;
299         }
300         if (*str == ',')
301                 return str + 1;
302         if (*str == '\0')
303                 return str;
304         MESSAGE(KERN_WARNING,
305                 "junk at end of dasd parameter string: %s\n", str);
306         return ERR_PTR(-EINVAL);
307 }
308
309 static inline char *
310 dasd_parse_next_element( char *parsestring ) {
311         char * residual_str;
312         residual_str = dasd_parse_keyword(parsestring);
313         if (!IS_ERR(residual_str))
314                 return residual_str;
315         residual_str = dasd_parse_range(parsestring);
316         return residual_str;
317 }
318
319 /*
320  * Parse parameters stored in dasd[]
321  * The 'dasd=...' parameter allows to specify a comma separated list of
322  * keywords and device ranges. When the dasd driver is build into the kernel,
323  * the complete list will be stored as one element of the dasd[] array.
324  * When the dasd driver is build as a module, then the list is broken into
325  * it's elements and each dasd[] entry contains one element.
326  */
327 int
328 dasd_parse(void)
329 {
330         int rc, i;
331         char *parsestring;
332
333         rc = 0;
334         for (i = 0; i < 256; i++) {
335                 if (dasd[i] == NULL)
336                         break;
337                 parsestring = dasd[i];
338                 /* loop over the comma separated list in the parsestring */
339                 while (*parsestring) {
340                         parsestring = dasd_parse_next_element(parsestring);
341                         if(IS_ERR(parsestring)) {
342                                 rc = PTR_ERR(parsestring);
343                                 break;
344                         }
345                 }
346                 if (rc) {
347                         DBF_EVENT(DBF_ALERT, "%s", "invalid range found");
348                         break;
349                 }
350         }
351         return rc;
352 }
353
354 /*
355  * Add a devmap for the device specified by busid. It is possible that
356  * the devmap already exists (dasd= parameter). The order of the devices
357  * added through this function will define the kdevs for the individual
358  * devices. 
359  */
360 static struct dasd_devmap *
361 dasd_add_busid(char *bus_id, int features)
362 {
363         struct dasd_devmap *devmap, *new, *tmp;
364         int hash;
365
366         new = (struct dasd_devmap *)
367                 kmalloc(sizeof(struct dasd_devmap), GFP_KERNEL);
368         if (!new)
369                 return ERR_PTR(-ENOMEM);
370         spin_lock(&dasd_devmap_lock);
371         devmap = 0;
372         hash = dasd_hash_busid(bus_id);
373         list_for_each_entry(tmp, &dasd_hashlists[hash], list)
374                 if (strncmp(tmp->bus_id, bus_id, BUS_ID_SIZE) == 0) {
375                         devmap = tmp;
376                         break;
377                 }
378         if (!devmap) {
379                 /* This bus_id is new. */
380                 new->devindex = dasd_max_devindex++;
381                 strncpy(new->bus_id, bus_id, BUS_ID_SIZE);
382                 new->features = features;
383                 new->device = 0;
384                 list_add(&new->list, &dasd_hashlists[hash]);
385                 devmap = new;
386                 new = 0;
387         }
388         spin_unlock(&dasd_devmap_lock);
389         if (new)
390                 kfree(new);
391         return devmap;
392 }
393
394 /*
395  * Find devmap for device with given bus_id.
396  */
397 static struct dasd_devmap *
398 dasd_find_busid(char *bus_id)
399 {
400         struct dasd_devmap *devmap, *tmp;
401         int hash;
402
403         spin_lock(&dasd_devmap_lock);
404         devmap = ERR_PTR(-ENODEV);
405         hash = dasd_hash_busid(bus_id);
406         list_for_each_entry(tmp, &dasd_hashlists[hash], list) {
407                 if (strncmp(tmp->bus_id, bus_id, BUS_ID_SIZE) == 0) {
408                         devmap = tmp;
409                         break;
410                 }
411         }
412         spin_unlock(&dasd_devmap_lock);
413         return devmap;
414 }
415
416 /*
417  * Check if busid has been added to the list of dasd ranges.
418  */
419 int
420 dasd_busid_known(char *bus_id)
421 {
422         return IS_ERR(dasd_find_busid(bus_id)) ? -ENOENT : 0;
423 }
424
425 /*
426  * Forget all about the device numbers added so far.
427  * This may only be called at module unload or system shutdown.
428  */
429 static void
430 dasd_forget_ranges(void)
431 {
432         struct dasd_devmap *devmap, *n;
433         int i;
434
435         spin_lock(&dasd_devmap_lock);
436         for (i = 0; i < 256; i++) {
437                 list_for_each_entry_safe(devmap, n, &dasd_hashlists[i], list) {
438                         if (devmap->device != NULL)
439                                 BUG();
440                         list_del(&devmap->list);
441                         kfree(devmap);
442                 }
443         }
444         spin_unlock(&dasd_devmap_lock);
445 }
446
447 /*
448  * Find the device struct by its device index.
449  */
450 struct dasd_device *
451 dasd_device_from_devindex(int devindex)
452 {
453         struct dasd_devmap *devmap, *tmp;
454         struct dasd_device *device;
455         int i;
456
457         spin_lock(&dasd_devmap_lock);
458         devmap = 0;
459         for (i = 0; (i < 256) && !devmap; i++)
460                 list_for_each_entry(tmp, &dasd_hashlists[i], list)
461                         if (tmp->devindex == devindex) {
462                                 /* Found the devmap for the device. */
463                                 devmap = tmp;
464                                 break;
465                         }
466         if (devmap && devmap->device) {
467                 device = devmap->device;
468                 dasd_get_device(device);
469         } else
470                 device = ERR_PTR(-ENODEV);
471         spin_unlock(&dasd_devmap_lock);
472         return device;
473 }
474
475 /*
476  * Return devmap for cdev. If no devmap exists yet, create one and
477  * connect it to the cdev.
478  */
479 static struct dasd_devmap *
480 dasd_devmap_from_cdev(struct ccw_device *cdev)
481 {
482         struct dasd_devmap *devmap;
483
484         devmap = dasd_find_busid(cdev->dev.bus_id);
485         if (IS_ERR(devmap))
486                 devmap = dasd_add_busid(cdev->dev.bus_id, DASD_FEATURE_DEFAULT);
487         return devmap;
488 }
489
490 /*
491  * Create a dasd device structure for cdev.
492  */
493 struct dasd_device *
494 dasd_create_device(struct ccw_device *cdev)
495 {
496         struct dasd_devmap *devmap;
497         struct dasd_device *device;
498         int rc;
499
500         devmap = dasd_devmap_from_cdev(cdev);
501         if (IS_ERR(devmap))
502                 return (void *) devmap;
503         cdev->dev.driver_data = devmap;
504
505         device = dasd_alloc_device();
506         if (IS_ERR(device))
507                 return device;
508         atomic_set(&device->ref_count, 2);
509
510         spin_lock(&dasd_devmap_lock);
511         if (!devmap->device) {
512                 devmap->device = device;
513                 device->devindex = devmap->devindex;
514                 if (devmap->features & DASD_FEATURE_READONLY)
515                         set_bit(DASD_FLAG_RO, &device->flags);
516                 else
517                         clear_bit(DASD_FLAG_RO, &device->flags);
518                 if (devmap->features & DASD_FEATURE_USEDIAG)
519                         set_bit(DASD_FLAG_USE_DIAG, &device->flags);
520                 else
521                         clear_bit(DASD_FLAG_USE_DIAG, &device->flags);
522                 get_device(&cdev->dev);
523                 device->cdev = cdev;
524                 rc = 0;
525         } else
526                 /* Someone else was faster. */
527                 rc = -EBUSY;
528         spin_unlock(&dasd_devmap_lock);
529
530         if (rc) {
531                 dasd_free_device(device);
532                 return ERR_PTR(rc);
533         }
534         return device;
535 }
536
537 /*
538  * Wait queue for dasd_delete_device waits.
539  */
540 static DECLARE_WAIT_QUEUE_HEAD(dasd_delete_wq);
541
542 /*
543  * Remove a dasd device structure. The passed referenced
544  * is destroyed.
545  */
546 void
547 dasd_delete_device(struct dasd_device *device)
548 {
549         struct ccw_device *cdev;
550         struct dasd_devmap *devmap;
551
552         /* First remove device pointer from devmap. */
553         devmap = dasd_find_busid(device->cdev->dev.bus_id);
554         spin_lock(&dasd_devmap_lock);
555         if (devmap->device != device) {
556                 spin_unlock(&dasd_devmap_lock);
557                 dasd_put_device(device);
558                 return;
559         }
560         devmap->device = NULL;
561         spin_unlock(&dasd_devmap_lock);
562
563         /* Drop ref_count by 2, one for the devmap reference and
564          * one for the passed reference. */
565         atomic_sub(2, &device->ref_count);
566
567         /* Wait for reference counter to drop to zero. */
568         wait_event(dasd_delete_wq, atomic_read(&device->ref_count) == 0);
569
570         /* Disconnect dasd_device structure from ccw_device structure. */
571         cdev = device->cdev;
572         device->cdev = NULL;
573
574         /* Disconnect dasd_devmap structure from ccw_device structure. */
575         cdev->dev.driver_data = NULL;
576
577         /* Put ccw_device structure. */
578         put_device(&cdev->dev);
579
580         /* Now the device structure can be freed. */
581         dasd_free_device(device);
582 }
583
584 /*
585  * Reference counter dropped to zero. Wake up waiter
586  * in dasd_delete_device.
587  */
588 void
589 dasd_put_device_wake(struct dasd_device *device)
590 {
591         wake_up(&dasd_delete_wq);
592 }
593
594 /*
595  * Return dasd_device structure associated with cdev.
596  */
597 struct dasd_device *
598 dasd_device_from_cdev(struct ccw_device *cdev)
599 {
600         struct dasd_devmap *devmap;
601         struct dasd_device *device;
602
603         device = ERR_PTR(-ENODEV);
604         spin_lock(&dasd_devmap_lock);
605         devmap = cdev->dev.driver_data;
606         if (devmap && devmap->device) {
607                 device = devmap->device;
608                 dasd_get_device(device);
609         }
610         spin_unlock(&dasd_devmap_lock);
611         return device;
612 }
613
614 /*
615  * SECTION: files in sysfs
616  */
617
618 /*
619  * readonly controls the readonly status of a dasd
620  */
621 static ssize_t
622 dasd_ro_show(struct device *dev, char *buf)
623 {
624         struct dasd_devmap *devmap;
625         int ro_flag;
626
627         devmap = dev->driver_data;
628         if (devmap)
629                 ro_flag = (devmap->features & DASD_FEATURE_READONLY) != 0;
630         else
631                 ro_flag = (DASD_FEATURE_DEFAULT & DASD_FEATURE_READONLY) != 0;
632         return snprintf(buf, PAGE_SIZE, ro_flag ? "1\n" : "0\n");
633 }
634
635 static ssize_t
636 dasd_ro_store(struct device *dev, const char *buf, size_t count)
637 {
638         struct dasd_devmap *devmap;
639         int ro_flag;
640
641         devmap = dasd_devmap_from_cdev(to_ccwdev(dev));
642         ro_flag = buf[0] == '1';
643         spin_lock(&dasd_devmap_lock);
644         if (ro_flag)
645                 devmap->features |= DASD_FEATURE_READONLY;
646         else
647                 devmap->features &= ~DASD_FEATURE_READONLY;
648         if (devmap->device) {
649                 if (devmap->device->gdp)
650                         set_disk_ro(devmap->device->gdp, ro_flag);
651                 if (ro_flag)
652                         set_bit(DASD_FLAG_RO, &devmap->device->flags);
653                 else
654                         clear_bit(DASD_FLAG_RO, &devmap->device->flags);
655         }
656         spin_unlock(&dasd_devmap_lock);
657         return count;
658 }
659
660 static DEVICE_ATTR(readonly, 0644, dasd_ro_show, dasd_ro_store);
661
662 /*
663  * use_diag controls whether the driver should use diag rather than ssch
664  * to talk to the device
665  */
666 /* TODO: Implement */
667 static ssize_t 
668 dasd_use_diag_show(struct device *dev, char *buf)
669 {
670         struct dasd_devmap *devmap;
671         int use_diag;
672
673         devmap = dev->driver_data;
674         if (devmap)
675                 use_diag = (devmap->features & DASD_FEATURE_USEDIAG) != 0;
676         else
677                 use_diag = (DASD_FEATURE_DEFAULT & DASD_FEATURE_USEDIAG) != 0;
678         return sprintf(buf, use_diag ? "1\n" : "0\n");
679 }
680
681 static ssize_t
682 dasd_use_diag_store(struct device *dev, const char *buf, size_t count)
683 {
684         struct dasd_devmap *devmap;
685         int use_diag;
686
687         devmap = dasd_devmap_from_cdev(to_ccwdev(dev));
688         use_diag = buf[0] == '1';
689         spin_lock(&dasd_devmap_lock);
690         /* Changing diag discipline flag is only allowed in offline state. */
691         if (!devmap->device) {
692                 if (use_diag)
693                         devmap->features |= DASD_FEATURE_USEDIAG;
694                 else
695                         devmap->features &= ~DASD_FEATURE_USEDIAG;
696         } else
697                 count = -EPERM;
698         spin_unlock(&dasd_devmap_lock);
699         return count;
700 }
701
702 static
703 DEVICE_ATTR(use_diag, 0644, dasd_use_diag_show, dasd_use_diag_store);
704
705 static ssize_t
706 dasd_discipline_show(struct device *dev, char *buf)
707 {
708         struct dasd_devmap *devmap;
709         char *dname;
710
711         spin_lock(&dasd_devmap_lock);
712         dname = "none";
713         devmap = dev->driver_data;
714         if (devmap && devmap->device && devmap->device->discipline)
715                 dname = devmap->device->discipline->name;
716         spin_unlock(&dasd_devmap_lock);
717         return snprintf(buf, PAGE_SIZE, "%s\n", dname);
718 }
719
720 static DEVICE_ATTR(discipline, 0444, dasd_discipline_show, NULL);
721
722 static struct attribute * dasd_attrs[] = {
723         &dev_attr_readonly.attr,
724         &dev_attr_discipline.attr,
725         &dev_attr_use_diag.attr,
726         NULL,
727 };
728
729 static struct attribute_group dasd_attr_group = {
730         .attrs = dasd_attrs,
731 };
732
733 int
734 dasd_add_sysfs_files(struct ccw_device *cdev)
735 {
736         return sysfs_create_group(&cdev->dev.kobj, &dasd_attr_group);
737 }
738
739 void
740 dasd_remove_sysfs_files(struct ccw_device *cdev)
741 {
742         sysfs_remove_group(&cdev->dev.kobj, &dasd_attr_group);
743 }
744
745
746 int
747 dasd_devmap_init(void)
748 {
749         int i;
750
751         /* Initialize devmap structures. */
752         dasd_max_devindex = 0;
753         for (i = 0; i < 256; i++)
754                 INIT_LIST_HEAD(&dasd_hashlists[i]);
755         return 0;
756
757 }
758
759 void
760 dasd_devmap_exit(void)
761 {
762         dasd_forget_ranges();
763 }