aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-floppy.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-01-02 10:12:51 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-01-02 10:12:51 -0500
commit07bd3f4731f9c7ebcbab90905ca4ad6fc6825f96 (patch)
treea221416a18a4b1d69009ecd933496b3edafaba01 /drivers/ide/ide-floppy.c
parentbf64741fe89280bd81a9e3a1beadec1570861848 (diff)
ide-floppy: allocate only toplevel packet commands
This makes the top-level function just allocate a single pc entry, and then pass it down as a pointer to all the helper functions that also need one of those "struct ide_atapi_pc" things. As far as I can tell, the use of these things never overlaps each other, BUT I DID NOT CHECK VERY CLOSELY! So I'm not guaranteeing this is correct, and I don't have the hardware. It would be good for somebody who knows the code more, and has the hardware, could please test this? With this, ide-floppy still has fairly big stack usage, but instead of idefloppy_ioctl [vmlinux]: 1208 ide_floppy_get_capacity [vmlinux]: 872 idefloppy_release [vmlinux]: 408 idefloppy_open [vmlinux]: 408 where those two first ones are at the very top of the list of stack users for me, it's now ide_floppy_get_capacity [vmlinux]: 404 ide_floppy_ioctl [vmlinux]: 364 ie they are still high, but they are no longer at the top. Borislav: Since ide_floppy_get_capacity is passed as a function pointer to other parts of the kernel (e.g., block layer) we need that ide_atapi_pc to be created on stack. Also, redid stack users numbers above. The two functions missing from Linus' original 'make stackusage' output are due to ide being rewritten/reorganized atm. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-floppy.c')
-rw-r--r--drivers/ide/ide-floppy.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index aeb1ad782f54..1f07f3818938 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -342,38 +342,38 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
342 * Look at the flexible disk page parameters. We ignore the CHS capacity 342 * Look at the flexible disk page parameters. We ignore the CHS capacity
343 * parameters and use the LBA parameters instead. 343 * parameters and use the LBA parameters instead.
344 */ 344 */
345static int ide_floppy_get_flexible_disk_page(ide_drive_t *drive) 345static int ide_floppy_get_flexible_disk_page(ide_drive_t *drive,
346 struct ide_atapi_pc *pc)
346{ 347{
347 struct ide_disk_obj *floppy = drive->driver_data; 348 struct ide_disk_obj *floppy = drive->driver_data;
348 struct gendisk *disk = floppy->disk; 349 struct gendisk *disk = floppy->disk;
349 struct ide_atapi_pc pc;
350 u8 *page; 350 u8 *page;
351 int capacity, lba_capacity; 351 int capacity, lba_capacity;
352 u16 transfer_rate, sector_size, cyls, rpm; 352 u16 transfer_rate, sector_size, cyls, rpm;
353 u8 heads, sectors; 353 u8 heads, sectors;
354 354
355 ide_floppy_create_mode_sense_cmd(&pc, IDEFLOPPY_FLEXIBLE_DISK_PAGE); 355 ide_floppy_create_mode_sense_cmd(pc, IDEFLOPPY_FLEXIBLE_DISK_PAGE);
356 356
357 if (ide_queue_pc_tail(drive, disk, &pc)) { 357 if (ide_queue_pc_tail(drive, disk, pc)) {
358 printk(KERN_ERR PFX "Can't get flexible disk page params\n"); 358 printk(KERN_ERR PFX "Can't get flexible disk page params\n");
359 return 1; 359 return 1;
360 } 360 }
361 361
362 if (pc.buf[3] & 0x80) 362 if (pc->buf[3] & 0x80)
363 drive->dev_flags |= IDE_DFLAG_WP; 363 drive->dev_flags |= IDE_DFLAG_WP;
364 else 364 else
365 drive->dev_flags &= ~IDE_DFLAG_WP; 365 drive->dev_flags &= ~IDE_DFLAG_WP;
366 366
367 set_disk_ro(disk, !!(drive->dev_flags & IDE_DFLAG_WP)); 367 set_disk_ro(disk, !!(drive->dev_flags & IDE_DFLAG_WP));
368 368
369 page = &pc.buf[8]; 369 page = &pc->buf[8];
370 370
371 transfer_rate = be16_to_cpup((__be16 *)&pc.buf[8 + 2]); 371 transfer_rate = be16_to_cpup((__be16 *)&pc->buf[8 + 2]);
372 sector_size = be16_to_cpup((__be16 *)&pc.buf[8 + 6]); 372 sector_size = be16_to_cpup((__be16 *)&pc->buf[8 + 6]);
373 cyls = be16_to_cpup((__be16 *)&pc.buf[8 + 8]); 373 cyls = be16_to_cpup((__be16 *)&pc->buf[8 + 8]);
374 rpm = be16_to_cpup((__be16 *)&pc.buf[8 + 28]); 374 rpm = be16_to_cpup((__be16 *)&pc->buf[8 + 28]);
375 heads = pc.buf[8 + 4]; 375 heads = pc->buf[8 + 4];
376 sectors = pc.buf[8 + 5]; 376 sectors = pc->buf[8 + 5];
377 377
378 capacity = cyls * heads * sectors * sector_size; 378 capacity = cyls * heads * sectors * sector_size;
379 379
@@ -499,7 +499,7 @@ static int ide_floppy_get_capacity(ide_drive_t *drive)
499 499
500 /* Clik! disk does not support get_flexible_disk_page */ 500 /* Clik! disk does not support get_flexible_disk_page */
501 if (!(drive->atapi_flags & IDE_AFLAG_CLIK_DRIVE)) 501 if (!(drive->atapi_flags & IDE_AFLAG_CLIK_DRIVE))
502 (void) ide_floppy_get_flexible_disk_page(drive); 502 (void) ide_floppy_get_flexible_disk_page(drive, &pc);
503 503
504 return rc; 504 return rc;
505} 505}