#include <linux/smp.h>
#include <linux/interrupt.h>
#include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi_host.h>
#include "aic7xxx_old/aic7xxx.h"
#include "aic7xxx_old/sequencer.h"
#define AIC7XXX_C_VERSION "5.2.6"
-#define NUMBER(arr) (sizeof(arr) / sizeof(arr[0]))
-#define MIN(a,b) (((a) < (b)) ? (a) : (b))
-#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define ALL_TARGETS -1
#define ALL_CHANNELS -1
#define ALL_LUNS -1
while ((p = strsep(&s, ",.")) != NULL)
{
- for (i = 0; i < NUMBER(options); i++)
+ for (i = 0; i < ARRAY_SIZE(options); i++)
{
n = strlen(options[i].name);
if (!strncmp(options[i].name, p, n))
else if (instance >= 0)
instance++;
if ( (device >= MAX_TARGETS) ||
- (instance >= NUMBER(aic7xxx_tag_info)) )
+ (instance >= ARRAY_SIZE(aic7xxx_tag_info)) )
done = TRUE;
tok++;
if (!done)
}
}
if ( (instance >= 0) && (device >= 0) &&
- (instance < NUMBER(aic7xxx_tag_info)) &&
+ (instance < ARRAY_SIZE(aic7xxx_tag_info)) &&
(device < MAX_TARGETS) )
aic7xxx_tag_info[instance].tag_commands[device] =
simple_strtoul(tok, NULL, 0) & 0xff;
{
int end_addr;
- end_addr = MIN(address, skip_addr);
+ end_addr = min_t(int, address, skip_addr);
address_offset += end_addr - i;
i = skip_addr;
}
if(!(p->features & AHC_ULTRA3))
{
*options = 0;
- maxsync = MAX(maxsync, AHC_SYNCRATE_ULTRA2);
+ maxsync = max_t(unsigned int, maxsync, AHC_SYNCRATE_ULTRA2);
}
break;
case MSG_EXT_PPR_OPTION_DT_CRC_QUICK:
if(!(p->features & AHC_ULTRA3))
{
*options = 0;
- maxsync = MAX(maxsync, AHC_SYNCRATE_ULTRA2);
+ maxsync = max_t(unsigned int, maxsync, AHC_SYNCRATE_ULTRA2);
}
else
{
break;
default:
*options = 0;
- maxsync = MAX(maxsync, AHC_SYNCRATE_ULTRA2);
+ maxsync = max_t(unsigned int, maxsync, AHC_SYNCRATE_ULTRA2);
break;
}
syncrate = &aic7xxx_syncrates[maxsync];
else
maxoffset = MAX_OFFSET_8BIT;
}
- *offset = MIN(*offset, maxoffset);
+ *offset = min(*offset, maxoffset);
}
/*+F*************************************************************************
break;
}
}
- scb_count = MIN( (i-1), p->scb_data->maxscbs - p->scb_data->numscbs);
+ scb_count = min( (i-1), p->scb_data->maxscbs - p->scb_data->numscbs);
scb_ap = (struct aic7xxx_scb *)kmalloc(sizeof (struct aic7xxx_scb) * scb_count
+ sizeof(struct aic7xxx_scb_dma), GFP_ATOMIC);
if (scb_ap == NULL)
if(p->user[tindex].offset)
{
aic_dev->needsdtr_copy = 1;
- aic_dev->goal.period = MAX(10,p->user[tindex].period);
+ aic_dev->goal.period = max_t(unsigned char, 10,p->user[tindex].period);
if(p->features & AHC_ULTRA2)
{
aic_dev->goal.offset = MAX_OFFSET_ULTRA2;
* the device isn't allowed to send values greater than the ones
* we first sent to it.
*/
- new_period = MAX(period, aic_dev->goal.period);
- new_offset = MIN(offset, aic_dev->goal.offset);
+ new_period = max_t(unsigned int, period, aic_dev->goal.period);
+ new_offset = min_t(unsigned int, offset, aic_dev->goal.offset);
}
/*
if(p->user[tindex].offset)
{
aic_dev->needsdtr_copy = 1;
- aic_dev->goal.period = MAX(10,p->user[tindex].period);
+ aic_dev->goal.period = max_t(unsigned char, 10, p->user[tindex].period);
if(p->features & AHC_ULTRA2)
{
aic_dev->goal.offset = MAX_OFFSET_ULTRA2;
unsigned char errno = aic_inb(p, ERROR);
printk(KERN_ERR "(scsi%d) BRKADRINT error(0x%x):\n", p->host_no, errno);
- for (i = 0; i < NUMBER(hard_error); i++)
+ for (i = 0; i < ARRAY_SIZE(hard_error); i++)
{
if (errno & hard_error[i].errno)
{
else
{
aic_dev->needsdtr = aic_dev->needsdtr_copy = 1;
- aic_dev->goal.period = MAX(10, aic_dev->goal.period);
+ aic_dev->goal.period = max_t(unsigned char, 10, aic_dev->goal.period);
aic_dev->goal.options = 0;
}
}
}
else
{
- if (p->instance >= NUMBER(aic7xxx_tag_info))
+ if (p->instance >= ARRAY_SIZE(aic7xxx_tag_info))
{
static int print_warning = TRUE;
if(print_warning)
buf[i] = inb(base + i);
}
- for (i = 0; i < NUMBER(AIC7xxx); i++)
+ for (i = 0; i < ARRAY_SIZE(AIC7xxx); i++)
{
/*
* Signature match on enabled card?
unsigned int devconfig, i, oldverbose;
struct pci_dev *pdev = NULL;
- for (i = 0; i < NUMBER(aic_pdevs); i++)
+ for (i = 0; i < ARRAY_SIZE(aic_pdevs); i++)
{
pdev = NULL;
while ((pdev = pci_find_device(aic_pdevs[i].vendor_id,
found++;
continue;
skip_pci_controller:
+#ifdef CONFIG_PCI
pci_release_regions(temp_p->pdev);
+#endif
kfree(temp_p);
} /* Found an Adaptec PCI device. */
else /* Well, we found one, but we couldn't get any memory */
* EISA/VL-bus card signature probe.
*/
slot = MINSLOT;
- while ( (slot <= MAXSLOT) &&
+ while ( (slot <= MAXSLOT) &&
!(aic7xxx_no_probe) )
{
base = SLOTBASE(slot) + MINREG;
int i;
left = found;
- for (i=0; i<NUMBER(sort_list); i++)
+ for (i=0; i<ARRAY_SIZE(sort_list); i++)
{
temp_p = sort_list[i];
while(temp_p != NULL)
#endif /* MMAPIO */
if(!p->pdev)
release_region(p->base, MAXREG - MINREG);
+#ifdef CONFIG_PCI
else
pci_release_regions(p->pdev);
+#endif
prev = NULL;
next = first_aic7xxx;
while(next != NULL)