ide-floppy: ->{srfp,wp} -> IDE_AFLAG_{SRFP,WP}
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 10 Oct 2008 20:39:38 +0000 (22:39 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Fri, 10 Oct 2008 20:39:38 +0000 (22:39 +0200)
Add IDE_AFLAG_{SRFP,WP} drive->atapi_flags and use them
instead of ->{srfp,wp} struct ide_floppy_obj fields.

There should be no functional changes caused by this patch.

Acked-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/ide-floppy.c
include/linux/ide.h

index de611c57b2805dc5f91577c5cbf7b058273e9ff0..78d92835a3c1e9ec461bd29243f9e57e57953010 100644 (file)
@@ -110,10 +110,6 @@ typedef struct ide_floppy_obj {
        u8 cap_desc[8];
        /* Copy of the flexible disk page */
        u8 flexible_disk_page[32];
-       /* Write protect */
-       int wp;
-       /* Supports format progress report */
-       int srfp;
 } idefloppy_floppy_t;
 
 #define IDEFLOPPY_TICKS_DELAY  HZ/20   /* default delay for ZIP 100 (50ms) */
@@ -574,8 +570,14 @@ static int ide_floppy_get_flexible_disk_page(ide_drive_t *drive)
                                " parameters\n");
                return 1;
        }
-       floppy->wp = !!(pc.buf[3] & 0x80);
-       set_disk_ro(disk, floppy->wp);
+
+       if (pc.buf[3] & 0x80)
+               drive->atapi_flags |= IDE_AFLAG_WP;
+       else
+               drive->atapi_flags &= ~IDE_AFLAG_WP;
+
+       set_disk_ro(disk, !!(drive->atapi_flags & IDE_AFLAG_WP));
+
        page = &pc.buf[8];
 
        transfer_rate = be16_to_cpup((__be16 *)&pc.buf[8 + 2]);
@@ -614,7 +616,7 @@ static int idefloppy_get_sfrp_bit(ide_drive_t *drive)
        idefloppy_floppy_t *floppy = drive->driver_data;
        struct ide_atapi_pc pc;
 
-       floppy->srfp = 0;
+       drive->atapi_flags &= ~IDE_AFLAG_SRFP;
 
        idefloppy_create_mode_sense_cmd(&pc, IDEFLOPPY_CAPABILITIES_PAGE);
        pc.flags |= PC_FLAG_SUPPRESS_ERROR;
@@ -622,7 +624,9 @@ static int idefloppy_get_sfrp_bit(ide_drive_t *drive)
        if (ide_queue_pc_tail(drive, floppy->disk, &pc))
                return 1;
 
-       floppy->srfp = pc.buf[8 + 2] & 0x40;
+       if (pc.buf[8 + 2] & 0x40)
+               drive->atapi_flags |= IDE_AFLAG_SRFP;
+
        return 0;
 }
 
@@ -820,7 +824,7 @@ static int ide_floppy_get_format_progress(ide_drive_t *drive, int __user *arg)
        struct ide_atapi_pc pc;
        int progress_indication = 0x10000;
 
-       if (floppy->srfp) {
+       if (drive->atapi_flags & IDE_AFLAG_SRFP) {
                idefloppy_create_request_sense_cmd(&pc);
                if (ide_queue_pc_tail(drive, floppy->disk, &pc))
                        return -EIO;
@@ -1044,7 +1048,7 @@ static int idefloppy_open(struct inode *inode, struct file *filp)
                        goto out_put_floppy;
                }
 
-               if (floppy->wp && (filp->f_mode & 2)) {
+               if ((drive->atapi_flags & IDE_AFLAG_WP) && (filp->f_mode & 2)) {
                        ret = -EROFS;
                        goto out_put_floppy;
                }
index b5be2368c96e2564245f5f127a2f8153691178bb..cc41a885688ab14cf01090860beca4e81cebe743 100644 (file)
@@ -356,21 +356,25 @@ enum {
        IDE_AFLAG_CLIK_DRIVE            = (1 << 19),
        /* Requires BH algorithm for packets */
        IDE_AFLAG_ZIP_DRIVE             = (1 << 20),
+       /* Write protect */
+       IDE_AFLAG_WP                    = (1 << 21),
+       /* Supports format progress report */
+       IDE_AFLAG_SRFP                  = (1 << 22),
 
        /* ide-tape */
-       IDE_AFLAG_IGNORE_DSC            = (1 << 21),
+       IDE_AFLAG_IGNORE_DSC            = (1 << 23),
        /* 0 When the tape position is unknown */
-       IDE_AFLAG_ADDRESS_VALID         = (1 << 22),
+       IDE_AFLAG_ADDRESS_VALID         = (1 << 24),
        /* Device already opened */
-       IDE_AFLAG_BUSY                  = (1 << 23),
+       IDE_AFLAG_BUSY                  = (1 << 25),
        /* Attempt to auto-detect the current user block size */
-       IDE_AFLAG_DETECT_BS             = (1 << 24),
+       IDE_AFLAG_DETECT_BS             = (1 << 26),
        /* Currently on a filemark */
-       IDE_AFLAG_FILEMARK              = (1 << 25),
+       IDE_AFLAG_FILEMARK              = (1 << 27),
        /* 0 = no tape is loaded, so we don't rewind after ejecting */
-       IDE_AFLAG_MEDIUM_PRESENT        = (1 << 26),
+       IDE_AFLAG_MEDIUM_PRESENT        = (1 << 28),
 
-       IDE_AFLAG_NO_AUTOCLOSE          = (1 << 27),
+       IDE_AFLAG_NO_AUTOCLOSE          = (1 << 29),
 };
 
 struct ide_drive_s {