diff options
author | Ondrej Zary <linux@rainbow-software.org> | 2015-02-06 17:11:38 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Odin.com> | 2015-04-09 21:07:48 -0400 |
commit | b847fd0d85060fa213a14fa78b46e0ca5b09c5df (patch) | |
tree | 4b3b54a4f2acb9b6d34d4b92bfd8993698d3cda9 | |
parent | 8537cba8b6e14ff86f088dd71592090606c97050 (diff) |
aha1542: split out code from aha1542_hw_init
Split out bus times related block of aha1542_hw_init into separate function
aha1542_set_bus_times.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
-rw-r--r-- | drivers/scsi/aha1542.c | 65 |
1 files changed, 35 insertions, 30 deletions
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c index 4bfba454a032..b8e495243cf6 100644 --- a/drivers/scsi/aha1542.c +++ b/drivers/scsi/aha1542.c | |||
@@ -867,6 +867,40 @@ static int __init do_setup(char *str) | |||
867 | __setup("aha1542=",do_setup); | 867 | __setup("aha1542=",do_setup); |
868 | #endif | 868 | #endif |
869 | 869 | ||
870 | /* Set the Bus on/off-times as not to ruin floppy performance */ | ||
871 | static void aha1542_set_bus_times(int indx) | ||
872 | { | ||
873 | unsigned int base_io = bases[indx]; | ||
874 | u8 oncmd[] = {CMD_BUSON_TIME, 7}; | ||
875 | u8 offcmd[] = {CMD_BUSOFF_TIME, 5}; | ||
876 | |||
877 | if (setup_called[indx]) { | ||
878 | oncmd[1] = setup_buson[indx]; | ||
879 | offcmd[1] = setup_busoff[indx]; | ||
880 | } | ||
881 | aha1542_intr_reset(base_io); | ||
882 | aha1542_out(base_io, oncmd, 2); | ||
883 | if (!wait_mask(INTRFLAGS(base_io), INTRMASK, HACC, 0, 0)) | ||
884 | goto fail; | ||
885 | aha1542_intr_reset(base_io); | ||
886 | aha1542_out(base_io, offcmd, 2); | ||
887 | if (!wait_mask(INTRFLAGS(base_io), INTRMASK, HACC, 0, 0)) | ||
888 | goto fail; | ||
889 | if (setup_dmaspeed[indx] >= 0) { | ||
890 | u8 dmacmd[] = {CMD_DMASPEED, 0}; | ||
891 | dmacmd[1] = setup_dmaspeed[indx]; | ||
892 | aha1542_intr_reset(base_io); | ||
893 | aha1542_out(base_io, dmacmd, 2); | ||
894 | if (!wait_mask(INTRFLAGS(base_io), INTRMASK, HACC, 0, 0)) | ||
895 | goto fail; | ||
896 | } | ||
897 | aha1542_intr_reset(base_io); | ||
898 | return; | ||
899 | fail: | ||
900 | printk(KERN_ERR "setting bus on/off-time failed\n"); | ||
901 | aha1542_intr_reset(base_io); | ||
902 | } | ||
903 | |||
870 | /* return non-zero on detection */ | 904 | /* return non-zero on detection */ |
871 | static struct Scsi_Host *aha1542_hw_init(struct scsi_host_template *tpnt, struct device *pdev, int indx) | 905 | static struct Scsi_Host *aha1542_hw_init(struct scsi_host_template *tpnt, struct device *pdev, int indx) |
872 | { | 906 | { |
@@ -897,37 +931,8 @@ static struct Scsi_Host *aha1542_hw_init(struct scsi_host_template *tpnt, struct | |||
897 | 931 | ||
898 | base_io = bases[indx]; | 932 | base_io = bases[indx]; |
899 | 933 | ||
900 | /* Set the Bus on/off-times as not to ruin floppy performance */ | 934 | aha1542_set_bus_times(indx); |
901 | { | ||
902 | u8 oncmd[] = {CMD_BUSON_TIME, 7}; | ||
903 | u8 offcmd[] = {CMD_BUSOFF_TIME, 5}; | ||
904 | 935 | ||
905 | if (setup_called[indx]) { | ||
906 | oncmd[1] = setup_buson[indx]; | ||
907 | offcmd[1] = setup_busoff[indx]; | ||
908 | } | ||
909 | aha1542_intr_reset(base_io); | ||
910 | aha1542_out(base_io, oncmd, 2); | ||
911 | if (!wait_mask(INTRFLAGS(base_io), INTRMASK, HACC, 0, 0)) | ||
912 | goto fail; | ||
913 | aha1542_intr_reset(base_io); | ||
914 | aha1542_out(base_io, offcmd, 2); | ||
915 | if (!wait_mask(INTRFLAGS(base_io), INTRMASK, HACC, 0, 0)) | ||
916 | goto fail; | ||
917 | if (setup_dmaspeed[indx] >= 0) { | ||
918 | u8 dmacmd[] = {CMD_DMASPEED, 0}; | ||
919 | dmacmd[1] = setup_dmaspeed[indx]; | ||
920 | aha1542_intr_reset(base_io); | ||
921 | aha1542_out(base_io, dmacmd, 2); | ||
922 | if (!wait_mask(INTRFLAGS(base_io), INTRMASK, HACC, 0, 0)) | ||
923 | goto fail; | ||
924 | } | ||
925 | while (0) { | ||
926 | fail: | ||
927 | printk(KERN_ERR "aha1542_detect: setting bus on/off-time failed\n"); | ||
928 | } | ||
929 | aha1542_intr_reset(base_io); | ||
930 | } | ||
931 | if (aha1542_query(base_io, &trans)) | 936 | if (aha1542_query(base_io, &trans)) |
932 | goto unregister; | 937 | goto unregister; |
933 | 938 | ||