OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [drivers/] [ide/] [ide-default.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
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 void idedefault_setup (ide_drive_t *drive)
40
{
41
}
42
 
43
static int idedefault_open(struct inode *inode, struct file *filp, ide_drive_t *drive)
44
{
45
        MOD_INC_USE_COUNT;
46
        if(filp->f_flags & O_NDELAY)
47
                return 0;
48
        MOD_DEC_USE_COUNT;
49
        drive->usage--;
50
        return -ENXIO;
51
}
52
 
53
static void idedefault_release(struct inode *inode, struct file *filp, ide_drive_t *drive)
54
{
55
        MOD_DEC_USE_COUNT;
56
}
57
 
58
int idedefault_init (void);
59
int idedefault_attach(ide_drive_t *drive);
60
 
61
/*
62
 *      IDE subdriver functions, registered with ide.c
63
 */
64
 
65
ide_driver_t idedefault_driver = {
66
        name:                   "ide-default",
67
        version:                IDEDEFAULT_VERSION,
68
        media:                  0,
69
        busy:                   0,
70
        supports_dma:           1,
71
        supports_dsc_overlap:   0,
72
        init:                   idedefault_init,
73
        attach:                 idedefault_attach,
74
        open:                   idedefault_open,
75
        release:                idedefault_release
76
};
77
 
78
static ide_module_t idedefault_module = {
79
        IDE_DRIVER_MODULE,
80
        idedefault_init,
81
        &idedefault_driver,
82
        NULL
83
};
84
 
85
int idedefault_attach (ide_drive_t *drive)
86
{
87
        int ret = 0;
88
        MOD_INC_USE_COUNT;
89
        if (ide_register_subdriver(drive,
90
                        &idedefault_driver, IDE_SUBDRIVER_VERSION)) {
91
                printk(KERN_ERR "ide-default: %s: Failed to register the "
92
                        "driver with ide.c\n", drive->name);
93
                ret = 1;
94
                goto bye_game_over;
95
        }
96
        DRIVER(drive)->busy++;
97
        idedefault_setup(drive);
98
        DRIVER(drive)->busy--;
99
 
100
bye_game_over:
101
        MOD_DEC_USE_COUNT;
102
        return ret;
103
}
104
 
105
int idedefault_init (void)
106
{
107
        ide_register_module(&idedefault_module);
108
        return 0;
109
}
110
 
111
MODULE_LICENSE("GPL");

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.