1 #include <linux/module.h>
2 #include <linux/types.h>
3 #include <linux/string.h>
4 #include <linux/kernel.h>
5 #include <linux/errno.h>
11 #include <linux/slab.h>
13 #if !defined(CONFIG_DEBUG_BLOCK_EXT_DEVT)
14 #define IDE_DISK_MINORS (1 << PARTN_BITS)
16 #define IDE_DISK_MINORS 0
22 #define IDE_GD_VERSION "1.18"
26 static unsigned long debug_mask;
31 static void ide_disk_release(
struct device *);
69 struct gendisk *
g = idkp->
disk;
81 static void ide_disk_release(
struct device *
dev)
85 struct gendisk *g = idkp->
disk;
89 g->private_data =
NULL;
101 if (ata_id_hpa_enabled(drive->
id))
108 .ident =
"Acer TravelMate 660",
146 #ifdef CONFIG_IDE_PROC_FS
147 static ide_proc_entry_t *ide_disk_proc_entries(
ide_drive_t *drive)
152 static const struct ide_proc_devset *ide_disk_proc_devsets(
ide_drive_t *drive)
162 return drive->
disk_ops->do_request(drive, rq, sector);
171 .probe = ide_gd_probe,
172 .remove = ide_gd_remove,
173 .resume = ide_gd_resume,
174 .shutdown = ide_gd_shutdown,
176 .do_request = ide_gd_do_request,
177 #ifdef CONFIG_IDE_PROC_FS
178 .proc_entries = ide_disk_proc_entries,
179 .proc_devsets = ide_disk_proc_devsets,
185 struct gendisk *disk = bdev->
bd_disk;
190 idkp = ide_disk_get(disk);
204 ret = drive->
disk_ops->init_media(drive, disk);
226 drive->
disk_ops->set_doorlock(drive, disk, 1);
246 ret = ide_gd_open(bdev, mode);
253 static int ide_gd_release(
struct gendisk *disk,
fmode_t mode)
265 drive->
disk_ops->set_doorlock(drive, disk, 0);
288 static unsigned int ide_gd_check_events(
struct gendisk *disk,
289 unsigned int clearing)
310 return ret ? DISK_EVENT_MEDIA_CHANGE : 0;
313 static void ide_gd_unlock_native_capacity(
struct gendisk *disk)
323 static int ide_gd_revalidate_disk(
struct gendisk *disk)
328 if (ide_gd_check_events(disk, 0))
329 drive->
disk_ops->get_capacity(drive);
336 unsigned int cmd,
unsigned long arg)
341 return drive->
disk_ops->ioctl(drive, bdev, mode, cmd, arg);
344 static const struct block_device_operations ide_gd_ops = {
346 .open = ide_gd_unlocked_open,
347 .release = ide_gd_release,
348 .ioctl = ide_gd_ioctl,
349 .getgeo = ide_gd_getgeo,
350 .check_events = ide_gd_check_events,
351 .unlock_native_capacity = ide_gd_unlock_native_capacity,
352 .revalidate_disk = ide_gd_revalidate_disk
365 #ifdef CONFIG_IDE_GD_ATA
369 #ifdef CONFIG_IDE_GD_ATAPI
373 if (disk_ops ==
NULL)
396 idkp->
dev.release = ide_disk_release;
403 idkp->
driver = &ide_gd_driver;
406 g->private_data = &idkp->
driver;
412 disk_ops->
setup(drive);
417 g->driverfs_dev = &drive->
gendev;
418 g->flags |= GENHD_FL_EXT_DEVT;
420 g->flags = GENHD_FL_REMOVABLE;
421 g->fops = &ide_gd_ops;
433 static int __init ide_gd_init(
void)
439 static void __exit ide_gd_exit(
void)