diff options
author | Joe Perches <joe@perches.com> | 2010-03-10 18:21:00 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-12 18:52:30 -0500 |
commit | 57584c5a3824a15f65d2b065d9f453fc1ae1dab7 (patch) | |
tree | e874998d0550a50d73dc191513aeaaf1c12487c6 /drivers/block | |
parent | 29f1c7848feb3954939b52fd5b7dca30dbce9426 (diff) |
drivers/block/floppy.c: add function is_ready_state
Used a couple of times, might simplify the code a bit.
Signed-off-by: Joe Perches <joe@perches.com>
Cc: Stephen Hemminger <shemminger@vyatta.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/floppy.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index e080e1930cc1..1264102cdcb1 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -782,6 +782,12 @@ static inline int is_selected(int dor, int unit) | |||
782 | return ((dor & (0x10 << unit)) && (dor & 3) == unit); | 782 | return ((dor & (0x10 << unit)) && (dor & 3) == unit); |
783 | } | 783 | } |
784 | 784 | ||
785 | static bool is_ready_state(int status) | ||
786 | { | ||
787 | int state = status & (STATUS_READY | STATUS_DIR | STATUS_DMA); | ||
788 | return state == STATUS_READY; | ||
789 | } | ||
790 | |||
785 | static int set_dor(int fdc, char mask, char data) | 791 | static int set_dor(int fdc, char mask, char data) |
786 | { | 792 | { |
787 | unsigned char unit; | 793 | unsigned char unit; |
@@ -823,8 +829,10 @@ static void twaddle(void) | |||
823 | DRS->select_date = jiffies; | 829 | DRS->select_date = jiffies; |
824 | } | 830 | } |
825 | 831 | ||
826 | /* reset all driver information about the current fdc. This is needed after | 832 | /* |
827 | * a reset, and after a raw command. */ | 833 | * Reset all driver information about the current fdc. |
834 | * This is needed after a reset, and after a raw command. | ||
835 | */ | ||
828 | static void reset_fdc_info(int mode) | 836 | static void reset_fdc_info(int mode) |
829 | { | 837 | { |
830 | int drive; | 838 | int drive; |
@@ -1162,7 +1170,8 @@ static int output_byte(char byte) | |||
1162 | 1170 | ||
1163 | if (status < 0) | 1171 | if (status < 0) |
1164 | return -1; | 1172 | return -1; |
1165 | if ((status & (STATUS_READY | STATUS_DIR | STATUS_DMA)) == STATUS_READY) { | 1173 | |
1174 | if (is_ready_state(status)) { | ||
1166 | fd_outb(byte, FD_DATA); | 1175 | fd_outb(byte, FD_DATA); |
1167 | #ifdef FLOPPY_SANITY_CHECK | 1176 | #ifdef FLOPPY_SANITY_CHECK |
1168 | output_log[output_log_pos].data = byte; | 1177 | output_log[output_log_pos].data = byte; |
@@ -1221,8 +1230,10 @@ static int need_more_output(void) | |||
1221 | 1230 | ||
1222 | if (status < 0) | 1231 | if (status < 0) |
1223 | return -1; | 1232 | return -1; |
1224 | if ((status & (STATUS_READY | STATUS_DIR | STATUS_DMA)) == STATUS_READY) | 1233 | |
1234 | if (is_ready_state(status)) | ||
1225 | return MORE_OUTPUT; | 1235 | return MORE_OUTPUT; |
1236 | |||
1226 | return result(); | 1237 | return result(); |
1227 | } | 1238 | } |
1228 | 1239 | ||