cmd64x: set IDE_HFLAG_SERIALIZE explictly for CMD646
[linux-2.6] / drivers / ide / ide-proc.c
1 /*
2  *  Copyright (C) 1997-1998     Mark Lord
3  *  Copyright (C) 2003          Red Hat
4  *
5  *  Some code was moved here from ide.c, see it for original copyrights.
6  */
7
8 /*
9  * This is the /proc/ide/ filesystem implementation.
10  *
11  * Drive/Driver settings can be retrieved by reading the drive's
12  * "settings" files.  e.g.    "cat /proc/ide0/hda/settings"
13  * To write a new value "val" into a specific setting "name", use:
14  *   echo "name:val" >/proc/ide/ide0/hda/settings
15  */
16
17 #include <linux/module.h>
18
19 #include <asm/uaccess.h>
20 #include <linux/errno.h>
21 #include <linux/proc_fs.h>
22 #include <linux/stat.h>
23 #include <linux/mm.h>
24 #include <linux/pci.h>
25 #include <linux/ctype.h>
26 #include <linux/ide.h>
27 #include <linux/seq_file.h>
28
29 #include <asm/io.h>
30
31 static struct proc_dir_entry *proc_ide_root;
32
33 static int proc_ide_read_imodel
34         (char *page, char **start, off_t off, int count, int *eof, void *data)
35 {
36         ide_hwif_t      *hwif = (ide_hwif_t *) data;
37         int             len;
38         const char      *name;
39
40         switch (hwif->chipset) {
41         case ide_generic:       name = "generic";       break;
42         case ide_pci:           name = "pci";           break;
43         case ide_cmd640:        name = "cmd640";        break;
44         case ide_dtc2278:       name = "dtc2278";       break;
45         case ide_ali14xx:       name = "ali14xx";       break;
46         case ide_qd65xx:        name = "qd65xx";        break;
47         case ide_umc8672:       name = "umc8672";       break;
48         case ide_ht6560b:       name = "ht6560b";       break;
49         case ide_rz1000:        name = "rz1000";        break;
50         case ide_trm290:        name = "trm290";        break;
51         case ide_cy82c693:      name = "cy82c693";      break;
52         case ide_4drives:       name = "4drives";       break;
53         case ide_pmac:          name = "mac-io";        break;
54         case ide_au1xxx:        name = "au1xxx";        break;
55         case ide_palm3710:      name = "palm3710";      break;
56         case ide_acorn:         name = "acorn";         break;
57         default:                name = "(unknown)";     break;
58         }
59         len = sprintf(page, "%s\n", name);
60         PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
61 }
62
63 static int proc_ide_read_mate
64         (char *page, char **start, off_t off, int count, int *eof, void *data)
65 {
66         ide_hwif_t      *hwif = (ide_hwif_t *) data;
67         int             len;
68
69         if (hwif && hwif->mate)
70                 len = sprintf(page, "%s\n", hwif->mate->name);
71         else
72                 len = sprintf(page, "(none)\n");
73         PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
74 }
75
76 static int proc_ide_read_channel
77         (char *page, char **start, off_t off, int count, int *eof, void *data)
78 {
79         ide_hwif_t      *hwif = (ide_hwif_t *) data;
80         int             len;
81
82         page[0] = hwif->channel ? '1' : '0';
83         page[1] = '\n';
84         len = 2;
85         PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
86 }
87
88 static int proc_ide_read_identify
89         (char *page, char **start, off_t off, int count, int *eof, void *data)
90 {
91         ide_drive_t     *drive = (ide_drive_t *)data;
92         int             len = 0, i = 0;
93         int             err = 0;
94
95         len = sprintf(page, "\n");
96
97         if (drive) {
98                 __le16 *val = (__le16 *)page;
99
100                 err = taskfile_lib_get_identify(drive, page);
101                 if (!err) {
102                         char *out = (char *)page + SECTOR_SIZE;
103
104                         page = out;
105                         do {
106                                 out += sprintf(out, "%04x%c",
107                                         le16_to_cpup(val), (++i & 7) ? ' ' : '\n');
108                                 val += 1;
109                         } while (i < SECTOR_SIZE / 2);
110                         len = out - page;
111                 }
112         }
113         PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
114 }
115
116 /**
117  *      ide_find_setting        -       find a specific setting
118  *      @st: setting table pointer
119  *      @name: setting name
120  *
121  *      Scan's the setting table for a matching entry and returns
122  *      this or NULL if no entry is found. The caller must hold the
123  *      setting semaphore
124  */
125
126 static
127 const struct ide_proc_devset *ide_find_setting(const struct ide_proc_devset *st,
128                                                char *name)
129 {
130         while (st->name) {
131                 if (strcmp(st->name, name) == 0)
132                         break;
133                 st++;
134         }
135         return st->name ? st : NULL;
136 }
137
138 /**
139  *      ide_read_setting        -       read an IDE setting
140  *      @drive: drive to read from
141  *      @setting: drive setting
142  *
143  *      Read a drive setting and return the value. The caller
144  *      must hold the ide_setting_mtx when making this call.
145  *
146  *      BUGS: the data return and error are the same return value
147  *      so an error -EINVAL and true return of the same value cannot
148  *      be told apart
149  */
150
151 static int ide_read_setting(ide_drive_t *drive,
152                             const struct ide_proc_devset *setting)
153 {
154         const struct ide_devset *ds = setting->setting;
155         int val = -EINVAL;
156
157         if (ds->get)
158                 val = ds->get(drive);
159
160         return val;
161 }
162
163 /**
164  *      ide_write_setting       -       read an IDE setting
165  *      @drive: drive to read from
166  *      @setting: drive setting
167  *      @val: value
168  *
169  *      Write a drive setting if it is possible. The caller
170  *      must hold the ide_setting_mtx when making this call.
171  *
172  *      BUGS: the data return and error are the same return value
173  *      so an error -EINVAL and true return of the same value cannot
174  *      be told apart
175  *
176  *      FIXME:  This should be changed to enqueue a special request
177  *      to the driver to change settings, and then wait on a sema for completion.
178  *      The current scheme of polling is kludgy, though safe enough.
179  */
180
181 static int ide_write_setting(ide_drive_t *drive,
182                              const struct ide_proc_devset *setting, int val)
183 {
184         const struct ide_devset *ds = setting->setting;
185
186         if (!capable(CAP_SYS_ADMIN))
187                 return -EACCES;
188         if (!ds->set)
189                 return -EPERM;
190         if ((ds->flags & DS_SYNC)
191             && (val < setting->min || val > setting->max))
192                 return -EINVAL;
193         return ide_devset_execute(drive, ds, val);
194 }
195
196 ide_devset_get(xfer_rate, current_speed);
197
198 static int set_xfer_rate (ide_drive_t *drive, int arg)
199 {
200         ide_task_t task;
201         int err;
202
203         if (arg < XFER_PIO_0 || arg > XFER_UDMA_6)
204                 return -EINVAL;
205
206         memset(&task, 0, sizeof(task));
207         task.tf.command = ATA_CMD_SET_FEATURES;
208         task.tf.feature = SETFEATURES_XFER;
209         task.tf.nsect   = (u8)arg;
210         task.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT |
211                         IDE_TFLAG_IN_NSECT;
212
213         err = ide_no_data_taskfile(drive, &task);
214
215         if (!err) {
216                 ide_set_xfer_rate(drive, (u8) arg);
217                 ide_driveid_update(drive);
218         }
219         return err;
220 }
221
222 ide_devset_rw(current_speed, xfer_rate);
223 ide_devset_rw_field(init_speed, init_speed);
224 ide_devset_rw_flag(nice1, IDE_DFLAG_NICE1);
225 ide_devset_rw_field(number, dn);
226
227 static const struct ide_proc_devset ide_generic_settings[] = {
228         IDE_PROC_DEVSET(current_speed, 0, 70),
229         IDE_PROC_DEVSET(init_speed, 0, 70),
230         IDE_PROC_DEVSET(io_32bit,  0, 1 + (SUPPORT_VLB_SYNC << 1)),
231         IDE_PROC_DEVSET(keepsettings, 0, 1),
232         IDE_PROC_DEVSET(nice1, 0, 1),
233         IDE_PROC_DEVSET(number, 0, 3),
234         IDE_PROC_DEVSET(pio_mode, 0, 255),
235         IDE_PROC_DEVSET(unmaskirq, 0, 1),
236         IDE_PROC_DEVSET(using_dma, 0, 1),
237         { 0 },
238 };
239
240 static void proc_ide_settings_warn(void)
241 {
242         static int warned;
243
244         if (warned)
245                 return;
246
247         printk(KERN_WARNING "Warning: /proc/ide/hd?/settings interface is "
248                             "obsolete, and will be removed soon!\n");
249         warned = 1;
250 }
251
252 static int proc_ide_read_settings
253         (char *page, char **start, off_t off, int count, int *eof, void *data)
254 {
255         const struct ide_proc_devset *setting, *g, *d;
256         const struct ide_devset *ds;
257         ide_drive_t     *drive = (ide_drive_t *) data;
258         char            *out = page;
259         int             len, rc, mul_factor, div_factor;
260
261         proc_ide_settings_warn();
262
263         mutex_lock(&ide_setting_mtx);
264         g = ide_generic_settings;
265         d = drive->settings;
266         out += sprintf(out, "name\t\t\tvalue\t\tmin\t\tmax\t\tmode\n");
267         out += sprintf(out, "----\t\t\t-----\t\t---\t\t---\t\t----\n");
268         while (g->name || (d && d->name)) {
269                 /* read settings in the alphabetical order */
270                 if (g->name && d && d->name) {
271                         if (strcmp(d->name, g->name) < 0)
272                                 setting = d++;
273                         else
274                                 setting = g++;
275                 } else if (d && d->name) {
276                         setting = d++;
277                 } else
278                         setting = g++;
279                 mul_factor = setting->mulf ? setting->mulf(drive) : 1;
280                 div_factor = setting->divf ? setting->divf(drive) : 1;
281                 out += sprintf(out, "%-24s", setting->name);
282                 rc = ide_read_setting(drive, setting);
283                 if (rc >= 0)
284                         out += sprintf(out, "%-16d", rc * mul_factor / div_factor);
285                 else
286                         out += sprintf(out, "%-16s", "write-only");
287                 out += sprintf(out, "%-16d%-16d", (setting->min * mul_factor + div_factor - 1) / div_factor, setting->max * mul_factor / div_factor);
288                 ds = setting->setting;
289                 if (ds->get)
290                         out += sprintf(out, "r");
291                 if (ds->set)
292                         out += sprintf(out, "w");
293                 out += sprintf(out, "\n");
294         }
295         len = out - page;
296         mutex_unlock(&ide_setting_mtx);
297         PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
298 }
299
300 #define MAX_LEN 30
301
302 static int proc_ide_write_settings(struct file *file, const char __user *buffer,
303                                    unsigned long count, void *data)
304 {
305         ide_drive_t     *drive = (ide_drive_t *) data;
306         char            name[MAX_LEN + 1];
307         int             for_real = 0, mul_factor, div_factor;
308         unsigned long   n;
309
310         const struct ide_proc_devset *setting;
311         char *buf, *s;
312
313         if (!capable(CAP_SYS_ADMIN))
314                 return -EACCES;
315
316         proc_ide_settings_warn();
317
318         if (count >= PAGE_SIZE)
319                 return -EINVAL;
320
321         s = buf = (char *)__get_free_page(GFP_USER);
322         if (!buf)
323                 return -ENOMEM;
324
325         if (copy_from_user(buf, buffer, count)) {
326                 free_page((unsigned long)buf);
327                 return -EFAULT;
328         }
329
330         buf[count] = '\0';
331
332         /*
333          * Skip over leading whitespace
334          */
335         while (count && isspace(*s)) {
336                 --count;
337                 ++s;
338         }
339         /*
340          * Do one full pass to verify all parameters,
341          * then do another to actually write the new settings.
342          */
343         do {
344                 char *p = s;
345                 n = count;
346                 while (n > 0) {
347                         unsigned val;
348                         char *q = p;
349
350                         while (n > 0 && *p != ':') {
351                                 --n;
352                                 p++;
353                         }
354                         if (*p != ':')
355                                 goto parse_error;
356                         if (p - q > MAX_LEN)
357                                 goto parse_error;
358                         memcpy(name, q, p - q);
359                         name[p - q] = 0;
360
361                         if (n > 0) {
362                                 --n;
363                                 p++;
364                         } else
365                                 goto parse_error;
366
367                         val = simple_strtoul(p, &q, 10);
368                         n -= q - p;
369                         p = q;
370                         if (n > 0 && !isspace(*p))
371                                 goto parse_error;
372                         while (n > 0 && isspace(*p)) {
373                                 --n;
374                                 ++p;
375                         }
376
377                         mutex_lock(&ide_setting_mtx);
378                         /* generic settings first, then driver specific ones */
379                         setting = ide_find_setting(ide_generic_settings, name);
380                         if (!setting) {
381                                 if (drive->settings)
382                                         setting = ide_find_setting(drive->settings, name);
383                                 if (!setting) {
384                                         mutex_unlock(&ide_setting_mtx);
385                                         goto parse_error;
386                                 }
387                         }
388                         if (for_real) {
389                                 mul_factor = setting->mulf ? setting->mulf(drive) : 1;
390                                 div_factor = setting->divf ? setting->divf(drive) : 1;
391                                 ide_write_setting(drive, setting, val * div_factor / mul_factor);
392                         }
393                         mutex_unlock(&ide_setting_mtx);
394                 }
395         } while (!for_real++);
396         free_page((unsigned long)buf);
397         return count;
398 parse_error:
399         free_page((unsigned long)buf);
400         printk("proc_ide_write_settings(): parse error\n");
401         return -EINVAL;
402 }
403
404 int proc_ide_read_capacity
405         (char *page, char **start, off_t off, int count, int *eof, void *data)
406 {
407         int len = sprintf(page, "%llu\n", (long long)0x7fffffff);
408         PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
409 }
410
411 EXPORT_SYMBOL_GPL(proc_ide_read_capacity);
412
413 int proc_ide_read_geometry
414         (char *page, char **start, off_t off, int count, int *eof, void *data)
415 {
416         ide_drive_t     *drive = (ide_drive_t *) data;
417         char            *out = page;
418         int             len;
419
420         out += sprintf(out, "physical     %d/%d/%d\n",
421                         drive->cyl, drive->head, drive->sect);
422         out += sprintf(out, "logical      %d/%d/%d\n",
423                         drive->bios_cyl, drive->bios_head, drive->bios_sect);
424
425         len = out - page;
426         PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
427 }
428
429 EXPORT_SYMBOL(proc_ide_read_geometry);
430
431 static int proc_ide_read_dmodel
432         (char *page, char **start, off_t off, int count, int *eof, void *data)
433 {
434         ide_drive_t     *drive = (ide_drive_t *) data;
435         char            *m = (char *)&drive->id[ATA_ID_PROD];
436         int             len;
437
438         len = sprintf(page, "%.40s\n", m[0] ? m : "(none)");
439         PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
440 }
441
442 static int proc_ide_read_driver
443         (char *page, char **start, off_t off, int count, int *eof, void *data)
444 {
445         ide_drive_t     *drive = (ide_drive_t *) data;
446         struct device   *dev = &drive->gendev;
447         ide_driver_t    *ide_drv;
448         int             len;
449
450         if (dev->driver) {
451                 ide_drv = container_of(dev->driver, ide_driver_t, gen_driver);
452                 len = sprintf(page, "%s version %s\n",
453                                 dev->driver->name, ide_drv->version);
454         } else
455                 len = sprintf(page, "ide-default version 0.9.newide\n");
456         PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
457 }
458
459 static int ide_replace_subdriver(ide_drive_t *drive, const char *driver)
460 {
461         struct device *dev = &drive->gendev;
462         int ret = 1;
463         int err;
464
465         device_release_driver(dev);
466         /* FIXME: device can still be in use by previous driver */
467         strlcpy(drive->driver_req, driver, sizeof(drive->driver_req));
468         err = device_attach(dev);
469         if (err < 0)
470                 printk(KERN_WARNING "IDE: %s: device_attach error: %d\n",
471                         __func__, err);
472         drive->driver_req[0] = 0;
473         if (dev->driver == NULL) {
474                 err = device_attach(dev);
475                 if (err < 0)
476                         printk(KERN_WARNING
477                                 "IDE: %s: device_attach(2) error: %d\n",
478                                 __func__, err);
479         }
480         if (dev->driver && !strcmp(dev->driver->name, driver))
481                 ret = 0;
482
483         return ret;
484 }
485
486 static int proc_ide_write_driver
487         (struct file *file, const char __user *buffer, unsigned long count, void *data)
488 {
489         ide_drive_t     *drive = (ide_drive_t *) data;
490         char name[32];
491
492         if (!capable(CAP_SYS_ADMIN))
493                 return -EACCES;
494         if (count > 31)
495                 count = 31;
496         if (copy_from_user(name, buffer, count))
497                 return -EFAULT;
498         name[count] = '\0';
499         if (ide_replace_subdriver(drive, name))
500                 return -EINVAL;
501         return count;
502 }
503
504 static int proc_ide_read_media
505         (char *page, char **start, off_t off, int count, int *eof, void *data)
506 {
507         ide_drive_t     *drive = (ide_drive_t *) data;
508         const char      *media;
509         int             len;
510
511         switch (drive->media) {
512         case ide_disk:          media = "disk\n";       break;
513         case ide_cdrom:         media = "cdrom\n";      break;
514         case ide_tape:          media = "tape\n";       break;
515         case ide_floppy:        media = "floppy\n";     break;
516         case ide_optical:       media = "optical\n";    break;
517         default:                media = "UNKNOWN\n";    break;
518         }
519         strcpy(page, media);
520         len = strlen(media);
521         PROC_IDE_READ_RETURN(page, start, off, count, eof, len);
522 }
523
524 static ide_proc_entry_t generic_drive_entries[] = {
525         { "driver",     S_IFREG|S_IRUGO,         proc_ide_read_driver,
526                                                  proc_ide_write_driver },
527         { "identify",   S_IFREG|S_IRUSR,         proc_ide_read_identify, NULL },
528         { "media",      S_IFREG|S_IRUGO,         proc_ide_read_media,    NULL },
529         { "model",      S_IFREG|S_IRUGO,         proc_ide_read_dmodel,   NULL },
530         { "settings",   S_IFREG|S_IRUSR|S_IWUSR, proc_ide_read_settings,
531                                                  proc_ide_write_settings },
532         { NULL, 0, NULL, NULL }
533 };
534
535 static void ide_add_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p, void *data)
536 {
537         struct proc_dir_entry *ent;
538
539         if (!dir || !p)
540                 return;
541         while (p->name != NULL) {
542                 ent = create_proc_entry(p->name, p->mode, dir);
543                 if (!ent) return;
544                 ent->data = data;
545                 ent->read_proc = p->read_proc;
546                 ent->write_proc = p->write_proc;
547                 p++;
548         }
549 }
550
551 static void ide_remove_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p)
552 {
553         if (!dir || !p)
554                 return;
555         while (p->name != NULL) {
556                 remove_proc_entry(p->name, dir);
557                 p++;
558         }
559 }
560
561 void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver)
562 {
563         mutex_lock(&ide_setting_mtx);
564         drive->settings = driver->proc_devsets(drive);
565         mutex_unlock(&ide_setting_mtx);
566
567         ide_add_proc_entries(drive->proc, driver->proc_entries(drive), drive);
568 }
569
570 EXPORT_SYMBOL(ide_proc_register_driver);
571
572 /**
573  *      ide_proc_unregister_driver      -       remove driver specific data
574  *      @drive: drive
575  *      @driver: driver
576  *
577  *      Clean up the driver specific /proc files and IDE settings
578  *      for a given drive.
579  *
580  *      Takes ide_setting_mtx.
581  */
582
583 void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver)
584 {
585         ide_remove_proc_entries(drive->proc, driver->proc_entries(drive));
586
587         mutex_lock(&ide_setting_mtx);
588         /*
589          * ide_setting_mtx protects both the settings list and the use
590          * of settings (we cannot take a setting out that is being used).
591          */
592         drive->settings = NULL;
593         mutex_unlock(&ide_setting_mtx);
594 }
595 EXPORT_SYMBOL(ide_proc_unregister_driver);
596
597 void ide_proc_port_register_devices(ide_hwif_t *hwif)
598 {
599         int     d;
600         struct proc_dir_entry *ent;
601         struct proc_dir_entry *parent = hwif->proc;
602         char name[64];
603
604         for (d = 0; d < MAX_DRIVES; d++) {
605                 ide_drive_t *drive = &hwif->drives[d];
606
607                 if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0 || drive->proc)
608                         continue;
609
610                 drive->proc = proc_mkdir(drive->name, parent);
611                 if (drive->proc)
612                         ide_add_proc_entries(drive->proc, generic_drive_entries, drive);
613                 sprintf(name, "ide%d/%s", (drive->name[2]-'a')/2, drive->name);
614                 ent = proc_symlink(drive->name, proc_ide_root, name);
615                 if (!ent) return;
616         }
617 }
618
619 void ide_proc_unregister_device(ide_drive_t *drive)
620 {
621         if (drive->proc) {
622                 ide_remove_proc_entries(drive->proc, generic_drive_entries);
623                 remove_proc_entry(drive->name, proc_ide_root);
624                 remove_proc_entry(drive->name, drive->hwif->proc);
625                 drive->proc = NULL;
626         }
627 }
628
629 static ide_proc_entry_t hwif_entries[] = {
630         { "channel",    S_IFREG|S_IRUGO,        proc_ide_read_channel,  NULL },
631         { "mate",       S_IFREG|S_IRUGO,        proc_ide_read_mate,     NULL },
632         { "model",      S_IFREG|S_IRUGO,        proc_ide_read_imodel,   NULL },
633         { NULL, 0, NULL, NULL }
634 };
635
636 void ide_proc_register_port(ide_hwif_t *hwif)
637 {
638         if (!hwif->proc) {
639                 hwif->proc = proc_mkdir(hwif->name, proc_ide_root);
640
641                 if (!hwif->proc)
642                         return;
643
644                 ide_add_proc_entries(hwif->proc, hwif_entries, hwif);
645         }
646 }
647
648 void ide_proc_unregister_port(ide_hwif_t *hwif)
649 {
650         if (hwif->proc) {
651                 ide_remove_proc_entries(hwif->proc, hwif_entries);
652                 remove_proc_entry(hwif->name, proc_ide_root);
653                 hwif->proc = NULL;
654         }
655 }
656
657 static int proc_print_driver(struct device_driver *drv, void *data)
658 {
659         ide_driver_t *ide_drv = container_of(drv, ide_driver_t, gen_driver);
660         struct seq_file *s = data;
661
662         seq_printf(s, "%s version %s\n", drv->name, ide_drv->version);
663
664         return 0;
665 }
666
667 static int ide_drivers_show(struct seq_file *s, void *p)
668 {
669         int err;
670
671         err = bus_for_each_drv(&ide_bus_type, NULL, s, proc_print_driver);
672         if (err < 0)
673                 printk(KERN_WARNING "IDE: %s: bus_for_each_drv error: %d\n",
674                         __func__, err);
675         return 0;
676 }
677
678 static int ide_drivers_open(struct inode *inode, struct file *file)
679 {
680         return single_open(file, &ide_drivers_show, NULL);
681 }
682
683 static const struct file_operations ide_drivers_operations = {
684         .owner          = THIS_MODULE,
685         .open           = ide_drivers_open,
686         .read           = seq_read,
687         .llseek         = seq_lseek,
688         .release        = single_release,
689 };
690
691 void proc_ide_create(void)
692 {
693         proc_ide_root = proc_mkdir("ide", NULL);
694
695         if (!proc_ide_root)
696                 return;
697
698         proc_create("drivers", 0, proc_ide_root, &ide_drivers_operations);
699 }
700
701 void proc_ide_destroy(void)
702 {
703         remove_proc_entry("drivers", proc_ide_root);
704         remove_proc_entry("ide", NULL);
705 }