提交 d2411495 编写于 作者: M Matthew Wilcox 提交者: James Bottomley

[SCSI] advansys: Remove asc_board_t typedef and ASC_BOARDP macro

asc_board_t was simply a typedef for struct asc_board.  ASC_BOARDP()
can be replaced by shost_priv() except in the ASC_STATS* macros which
rely on the cast; add an explicit cast there.
Signed-off-by: NMatthew Wilcox <willy@linux.intel.com>
Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
上级 720349a8
...@@ -2203,10 +2203,7 @@ do { \ ...@@ -2203,10 +2203,7 @@ do { \
(sizeof(ADV_SG_BLOCK) * \ (sizeof(ADV_SG_BLOCK) * \
((ADV_MAX_SG_LIST + (NO_OF_SG_PER_BLOCK - 1))/NO_OF_SG_PER_BLOCK)) ((ADV_MAX_SG_LIST + (NO_OF_SG_PER_BLOCK - 1))/NO_OF_SG_PER_BLOCK))
/* Reference Scsi_Host hostdata */ /* struct asc_board flags */
#define ASC_BOARDP(host) ((asc_board_t *) &((host)->hostdata))
/* asc_board_t flags */
#define ASC_IS_WIDE_BOARD 0x04 /* AdvanSys Wide Board */ #define ASC_IS_WIDE_BOARD 0x04 /* AdvanSys Wide Board */
#define ASC_NARROW_BOARD(boardp) (((boardp)->flags & ASC_IS_WIDE_BOARD) == 0) #define ASC_NARROW_BOARD(boardp) (((boardp)->flags & ASC_IS_WIDE_BOARD) == 0)
...@@ -2244,15 +2241,12 @@ do { \ ...@@ -2244,15 +2241,12 @@ do { \
#define HOST_BYTE(byte) ((byte) << 16) #define HOST_BYTE(byte) ((byte) << 16)
#define DRIVER_BYTE(byte) ((byte) << 24) #define DRIVER_BYTE(byte) ((byte) << 24)
#define ASC_STATS(shost, counter) ASC_STATS_ADD(shost, counter, 1)
#ifndef ADVANSYS_STATS #ifndef ADVANSYS_STATS
#define ASC_STATS(shost, counter)
#define ASC_STATS_ADD(shost, counter, count) #define ASC_STATS_ADD(shost, counter, count)
#else /* ADVANSYS_STATS */ #else /* ADVANSYS_STATS */
#define ASC_STATS(shost, counter) \
(ASC_BOARDP(shost)->asc_stats.counter++)
#define ASC_STATS_ADD(shost, counter, count) \ #define ASC_STATS_ADD(shost, counter, count) \
(ASC_BOARDP(shost)->asc_stats.counter += (count)) (((struct asc_board *) shost_priv(shost))->asc_stats.counter += (count))
#endif /* ADVANSYS_STATS */ #endif /* ADVANSYS_STATS */
#define ASC_CEILING(val, unit) (((val) + ((unit) - 1))/(unit)) #define ASC_CEILING(val, unit) (((val) + ((unit) - 1))/(unit))
...@@ -2475,7 +2469,7 @@ typedef struct adv_req { ...@@ -2475,7 +2469,7 @@ typedef struct adv_req {
* of the 'Scsi_Host' structure starting at the 'hostdata' * of the 'Scsi_Host' structure starting at the 'hostdata'
* field. It is guaranteed to be allocated from DMA-able memory. * field. It is guaranteed to be allocated from DMA-able memory.
*/ */
typedef struct asc_board { struct asc_board {
struct device *dev; struct device *dev;
int id; /* Board Id */ int id; /* Board Id */
uint flags; /* Board flags */ uint flags; /* Board flags */
...@@ -2523,7 +2517,7 @@ typedef struct asc_board { ...@@ -2523,7 +2517,7 @@ typedef struct asc_board {
ushort bios_version; /* BIOS Version. */ ushort bios_version; /* BIOS Version. */
ushort bios_codeseg; /* BIOS Code Segment. */ ushort bios_codeseg; /* BIOS Code Segment. */
ushort bios_codelen; /* BIOS Code Segment Length. */ ushort bios_codelen; /* BIOS Code Segment Length. */
} asc_board_t; };
#define adv_dvc_to_board(adv_dvc) container_of(adv_dvc, struct asc_board, \ #define adv_dvc_to_board(adv_dvc) container_of(adv_dvc, struct asc_board, \
dvc_var.adv_dvc_var) dvc_var.adv_dvc_var)
...@@ -2543,9 +2537,7 @@ static int asc_dbglvl = 3; ...@@ -2543,9 +2537,7 @@ static int asc_dbglvl = 3;
*/ */
static void asc_prt_scsi_host(struct Scsi_Host *s) static void asc_prt_scsi_host(struct Scsi_Host *s)
{ {
asc_board_t *boardp; struct asc_board *boardp = shost_priv(s);
boardp = ASC_BOARDP(s);
printk("Scsi_Host at addr 0x%lx\n", (ulong)s); printk("Scsi_Host at addr 0x%lx\n", (ulong)s);
printk(" host_busy %u, host_no %d, last_reset %d,\n", printk(" host_busy %u, host_no %d, last_reset %d,\n",
...@@ -2561,11 +2553,11 @@ static void asc_prt_scsi_host(struct Scsi_Host *s) ...@@ -2561,11 +2553,11 @@ static void asc_prt_scsi_host(struct Scsi_Host *s)
s->cmd_per_lun, s->sg_tablesize, s->unchecked_isa_dma); s->cmd_per_lun, s->sg_tablesize, s->unchecked_isa_dma);
if (ASC_NARROW_BOARD(boardp)) { if (ASC_NARROW_BOARD(boardp)) {
asc_prt_asc_dvc_var(&ASC_BOARDP(s)->dvc_var.asc_dvc_var); asc_prt_asc_dvc_var(boardp->dvc_var.asc_dvc_var);
asc_prt_asc_dvc_cfg(&ASC_BOARDP(s)->dvc_cfg.asc_dvc_cfg); asc_prt_asc_dvc_cfg(boardp->dvc_cfg.asc_dvc_cfg);
} else { } else {
asc_prt_adv_dvc_var(&ASC_BOARDP(s)->dvc_var.adv_dvc_var); asc_prt_adv_dvc_var(boardp->dvc_var.adv_dvc_var);
asc_prt_adv_dvc_cfg(&ASC_BOARDP(s)->dvc_cfg.adv_dvc_cfg); asc_prt_adv_dvc_cfg(boardp->dvc_cfg.adv_dvc_cfg);
} }
} }
...@@ -2914,13 +2906,12 @@ static void asc_prt_hex(char *f, uchar *s, int l) ...@@ -2914,13 +2906,12 @@ static void asc_prt_hex(char *f, uchar *s, int l)
static const char *advansys_info(struct Scsi_Host *shost) static const char *advansys_info(struct Scsi_Host *shost)
{ {
static char info[ASC_INFO_SIZE]; static char info[ASC_INFO_SIZE];
asc_board_t *boardp; struct asc_board *boardp = shost_priv(shost);
ASC_DVC_VAR *asc_dvc_varp; ASC_DVC_VAR *asc_dvc_varp;
ADV_DVC_VAR *adv_dvc_varp; ADV_DVC_VAR *adv_dvc_varp;
char *busname; char *busname;
char *widename = NULL; char *widename = NULL;
boardp = ASC_BOARDP(shost);
if (ASC_NARROW_BOARD(boardp)) { if (ASC_NARROW_BOARD(boardp)) {
asc_dvc_varp = &boardp->dvc_var.asc_dvc_var; asc_dvc_varp = &boardp->dvc_var.asc_dvc_var;
ASC_DBG(1, "advansys_info: begin\n"); ASC_DBG(1, "advansys_info: begin\n");
...@@ -3032,14 +3023,13 @@ static int asc_prt_line(char *buf, int buflen, char *fmt, ...) ...@@ -3032,14 +3023,13 @@ static int asc_prt_line(char *buf, int buflen, char *fmt, ...)
*/ */
static int asc_prt_board_devices(struct Scsi_Host *shost, char *cp, int cplen) static int asc_prt_board_devices(struct Scsi_Host *shost, char *cp, int cplen)
{ {
asc_board_t *boardp; struct asc_board *boardp = shost_priv(shost);
int leftlen; int leftlen;
int totlen; int totlen;
int len; int len;
int chip_scsi_id; int chip_scsi_id;
int i; int i;
boardp = ASC_BOARDP(shost);
leftlen = cplen; leftlen = cplen;
totlen = len = 0; totlen = len = 0;
...@@ -3073,13 +3063,12 @@ static int asc_prt_board_devices(struct Scsi_Host *shost, char *cp, int cplen) ...@@ -3073,13 +3063,12 @@ static int asc_prt_board_devices(struct Scsi_Host *shost, char *cp, int cplen)
*/ */
static int asc_prt_adv_bios(struct Scsi_Host *shost, char *cp, int cplen) static int asc_prt_adv_bios(struct Scsi_Host *shost, char *cp, int cplen)
{ {
asc_board_t *boardp; struct asc_board *boardp = shost_priv(shost);
int leftlen; int leftlen;
int totlen; int totlen;
int len; int len;
ushort major, minor, letter; ushort major, minor, letter;
boardp = ASC_BOARDP(shost);
leftlen = cplen; leftlen = cplen;
totlen = len = 0; totlen = len = 0;
...@@ -3239,7 +3228,7 @@ static int asc_get_eeprom_string(ushort *serialnum, uchar *cp) ...@@ -3239,7 +3228,7 @@ static int asc_get_eeprom_string(ushort *serialnum, uchar *cp)
*/ */
static int asc_prt_asc_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen) static int asc_prt_asc_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen)
{ {
asc_board_t *boardp; struct asc_board *boardp = shost_priv(shost);
ASC_DVC_VAR *asc_dvc_varp; ASC_DVC_VAR *asc_dvc_varp;
int leftlen; int leftlen;
int totlen; int totlen;
...@@ -3251,7 +3240,6 @@ static int asc_prt_asc_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen ...@@ -3251,7 +3240,6 @@ static int asc_prt_asc_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen
#endif /* CONFIG_ISA */ #endif /* CONFIG_ISA */
uchar serialstr[13]; uchar serialstr[13];
boardp = ASC_BOARDP(shost);
asc_dvc_varp = &boardp->dvc_var.asc_dvc_var; asc_dvc_varp = &boardp->dvc_var.asc_dvc_var;
ep = &boardp->eep_config.asc_eep; ep = &boardp->eep_config.asc_eep;
...@@ -3373,7 +3361,7 @@ static int asc_prt_asc_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen ...@@ -3373,7 +3361,7 @@ static int asc_prt_asc_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen
*/ */
static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen) static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen)
{ {
asc_board_t *boardp; struct asc_board *boardp = shost_priv(shost);
ADV_DVC_VAR *adv_dvc_varp; ADV_DVC_VAR *adv_dvc_varp;
int leftlen; int leftlen;
int totlen; int totlen;
...@@ -3388,7 +3376,6 @@ static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen ...@@ -3388,7 +3376,6 @@ static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen
ushort *wordp; ushort *wordp;
ushort sdtr_speed = 0; ushort sdtr_speed = 0;
boardp = ASC_BOARDP(shost);
adv_dvc_varp = &boardp->dvc_var.adv_dvc_var; adv_dvc_varp = &boardp->dvc_var.adv_dvc_var;
if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) { if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
ep_3550 = &boardp->eep_config.adv_3550_eep; ep_3550 = &boardp->eep_config.adv_3550_eep;
...@@ -3660,14 +3647,12 @@ static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen ...@@ -3660,14 +3647,12 @@ static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen
*/ */
static int asc_prt_driver_conf(struct Scsi_Host *shost, char *cp, int cplen) static int asc_prt_driver_conf(struct Scsi_Host *shost, char *cp, int cplen)
{ {
asc_board_t *boardp; struct asc_board *boardp = shost_priv(shost);
int leftlen; int leftlen;
int totlen; int totlen;
int len; int len;
int chip_scsi_id; int chip_scsi_id;
boardp = ASC_BOARDP(shost);
leftlen = cplen; leftlen = cplen;
totlen = len = 0; totlen = len = 0;
...@@ -3724,7 +3709,7 @@ static int asc_prt_driver_conf(struct Scsi_Host *shost, char *cp, int cplen) ...@@ -3724,7 +3709,7 @@ static int asc_prt_driver_conf(struct Scsi_Host *shost, char *cp, int cplen)
*/ */
static int asc_prt_asc_board_info(struct Scsi_Host *shost, char *cp, int cplen) static int asc_prt_asc_board_info(struct Scsi_Host *shost, char *cp, int cplen)
{ {
asc_board_t *boardp; struct asc_board *boardp = shost_priv(shost);
int chip_scsi_id; int chip_scsi_id;
int leftlen; int leftlen;
int totlen; int totlen;
...@@ -3734,7 +3719,6 @@ static int asc_prt_asc_board_info(struct Scsi_Host *shost, char *cp, int cplen) ...@@ -3734,7 +3719,6 @@ static int asc_prt_asc_board_info(struct Scsi_Host *shost, char *cp, int cplen)
int i; int i;
int renegotiate = 0; int renegotiate = 0;
boardp = ASC_BOARDP(shost);
v = &boardp->dvc_var.asc_dvc_var; v = &boardp->dvc_var.asc_dvc_var;
c = &boardp->dvc_cfg.asc_dvc_cfg; c = &boardp->dvc_cfg.asc_dvc_cfg;
chip_scsi_id = c->chip_scsi_id; chip_scsi_id = c->chip_scsi_id;
...@@ -3912,7 +3896,7 @@ static int asc_prt_asc_board_info(struct Scsi_Host *shost, char *cp, int cplen) ...@@ -3912,7 +3896,7 @@ static int asc_prt_asc_board_info(struct Scsi_Host *shost, char *cp, int cplen)
*/ */
static int asc_prt_adv_board_info(struct Scsi_Host *shost, char *cp, int cplen) static int asc_prt_adv_board_info(struct Scsi_Host *shost, char *cp, int cplen)
{ {
asc_board_t *boardp; struct asc_board *boardp = shost_priv(shost);
int leftlen; int leftlen;
int totlen; int totlen;
int len; int len;
...@@ -3929,7 +3913,6 @@ static int asc_prt_adv_board_info(struct Scsi_Host *shost, char *cp, int cplen) ...@@ -3929,7 +3913,6 @@ static int asc_prt_adv_board_info(struct Scsi_Host *shost, char *cp, int cplen)
ushort period = 0; ushort period = 0;
int renegotiate = 0; int renegotiate = 0;
boardp = ASC_BOARDP(shost);
v = &boardp->dvc_var.adv_dvc_var; v = &boardp->dvc_var.adv_dvc_var;
c = &boardp->dvc_cfg.adv_dvc_cfg; c = &boardp->dvc_cfg.adv_dvc_cfg;
iop_base = v->iop_base; iop_base = v->iop_base;
...@@ -4192,17 +4175,11 @@ asc_proc_copy(off_t advoffset, off_t offset, char *curbuf, int leftlen, ...@@ -4192,17 +4175,11 @@ asc_proc_copy(off_t advoffset, off_t offset, char *curbuf, int leftlen,
*/ */
static int asc_prt_board_stats(struct Scsi_Host *shost, char *cp, int cplen) static int asc_prt_board_stats(struct Scsi_Host *shost, char *cp, int cplen)
{ {
int leftlen; struct asc_board *boardp = shost_priv(shost);
int totlen; struct asc_stats *s = &boardp->asc_stats;
int len;
struct asc_stats *s;
asc_board_t *boardp;
leftlen = cplen;
totlen = len = 0;
boardp = ASC_BOARDP(shost); int leftlen = cplen;
s = &boardp->asc_stats; int len, totlen = 0;
len = asc_prt_line(cp, leftlen, len = asc_prt_line(cp, leftlen,
"\nLinux Driver Statistics for AdvanSys SCSI Host %d:\n", "\nLinux Driver Statistics for AdvanSys SCSI Host %d:\n",
...@@ -4309,7 +4286,7 @@ static int ...@@ -4309,7 +4286,7 @@ static int
advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
off_t offset, int length, int inout) off_t offset, int length, int inout)
{ {
asc_board_t *boardp; struct asc_board *boardp = shost_priv(shost);
char *cp; char *cp;
int cplen; int cplen;
int cnt; int cnt;
...@@ -4323,16 +4300,13 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, ...@@ -4323,16 +4300,13 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
/* /*
* User write not supported. * User write not supported.
*/ */
if (inout == TRUE) { if (inout == TRUE)
return (-ENOSYS); return -ENOSYS;
}
/* /*
* User read of /proc/scsi/advansys/[0...] file. * User read of /proc/scsi/advansys/[0...] file.
*/ */
boardp = ASC_BOARDP(shost);
/* Copy read data starting at the beginning of the buffer. */ /* Copy read data starting at the beginning of the buffer. */
*start = buffer; *start = buffer;
curbuf = buffer; curbuf = buffer;
...@@ -4477,7 +4451,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start, ...@@ -4477,7 +4451,7 @@ advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
static void asc_scsi_done(struct scsi_cmnd *scp) static void asc_scsi_done(struct scsi_cmnd *scp)
{ {
struct asc_board *boardp = ASC_BOARDP(scp->device->host); struct asc_board *boardp = shost_priv(scp->device->host);
if (scp->use_sg) if (scp->use_sg)
dma_unmap_sg(boardp->dev, dma_unmap_sg(boardp->dev,
...@@ -8376,7 +8350,7 @@ static void adv_async_callback(ADV_DVC_VAR *adv_dvc_varp, uchar code) ...@@ -8376,7 +8350,7 @@ static void adv_async_callback(ADV_DVC_VAR *adv_dvc_varp, uchar code)
*/ */
static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp) static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)
{ {
asc_board_t *boardp; struct asc_board *boardp;
adv_req_t *reqp; adv_req_t *reqp;
adv_sgblk_t *sgblkp; adv_sgblk_t *sgblkp;
struct scsi_cmnd *scp; struct scsi_cmnd *scp;
...@@ -8420,7 +8394,7 @@ static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp) ...@@ -8420,7 +8394,7 @@ static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)
ASC_STATS(shost, callback); ASC_STATS(shost, callback);
ASC_DBG1(1, "adv_isr_callback: shost 0x%lx\n", (ulong)shost); ASC_DBG1(1, "adv_isr_callback: shost 0x%lx\n", (ulong)shost);
boardp = ASC_BOARDP(shost); boardp = shost_priv(shost);
BUG_ON(adv_dvc_varp != &boardp->dvc_var.adv_dvc_var); BUG_ON(adv_dvc_varp != &boardp->dvc_var.adv_dvc_var);
/* /*
...@@ -8825,7 +8799,7 @@ static int AscIsrChipHalted(ASC_DVC_VAR *asc_dvc) ...@@ -8825,7 +8799,7 @@ static int AscIsrChipHalted(ASC_DVC_VAR *asc_dvc)
uchar cur_dvc_qng; uchar cur_dvc_qng;
uchar asyn_sdtr; uchar asyn_sdtr;
uchar scsi_status; uchar scsi_status;
asc_board_t *boardp; struct asc_board *boardp;
BUG_ON(!asc_dvc->drv_ptr); BUG_ON(!asc_dvc->drv_ptr);
boardp = asc_dvc->drv_ptr; boardp = asc_dvc->drv_ptr;
...@@ -9346,7 +9320,7 @@ _AscCopyLramScsiDoneQ(PortAddr iop_base, ...@@ -9346,7 +9320,7 @@ _AscCopyLramScsiDoneQ(PortAddr iop_base,
*/ */
static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep) static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep)
{ {
asc_board_t *boardp; struct asc_board *boardp;
struct scsi_cmnd *scp; struct scsi_cmnd *scp;
struct Scsi_Host *shost; struct Scsi_Host *shost;
...@@ -9371,7 +9345,7 @@ static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep) ...@@ -9371,7 +9345,7 @@ static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep)
ASC_STATS(shost, callback); ASC_STATS(shost, callback);
ASC_DBG1(1, "asc_isr_callback: shost 0x%lx\n", (ulong)shost); ASC_DBG1(1, "asc_isr_callback: shost 0x%lx\n", (ulong)shost);
boardp = ASC_BOARDP(shost); boardp = shost_priv(shost);
BUG_ON(asc_dvc_varp != &boardp->dvc_var.asc_dvc_var); BUG_ON(asc_dvc_varp != &boardp->dvc_var.asc_dvc_var);
/* /*
...@@ -9727,7 +9701,7 @@ static int AscISR(ASC_DVC_VAR *asc_dvc) ...@@ -9727,7 +9701,7 @@ static int AscISR(ASC_DVC_VAR *asc_dvc)
static int advansys_reset(struct scsi_cmnd *scp) static int advansys_reset(struct scsi_cmnd *scp)
{ {
struct Scsi_Host *shost = scp->device->host; struct Scsi_Host *shost = scp->device->host;
struct asc_board *boardp = ASC_BOARDP(shost); struct asc_board *boardp = shost_priv(shost);
unsigned long flags; unsigned long flags;
int status; int status;
int ret = SUCCESS; int ret = SUCCESS;
...@@ -9810,11 +9784,10 @@ static int ...@@ -9810,11 +9784,10 @@ static int
advansys_biosparam(struct scsi_device *sdev, struct block_device *bdev, advansys_biosparam(struct scsi_device *sdev, struct block_device *bdev,
sector_t capacity, int ip[]) sector_t capacity, int ip[])
{ {
asc_board_t *boardp; struct asc_board *boardp = shost_priv(sdev->host);
ASC_DBG(1, "advansys_biosparam: begin\n"); ASC_DBG(1, "advansys_biosparam: begin\n");
ASC_STATS(sdev->host, biosparam); ASC_STATS(sdev->host, biosparam);
boardp = ASC_BOARDP(sdev->host);
if (ASC_NARROW_BOARD(boardp)) { if (ASC_NARROW_BOARD(boardp)) {
if ((boardp->dvc_var.asc_dvc_var.dvc_cntl & if ((boardp->dvc_var.asc_dvc_var.dvc_cntl &
ASC_CNTL_BIOS_GT_1GB) && capacity > 0x200000) { ASC_CNTL_BIOS_GT_1GB) && capacity > 0x200000) {
...@@ -9848,7 +9821,7 @@ static irqreturn_t advansys_interrupt(int irq, void *dev_id) ...@@ -9848,7 +9821,7 @@ static irqreturn_t advansys_interrupt(int irq, void *dev_id)
{ {
unsigned long flags; unsigned long flags;
struct Scsi_Host *shost = dev_id; struct Scsi_Host *shost = dev_id;
asc_board_t *boardp = ASC_BOARDP(shost); struct asc_board *boardp = shost_priv(shost);
irqreturn_t result = IRQ_NONE; irqreturn_t result = IRQ_NONE;
ASC_DBG1(2, "advansys_interrupt: boardp 0x%p\n", boardp); ASC_DBG1(2, "advansys_interrupt: boardp 0x%p\n", boardp);
...@@ -10110,7 +10083,7 @@ advansys_wide_slave_configure(struct scsi_device *sdev, ADV_DVC_VAR *adv_dvc) ...@@ -10110,7 +10083,7 @@ advansys_wide_slave_configure(struct scsi_device *sdev, ADV_DVC_VAR *adv_dvc)
*/ */
static int advansys_slave_configure(struct scsi_device *sdev) static int advansys_slave_configure(struct scsi_device *sdev)
{ {
asc_board_t *boardp = ASC_BOARDP(sdev->host); struct asc_board *boardp = shost_priv(sdev->host);
if (ASC_NARROW_BOARD(boardp)) if (ASC_NARROW_BOARD(boardp))
advansys_narrow_slave_configure(sdev, advansys_narrow_slave_configure(sdev,
...@@ -10122,7 +10095,7 @@ static int advansys_slave_configure(struct scsi_device *sdev) ...@@ -10122,7 +10095,7 @@ static int advansys_slave_configure(struct scsi_device *sdev)
return 0; return 0;
} }
static int asc_build_req(asc_board_t *boardp, struct scsi_cmnd *scp, static int asc_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,
struct asc_scsi_q *asc_scsi_q) struct asc_scsi_q *asc_scsi_q)
{ {
memset(asc_scsi_q, 0, sizeof(*asc_scsi_q)); memset(asc_scsi_q, 0, sizeof(*asc_scsi_q));
...@@ -10257,7 +10230,7 @@ static int asc_build_req(asc_board_t *boardp, struct scsi_cmnd *scp, ...@@ -10257,7 +10230,7 @@ static int asc_build_req(asc_board_t *boardp, struct scsi_cmnd *scp,
* ADV_ERROR(-1) - SG List creation failed * ADV_ERROR(-1) - SG List creation failed
*/ */
static int static int
adv_get_sglist(asc_board_t *boardp, adv_req_t *reqp, struct scsi_cmnd *scp, adv_get_sglist(struct asc_board *boardp, adv_req_t *reqp, struct scsi_cmnd *scp,
int use_sg) int use_sg)
{ {
adv_sgblk_t *sgblkp; adv_sgblk_t *sgblkp;
...@@ -10367,7 +10340,7 @@ adv_get_sglist(asc_board_t *boardp, adv_req_t *reqp, struct scsi_cmnd *scp, ...@@ -10367,7 +10340,7 @@ adv_get_sglist(asc_board_t *boardp, adv_req_t *reqp, struct scsi_cmnd *scp,
* to little-endian order. * to little-endian order.
*/ */
static int static int
adv_build_req(asc_board_t *boardp, struct scsi_cmnd *scp, adv_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,
ADV_SCSI_REQ_Q **adv_scsiqpp) ADV_SCSI_REQ_Q **adv_scsiqpp)
{ {
adv_req_t *reqp; adv_req_t *reqp;
...@@ -11255,7 +11228,7 @@ static int AdvExeScsiQueue(ADV_DVC_VAR *asc_dvc, ADV_SCSI_REQ_Q *scsiq) ...@@ -11255,7 +11228,7 @@ static int AdvExeScsiQueue(ADV_DVC_VAR *asc_dvc, ADV_SCSI_REQ_Q *scsiq)
static int asc_execute_scsi_cmnd(struct scsi_cmnd *scp) static int asc_execute_scsi_cmnd(struct scsi_cmnd *scp)
{ {
int ret, err_code; int ret, err_code;
asc_board_t *boardp = ASC_BOARDP(scp->device->host); struct asc_board *boardp = shost_priv(scp->device->host);
ASC_DBG1(1, "asc_execute_scsi_cmnd: scp 0x%p\n", scp); ASC_DBG1(1, "asc_execute_scsi_cmnd: scp 0x%p\n", scp);
...@@ -11346,7 +11319,7 @@ static int ...@@ -11346,7 +11319,7 @@ static int
advansys_queuecommand(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *)) advansys_queuecommand(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *))
{ {
struct Scsi_Host *shost = scp->device->host; struct Scsi_Host *shost = scp->device->host;
asc_board_t *boardp = ASC_BOARDP(shost); struct asc_board *boardp = shost_priv(shost);
unsigned long flags; unsigned long flags;
int asc_res, result = 0; int asc_res, result = 0;
...@@ -12094,7 +12067,7 @@ static ushort __devinit AscInitFromEEP(ASC_DVC_VAR *asc_dvc) ...@@ -12094,7 +12067,7 @@ static ushort __devinit AscInitFromEEP(ASC_DVC_VAR *asc_dvc)
return (warn_code); return (warn_code);
} }
static int __devinit AscInitGetConfig(asc_board_t *boardp) static int __devinit AscInitGetConfig(struct asc_board *boardp)
{ {
ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var; ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var;
unsigned short warn_code = 0; unsigned short warn_code = 0;
...@@ -12151,7 +12124,7 @@ static int __devinit AscInitGetConfig(asc_board_t *boardp) ...@@ -12151,7 +12124,7 @@ static int __devinit AscInitGetConfig(asc_board_t *boardp)
return asc_dvc->err_code; return asc_dvc->err_code;
} }
static int __devinit AscInitSetConfig(struct pci_dev *pdev, asc_board_t *boardp) static int __devinit AscInitSetConfig(struct pci_dev *pdev, struct asc_board *boardp)
{ {
ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var; ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var;
PortAddr iop_base = asc_dvc->iop_base; PortAddr iop_base = asc_dvc->iop_base;
...@@ -13548,7 +13521,7 @@ static int __devinit AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc) ...@@ -13548,7 +13521,7 @@ static int __devinit AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc)
* then 0 is returned. * then 0 is returned.
*/ */
static int __devinit static int __devinit
AdvInitGetConfig(struct pci_dev *pdev, asc_board_t *boardp) AdvInitGetConfig(struct pci_dev *pdev, struct asc_board *boardp)
{ {
ADV_DVC_VAR *asc_dvc = &boardp->dvc_var.adv_dvc_var; ADV_DVC_VAR *asc_dvc = &boardp->dvc_var.adv_dvc_var;
unsigned short warn_code = 0; unsigned short warn_code = 0;
...@@ -13660,7 +13633,7 @@ static struct scsi_host_template advansys_template = { ...@@ -13660,7 +13633,7 @@ static struct scsi_host_template advansys_template = {
}; };
static int __devinit static int __devinit
advansys_wide_init_chip(asc_board_t *boardp, ADV_DVC_VAR *adv_dvc_varp) advansys_wide_init_chip(struct asc_board *boardp, ADV_DVC_VAR *adv_dvc_varp)
{ {
int req_cnt = 0; int req_cnt = 0;
adv_req_t *reqp = NULL; adv_req_t *reqp = NULL;
...@@ -13764,7 +13737,7 @@ advansys_wide_init_chip(asc_board_t *boardp, ADV_DVC_VAR *adv_dvc_varp) ...@@ -13764,7 +13737,7 @@ advansys_wide_init_chip(asc_board_t *boardp, ADV_DVC_VAR *adv_dvc_varp)
return err_code; return err_code;
} }
static void advansys_wide_free_mem(asc_board_t *boardp) static void advansys_wide_free_mem(struct asc_board *boardp)
{ {
kfree(boardp->carrp); kfree(boardp->carrp);
boardp->carrp = NULL; boardp->carrp = NULL;
...@@ -13781,12 +13754,11 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost, ...@@ -13781,12 +13754,11 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
unsigned int iop, int bus_type) unsigned int iop, int bus_type)
{ {
struct pci_dev *pdev; struct pci_dev *pdev;
asc_board_t *boardp; struct asc_board *boardp = shost_priv(shost);
ASC_DVC_VAR *asc_dvc_varp = NULL; ASC_DVC_VAR *asc_dvc_varp = NULL;
ADV_DVC_VAR *adv_dvc_varp = NULL; ADV_DVC_VAR *adv_dvc_varp = NULL;
int share_irq, warn_code, ret; int share_irq, warn_code, ret;
boardp = ASC_BOARDP(shost);
boardp->id = asc_board_count++; boardp->id = asc_board_count++;
spin_lock_init(&boardp->lock); spin_lock_init(&boardp->lock);
pdev = (bus_type == ASC_IS_PCI) ? to_pci_dev(boardp->dev) : NULL; pdev = (bus_type == ASC_IS_PCI) ? to_pci_dev(boardp->dev) : NULL;
...@@ -14282,11 +14254,9 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost, ...@@ -14282,11 +14254,9 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
*/ */
static int advansys_release(struct Scsi_Host *shost) static int advansys_release(struct Scsi_Host *shost)
{ {
asc_board_t *boardp; struct asc_board *boardp = shost_priv(shost);
ASC_DBG(1, "advansys_release: begin\n"); ASC_DBG(1, "advansys_release: begin\n");
scsi_remove_host(shost); scsi_remove_host(shost);
boardp = ASC_BOARDP(shost);
free_irq(boardp->irq, shost); free_irq(boardp->irq, shost);
if (shost->dma_channel != NO_ISA_DMA) { if (shost->dma_channel != NO_ISA_DMA) {
ASC_DBG(1, "advansys_release: free_dma()\n"); ASC_DBG(1, "advansys_release: free_dma()\n");
...@@ -14348,7 +14318,7 @@ static int __devinit advansys_isa_probe(struct device *dev, unsigned int id) ...@@ -14348,7 +14318,7 @@ static int __devinit advansys_isa_probe(struct device *dev, unsigned int id)
if (!shost) if (!shost)
goto release_region; goto release_region;
board = ASC_BOARDP(shost); board = shost_priv(shost);
board->irq = advansys_isa_irq_no(iop_base); board->irq = advansys_isa_irq_no(iop_base);
board->dev = dev; board->dev = dev;
...@@ -14431,7 +14401,7 @@ static int __devinit advansys_vlb_probe(struct device *dev, unsigned int id) ...@@ -14431,7 +14401,7 @@ static int __devinit advansys_vlb_probe(struct device *dev, unsigned int id)
if (!shost) if (!shost)
goto release_region; goto release_region;
board = ASC_BOARDP(shost); board = shost_priv(shost);
board->irq = advansys_vlb_irq_no(iop_base); board->irq = advansys_vlb_irq_no(iop_base);
board->dev = dev; board->dev = dev;
...@@ -14538,7 +14508,7 @@ static int __devinit advansys_eisa_probe(struct device *dev) ...@@ -14538,7 +14508,7 @@ static int __devinit advansys_eisa_probe(struct device *dev)
if (!shost) if (!shost)
goto release_region; goto release_region;
board = ASC_BOARDP(shost); board = shost_priv(shost);
board->irq = irq; board->irq = irq;
board->dev = dev; board->dev = dev;
...@@ -14654,7 +14624,7 @@ advansys_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -14654,7 +14624,7 @@ advansys_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (!shost) if (!shost)
goto release_region; goto release_region;
board = ASC_BOARDP(shost); board = shost_priv(shost);
board->irq = pdev->irq; board->irq = pdev->irq;
board->dev = &pdev->dev; board->dev = &pdev->dev;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册