ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[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
27 #include <asm/byteorder.h>
28 #include <asm/irq.h>
29 #include <asm/uaccess.h>
30 #include <asm/io.h>
31 #include <asm/unaligned.h>
32 #include <asm/bitops.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         .drives         =       LIST_HEAD_INIT(idedefault_driver.drives)
50 };
51
52 static int idedefault_attach (ide_drive_t *drive)
53 {
54         if (ide_register_subdriver(drive, &idedefault_driver)) {
55                 printk(KERN_ERR "ide-default: %s: Failed to register the "
56                         "driver with ide.c\n", drive->name);
57                 return 1;
58         }
59         
60         /* For the sake of the request layer, we must make sure we have a
61          * correct ready_stat value, that is 0 for ATAPI devices or we will
62          * fail any request like Power Management
63          */
64         if (drive->media != ide_disk)
65                 drive->ready_stat = 0;
66
67         return 0;
68 }
69
70 MODULE_DESCRIPTION("IDE Default Driver");
71
72 MODULE_LICENSE("GPL");