aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-floppy.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-floppy.c')
-rw-r--r--drivers/ide/ide-floppy.c45
1 files changed, 37 insertions, 8 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 802e0968e32f..58746c748c12 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -68,7 +68,7 @@
68 * Used to finish servicing a request. For read/write requests, we will call 68 * Used to finish servicing a request. For read/write requests, we will call
69 * ide_end_request to pass to the next buffer. 69 * ide_end_request to pass to the next buffer.
70 */ 70 */
71int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs) 71static int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs)
72{ 72{
73 idefloppy_floppy_t *floppy = drive->driver_data; 73 idefloppy_floppy_t *floppy = drive->driver_data;
74 struct request *rq = HWGROUP(drive)->rq; 74 struct request *rq = HWGROUP(drive)->rq;
@@ -280,13 +280,12 @@ static void idefloppy_blockpc_cmd(idefloppy_floppy_t *floppy,
280 pc->req_xfer = pc->buf_size = rq->data_len; 280 pc->req_xfer = pc->buf_size = rq->data_len;
281} 281}
282 282
283ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, struct request *rq, 283static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
284 sector_t block_s) 284 struct request *rq, sector_t block)
285{ 285{
286 idefloppy_floppy_t *floppy = drive->driver_data; 286 idefloppy_floppy_t *floppy = drive->driver_data;
287 ide_hwif_t *hwif = drive->hwif; 287 ide_hwif_t *hwif = drive->hwif;
288 struct ide_atapi_pc *pc; 288 struct ide_atapi_pc *pc;
289 unsigned long block = (unsigned long)block_s;
290 289
291 ide_debug_log(IDE_DBG_FUNC, "%s: dev: %s, cmd: 0x%x, cmd_type: %x, " 290 ide_debug_log(IDE_DBG_FUNC, "%s: dev: %s, cmd: 0x%x, cmd_type: %x, "
292 "errors: %d\n", 291 "errors: %d\n",
@@ -316,7 +315,7 @@ ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, struct request *rq,
316 return ide_stopped; 315 return ide_stopped;
317 } 316 }
318 pc = &floppy->queued_pc; 317 pc = &floppy->queued_pc;
319 idefloppy_create_rw_cmd(drive, pc, rq, block); 318 idefloppy_create_rw_cmd(drive, pc, rq, (unsigned long)block);
320 } else if (blk_special_request(rq)) { 319 } else if (blk_special_request(rq)) {
321 pc = (struct ide_atapi_pc *) rq->buffer; 320 pc = (struct ide_atapi_pc *) rq->buffer;
322 } else if (blk_pc_request(rq)) { 321 } else if (blk_pc_request(rq)) {
@@ -406,7 +405,7 @@ static int ide_floppy_get_flexible_disk_page(ide_drive_t *drive)
406 * Determine if a media is present in the floppy drive, and if so, its LBA 405 * Determine if a media is present in the floppy drive, and if so, its LBA
407 * capacity. 406 * capacity.
408 */ 407 */
409int ide_floppy_get_capacity(ide_drive_t *drive) 408static int ide_floppy_get_capacity(ide_drive_t *drive)
410{ 409{
411 idefloppy_floppy_t *floppy = drive->driver_data; 410 idefloppy_floppy_t *floppy = drive->driver_data;
412 struct gendisk *disk = floppy->disk; 411 struct gendisk *disk = floppy->disk;
@@ -505,9 +504,9 @@ int ide_floppy_get_capacity(ide_drive_t *drive)
505 return rc; 504 return rc;
506} 505}
507 506
508void ide_floppy_setup(ide_drive_t *drive) 507static void ide_floppy_setup(ide_drive_t *drive)
509{ 508{
510 struct ide_floppy_obj *floppy = drive->driver_data; 509 struct ide_disk_obj *floppy = drive->driver_data;
511 u16 *id = drive->id; 510 u16 *id = drive->id;
512 511
513 drive->pc_callback = ide_floppy_callback; 512 drive->pc_callback = ide_floppy_callback;
@@ -547,3 +546,33 @@ void ide_floppy_setup(ide_drive_t *drive)
547 546
548 drive->dev_flags |= IDE_DFLAG_ATTACH; 547 drive->dev_flags |= IDE_DFLAG_ATTACH;
549} 548}
549
550static void ide_floppy_flush(ide_drive_t *drive)
551{
552}
553
554static int ide_floppy_init_media(ide_drive_t *drive, struct gendisk *disk)
555{
556 int ret = 0;
557
558 if (ide_do_test_unit_ready(drive, disk))
559 ide_do_start_stop(drive, disk, 1);
560
561 ret = ide_floppy_get_capacity(drive);
562
563 set_capacity(disk, ide_gd_capacity(drive));
564
565 return ret;
566}
567
568const struct ide_disk_ops ide_atapi_disk_ops = {
569 .check = ide_check_atapi_device,
570 .get_capacity = ide_floppy_get_capacity,
571 .setup = ide_floppy_setup,
572 .flush = ide_floppy_flush,
573 .init_media = ide_floppy_init_media,
574 .set_doorlock = ide_set_media_lock,
575 .do_request = ide_floppy_do_request,
576 .end_request = ide_floppy_end_request,
577 .ioctl = ide_floppy_ioctl,
578};