diff options
author | Amol Lad <amol@verismonetworks.com> | 2006-10-20 17:48:40 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-10-25 18:14:17 -0400 |
commit | 6d07cb71fdacc710fd9816cddb5c2df0f7bd96b4 (patch) | |
tree | 4ed71340e00685e7556580be5b52f218702441d7 | |
parent | 5a09e39810ae0465016c380962e12dd115779b87 (diff) |
[SCSI] drivers/scsi: Handcrafted MIN/MAX macro removal
Cleanups done to use min/max macros from kernel.h. Handcrafted MIN/MAX
macros are changed to use macros in kernel.h
[akpm@osdl.org: fix warning]
Signed-off-by: Amol Lad <amol@verismonetworks.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r-- | drivers/scsi/aic7xxx/aic79xx.h | 8 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aic79xx_core.c | 22 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aic79xx_osm.c | 7 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aic7xxx.h | 8 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aic7xxx_core.c | 18 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aic7xxx_osm.c | 4 |
6 files changed, 26 insertions, 41 deletions
diff --git a/drivers/scsi/aic7xxx/aic79xx.h b/drivers/scsi/aic7xxx/aic79xx.h index df3346b5caf8..c58ac6a87306 100644 --- a/drivers/scsi/aic7xxx/aic79xx.h +++ b/drivers/scsi/aic7xxx/aic79xx.h | |||
@@ -53,14 +53,6 @@ struct ahd_platform_data; | |||
53 | struct scb_platform_data; | 53 | struct scb_platform_data; |
54 | 54 | ||
55 | /****************************** Useful Macros *********************************/ | 55 | /****************************** Useful Macros *********************************/ |
56 | #ifndef MAX | ||
57 | #define MAX(a,b) (((a) > (b)) ? (a) : (b)) | ||
58 | #endif | ||
59 | |||
60 | #ifndef MIN | ||
61 | #define MIN(a,b) (((a) < (b)) ? (a) : (b)) | ||
62 | #endif | ||
63 | |||
64 | #ifndef TRUE | 56 | #ifndef TRUE |
65 | #define TRUE 1 | 57 | #define TRUE 1 |
66 | #endif | 58 | #endif |
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c index 653818d2f802..6adcf7989ce7 100644 --- a/drivers/scsi/aic7xxx/aic79xx_core.c +++ b/drivers/scsi/aic7xxx/aic79xx_core.c | |||
@@ -2850,14 +2850,14 @@ ahd_devlimited_syncrate(struct ahd_softc *ahd, | |||
2850 | transinfo = &tinfo->goal; | 2850 | transinfo = &tinfo->goal; |
2851 | *ppr_options &= (transinfo->ppr_options|MSG_EXT_PPR_PCOMP_EN); | 2851 | *ppr_options &= (transinfo->ppr_options|MSG_EXT_PPR_PCOMP_EN); |
2852 | if (transinfo->width == MSG_EXT_WDTR_BUS_8_BIT) { | 2852 | if (transinfo->width == MSG_EXT_WDTR_BUS_8_BIT) { |
2853 | maxsync = MAX(maxsync, AHD_SYNCRATE_ULTRA2); | 2853 | maxsync = max(maxsync, (u_int)AHD_SYNCRATE_ULTRA2); |
2854 | *ppr_options &= ~MSG_EXT_PPR_DT_REQ; | 2854 | *ppr_options &= ~MSG_EXT_PPR_DT_REQ; |
2855 | } | 2855 | } |
2856 | if (transinfo->period == 0) { | 2856 | if (transinfo->period == 0) { |
2857 | *period = 0; | 2857 | *period = 0; |
2858 | *ppr_options = 0; | 2858 | *ppr_options = 0; |
2859 | } else { | 2859 | } else { |
2860 | *period = MAX(*period, transinfo->period); | 2860 | *period = max(*period, (u_int)transinfo->period); |
2861 | ahd_find_syncrate(ahd, period, ppr_options, maxsync); | 2861 | ahd_find_syncrate(ahd, period, ppr_options, maxsync); |
2862 | } | 2862 | } |
2863 | } | 2863 | } |
@@ -2924,12 +2924,12 @@ ahd_validate_offset(struct ahd_softc *ahd, | |||
2924 | maxoffset = MAX_OFFSET_PACED; | 2924 | maxoffset = MAX_OFFSET_PACED; |
2925 | } else | 2925 | } else |
2926 | maxoffset = MAX_OFFSET_NON_PACED; | 2926 | maxoffset = MAX_OFFSET_NON_PACED; |
2927 | *offset = MIN(*offset, maxoffset); | 2927 | *offset = min(*offset, maxoffset); |
2928 | if (tinfo != NULL) { | 2928 | if (tinfo != NULL) { |
2929 | if (role == ROLE_TARGET) | 2929 | if (role == ROLE_TARGET) |
2930 | *offset = MIN(*offset, tinfo->user.offset); | 2930 | *offset = min(*offset, (u_int)tinfo->user.offset); |
2931 | else | 2931 | else |
2932 | *offset = MIN(*offset, tinfo->goal.offset); | 2932 | *offset = min(*offset, (u_int)tinfo->goal.offset); |
2933 | } | 2933 | } |
2934 | } | 2934 | } |
2935 | 2935 | ||
@@ -2955,9 +2955,9 @@ ahd_validate_width(struct ahd_softc *ahd, struct ahd_initiator_tinfo *tinfo, | |||
2955 | } | 2955 | } |
2956 | if (tinfo != NULL) { | 2956 | if (tinfo != NULL) { |
2957 | if (role == ROLE_TARGET) | 2957 | if (role == ROLE_TARGET) |
2958 | *bus_width = MIN(tinfo->user.width, *bus_width); | 2958 | *bus_width = min((u_int)tinfo->user.width, *bus_width); |
2959 | else | 2959 | else |
2960 | *bus_width = MIN(tinfo->goal.width, *bus_width); | 2960 | *bus_width = min((u_int)tinfo->goal.width, *bus_width); |
2961 | } | 2961 | } |
2962 | } | 2962 | } |
2963 | 2963 | ||
@@ -6057,9 +6057,9 @@ ahd_alloc_scbs(struct ahd_softc *ahd) | |||
6057 | #endif | 6057 | #endif |
6058 | } | 6058 | } |
6059 | 6059 | ||
6060 | newcount = MIN(scb_data->sense_left, scb_data->scbs_left); | 6060 | newcount = min(scb_data->sense_left, scb_data->scbs_left); |
6061 | newcount = MIN(newcount, scb_data->sgs_left); | 6061 | newcount = min(newcount, scb_data->sgs_left); |
6062 | newcount = MIN(newcount, (AHD_SCB_MAX_ALLOC - scb_data->numscbs)); | 6062 | newcount = min(newcount, (AHD_SCB_MAX_ALLOC - scb_data->numscbs)); |
6063 | for (i = 0; i < newcount; i++) { | 6063 | for (i = 0; i < newcount; i++) { |
6064 | struct scb_platform_data *pdata; | 6064 | struct scb_platform_data *pdata; |
6065 | u_int col_tag; | 6065 | u_int col_tag; |
@@ -8668,7 +8668,7 @@ ahd_resolve_seqaddr(struct ahd_softc *ahd, u_int address) | |||
8668 | if (skip_addr > i) { | 8668 | if (skip_addr > i) { |
8669 | int end_addr; | 8669 | int end_addr; |
8670 | 8670 | ||
8671 | end_addr = MIN(address, skip_addr); | 8671 | end_addr = min(address, skip_addr); |
8672 | address_offset += end_addr - i; | 8672 | address_offset += end_addr - i; |
8673 | i = skip_addr; | 8673 | i = skip_addr; |
8674 | } else { | 8674 | } else { |
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index d8d6687e20ad..77ef4d9b0e5f 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c | |||
@@ -1814,9 +1814,9 @@ ahd_linux_handle_scsi_status(struct ahd_softc *ahd, | |||
1814 | u_int sense_offset; | 1814 | u_int sense_offset; |
1815 | 1815 | ||
1816 | if (scb->flags & SCB_SENSE) { | 1816 | if (scb->flags & SCB_SENSE) { |
1817 | sense_size = MIN(sizeof(struct scsi_sense_data) | 1817 | sense_size = min(sizeof(struct scsi_sense_data) |
1818 | - ahd_get_sense_residual(scb), | 1818 | - ahd_get_sense_residual(scb), |
1819 | sizeof(cmd->sense_buffer)); | 1819 | (u_long)sizeof(cmd->sense_buffer)); |
1820 | sense_offset = 0; | 1820 | sense_offset = 0; |
1821 | } else { | 1821 | } else { |
1822 | /* | 1822 | /* |
@@ -1825,7 +1825,8 @@ ahd_linux_handle_scsi_status(struct ahd_softc *ahd, | |||
1825 | */ | 1825 | */ |
1826 | siu = (struct scsi_status_iu_header *) | 1826 | siu = (struct scsi_status_iu_header *) |
1827 | scb->sense_data; | 1827 | scb->sense_data; |
1828 | sense_size = MIN(scsi_4btoul(siu->sense_length), | 1828 | sense_size = min_t(size_t, |
1829 | scsi_4btoul(siu->sense_length), | ||
1829 | sizeof(cmd->sense_buffer)); | 1830 | sizeof(cmd->sense_buffer)); |
1830 | sense_offset = SIU_SENSE_OFFSET(siu); | 1831 | sense_offset = SIU_SENSE_OFFSET(siu); |
1831 | } | 1832 | } |
diff --git a/drivers/scsi/aic7xxx/aic7xxx.h b/drivers/scsi/aic7xxx/aic7xxx.h index 62ff8c3dc2bb..4850820816e0 100644 --- a/drivers/scsi/aic7xxx/aic7xxx.h +++ b/drivers/scsi/aic7xxx/aic7xxx.h | |||
@@ -54,14 +54,6 @@ struct scb_platform_data; | |||
54 | struct seeprom_descriptor; | 54 | struct seeprom_descriptor; |
55 | 55 | ||
56 | /****************************** Useful Macros *********************************/ | 56 | /****************************** Useful Macros *********************************/ |
57 | #ifndef MAX | ||
58 | #define MAX(a,b) (((a) > (b)) ? (a) : (b)) | ||
59 | #endif | ||
60 | |||
61 | #ifndef MIN | ||
62 | #define MIN(a,b) (((a) < (b)) ? (a) : (b)) | ||
63 | #endif | ||
64 | |||
65 | #ifndef TRUE | 57 | #ifndef TRUE |
66 | #define TRUE 1 | 58 | #define TRUE 1 |
67 | #endif | 59 | #endif |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c index 93e4e40944b6..46bd7bc2fa4d 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_core.c +++ b/drivers/scsi/aic7xxx/aic7xxx_core.c | |||
@@ -1671,7 +1671,7 @@ ahc_devlimited_syncrate(struct ahc_softc *ahc, | |||
1671 | transinfo = &tinfo->goal; | 1671 | transinfo = &tinfo->goal; |
1672 | *ppr_options &= transinfo->ppr_options; | 1672 | *ppr_options &= transinfo->ppr_options; |
1673 | if (transinfo->width == MSG_EXT_WDTR_BUS_8_BIT) { | 1673 | if (transinfo->width == MSG_EXT_WDTR_BUS_8_BIT) { |
1674 | maxsync = MAX(maxsync, AHC_SYNCRATE_ULTRA2); | 1674 | maxsync = max(maxsync, (u_int)AHC_SYNCRATE_ULTRA2); |
1675 | *ppr_options &= ~MSG_EXT_PPR_DT_REQ; | 1675 | *ppr_options &= ~MSG_EXT_PPR_DT_REQ; |
1676 | } | 1676 | } |
1677 | if (transinfo->period == 0) { | 1677 | if (transinfo->period == 0) { |
@@ -1679,7 +1679,7 @@ ahc_devlimited_syncrate(struct ahc_softc *ahc, | |||
1679 | *ppr_options = 0; | 1679 | *ppr_options = 0; |
1680 | return (NULL); | 1680 | return (NULL); |
1681 | } | 1681 | } |
1682 | *period = MAX(*period, transinfo->period); | 1682 | *period = max(*period, (u_int)transinfo->period); |
1683 | return (ahc_find_syncrate(ahc, period, ppr_options, maxsync)); | 1683 | return (ahc_find_syncrate(ahc, period, ppr_options, maxsync)); |
1684 | } | 1684 | } |
1685 | 1685 | ||
@@ -1804,12 +1804,12 @@ ahc_validate_offset(struct ahc_softc *ahc, | |||
1804 | else | 1804 | else |
1805 | maxoffset = MAX_OFFSET_8BIT; | 1805 | maxoffset = MAX_OFFSET_8BIT; |
1806 | } | 1806 | } |
1807 | *offset = MIN(*offset, maxoffset); | 1807 | *offset = min(*offset, maxoffset); |
1808 | if (tinfo != NULL) { | 1808 | if (tinfo != NULL) { |
1809 | if (role == ROLE_TARGET) | 1809 | if (role == ROLE_TARGET) |
1810 | *offset = MIN(*offset, tinfo->user.offset); | 1810 | *offset = min(*offset, (u_int)tinfo->user.offset); |
1811 | else | 1811 | else |
1812 | *offset = MIN(*offset, tinfo->goal.offset); | 1812 | *offset = min(*offset, (u_int)tinfo->goal.offset); |
1813 | } | 1813 | } |
1814 | } | 1814 | } |
1815 | 1815 | ||
@@ -1835,9 +1835,9 @@ ahc_validate_width(struct ahc_softc *ahc, struct ahc_initiator_tinfo *tinfo, | |||
1835 | } | 1835 | } |
1836 | if (tinfo != NULL) { | 1836 | if (tinfo != NULL) { |
1837 | if (role == ROLE_TARGET) | 1837 | if (role == ROLE_TARGET) |
1838 | *bus_width = MIN(tinfo->user.width, *bus_width); | 1838 | *bus_width = min((u_int)tinfo->user.width, *bus_width); |
1839 | else | 1839 | else |
1840 | *bus_width = MIN(tinfo->goal.width, *bus_width); | 1840 | *bus_width = min((u_int)tinfo->goal.width, *bus_width); |
1841 | } | 1841 | } |
1842 | } | 1842 | } |
1843 | 1843 | ||
@@ -4406,7 +4406,7 @@ ahc_alloc_scbs(struct ahc_softc *ahc) | |||
4406 | physaddr = sg_map->sg_physaddr; | 4406 | physaddr = sg_map->sg_physaddr; |
4407 | 4407 | ||
4408 | newcount = (PAGE_SIZE / (AHC_NSEG * sizeof(struct ahc_dma_seg))); | 4408 | newcount = (PAGE_SIZE / (AHC_NSEG * sizeof(struct ahc_dma_seg))); |
4409 | newcount = MIN(newcount, (AHC_SCB_MAX_ALLOC - scb_data->numscbs)); | 4409 | newcount = min(newcount, (AHC_SCB_MAX_ALLOC - scb_data->numscbs)); |
4410 | for (i = 0; i < newcount; i++) { | 4410 | for (i = 0; i < newcount; i++) { |
4411 | struct scb_platform_data *pdata; | 4411 | struct scb_platform_data *pdata; |
4412 | #ifndef __linux__ | 4412 | #ifndef __linux__ |
@@ -6442,7 +6442,7 @@ ahc_download_instr(struct ahc_softc *ahc, u_int instrptr, uint8_t *dconsts) | |||
6442 | if (skip_addr > i) { | 6442 | if (skip_addr > i) { |
6443 | int end_addr; | 6443 | int end_addr; |
6444 | 6444 | ||
6445 | end_addr = MIN(address, skip_addr); | 6445 | end_addr = min(address, skip_addr); |
6446 | address_offset += end_addr - i; | 6446 | address_offset += end_addr - i; |
6447 | i = skip_addr; | 6447 | i = skip_addr; |
6448 | } else { | 6448 | } else { |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index ad8578e95937..8eb1211a7888 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c | |||
@@ -1876,9 +1876,9 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc, | |||
1876 | if (scb->flags & SCB_SENSE) { | 1876 | if (scb->flags & SCB_SENSE) { |
1877 | u_int sense_size; | 1877 | u_int sense_size; |
1878 | 1878 | ||
1879 | sense_size = MIN(sizeof(struct scsi_sense_data) | 1879 | sense_size = min(sizeof(struct scsi_sense_data) |
1880 | - ahc_get_sense_residual(scb), | 1880 | - ahc_get_sense_residual(scb), |
1881 | sizeof(cmd->sense_buffer)); | 1881 | (u_long)sizeof(cmd->sense_buffer)); |
1882 | memcpy(cmd->sense_buffer, | 1882 | memcpy(cmd->sense_buffer, |
1883 | ahc_get_sense_buf(ahc, scb), sense_size); | 1883 | ahc_get_sense_buf(ahc, scb), sense_size); |
1884 | if (sense_size < sizeof(cmd->sense_buffer)) | 1884 | if (sense_size < sizeof(cmd->sense_buffer)) |