diff options
author | Steve French <sfrench@hera.kernel.org> | 2005-05-31 17:32:44 -0400 |
---|---|---|
committer | Steve French <sfrench@hera.kernel.org> | 2005-05-31 17:32:44 -0400 |
commit | af6f5e3247a68074e384ef93c0b4bce1b73c9d80 (patch) | |
tree | 87b0f1e48bd0ca67a78fab0fa42b37864863fdfd /drivers/ide/ide-cd.c | |
parent | 7e2987503dda95a5f80290bb8c06279009c2419e (diff) | |
parent | 2e3e80c2b75e3815a0160cbd23d4fdb767d66b35 (diff) |
Merge with rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r-- | drivers/ide/ide-cd.c | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 33a020faeabd..39f3e9101ed4 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -1932,8 +1932,11 @@ static ide_startstop_t cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) | |||
1932 | 1932 | ||
1933 | /* | 1933 | /* |
1934 | * check if dma is safe | 1934 | * check if dma is safe |
1935 | * | ||
1936 | * NOTE! The "len" and "addr" checks should possibly have | ||
1937 | * separate masks. | ||
1935 | */ | 1938 | */ |
1936 | if ((rq->data_len & mask) || (addr & mask)) | 1939 | if ((rq->data_len & 15) || (addr & mask)) |
1937 | info->dma = 0; | 1940 | info->dma = 0; |
1938 | } | 1941 | } |
1939 | 1942 | ||
@@ -3255,16 +3258,12 @@ sector_t ide_cdrom_capacity (ide_drive_t *drive) | |||
3255 | return capacity * sectors_per_frame; | 3258 | return capacity * sectors_per_frame; |
3256 | } | 3259 | } |
3257 | 3260 | ||
3258 | static | 3261 | static int ide_cd_remove(struct device *dev) |
3259 | int ide_cdrom_cleanup(ide_drive_t *drive) | ||
3260 | { | 3262 | { |
3263 | ide_drive_t *drive = to_ide_device(dev); | ||
3261 | struct cdrom_info *info = drive->driver_data; | 3264 | struct cdrom_info *info = drive->driver_data; |
3262 | 3265 | ||
3263 | if (ide_unregister_subdriver(drive)) { | 3266 | ide_unregister_subdriver(drive, info->driver); |
3264 | printk(KERN_ERR "%s: %s: failed to ide_unregister_subdriver\n", | ||
3265 | __FUNCTION__, drive->name); | ||
3266 | return 1; | ||
3267 | } | ||
3268 | 3267 | ||
3269 | del_gendisk(info->disk); | 3268 | del_gendisk(info->disk); |
3270 | 3269 | ||
@@ -3297,7 +3296,7 @@ static void ide_cd_release(struct kref *kref) | |||
3297 | kfree(info); | 3296 | kfree(info); |
3298 | } | 3297 | } |
3299 | 3298 | ||
3300 | static int ide_cdrom_attach (ide_drive_t *drive); | 3299 | static int ide_cd_probe(struct device *); |
3301 | 3300 | ||
3302 | #ifdef CONFIG_PROC_FS | 3301 | #ifdef CONFIG_PROC_FS |
3303 | static int proc_idecd_read_capacity | 3302 | static int proc_idecd_read_capacity |
@@ -3320,19 +3319,20 @@ static ide_proc_entry_t idecd_proc[] = { | |||
3320 | 3319 | ||
3321 | static ide_driver_t ide_cdrom_driver = { | 3320 | static ide_driver_t ide_cdrom_driver = { |
3322 | .owner = THIS_MODULE, | 3321 | .owner = THIS_MODULE, |
3323 | .name = "ide-cdrom", | 3322 | .gen_driver = { |
3323 | .name = "ide-cdrom", | ||
3324 | .bus = &ide_bus_type, | ||
3325 | .probe = ide_cd_probe, | ||
3326 | .remove = ide_cd_remove, | ||
3327 | }, | ||
3324 | .version = IDECD_VERSION, | 3328 | .version = IDECD_VERSION, |
3325 | .media = ide_cdrom, | 3329 | .media = ide_cdrom, |
3326 | .busy = 0, | ||
3327 | .supports_dsc_overlap = 1, | 3330 | .supports_dsc_overlap = 1, |
3328 | .cleanup = ide_cdrom_cleanup, | ||
3329 | .do_request = ide_do_rw_cdrom, | 3331 | .do_request = ide_do_rw_cdrom, |
3330 | .end_request = ide_end_request, | 3332 | .end_request = ide_end_request, |
3331 | .error = __ide_error, | 3333 | .error = __ide_error, |
3332 | .abort = __ide_abort, | 3334 | .abort = __ide_abort, |
3333 | .proc = idecd_proc, | 3335 | .proc = idecd_proc, |
3334 | .attach = ide_cdrom_attach, | ||
3335 | .drives = LIST_HEAD_INIT(ide_cdrom_driver.drives), | ||
3336 | }; | 3336 | }; |
3337 | 3337 | ||
3338 | static int idecd_open(struct inode * inode, struct file * file) | 3338 | static int idecd_open(struct inode * inode, struct file * file) |
@@ -3418,8 +3418,9 @@ static char *ignore = NULL; | |||
3418 | module_param(ignore, charp, 0400); | 3418 | module_param(ignore, charp, 0400); |
3419 | MODULE_DESCRIPTION("ATAPI CD-ROM Driver"); | 3419 | MODULE_DESCRIPTION("ATAPI CD-ROM Driver"); |
3420 | 3420 | ||
3421 | static int ide_cdrom_attach (ide_drive_t *drive) | 3421 | static int ide_cd_probe(struct device *dev) |
3422 | { | 3422 | { |
3423 | ide_drive_t *drive = to_ide_device(dev); | ||
3423 | struct cdrom_info *info; | 3424 | struct cdrom_info *info; |
3424 | struct gendisk *g; | 3425 | struct gendisk *g; |
3425 | struct request_sense sense; | 3426 | struct request_sense sense; |
@@ -3453,11 +3454,8 @@ static int ide_cdrom_attach (ide_drive_t *drive) | |||
3453 | 3454 | ||
3454 | ide_init_disk(g, drive); | 3455 | ide_init_disk(g, drive); |
3455 | 3456 | ||
3456 | if (ide_register_subdriver(drive, &ide_cdrom_driver)) { | 3457 | ide_register_subdriver(drive, &ide_cdrom_driver); |
3457 | printk(KERN_ERR "%s: Failed to register the driver with ide.c\n", | 3458 | |
3458 | drive->name); | ||
3459 | goto out_put_disk; | ||
3460 | } | ||
3461 | memset(info, 0, sizeof (struct cdrom_info)); | 3459 | memset(info, 0, sizeof (struct cdrom_info)); |
3462 | 3460 | ||
3463 | kref_init(&info->kref); | 3461 | kref_init(&info->kref); |
@@ -3470,7 +3468,6 @@ static int ide_cdrom_attach (ide_drive_t *drive) | |||
3470 | 3468 | ||
3471 | drive->driver_data = info; | 3469 | drive->driver_data = info; |
3472 | 3470 | ||
3473 | DRIVER(drive)->busy++; | ||
3474 | g->minors = 1; | 3471 | g->minors = 1; |
3475 | snprintf(g->devfs_name, sizeof(g->devfs_name), | 3472 | snprintf(g->devfs_name, sizeof(g->devfs_name), |
3476 | "%s/cd", drive->devfs_name); | 3473 | "%s/cd", drive->devfs_name); |
@@ -3478,8 +3475,7 @@ static int ide_cdrom_attach (ide_drive_t *drive) | |||
3478 | g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE; | 3475 | g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE; |
3479 | if (ide_cdrom_setup(drive)) { | 3476 | if (ide_cdrom_setup(drive)) { |
3480 | struct cdrom_device_info *devinfo = &info->devinfo; | 3477 | struct cdrom_device_info *devinfo = &info->devinfo; |
3481 | DRIVER(drive)->busy--; | 3478 | ide_unregister_subdriver(drive, &ide_cdrom_driver); |
3482 | ide_unregister_subdriver(drive); | ||
3483 | if (info->buffer != NULL) | 3479 | if (info->buffer != NULL) |
3484 | kfree(info->buffer); | 3480 | kfree(info->buffer); |
3485 | if (info->toc != NULL) | 3481 | if (info->toc != NULL) |
@@ -3492,7 +3488,6 @@ static int ide_cdrom_attach (ide_drive_t *drive) | |||
3492 | drive->driver_data = NULL; | 3488 | drive->driver_data = NULL; |
3493 | goto failed; | 3489 | goto failed; |
3494 | } | 3490 | } |
3495 | DRIVER(drive)->busy--; | ||
3496 | 3491 | ||
3497 | cdrom_read_toc(drive, &sense); | 3492 | cdrom_read_toc(drive, &sense); |
3498 | g->fops = &idecd_ops; | 3493 | g->fops = &idecd_ops; |
@@ -3500,23 +3495,20 @@ static int ide_cdrom_attach (ide_drive_t *drive) | |||
3500 | add_disk(g); | 3495 | add_disk(g); |
3501 | return 0; | 3496 | return 0; |
3502 | 3497 | ||
3503 | out_put_disk: | ||
3504 | put_disk(g); | ||
3505 | out_free_cd: | 3498 | out_free_cd: |
3506 | kfree(info); | 3499 | kfree(info); |
3507 | failed: | 3500 | failed: |
3508 | return 1; | 3501 | return -ENODEV; |
3509 | } | 3502 | } |
3510 | 3503 | ||
3511 | static void __exit ide_cdrom_exit(void) | 3504 | static void __exit ide_cdrom_exit(void) |
3512 | { | 3505 | { |
3513 | ide_unregister_driver(&ide_cdrom_driver); | 3506 | driver_unregister(&ide_cdrom_driver.gen_driver); |
3514 | } | 3507 | } |
3515 | 3508 | ||
3516 | static int ide_cdrom_init(void) | 3509 | static int ide_cdrom_init(void) |
3517 | { | 3510 | { |
3518 | ide_register_driver(&ide_cdrom_driver); | 3511 | return driver_register(&ide_cdrom_driver.gen_driver); |
3519 | return 0; | ||
3520 | } | 3512 | } |
3521 | 3513 | ||
3522 | module_init(ide_cdrom_init); | 3514 | module_init(ide_cdrom_init); |