diff options
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/ide-floppy.c | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 98df4023ecdf..e9d11faec9bd 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -291,24 +291,6 @@ struct idefloppy_id_gcw { | |||
291 | #define IDEFLOPPY_CAPABILITIES_PAGE 0x1b | 291 | #define IDEFLOPPY_CAPABILITIES_PAGE 0x1b |
292 | #define IDEFLOPPY_FLEXIBLE_DISK_PAGE 0x05 | 292 | #define IDEFLOPPY_FLEXIBLE_DISK_PAGE 0x05 |
293 | 293 | ||
294 | /* | ||
295 | * Mode Parameter Header for the MODE SENSE packet command | ||
296 | */ | ||
297 | typedef struct { | ||
298 | u16 mode_data_length; /* Length of the following data transfer */ | ||
299 | u8 medium_type; /* Medium Type */ | ||
300 | #if defined(__LITTLE_ENDIAN_BITFIELD) | ||
301 | unsigned reserved3 :7; | ||
302 | unsigned wp :1; /* Write protect */ | ||
303 | #elif defined(__BIG_ENDIAN_BITFIELD) | ||
304 | unsigned wp :1; /* Write protect */ | ||
305 | unsigned reserved3 :7; | ||
306 | #else | ||
307 | #error "Bitfield endianness not defined! Check your byteorder.h" | ||
308 | #endif | ||
309 | u8 reserved[4]; | ||
310 | } idefloppy_mode_parameter_header_t; | ||
311 | |||
312 | static DEFINE_MUTEX(idefloppy_ref_mutex); | 294 | static DEFINE_MUTEX(idefloppy_ref_mutex); |
313 | 295 | ||
314 | #define to_ide_floppy(obj) container_of(obj, struct ide_floppy_obj, kref) | 296 | #define to_ide_floppy(obj) container_of(obj, struct ide_floppy_obj, kref) |
@@ -954,7 +936,7 @@ static void idefloppy_create_format_unit_cmd (idefloppy_pc_t *pc, int b, int l, | |||
954 | */ | 936 | */ |
955 | static void idefloppy_create_mode_sense_cmd (idefloppy_pc_t *pc, u8 page_code, u8 type) | 937 | static void idefloppy_create_mode_sense_cmd (idefloppy_pc_t *pc, u8 page_code, u8 type) |
956 | { | 938 | { |
957 | u16 length = sizeof(idefloppy_mode_parameter_header_t); | 939 | u16 length = 8; /* sizeof(Mode Parameter Header) = 8 Bytes */ |
958 | 940 | ||
959 | idefloppy_init_pc(pc); | 941 | idefloppy_init_pc(pc); |
960 | pc->c[0] = GPCMD_MODE_SENSE_10; | 942 | pc->c[0] = GPCMD_MODE_SENSE_10; |
@@ -1120,7 +1102,6 @@ static int idefloppy_get_flexible_disk_page (ide_drive_t *drive) | |||
1120 | { | 1102 | { |
1121 | idefloppy_floppy_t *floppy = drive->driver_data; | 1103 | idefloppy_floppy_t *floppy = drive->driver_data; |
1122 | idefloppy_pc_t pc; | 1104 | idefloppy_pc_t pc; |
1123 | idefloppy_mode_parameter_header_t *header; | ||
1124 | idefloppy_flexible_disk_page_t *page; | 1105 | idefloppy_flexible_disk_page_t *page; |
1125 | int capacity, lba_capacity; | 1106 | int capacity, lba_capacity; |
1126 | 1107 | ||
@@ -1130,10 +1111,9 @@ static int idefloppy_get_flexible_disk_page (ide_drive_t *drive) | |||
1130 | "page parameters\n"); | 1111 | "page parameters\n"); |
1131 | return 1; | 1112 | return 1; |
1132 | } | 1113 | } |
1133 | header = (idefloppy_mode_parameter_header_t *) pc.buffer; | 1114 | floppy->wp = !!(pc.buffer[3] & 0x80); |
1134 | floppy->wp = header->wp; | ||
1135 | set_disk_ro(floppy->disk, floppy->wp); | 1115 | set_disk_ro(floppy->disk, floppy->wp); |
1136 | page = (idefloppy_flexible_disk_page_t *) (header + 1); | 1116 | page = (idefloppy_flexible_disk_page_t *) &pc.buffer[8]; |
1137 | 1117 | ||
1138 | page->transfer_rate = be16_to_cpu(page->transfer_rate); | 1118 | page->transfer_rate = be16_to_cpu(page->transfer_rate); |
1139 | page->sector_size = be16_to_cpu(page->sector_size); | 1119 | page->sector_size = be16_to_cpu(page->sector_size); |