ide: move ide_rate_filter() calls to the upper layer (take 2)
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Thu, 11 Oct 2007 21:53:59 +0000 (23:53 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Thu, 11 Oct 2007 21:53:59 +0000 (23:53 +0200)
* Move ide_rate_filter() calls from host drivers to IDE core.

* Make ide_rate_filter() static.

* Make 'speed' argument of ->speedproc const.

v2:
* Fix it8213_tune_chipset() comment.

There should be no functionality changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
32 files changed:
drivers/ide/arm/icside.c
drivers/ide/cris/ide-cris.c
drivers/ide/ide-lib.c
drivers/ide/mips/au1xxx-ide.c
drivers/ide/pci/aec62xx.c
drivers/ide/pci/alim15x3.c
drivers/ide/pci/amd74xx.c
drivers/ide/pci/atiixp.c
drivers/ide/pci/cmd64x.c
drivers/ide/pci/cs5520.c
drivers/ide/pci/cs5530.c
drivers/ide/pci/cs5535.c
drivers/ide/pci/hpt34x.c
drivers/ide/pci/hpt366.c
drivers/ide/pci/it8213.c
drivers/ide/pci/it821x.c
drivers/ide/pci/jmicron.c
drivers/ide/pci/pdc202xx_new.c
drivers/ide/pci/pdc202xx_old.c
drivers/ide/pci/piix.c
drivers/ide/pci/sc1200.c
drivers/ide/pci/scc_pata.c
drivers/ide/pci/serverworks.c
drivers/ide/pci/siimage.c
drivers/ide/pci/sis5513.c
drivers/ide/pci/sl82c105.c
drivers/ide/pci/slc90e66.c
drivers/ide/pci/tc86c001.c
drivers/ide/pci/triflex.c
drivers/ide/pci/via82cxxx.c
drivers/ide/ppc/pmac.c
include/linux/ide.h

index 28f910b5aa5d10c8e9d2202ef9704e803e5db9c9..99a27f2dc03a23694813d6103e00e7c69555c328 100644 (file)
@@ -248,15 +248,10 @@ static void icside_build_sglist(ide_drive_t *drive, struct request *rq)
  *     MW1     80      50      50      150     C
  *     MW2     70      25      25      120     C
  */
-static int icside_set_speed(ide_drive_t *drive, u8 xfer_mode)
+static int icside_set_speed(ide_drive_t *drive, const u8 xfer_mode)
 {
        int on = 0, cycle_time = 0, use_dma_info = 0;
 
-       /*
-        * Limit the transfer speed to MW_DMA_2.
-        */
-       xfer_mode = ide_rate_filter(drive, xfer_mode);
-
        switch (xfer_mode) {
        case XFER_MW_DMA_2:
                cycle_time = 250;
index e08782ac88e0c8817c91e0cde683321ae24f1c39..67cec8916fcda82298234b443b39c835c0d69cfb 100644 (file)
@@ -722,12 +722,10 @@ static void tune_cris_ide(ide_drive_t *drive, u8 pio)
        (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio);
 }
 
-static int speed_cris_ide(ide_drive_t *drive, u8 speed)
+static int speed_cris_ide(ide_drive_t *drive, const u8 speed)
 {
        int cyc = 0, dvs = 0, strobe = 0, hold = 0;
 
-       speed = ide_rate_filter(drive, speed);
-
        if (speed >= XFER_PIO_0 && speed <= XFER_PIO_4) {
                tune_cris_ide(drive, speed - XFER_PIO_0);
                return ide_config_drive_speed(drive, speed);
index 41a128f521123182e27fa5ebae6cb4e7708ab6d7..957618849540b41d76f741e579da897049fc5614 100644 (file)
@@ -79,7 +79,7 @@ EXPORT_SYMBOL(ide_xfer_verbose);
  *     TODO: check device PIO capabilities
  */
 
-u8 ide_rate_filter(ide_drive_t *drive, u8 speed)
+static u8 ide_rate_filter(ide_drive_t *drive, u8 speed)
 {
        ide_hwif_t *hwif = drive->hwif;
        u8 mode = ide_find_dma_mode(drive, speed);
@@ -96,8 +96,6 @@ u8 ide_rate_filter(ide_drive_t *drive, u8 speed)
        return min(speed, mode);
 }
 
-EXPORT_SYMBOL(ide_rate_filter);
-
 int ide_use_fast_pio(ide_drive_t *drive)
 {
        struct hd_driveid *id = drive->id;
@@ -364,13 +362,14 @@ void ide_toggle_bounce(ide_drive_t *drive, int on)
  
 int ide_set_xfer_rate(ide_drive_t *drive, u8 rate)
 {
-#ifndef CONFIG_BLK_DEV_IDEDMA
-       rate = min(rate, (u8) XFER_PIO_4);
-#endif
-       if(HWIF(drive)->speedproc)
-               return HWIF(drive)->speedproc(drive, rate);
-       else
+       ide_hwif_t *hwif = drive->hwif;
+
+       if (hwif->speedproc == NULL)
                return -1;
+
+       rate = ide_rate_filter(drive, rate);
+
+       return hwif->speedproc(drive, rate);
 }
 
 static void ide_dump_opcode(ide_drive_t *drive)
index 0d5e4c67fa54ae126f6047309683280930f9510f..b04db9ff1938d110f6877aa6c99d5af9062b9edf 100644 (file)
@@ -175,13 +175,11 @@ static void auide_tune_drive(ide_drive_t *drive, byte pio)
        ide_config_drive_speed(drive, speed);
 }
 
-static int auide_tune_chipset (ide_drive_t *drive, u8 speed)
+static int auide_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
        int mem_sttime;
        int mem_stcfg;
 
-       speed = ide_rate_filter(drive, speed);
-
        mem_sttime = 0;
        mem_stcfg  = au_readl(MEM_STCFG2);
 
index 74432830abf75980cb0de8d1254518a1939a8d82..a827ea2ab989c8cef99d16a5f132db26b905eef1 100644 (file)
@@ -87,12 +87,11 @@ static u8 pci_bus_clock_list_ultra (u8 speed, struct chipset_bus_clock_list_entr
        return chipset_table->ultra_settings;
 }
 
-static int aec6210_tune_chipset (ide_drive_t *drive, u8 xferspeed)
+static int aec6210_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
        ide_hwif_t *hwif        = HWIF(drive);
        struct pci_dev *dev     = hwif->pci_dev;
        u16 d_conf              = 0;
-       u8 speed                = ide_rate_filter(drive, xferspeed);
        u8 ultra = 0, ultra_conf = 0;
        u8 tmp0 = 0, tmp1 = 0, tmp2 = 0;
        unsigned long flags;
@@ -115,11 +114,10 @@ static int aec6210_tune_chipset (ide_drive_t *drive, u8 xferspeed)
        return(ide_config_drive_speed(drive, speed));
 }
 
-static int aec6260_tune_chipset (ide_drive_t *drive, u8 xferspeed)
+static int aec6260_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
        ide_hwif_t *hwif        = HWIF(drive);
        struct pci_dev *dev     = hwif->pci_dev;
-       u8 speed        = ide_rate_filter(drive, xferspeed);
        u8 unit         = (drive->select.b.unit & 0x01);
        u8 tmp1 = 0, tmp2 = 0;
        u8 ultra = 0, drive_conf = 0, ultra_conf = 0;
index 11ecb618007c3f5586006713c46b898eb7a0abf0..37ecd726aa400b9c4090a29301bb51cfd5f4b0c3 100644 (file)
@@ -409,17 +409,16 @@ static u8 ali_udma_filter(ide_drive_t *drive)
 /**
  *     ali15x3_tune_chipset    -       set up chipset/drive for new speed
  *     @drive: drive to configure for
- *     @xferspeed: desired speed
+ *     @speed: desired speed
  *
  *     Configure the hardware for the desired IDE transfer mode.
  *     We also do the needed drive configuration through helpers
  */
-static int ali15x3_tune_chipset (ide_drive_t *drive, u8 xferspeed)
+
+static int ali15x3_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
        ide_hwif_t *hwif        = HWIF(drive);
        struct pci_dev *dev     = hwif->pci_dev;
-       u8 speed                = ide_rate_filter(drive, xferspeed);
        u8 speed1               = speed;
        u8 unit                 = (drive->select.b.unit & 0x01);
        u8 tmpbyte              = 0x00;
index 3c0bb1e79514ec1ed2120bbd8c87765537f77f9f..9abbde3c79844287e26dccb7ec8cf630fd8ce65e 100644 (file)
@@ -234,14 +234,12 @@ static void amd_set_speed(struct pci_dev *dev, unsigned char dn, struct ide_timi
  * by upper layers.
  */
 
-static int amd_set_drive(ide_drive_t *drive, u8 speed)
+static int amd_set_drive(ide_drive_t *drive, const u8 speed)
 {
        ide_drive_t *peer = HWIF(drive)->drives + (~drive->dn & 1);
        struct ide_timing t, p;
        int T, UT;
 
-       speed = ide_rate_filter(drive, speed);
-
        if (speed != XFER_PIO_SLOW)
                ide_config_drive_speed(drive, speed);
 
index 679eb92b89209fb2f88b5f94962a2f21e87b7c47..e05e8829850090038f90a42e021858b232ee3a62 100644 (file)
@@ -163,23 +163,21 @@ static void atiixp_tuneproc(ide_drive_t *drive, u8 pio)
 /**
  *     atiixp_tune_chipset     -       tune a ATIIXP interface
  *     @drive: IDE drive to tune
- *     @xferspeed: speed to configure
+ *     @speed: speed to configure
  *
  *     Set a ATIIXP interface channel to the desired speeds. This involves
  *     requires the right timing data into the ATIIXP configuration space
  *     then setting the drive parameters appropriately
  */
 
-static int atiixp_speedproc(ide_drive_t *drive, u8 xferspeed)
+static int atiixp_speedproc(ide_drive_t *drive, const u8 speed)
 {
        struct pci_dev *dev = drive->hwif->pci_dev;
        unsigned long flags;
        int timing_shift = (drive->dn & 2) ? 16 : 0 + (drive->dn & 1) ? 0 : 8;
        u32 tmp32;
        u16 tmp16;
-       u8 speed, pio;
-
-       speed = ide_rate_filter(drive, xferspeed);
+       u8 pio;
 
        if (speed >= XFER_PIO_0 && speed <= XFER_PIO_4) {
                atiixp_tune_pio(drive, speed - XFER_PIO_0);
index 0e3b5de26e698a73b7976f4eb2358ab63e3fbc18..5fe50a234ce1a4fcee1e1a13407272d0bf56bfcf 100644 (file)
@@ -288,15 +288,13 @@ static void cmd64x_tune_drive (ide_drive_t *drive, u8 pio)
        (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio);
 }
 
-static int cmd64x_tune_chipset (ide_drive_t *drive, u8 speed)
+static int cmd64x_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
        ide_hwif_t *hwif        = HWIF(drive);
        struct pci_dev *dev     = hwif->pci_dev;
        u8 unit                 = drive->dn & 0x01;
        u8 regU = 0, pciU       = hwif->channel ? UDIDETCR1 : UDIDETCR0;
 
-       speed = ide_rate_filter(drive, speed);
-
        if (speed >= XFER_SW_DMA_0) {
                (void) pci_read_config_byte(dev, pciU, &regU);
                regU &= ~(unit ? 0xCA : 0x35);
index 507981042c82d8f3c29e1b53118e3e838085e88c..af67438328a858c3d43f3f06e6d54f3305618725 100644 (file)
@@ -66,16 +66,15 @@ static struct pio_clocks cs5520_pio_clocks[]={
        {1, 2, 1}
 };
 
-static int cs5520_tune_chipset(ide_drive_t *drive, u8 xferspeed)
+static int cs5520_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
        ide_hwif_t *hwif = HWIF(drive);
        struct pci_dev *pdev = hwif->pci_dev;
-       u8 speed = ide_rate_filter(drive, xferspeed);
        int pio = speed;
        u8 reg;
        int controller = drive->dn > 1 ? 1 : 0;
        int error;
-       
+
        switch(speed)
        {
                case XFER_PIO_4:
index e5949b1d3fb0c001726360ff2392f71c6edc303d..518f430c1529c17a1d62fcfb997ed6849832f133 100644 (file)
@@ -143,13 +143,11 @@ static int cs5530_config_dma(ide_drive_t *drive)
        return 1;
 }
 
-static int cs5530_tune_chipset(ide_drive_t *drive, u8 mode)
+static int cs5530_tune_chipset(ide_drive_t *drive, const u8 mode)
 {
        unsigned long basereg;
        unsigned int reg, timings = 0;
 
-       mode = ide_rate_filter(drive, mode);
-
        /*
         * Tell the drive to switch to the new mode; abort on failure.
         */
index 082ca7da2cbcd0e2f85d5aebce929aa27fa07995..bc00e7b6215168fcf93854b078d55f7556bca1ae 100644 (file)
@@ -75,7 +75,7 @@ static unsigned int cs5535_udma_timings[5] =
  *
  *     cs5535_set_speed() configures the chipset to a new speed.
  */
-static void cs5535_set_speed(ide_drive_t *drive, u8 speed)
+static void cs5535_set_speed(ide_drive_t *drive, const u8 speed)
 {
 
        u32 reg = 0, dummy;
@@ -141,7 +141,6 @@ static void cs5535_set_speed(ide_drive_t *drive, u8 speed)
  */
 static int cs5535_set_drive(ide_drive_t *drive, u8 speed)
 {
-       speed = ide_rate_filter(drive, speed);
        ide_config_drive_speed(drive, speed);
        cs5535_set_speed(drive, speed);
 
index cb8fe5643d3b75969d28ce5f72ddb8bc26b01ab8..ba982d66ff730014380f9518b74d1033224f9f23 100644 (file)
 
 #define HPT343_DEBUG_DRIVE_INFO                0
 
-static int hpt34x_tune_chipset (ide_drive_t *drive, u8 xferspeed)
+static int hpt34x_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
        struct pci_dev *dev     = HWIF(drive)->pci_dev;
-       u8 speed = ide_rate_filter(drive, xferspeed);
        u32 reg1= 0, tmp1 = 0, reg2 = 0, tmp2 = 0;
        u8                      hi_speed, lo_speed;
 
index 18c8ad091eb3be4011ba731d3923f8803cd74440..67127ac3a14aaafc6d80bbbac59bbccade13e3ca 100644 (file)
@@ -600,12 +600,11 @@ static u32 get_speed_setting(u8 speed, struct hpt_info *info)
        return (*info->settings)[i];
 }
 
-static int hpt36x_tune_chipset(ide_drive_t *drive, u8 xferspeed)
+static int hpt36x_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
        ide_hwif_t *hwif        = HWIF(drive);
        struct pci_dev  *dev    = hwif->pci_dev;
        struct hpt_info *info   = pci_get_drvdata(dev);
-       u8  speed               = ide_rate_filter(drive, xferspeed);
        u8  itr_addr            = drive->dn ? 0x44 : 0x40;
        u32 old_itr             = 0;
        u32 itr_mask, new_itr;
@@ -628,12 +627,11 @@ static int hpt36x_tune_chipset(ide_drive_t *drive, u8 xferspeed)
        return ide_config_drive_speed(drive, speed);
 }
 
-static int hpt37x_tune_chipset(ide_drive_t *drive, u8 xferspeed)
+static int hpt37x_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
        ide_hwif_t *hwif        = HWIF(drive);
        struct pci_dev  *dev    = hwif->pci_dev;
        struct hpt_info *info   = pci_get_drvdata(dev);
-       u8  speed               = ide_rate_filter(drive, xferspeed);
        u8  itr_addr            = 0x40 + (drive->dn * 4);
        u32 old_itr             = 0;
        u32 itr_mask, new_itr;
index 70b3245dbf62d59db907faba1ade0f3804af4616..6fa955749aecbadc67b3353d30a66057b3b8bf08 100644 (file)
@@ -115,20 +115,16 @@ static void it8213_tuneproc(ide_drive_t *drive, u8 pio)
 /**
  *     it8213_tune_chipset     -       set controller timings
  *     @drive: Drive to set up
- *     @xferspeed: speed we want to achieve
+ *     @speed: speed we want to achieve
  *
- *     Tune the ITE chipset for the desired mode. If we can't achieve
- *     the desired mode then tune for a lower one, but ultimately
- *     make the thing work.
+ *     Tune the ITE chipset for the desired mode.
  */
 
-static int it8213_tune_chipset (ide_drive_t *drive, u8 xferspeed)
+static int it8213_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
-
        ide_hwif_t *hwif        = HWIF(drive);
        struct pci_dev *dev     = hwif->pci_dev;
        u8 maslave              = 0x40;
-       u8 speed                = ide_rate_filter(drive, xferspeed);
        int a_speed             = 3 << (drive->dn * 4);
        int u_flag              = 1 << drive->dn;
        int v_flag              = 0x01 << drive->dn;
index 9286c99e2ff02b8cc26ade3d428b8c942982f4df..a756e61bcb32121f94271430082ff140b26b17a2 100644 (file)
@@ -405,23 +405,19 @@ static int it821x_dma_end(ide_drive_t *drive)
        return ret;
 }
 
-
 /**
  *     it821x_tune_chipset     -       set controller timings
  *     @drive: Drive to set up
- *     @xferspeed: speed we want to achieve
+ *     @speed: speed we want to achieve
  *
- *     Tune the ITE chipset for the desired mode. If we can't achieve
- *     the desired mode then tune for a lower one, but ultimately
- *     make the thing work.
+ *     Tune the ITE chipset for the desired mode.
  */
 
-static int it821x_tune_chipset (ide_drive_t *drive, byte xferspeed)
+static int it821x_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
 
        ide_hwif_t *hwif        = drive->hwif;
        struct it821x_dev *itdev = ide_get_hwifdata(hwif);
-       u8 speed                = ide_rate_filter(drive, xferspeed);
 
        switch (speed) {
        case XFER_PIO_4:
index 17490d255758b7cbb870c1bc39f02b7f2ad65ca5..7bac87fb481af132001d9c0adf01305ab9481dbb 100644 (file)
@@ -92,17 +92,14 @@ static void jmicron_tuneproc(ide_drive_t *drive, u8 pio)
 /**
  *     jmicron_tune_chipset    -       set controller timings
  *     @drive: Drive to set up
- *     @xferspeed: speed we want to achieve
+ *     @speed: speed we want to achieve
  *
  *     As the JMicron snoops for timings all we actually need to do is
- *     make sure we don't set an invalid mode. We do need to honour
- *     the cable detect here.
+ *     set the transfer mode on the device.
  */
 
-static int jmicron_tune_chipset (ide_drive_t *drive, byte xferspeed)
+static int jmicron_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
-       u8 speed = ide_rate_filter(drive, xferspeed);
-
        return ide_config_drive_speed(drive, speed);
 }
 
index 7c5544d10b9ab76d700688fdf676ad5674f6acd6..3787194a2249c1bd3d517dd88049984bf2f823ec 100644 (file)
@@ -146,14 +146,12 @@ static struct udma_timing {
        { 0x1a, 0x01, 0xcb },   /* UDMA mode 6 */
 };
 
-static int pdcnew_tune_chipset(ide_drive_t *drive, u8 speed)
+static int pdcnew_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
        ide_hwif_t *hwif        = HWIF(drive);
        u8 adj                  = (drive->dn & 1) ? 0x08 : 0x00;
        int                     err;
 
-       speed = ide_rate_filter(drive, speed);
-
        /*
         * Issue SETFEATURES_XFER to the drive first. PDC202xx hardware will
         * automatically set the timing registers based on 100 MHz PLL output.
index e19a891171cb5192155586fb7596686fdf06f4f3..e7a5e3014c0931b0d6c6d9e9d38e8c81de59943c 100644 (file)
@@ -63,12 +63,11 @@ static const char *pdc_quirk_drives[] = {
 
 static void pdc_old_disable_66MHz_clock(ide_hwif_t *);
 
-static int pdc202xx_tune_chipset (ide_drive_t *drive, u8 xferspeed)
+static int pdc202xx_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
        ide_hwif_t *hwif        = HWIF(drive);
        struct pci_dev *dev     = hwif->pci_dev;
        u8 drive_pci            = 0x60 + (drive->dn << 2);
-       u8 speed                = ide_rate_filter(drive, xferspeed);
 
        u8                      AP = 0, BP = 0, CP = 0;
        u8                      TA = 0, TB = 0, TC = 0;
index 5cfa9378bbb88b27a6b144eb7eb4ce0117d558be..b66f9d1411b35c18d92709b58cb35979f8af5db2 100644 (file)
@@ -221,19 +221,18 @@ static void piix_tune_drive (ide_drive_t *drive, u8 pio)
 /**
  *     piix_tune_chipset       -       tune a PIIX interface
  *     @drive: IDE drive to tune
- *     @xferspeed: speed to configure
+ *     @speed: speed to configure
  *
  *     Set a PIIX interface channel to the desired speeds. This involves
  *     requires the right timing data into the PIIX configuration space
  *     then setting the drive parameters appropriately
  */
-static int piix_tune_chipset (ide_drive_t *drive, u8 xferspeed)
+
+static int piix_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
        ide_hwif_t *hwif        = HWIF(drive);
        struct pci_dev *dev     = hwif->pci_dev;
        u8 maslave              = hwif->channel ? 0x42 : 0x40;
-       u8 speed                = ide_rate_filter(drive, xferspeed);
        int a_speed             = 3 << (drive->dn * 4);
        int u_flag              = 1 << drive->dn;
        int v_flag              = 0x01 << drive->dn;
index 9bdc9694d50dc10e4356372fb96ac816b17e9adb..059071cd2d49d2f8c87baca9716a2bb63d81f852 100644 (file)
@@ -138,7 +138,7 @@ out:
        return mask;
 }
 
-static int sc1200_tune_chipset(ide_drive_t *drive, u8 mode)
+static int sc1200_tune_chipset(ide_drive_t *drive, const u8 mode)
 {
        ide_hwif_t              *hwif = HWIF(drive);
        int                     unit = drive->select.b.unit;
@@ -146,8 +146,6 @@ static int sc1200_tune_chipset(ide_drive_t *drive, u8 mode)
        unsigned short          pci_clock;
        unsigned int            basereg = hwif->channel ? 0x50 : 0x40;
 
-       mode = ide_rate_filter(drive, mode);
-
        /*
         * Tell the drive to switch to the new mode; abort on failure.
         */
index eeb0a6d434aaaeee3a0f97307838595b09150db2..a19687caf65a6a95c1da40ce4162bf846ee3ed56 100644 (file)
@@ -231,16 +231,15 @@ static void scc_tuneproc(ide_drive_t *drive, u8 pio)
 /**
  *     scc_tune_chipset        -       tune a drive DMA mode
  *     @drive: Drive to set up
- *     @xferspeed: speed we want to achieve
+ *     @speed: speed we want to achieve
  *
  *     Load the timing settings for this device mode into the
  *     controller.
  */
 
-static int scc_tune_chipset(ide_drive_t *drive, byte xferspeed)
+static int scc_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
        ide_hwif_t *hwif = HWIF(drive);
-       u8 speed = ide_rate_filter(drive, xferspeed);
        struct scc_ports *ports = ide_get_hwifdata(hwif);
        unsigned long ctl_base = ports->ctl;
        unsigned long cckctrl_port = ctl_base + 0xff0;
index 9fead2e7d4c88363a993d510aaa16225bbd917ef..b51133bb58af99a3b0b0fe50d17bb8b7f05c5789 100644 (file)
@@ -145,7 +145,7 @@ static void svwks_tune_pio(ide_drive_t *drive, const u8 pio)
        }
 }
 
-static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed)
+static int svwks_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
        static const u8 udma_modes[]            = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 };
        static const u8 dma_modes[]             = { 0x77, 0x21, 0x20 };
@@ -153,7 +153,6 @@ static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed)
 
        ide_hwif_t *hwif        = HWIF(drive);
        struct pci_dev *dev     = hwif->pci_dev;
-       u8 speed                = ide_rate_filter(drive, xferspeed);
        u8 unit                 = (drive->select.b.unit & 0x01);
 
        u8 ultra_enable  = 0, ultra_timing = 0, dma_timing = 0;
index 50f6d172ef7715dc8371933af223ced8d02a8384..4c1f3bc7e17973fbed0e6809b1a92f17aca70cd0 100644 (file)
@@ -229,14 +229,12 @@ static void sil_tuneproc(ide_drive_t *drive, u8 pio)
 /**
  *     siimage_tune_chipset    -       set controller timings
  *     @drive: Drive to set up
- *     @xferspeed: speed we want to achieve
+ *     @speed: speed we want to achieve
  *
- *     Tune the SII chipset for the desired mode. If we can't achieve
- *     the desired mode then tune for a lower one, but ultimately
- *     make the thing work.
+ *     Tune the SII chipset for the desired mode.
  */
-static int siimage_tune_chipset (ide_drive_t *drive, byte xferspeed)
+
+static int siimage_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
        u8 ultra6[]             = { 0x0F, 0x0B, 0x07, 0x05, 0x03, 0x02, 0x01 };
        u8 ultra5[]             = { 0x0C, 0x07, 0x05, 0x04, 0x02, 0x01 };
@@ -245,7 +243,6 @@ static int siimage_tune_chipset (ide_drive_t *drive, byte xferspeed)
        ide_hwif_t *hwif        = HWIF(drive);
        u16 ultra = 0, multi    = 0;
        u8 mode = 0, unit       = drive->select.b.unit;
-       u8 speed                = ide_rate_filter(drive, xferspeed);
        unsigned long base      = (unsigned long)hwif->hwif_data;
        u8 scsc = 0, addr_mask  = ((hwif->channel) ?
                                    ((hwif->mmio) ? 0xF4 : 0x84) :
index 1da037f1394e5a71b8cc4a58975ae834aaf4d206..fed582b4b32fb218538c5f1f363e0c0026239b40 100644 (file)
@@ -531,15 +531,12 @@ static void sis5513_tuneproc(ide_drive_t *drive, u8 pio)
        (void)sis5513_tune_drive(drive, pio);
 }
 
-static int sis5513_tune_chipset (ide_drive_t *drive, u8 xferspeed)
+static int sis5513_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
        ide_hwif_t *hwif        = HWIF(drive);
        struct pci_dev *dev     = hwif->pci_dev;
-
-       u8 drive_pci, reg, speed;
        u32 regdw;
-
-       speed = ide_rate_filter(drive, xferspeed);
+       u8 drive_pci, reg;
 
        /* See config_art_rwp_pio for drive pci config registers */
        drive_pci = 0x40;
index 0947cab0059570b346a6409ea434c87ec8d0c8a8..9f425b0b5721323dbb2f467ecb9d6306e0f811d4 100644 (file)
@@ -113,7 +113,7 @@ static u8 sl82c105_tune_pio(ide_drive_t *drive, u8 pio)
 /*
  * Configure the drive and chipset for a new transfer speed.
  */
-static int sl82c105_tune_chipset(ide_drive_t *drive, u8 speed)
+static int sl82c105_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
        static u16 mwdma_timings[] = {0x0707, 0x0201, 0x0200};
        u16 drv_ctrl;
@@ -121,8 +121,6 @@ static int sl82c105_tune_chipset(ide_drive_t *drive, u8 speed)
        DBG(("sl82c105_tune_chipset(drive:%s, speed:%s)\n",
             drive->name, ide_xfer_verbose(speed)));
 
-       speed = ide_rate_filter(drive, speed);
-
        switch (speed) {
        case XFER_MW_DMA_2:
        case XFER_MW_DMA_1:
index 628b0664f57672e9802b9f715529f668c4fa08de..cc9353565070580193855d45610b731d10b1bc75 100644 (file)
@@ -102,12 +102,11 @@ static void slc90e66_tune_drive (ide_drive_t *drive, u8 pio)
        (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio);
 }
 
-static int slc90e66_tune_chipset (ide_drive_t *drive, u8 xferspeed)
+static int slc90e66_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
        ide_hwif_t *hwif        = HWIF(drive);
        struct pci_dev *dev     = hwif->pci_dev;
        u8 maslave              = hwif->channel ? 0x42 : 0x40;
-       u8 speed                = ide_rate_filter(drive, xferspeed);
        int sitre = 0, a_speed  = 7 << (drive->dn * 4);
        int u_speed = 0, u_flag = 1 << drive->dn;
        u16                     reg4042, reg44, reg48, reg4a;
index ec79bacc30c2fadf7bdd4d1914abdc1b361257fc..e5425772622fa8d37667480beef397008843572a 100644 (file)
 #include <linux/pci.h>
 #include <linux/ide.h>
 
-static int tc86c001_tune_chipset(ide_drive_t *drive, u8 speed)
+static int tc86c001_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
        ide_hwif_t *hwif        = HWIF(drive);
        unsigned long scr_port  = hwif->config_data + (drive->dn ? 0x02 : 0x00);
        u16 mode, scr           = hwif->INW(scr_port);
 
-       speed = ide_rate_filter(drive, speed);
-
        switch (speed) {
                case XFER_UDMA_4:       mode = 0x00c0; break;
                case XFER_UDMA_3:       mode = 0x00b0; break;
index 098692a6d615ff157c97cc55030b10ea883bf06d..47cf89be4dfc1422d9603709d2710d08a130e35c 100644 (file)
@@ -40,7 +40,7 @@
 #include <linux/ide.h>
 #include <linux/init.h>
 
-static int triflex_tune_chipset(ide_drive_t *drive, u8 xferspeed)
+static int triflex_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
        ide_hwif_t *hwif = HWIF(drive);
        struct pci_dev *dev = hwif->pci_dev;
@@ -48,7 +48,6 @@ static int triflex_tune_chipset(ide_drive_t *drive, u8 xferspeed)
        u16 timing = 0;
        u32 triflex_timings = 0;
        u8 unit = (drive->select.b.unit & 0x01);
-       u8 speed = ide_rate_filter(drive, xferspeed);
        
        pci_read_config_dword(dev, channel_offset, &triflex_timings);
        
index ec9ad6e0e1f693ec42d8396e69429d4ce286b229..e3bf907363325990ce150fdfedd44c4809712067 100644 (file)
@@ -158,15 +158,13 @@ static void via_set_speed(ide_hwif_t *hwif, u8 dn, struct ide_timing *timing)
  *     by upper layers.
  */
 
-static int via_set_drive(ide_drive_t *drive, u8 speed)
+static int via_set_drive(ide_drive_t *drive, const u8 speed)
 {
        ide_drive_t *peer = HWIF(drive)->drives + (~drive->dn & 1);
        struct via82cxxx_dev *vdev = pci_get_drvdata(drive->hwif->pci_dev);
        struct ide_timing t, p;
        unsigned int T, UT;
 
-       speed = ide_rate_filter(drive, speed);
-
        if (speed != XFER_PIO_SLOW)
                ide_config_drive_speed(drive, speed);
 
index 222adcb548235072e1e640e1a8ccf3fe25077193..284bb7c39b87c52173dc54706d81d3488ce92b27 100644 (file)
@@ -411,7 +411,6 @@ kauai_lookup_timing(struct kauai_timing* table, int cycle_time)
 
 static void pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif);
 static int pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq);
-static int pmac_ide_tune_chipset(ide_drive_t *drive, u8 speed);
 static void pmac_ide_tuneproc(ide_drive_t *drive, u8 pio);
 static void pmac_ide_selectproc(ide_drive_t *drive);
 static void pmac_ide_kauai_selectproc(ide_drive_t *drive);
@@ -920,16 +919,13 @@ set_timings_mdma(ide_drive_t *drive, int intf_type, u32 *timings, u32 *timings2,
  * our dedicated function is more precise as it uses the drive provided
  * cycle time value. We should probably fix this one to deal with that too...
  */
-static int
-pmac_ide_tune_chipset (ide_drive_t *drive, byte speed)
+static int pmac_ide_tune_chipset(ide_drive_t *drive, const u8 speed)
 {
        int unit = (drive->select.b.unit & 0x01);
        int ret = 0;
        pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data;
        u32 *timings, *timings2;
 
-       speed = ide_rate_filter(drive, speed);
-
        if (pmif == NULL)
                return 1;
                
index a3f9c216615edd9dda8475a7e762514f08e5fd91..81736cb7ef3d856af4a3063cbbc5db5c185b5acc 100644 (file)
@@ -705,7 +705,7 @@ typedef struct hwif_s {
        /* routine to tune PIO mode for drives */
        void    (*tuneproc)(ide_drive_t *, u8);
        /* routine to retune DMA modes for drives */
-       int     (*speedproc)(ide_drive_t *, u8);
+       int     (*speedproc)(ide_drive_t *, const u8);
        /* tweaks hardware to select drive */
        void    (*selectproc)(ide_drive_t *);
        /* chipset polling based on hba specifics */
@@ -1378,7 +1378,6 @@ static inline void ide_set_hwifdata (ide_hwif_t * hwif, void *data)
 }
 
 /* ide-lib.c */
-u8 ide_rate_filter(ide_drive_t *, u8);
 extern char *ide_xfer_verbose(u8 xfer_rate);
 extern void ide_toggle_bounce(ide_drive_t *drive, int on);
 extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);