vserver 1.9.5.x5
[linux-2.6.git] / drivers / ide / ide-default.c
1 /*
2  *      ide-default             -       Driver for unbound ide devices
3  *
4  *      This provides a clean way to bind a device to default operations
5  *      by having an actual driver class that rather than special casing
6  *      "no driver" all over the IDE code
7  *
8  *      Copyright (C) 2003, Red Hat <alan@redhat.com>
9  */
10
11 #include <linux/config.h>
12 #include <linux/module.h>
13 #include <linux/types.h>
14 #include <linux/string.h>
15 #include <linux/kernel.h>
16 #include <linux/delay.h>
17 #include <linux/timer.h>
18 #include <linux/mm.h>
19 #include <linux/interrupt.h>
20 #include <linux/major.h>
21 #include <linux/errno.h>
22 #include <linux/genhd.h>
23 #include <linux/slab.h>
24 #include <linux/cdrom.h>
25 #include <linux/ide.h>
26 #include <linux/bitops.h>
27
28 #include <asm/byteorder.h>
29 #include <asm/irq.h>
30 #include <asm/uaccess.h>
31 #include <asm/io.h>
32 #include <asm/unaligned.h>
33
34 #define IDEDEFAULT_VERSION      "0.9.newide"
35 /*
36  *      Driver initialization.
37  */
38
39 static int idedefault_attach(ide_drive_t *drive);
40
41 /*
42  *      IDE subdriver functions, registered with ide.c
43  */
44
45 ide_driver_t idedefault_driver = {
46         .name           =       "ide-default",
47         .version        =       IDEDEFAULT_VERSION,
48         .attach         =       idedefault_attach,
49         .cleanup        =       ide_unregister_subdriver,
50         .drives         =       LIST_HEAD_INIT(idedefault_driver.drives)
51 };
52
53 static int idedefault_attach (ide_drive_t *drive)
54 {
55         if (ide_register_subdriver(drive, &idedefault_driver)) {
56                 printk(KERN_ERR "ide-default: %s: Failed to register the "
57                         "driver with ide.c\n", drive->name);
58                 return 1;
59         }
60         
61         /* For the sake of the request layer, we must make sure we have a
62          * correct ready_stat value, that is 0 for ATAPI devices or we will
63          * fail any request like Power Management
64          */
65         if (drive->media != ide_disk)
66                 drive->ready_stat = 0;
67
68         return 0;
69 }
70
71 MODULE_DESCRIPTION("IDE Default Driver");
72
73 MODULE_LICENSE("GPL");