diff options
| author | Jesper Juhl <jesper.juhl@gmail.com> | 2007-10-17 02:30:57 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-17 11:43:03 -0400 |
| commit | 06f748c4754de4fe2fc8d517acf29cb46a0b2d60 (patch) | |
| tree | bac644ae5bb370066de964cba5043d855be9a822 /drivers | |
| parent | d2da272a4e581e831e3567a37ef167686f1ea1d3 (diff) | |
floppy: do a very minimal style cleanup of the floppy driver
Yes, some of this will likely be replaced in later patches, but I do not see
anyone else coming out of the woodwork with any patches for this driver, so
I'll ignore comments about churn. I want to get this driver cleaned up, and
if I'm going to do so I want to start with this basic style cleanup to reduce
the reading pain a bit.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/block/floppy.c | 123 |
1 files changed, 73 insertions, 50 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 72803a3585..c6416f8411 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | * Copyright (C) 1993, 1994 Alain Knaff | 5 | * Copyright (C) 1993, 1994 Alain Knaff |
| 6 | * Copyright (C) 1998 Alan Cox | 6 | * Copyright (C) 1998 Alan Cox |
| 7 | */ | 7 | */ |
| 8 | |||
| 8 | /* | 9 | /* |
| 9 | * 02.12.91 - Changed to static variables to indicate need for reset | 10 | * 02.12.91 - Changed to static variables to indicate need for reset |
| 10 | * and recalibrate. This makes some things easier (output_byte reset | 11 | * and recalibrate. This makes some things easier (output_byte reset |
| @@ -149,7 +150,7 @@ | |||
| 149 | #define REALLY_SLOW_IO | 150 | #define REALLY_SLOW_IO |
| 150 | 151 | ||
| 151 | #define DEBUGT 2 | 152 | #define DEBUGT 2 |
| 152 | #define DCL_DEBUG /* debug disk change line */ | 153 | #define DCL_DEBUG /* debug disk change line */ |
| 153 | 154 | ||
| 154 | /* do print messages for unexpected interrupts */ | 155 | /* do print messages for unexpected interrupts */ |
| 155 | static int print_unex = 1; | 156 | static int print_unex = 1; |
| @@ -161,10 +162,8 @@ static int print_unex = 1; | |||
| 161 | #include <linux/workqueue.h> | 162 | #include <linux/workqueue.h> |
| 162 | #define FDPATCHES | 163 | #define FDPATCHES |
| 163 | #include <linux/fdreg.h> | 164 | #include <linux/fdreg.h> |
| 164 | |||
| 165 | #include <linux/fd.h> | 165 | #include <linux/fd.h> |
| 166 | #include <linux/hdreg.h> | 166 | #include <linux/hdreg.h> |
| 167 | |||
| 168 | #include <linux/errno.h> | 167 | #include <linux/errno.h> |
| 169 | #include <linux/slab.h> | 168 | #include <linux/slab.h> |
| 170 | #include <linux/mm.h> | 169 | #include <linux/mm.h> |
| @@ -274,8 +273,7 @@ static inline void fallback_on_nodma_alloc(char **addr, size_t l) | |||
| 274 | return; /* we have the memory */ | 273 | return; /* we have the memory */ |
| 275 | if (can_use_virtual_dma != 2) | 274 | if (can_use_virtual_dma != 2) |
| 276 | return; /* no fallback allowed */ | 275 | return; /* no fallback allowed */ |
| 277 | printk | 276 | printk("DMA memory shortage. Temporarily falling back on virtual DMA\n"); |
| 278 | ("DMA memory shortage. Temporarily falling back on virtual DMA\n"); | ||
| 279 | *addr = (char *)nodma_mem_alloc(l); | 277 | *addr = (char *)nodma_mem_alloc(l); |
| 280 | #else | 278 | #else |
| 281 | return; | 279 | return; |
| @@ -291,8 +289,8 @@ static int initialising = 1; | |||
| 291 | #define TOMINOR(x) ((x & 3) | ((x & 4) << 5)) | 289 | #define TOMINOR(x) ((x & 3) | ((x & 4) << 5)) |
| 292 | #define UNIT(x) ((x) & 0x03) /* drive on fdc */ | 290 | #define UNIT(x) ((x) & 0x03) /* drive on fdc */ |
| 293 | #define FDC(x) (((x) & 0x04) >> 2) /* fdc of drive */ | 291 | #define FDC(x) (((x) & 0x04) >> 2) /* fdc of drive */ |
| 292 | /* reverse mapping from unit and fdc to drive */ | ||
| 294 | #define REVDRIVE(fdc, unit) ((unit) + ((fdc) << 2)) | 293 | #define REVDRIVE(fdc, unit) ((unit) + ((fdc) << 2)) |
| 295 | /* reverse mapping from unit and fdc to drive */ | ||
| 296 | #define DP (&drive_params[current_drive]) | 294 | #define DP (&drive_params[current_drive]) |
| 297 | #define DRS (&drive_state[current_drive]) | 295 | #define DRS (&drive_state[current_drive]) |
| 298 | #define DRWE (&write_errors[current_drive]) | 296 | #define DRWE (&write_errors[current_drive]) |
| @@ -356,7 +354,6 @@ static int inr; /* size of reply buffer, when called from interrupt */ | |||
| 356 | #define R_HEAD (reply_buffer[4]) | 354 | #define R_HEAD (reply_buffer[4]) |
| 357 | #define R_SECTOR (reply_buffer[5]) | 355 | #define R_SECTOR (reply_buffer[5]) |
| 358 | #define R_SIZECODE (reply_buffer[6]) | 356 | #define R_SIZECODE (reply_buffer[6]) |
| 359 | |||
| 360 | #define SEL_DLY (2*HZ/100) | 357 | #define SEL_DLY (2*HZ/100) |
| 361 | 358 | ||
| 362 | /* | 359 | /* |
| @@ -472,8 +469,8 @@ static struct floppy_struct floppy_type[32] = { | |||
| 472 | { 6400,40,2,80,0,0x25,0x5B,0xCF,0x00,"E3200" }, /* 26 3.20MB 3.5" */ | 469 | { 6400,40,2,80,0,0x25,0x5B,0xCF,0x00,"E3200" }, /* 26 3.20MB 3.5" */ |
| 473 | { 7040,44,2,80,0,0x25,0x5B,0xCF,0x00,"E3520" }, /* 27 3.52MB 3.5" */ | 470 | { 7040,44,2,80,0,0x25,0x5B,0xCF,0x00,"E3520" }, /* 27 3.52MB 3.5" */ |
| 474 | { 7680,48,2,80,0,0x25,0x63,0xCF,0x00,"E3840" }, /* 28 3.84MB 3.5" */ | 471 | { 7680,48,2,80,0,0x25,0x63,0xCF,0x00,"E3840" }, /* 28 3.84MB 3.5" */ |
| 475 | |||
| 476 | { 3680,23,2,80,0,0x1C,0x10,0xCF,0x00,"H1840" }, /* 29 1.84MB 3.5" */ | 472 | { 3680,23,2,80,0,0x1C,0x10,0xCF,0x00,"H1840" }, /* 29 1.84MB 3.5" */ |
| 473 | |||
| 477 | { 1600,10,2,80,0,0x25,0x02,0xDF,0x2E,"D800" }, /* 30 800KB 3.5" */ | 474 | { 1600,10,2,80,0,0x25,0x02,0xDF,0x2E,"D800" }, /* 30 800KB 3.5" */ |
| 478 | { 3200,20,2,80,0,0x1C,0x00,0xCF,0x2C,"H1600" }, /* 31 1.6MB 3.5" */ | 475 | { 3200,20,2,80,0,0x1C,0x00,0xCF,0x2C,"H1600" }, /* 31 1.6MB 3.5" */ |
| 479 | }; | 476 | }; |
| @@ -539,12 +536,12 @@ static char *floppy_track_buffer; | |||
| 539 | static int max_buffer_sectors; | 536 | static int max_buffer_sectors; |
| 540 | 537 | ||
| 541 | static int *errors; | 538 | static int *errors; |
| 542 | typedef void (*done_f) (int); | 539 | typedef void (*done_f)(int); |
| 543 | static struct cont_t { | 540 | static struct cont_t { |
| 544 | void (*interrupt) (void); /* this is called after the interrupt of the | 541 | void (*interrupt)(void); /* this is called after the interrupt of the |
| 545 | * main command */ | 542 | * main command */ |
| 546 | void (*redo) (void); /* this is called to retry the operation */ | 543 | void (*redo)(void); /* this is called to retry the operation */ |
| 547 | void (*error) (void); /* this is called to tally an error */ | 544 | void (*error)(void); /* this is called to tally an error */ |
| 548 | done_f done; /* this is called to say if the operation has | 545 | done_f done; /* this is called to say if the operation has |
| 549 | * succeeded/failed */ | 546 | * succeeded/failed */ |
| 550 | } *cont; | 547 | } *cont; |
| @@ -694,7 +691,6 @@ static void reschedule_timeout(int drive, const char *message, int marg) | |||
| 694 | } | 691 | } |
| 695 | 692 | ||
| 696 | #define INFBOUND(a,b) (a)=max_t(int, a, b) | 693 | #define INFBOUND(a,b) (a)=max_t(int, a, b) |
| 697 | |||
| 698 | #define SUPBOUND(a,b) (a)=min_t(int, a, b) | 694 | #define SUPBOUND(a,b) (a)=min_t(int, a, b) |
| 699 | 695 | ||
| 700 | /* | 696 | /* |
| @@ -733,6 +729,7 @@ static void reschedule_timeout(int drive, const char *message, int marg) | |||
| 733 | static int disk_change(int drive) | 729 | static int disk_change(int drive) |
| 734 | { | 730 | { |
| 735 | int fdc = FDC(drive); | 731 | int fdc = FDC(drive); |
| 732 | |||
| 736 | #ifdef FLOPPY_SANITY_CHECK | 733 | #ifdef FLOPPY_SANITY_CHECK |
| 737 | if (time_before(jiffies, UDRS->select_date + UDP->select_delay)) | 734 | if (time_before(jiffies, UDRS->select_date + UDP->select_delay)) |
| 738 | DPRINT("WARNING disk change called early\n"); | 735 | DPRINT("WARNING disk change called early\n"); |
| @@ -892,7 +889,6 @@ static int _lock_fdc(int drive, int interruptible, int line) | |||
| 892 | 889 | ||
| 893 | set_current_state(TASK_RUNNING); | 890 | set_current_state(TASK_RUNNING); |
| 894 | remove_wait_queue(&fdc_wait, &wait); | 891 | remove_wait_queue(&fdc_wait, &wait); |
| 895 | |||
| 896 | flush_scheduled_work(); | 892 | flush_scheduled_work(); |
| 897 | } | 893 | } |
| 898 | command_status = FD_COMMAND_NONE; | 894 | command_status = FD_COMMAND_NONE; |
| @@ -968,7 +964,9 @@ static void floppy_off(unsigned int drive) | |||
| 968 | */ | 964 | */ |
| 969 | static void scandrives(void) | 965 | static void scandrives(void) |
| 970 | { | 966 | { |
| 971 | int i, drive, saved_drive; | 967 | int i; |
| 968 | int drive; | ||
| 969 | int saved_drive; | ||
| 972 | 970 | ||
| 973 | if (DP->select_delay) | 971 | if (DP->select_delay) |
| 974 | return; | 972 | return; |
| @@ -1146,7 +1144,9 @@ static void show_floppy(void); | |||
| 1146 | /* waits until the fdc becomes ready */ | 1144 | /* waits until the fdc becomes ready */ |
| 1147 | static int wait_til_ready(void) | 1145 | static int wait_til_ready(void) |
| 1148 | { | 1146 | { |
| 1149 | int counter, status; | 1147 | int status; |
| 1148 | int counter; | ||
| 1149 | |||
| 1150 | if (FDCS->reset) | 1150 | if (FDCS->reset) |
| 1151 | return -1; | 1151 | return -1; |
| 1152 | for (counter = 0; counter < 10000; counter++) { | 1152 | for (counter = 0; counter < 10000; counter++) { |
| @@ -1193,7 +1193,8 @@ static int output_byte(char byte) | |||
| 1193 | /* gets the response from the fdc */ | 1193 | /* gets the response from the fdc */ |
| 1194 | static int result(void) | 1194 | static int result(void) |
| 1195 | { | 1195 | { |
| 1196 | int i, status = 0; | 1196 | int i; |
| 1197 | int status = 0; | ||
| 1197 | 1198 | ||
| 1198 | for (i = 0; i < MAX_REPLIES; i++) { | 1199 | for (i = 0; i < MAX_REPLIES; i++) { |
| 1199 | if ((status = wait_til_ready()) < 0) | 1200 | if ((status = wait_til_ready()) < 0) |
| @@ -1226,6 +1227,7 @@ static int result(void) | |||
| 1226 | static int need_more_output(void) | 1227 | static int need_more_output(void) |
| 1227 | { | 1228 | { |
| 1228 | int status; | 1229 | int status; |
| 1230 | |||
| 1229 | if ((status = wait_til_ready()) < 0) | 1231 | if ((status = wait_til_ready()) < 0) |
| 1230 | return -1; | 1232 | return -1; |
| 1231 | if ((status & (STATUS_READY | STATUS_DIR | STATUS_DMA)) == STATUS_READY) | 1233 | if ((status & (STATUS_READY | STATUS_DIR | STATUS_DMA)) == STATUS_READY) |
| @@ -1309,8 +1311,11 @@ static int fdc_configure(void) | |||
| 1309 | */ | 1311 | */ |
| 1310 | static void fdc_specify(void) | 1312 | static void fdc_specify(void) |
| 1311 | { | 1313 | { |
| 1312 | unsigned char spec1, spec2; | 1314 | unsigned char spec1; |
| 1313 | unsigned long srt, hlt, hut; | 1315 | unsigned char spec2; |
| 1316 | unsigned long srt; | ||
| 1317 | unsigned long hlt; | ||
| 1318 | unsigned long hut; | ||
| 1314 | unsigned long dtr = NOMINAL_DTR; | 1319 | unsigned long dtr = NOMINAL_DTR; |
| 1315 | unsigned long scale_dtr = NOMINAL_DTR; | 1320 | unsigned long scale_dtr = NOMINAL_DTR; |
| 1316 | int hlt_max_code = 0x7f; | 1321 | int hlt_max_code = 0x7f; |
| @@ -1472,7 +1477,6 @@ static int interpret_errors(void) | |||
| 1472 | tell_sector(); | 1477 | tell_sector(); |
| 1473 | } | 1478 | } |
| 1474 | printk("\n"); | 1479 | printk("\n"); |
| 1475 | |||
| 1476 | } | 1480 | } |
| 1477 | if (ST2 & ST2_WC || ST2 & ST2_BC) | 1481 | if (ST2 & ST2_WC || ST2 & ST2_BC) |
| 1478 | /* wrong cylinder => recal */ | 1482 | /* wrong cylinder => recal */ |
| @@ -1498,7 +1502,10 @@ static int interpret_errors(void) | |||
| 1498 | */ | 1502 | */ |
| 1499 | static void setup_rw_floppy(void) | 1503 | static void setup_rw_floppy(void) |
| 1500 | { | 1504 | { |
| 1501 | int i, r, flags, dflags; | 1505 | int i; |
| 1506 | int r; | ||
| 1507 | int flags; | ||
| 1508 | int dflags; | ||
| 1502 | unsigned long ready_date; | 1509 | unsigned long ready_date; |
| 1503 | timeout_fn function; | 1510 | timeout_fn function; |
| 1504 | 1511 | ||
| @@ -1728,9 +1735,9 @@ static void print_result(char *message, int inr) | |||
| 1728 | /* interrupt handler. Note that this can be called externally on the Sparc */ | 1735 | /* interrupt handler. Note that this can be called externally on the Sparc */ |
| 1729 | irqreturn_t floppy_interrupt(int irq, void *dev_id) | 1736 | irqreturn_t floppy_interrupt(int irq, void *dev_id) |
| 1730 | { | 1737 | { |
| 1731 | void (*handler) (void) = do_floppy; | ||
| 1732 | int do_print; | 1738 | int do_print; |
| 1733 | unsigned long f; | 1739 | unsigned long f; |
| 1740 | void (*handler)(void) = do_floppy; | ||
| 1734 | 1741 | ||
| 1735 | lasthandler = handler; | 1742 | lasthandler = handler; |
| 1736 | interruptjiffies = jiffies; | 1743 | interruptjiffies = jiffies; |
| @@ -1915,9 +1922,10 @@ static void floppy_shutdown(unsigned long data) | |||
| 1915 | /*typedef void (*timeout_fn)(unsigned long);*/ | 1922 | /*typedef void (*timeout_fn)(unsigned long);*/ |
| 1916 | 1923 | ||
| 1917 | /* start motor, check media-changed condition and write protection */ | 1924 | /* start motor, check media-changed condition and write protection */ |
| 1918 | static int start_motor(void (*function) (void)) | 1925 | static int start_motor(void (*function)(void)) |
| 1919 | { | 1926 | { |
| 1920 | int mask, data; | 1927 | int mask; |
| 1928 | int data; | ||
| 1921 | 1929 | ||
| 1922 | mask = 0xfc; | 1930 | mask = 0xfc; |
| 1923 | data = UNIT(current_drive); | 1931 | data = UNIT(current_drive); |
| @@ -2020,17 +2028,17 @@ static struct cont_t wakeup_cont = { | |||
| 2020 | .interrupt = empty, | 2028 | .interrupt = empty, |
| 2021 | .redo = do_wakeup, | 2029 | .redo = do_wakeup, |
| 2022 | .error = empty, | 2030 | .error = empty, |
| 2023 | .done = (done_f) empty | 2031 | .done = (done_f)empty |
| 2024 | }; | 2032 | }; |
| 2025 | 2033 | ||
| 2026 | static struct cont_t intr_cont = { | 2034 | static struct cont_t intr_cont = { |
| 2027 | .interrupt = empty, | 2035 | .interrupt = empty, |
| 2028 | .redo = process_fd_request, | 2036 | .redo = process_fd_request, |
| 2029 | .error = empty, | 2037 | .error = empty, |
| 2030 | .done = (done_f) empty | 2038 | .done = (done_f)empty |
| 2031 | }; | 2039 | }; |
| 2032 | 2040 | ||
| 2033 | static int wait_til_done(void (*handler) (void), int interruptible) | 2041 | static int wait_til_done(void (*handler)(void), int interruptible) |
| 2034 | { | 2042 | { |
| 2035 | int ret; | 2043 | int ret; |
| 2036 | 2044 | ||
| @@ -2049,7 +2057,6 @@ static int wait_til_done(void (*handler) (void), int interruptible) | |||
| 2049 | break; | 2057 | break; |
| 2050 | 2058 | ||
| 2051 | is_alive("wait_til_done"); | 2059 | is_alive("wait_til_done"); |
| 2052 | |||
| 2053 | schedule(); | 2060 | schedule(); |
| 2054 | } | 2061 | } |
| 2055 | 2062 | ||
| @@ -2141,6 +2148,7 @@ static void bad_flp_intr(void) | |||
| 2141 | static void set_floppy(int drive) | 2148 | static void set_floppy(int drive) |
| 2142 | { | 2149 | { |
| 2143 | int type = ITYPE(UDRS->fd_device); | 2150 | int type = ITYPE(UDRS->fd_device); |
| 2151 | |||
| 2144 | if (type) | 2152 | if (type) |
| 2145 | _floppy = floppy_type + type; | 2153 | _floppy = floppy_type + type; |
| 2146 | else | 2154 | else |
| @@ -2169,11 +2177,14 @@ static void format_interrupt(void) | |||
| 2169 | #define CT(x) ((x) | 0xc0) | 2177 | #define CT(x) ((x) | 0xc0) |
| 2170 | static void setup_format_params(int track) | 2178 | static void setup_format_params(int track) |
| 2171 | { | 2179 | { |
| 2180 | int n; | ||
| 2181 | int il; | ||
| 2182 | int count; | ||
| 2183 | int head_shift; | ||
| 2184 | int track_shift; | ||
| 2172 | struct fparm { | 2185 | struct fparm { |
| 2173 | unsigned char track, head, sect, size; | 2186 | unsigned char track, head, sect, size; |
| 2174 | } *here = (struct fparm *)floppy_track_buffer; | 2187 | } *here = (struct fparm *)floppy_track_buffer; |
| 2175 | int il, n; | ||
| 2176 | int count, head_shift, track_shift; | ||
| 2177 | 2188 | ||
| 2178 | raw_cmd = &default_raw_cmd; | 2189 | raw_cmd = &default_raw_cmd; |
| 2179 | raw_cmd->track = track; | 2190 | raw_cmd->track = track; |
| @@ -2344,7 +2355,10 @@ static void request_done(int uptodate) | |||
| 2344 | /* Interrupt handler evaluating the result of the r/w operation */ | 2355 | /* Interrupt handler evaluating the result of the r/w operation */ |
| 2345 | static void rw_interrupt(void) | 2356 | static void rw_interrupt(void) |
| 2346 | { | 2357 | { |
| 2347 | int nr_sectors, ssize, eoc, heads; | 2358 | int eoc; |
| 2359 | int ssize; | ||
| 2360 | int heads; | ||
| 2361 | int nr_sectors; | ||
| 2348 | 2362 | ||
| 2349 | if (R_HEAD >= 2) { | 2363 | if (R_HEAD >= 2) { |
| 2350 | /* some Toshiba floppy controllers occasionnally seem to | 2364 | /* some Toshiba floppy controllers occasionnally seem to |
| @@ -2476,7 +2490,8 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2) | |||
| 2476 | { | 2490 | { |
| 2477 | int remaining; /* number of transferred 512-byte sectors */ | 2491 | int remaining; /* number of transferred 512-byte sectors */ |
| 2478 | struct bio_vec *bv; | 2492 | struct bio_vec *bv; |
| 2479 | char *buffer, *dma_buffer; | 2493 | char *buffer; |
| 2494 | char *dma_buffer; | ||
| 2480 | int size; | 2495 | int size; |
| 2481 | struct req_iterator iter; | 2496 | struct req_iterator iter; |
| 2482 | 2497 | ||
| @@ -2578,7 +2593,8 @@ static inline int check_dma_crossing(char *start, | |||
| 2578 | */ | 2593 | */ |
| 2579 | static void virtualdmabug_workaround(void) | 2594 | static void virtualdmabug_workaround(void) |
| 2580 | { | 2595 | { |
| 2581 | int hard_sectors, end_sector; | 2596 | int hard_sectors; |
| 2597 | int end_sector; | ||
| 2582 | 2598 | ||
| 2583 | if (CT(COMMAND) == FD_WRITE) { | 2599 | if (CT(COMMAND) == FD_WRITE) { |
| 2584 | COMMAND &= ~0x80; /* switch off multiple track mode */ | 2600 | COMMAND &= ~0x80; /* switch off multiple track mode */ |
| @@ -2610,7 +2626,10 @@ static void virtualdmabug_workaround(void) | |||
| 2610 | static int make_raw_rw_request(void) | 2626 | static int make_raw_rw_request(void) |
| 2611 | { | 2627 | { |
| 2612 | int aligned_sector_t; | 2628 | int aligned_sector_t; |
| 2613 | int max_sector, max_size, tracksize, ssize; | 2629 | int max_sector; |
| 2630 | int max_size; | ||
| 2631 | int tracksize; | ||
| 2632 | int ssize; | ||
| 2614 | 2633 | ||
| 2615 | if (max_buffer_sectors == 0) { | 2634 | if (max_buffer_sectors == 0) { |
| 2616 | printk("VFS: Block I/O scheduled on unopened device\n"); | 2635 | printk("VFS: Block I/O scheduled on unopened device\n"); |
| @@ -2777,8 +2796,8 @@ static int make_raw_rw_request(void) | |||
| 2777 | indirect, direct, fsector_t); | 2796 | indirect, direct, fsector_t); |
| 2778 | return 0; | 2797 | return 0; |
| 2779 | } | 2798 | } |
| 2780 | /* check_dma_crossing(raw_cmd->kernel_data, | 2799 | /* check_dma_crossing(raw_cmd->kernel_data, |
| 2781 | raw_cmd->length, | 2800 | raw_cmd->length, |
| 2782 | "end of make_raw_request [1]");*/ | 2801 | "end of make_raw_request [1]");*/ |
| 2783 | 2802 | ||
| 2784 | virtualdmabug_workaround(); | 2803 | virtualdmabug_workaround(); |
| @@ -3011,6 +3030,7 @@ static struct cont_t poll_cont = { | |||
| 3011 | static int poll_drive(int interruptible, int flag) | 3030 | static int poll_drive(int interruptible, int flag) |
| 3012 | { | 3031 | { |
| 3013 | int ret; | 3032 | int ret; |
| 3033 | |||
| 3014 | /* no auto-sense, just clear dcl */ | 3034 | /* no auto-sense, just clear dcl */ |
| 3015 | raw_cmd = &default_raw_cmd; | 3035 | raw_cmd = &default_raw_cmd; |
| 3016 | raw_cmd->flags = flag; | 3036 | raw_cmd->flags = flag; |
| @@ -3173,7 +3193,8 @@ static inline int raw_cmd_copyout(int cmd, char __user *param, | |||
| 3173 | 3193 | ||
| 3174 | static void raw_cmd_free(struct floppy_raw_cmd **ptr) | 3194 | static void raw_cmd_free(struct floppy_raw_cmd **ptr) |
| 3175 | { | 3195 | { |
| 3176 | struct floppy_raw_cmd *next, *this; | 3196 | struct floppy_raw_cmd *next; |
| 3197 | struct floppy_raw_cmd *this; | ||
| 3177 | 3198 | ||
| 3178 | this = *ptr; | 3199 | this = *ptr; |
| 3179 | *ptr = NULL; | 3200 | *ptr = NULL; |
| @@ -3245,8 +3266,10 @@ static inline int raw_cmd_copyin(int cmd, char __user *param, | |||
| 3245 | 3266 | ||
| 3246 | static int raw_cmd_ioctl(int cmd, void __user *param) | 3267 | static int raw_cmd_ioctl(int cmd, void __user *param) |
| 3247 | { | 3268 | { |
| 3248 | int drive, ret, ret2; | ||
| 3249 | struct floppy_raw_cmd *my_raw_cmd; | 3269 | struct floppy_raw_cmd *my_raw_cmd; |
| 3270 | int drive; | ||
| 3271 | int ret2; | ||
| 3272 | int ret; | ||
| 3250 | 3273 | ||
| 3251 | if (FDCS->rawcmd <= 1) | 3274 | if (FDCS->rawcmd <= 1) |
| 3252 | FDCS->rawcmd = 1; | 3275 | FDCS->rawcmd = 1; |
| @@ -3453,7 +3476,8 @@ static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, | |||
| 3453 | #define IN(c,x,tag) case c: *(x) = inparam. tag ; return 0 | 3476 | #define IN(c,x,tag) case c: *(x) = inparam. tag ; return 0 |
| 3454 | 3477 | ||
| 3455 | int drive = (long)inode->i_bdev->bd_disk->private_data; | 3478 | int drive = (long)inode->i_bdev->bd_disk->private_data; |
| 3456 | int i, type = ITYPE(UDRS->fd_device); | 3479 | int type = ITYPE(UDRS->fd_device); |
| 3480 | int i; | ||
| 3457 | int ret; | 3481 | int ret; |
| 3458 | int size; | 3482 | int size; |
| 3459 | union inparam { | 3483 | union inparam { |
| @@ -3619,8 +3643,7 @@ static void __init config_types(void) | |||
| 3619 | if (!UDP->cmos && FLOPPY1_TYPE) | 3643 | if (!UDP->cmos && FLOPPY1_TYPE) |
| 3620 | UDP->cmos = FLOPPY1_TYPE; | 3644 | UDP->cmos = FLOPPY1_TYPE; |
| 3621 | 3645 | ||
| 3622 | /* XXX */ | 3646 | /* FIXME: additional physical CMOS drive detection should go here */ |
| 3623 | /* additional physical CMOS drive detection should go here */ | ||
| 3624 | 3647 | ||
| 3625 | for (drive = 0; drive < N_DRIVE; drive++) { | 3648 | for (drive = 0; drive < N_DRIVE; drive++) { |
| 3626 | unsigned int type = UDP->cmos; | 3649 | unsigned int type = UDP->cmos; |
| @@ -3903,13 +3926,13 @@ static int floppy_revalidate(struct gendisk *disk) | |||
| 3903 | } | 3926 | } |
| 3904 | 3927 | ||
| 3905 | static struct block_device_operations floppy_fops = { | 3928 | static struct block_device_operations floppy_fops = { |
| 3906 | .owner = THIS_MODULE, | 3929 | .owner = THIS_MODULE, |
| 3907 | .open = floppy_open, | 3930 | .open = floppy_open, |
| 3908 | .release = floppy_release, | 3931 | .release = floppy_release, |
| 3909 | .ioctl = fd_ioctl, | 3932 | .ioctl = fd_ioctl, |
| 3910 | .getgeo = fd_getgeo, | 3933 | .getgeo = fd_getgeo, |
| 3911 | .media_changed = check_floppy_change, | 3934 | .media_changed = check_floppy_change, |
| 3912 | .revalidate_disk = floppy_revalidate, | 3935 | .revalidate_disk = floppy_revalidate, |
| 3913 | }; | 3936 | }; |
| 3914 | 3937 | ||
| 3915 | /* | 3938 | /* |
| @@ -4428,8 +4451,8 @@ static int floppy_grab_irq_and_dma(void) | |||
| 4428 | if (FDCS->address != -1) | 4451 | if (FDCS->address != -1) |
| 4429 | fd_outb(FDCS->dor, FD_DOR); | 4452 | fd_outb(FDCS->dor, FD_DOR); |
| 4430 | /* | 4453 | /* |
| 4431 | * The driver will try and free resources and relies on us | 4454 | * The driver will try and free resources and relies on us |
| 4432 | * to know if they were allocated or not. | 4455 | * to know if they were allocated or not. |
| 4433 | */ | 4456 | */ |
| 4434 | fdc = 0; | 4457 | fdc = 0; |
| 4435 | irqdma_allocated = 1; | 4458 | irqdma_allocated = 1; |
