X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Ffc4%2Ffc.c;h=22b62b3cd14e5538f3b8e273c525c5586154b784;hb=refs%2Fheads%2Fvserver;hp=2329dd0e49ced3e2f98c6bb408484a7d54926634;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/drivers/fc4/fc.c b/drivers/fc4/fc.c index 2329dd0e4..22b62b3cd 100644 --- a/drivers/fc4/fc.c +++ b/drivers/fc4/fc.c @@ -38,7 +38,7 @@ #include #include #include "fcp_impl.h" -#include "../scsi/hosts.h" +#include /* #define FCDEBUG */ @@ -59,8 +59,6 @@ #define dma_unmap_single(d,h,s,dir) sbus_unmap_single(d,h,s,dir) #define dma_map_sg(d,s,n,dir) sbus_map_sg(d,s,n,dir) #define dma_unmap_sg(d,s,n,dir) sbus_unmap_sg(d,s,n,dir) -#define scsi_to_fc_dma_dir(dir) scsi_to_sbus_dma_dir(dir) -#define FC_DMA_BIDIRECTIONAL SBUS_DMA_BIDIRECTIONAL #else #define dma_alloc_consistent(d,s,p) pci_alloc_consistent(d,s,p) #define dma_free_consistent(d,s,v,h) pci_free_consistent(d,s,v,h) @@ -68,15 +66,13 @@ #define dma_unmap_single(d,h,s,dir) pci_unmap_single(d,h,s,dir) #define dma_map_sg(d,s,n,dir) pci_map_sg(d,s,n,dir) #define dma_unmap_sg(d,s,n,dir) pci_unmap_sg(d,s,n,dir) -#define scsi_to_fc_dma_dir(dir) scsi_to_pci_dma_dir(dir) -#define FC_DMA_BIDIRECTIONAL PCI_DMA_BIDIRECTIONAL #endif #define FCP_CMND(SCpnt) ((fcp_cmnd *)&(SCpnt->SCp)) #define FC_SCMND(SCpnt) ((fc_channel *)(SCpnt->device->host->hostdata[0])) -#define SC_FCMND(fcmnd) ((Scsi_Cmnd *)((long)fcmnd - (long)&(((Scsi_Cmnd *)0)->SCp))) +#define SC_FCMND(fcmnd) ((struct scsi_cmnd *)((long)fcmnd - (long)&(((struct scsi_cmnd *)0)->SCp))) -static int fcp_scsi_queue_it(fc_channel *, Scsi_Cmnd *, fcp_cmnd *, int); +static int fcp_scsi_queue_it(fc_channel *, struct scsi_cmnd *, fcp_cmnd *, int); void fcp_queue_empty(fc_channel *); static void fcp_scsi_insert_queue (fc_channel *fc, fcp_cmnd *fcmd) @@ -167,7 +163,7 @@ static void fcp_login_done(fc_channel *fc, int i, int status) fcmd = l->fcmds + i; plogi = l->logi + 3 * i; dma_unmap_single (fc->dev, fcmd->cmd, 3 * sizeof(logi), - FC_DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); plogi->code = LS_PLOGI; memcpy (&plogi->nport_wwn, &fc->wwn_nport, sizeof(fc_wwn)); memcpy (&plogi->node_wwn, &fc->wwn_node, sizeof(fc_wwn)); @@ -188,7 +184,7 @@ static void fcp_login_done(fc_channel *fc, int i, int status) } #endif fcmd->cmd = dma_map_single (fc->dev, plogi, 3 * sizeof(logi), - FC_DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); fcmd->rsp = fcmd->cmd + 2 * sizeof(logi); if (fc->hw_enque (fc, fcmd)) printk ("FC: Cannot enque PLOGI packet on %s\n", fc->name); @@ -212,7 +208,7 @@ static void fcp_login_done(fc_channel *fc, int i, int status) case FC_STATUS_OK: plogi = l->logi + 3 * i; dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), - FC_DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); if (!fc->wwn_dest.lo && !fc->wwn_dest.hi) { memcpy (&fc->wwn_dest, &plogi[1].node_wwn, sizeof(fc_wwn)); FCD(("Dest WWN %08x%08x\n", *(u32 *)&fc->wwn_dest, fc->wwn_dest.lo)) @@ -231,7 +227,7 @@ static void fcp_login_done(fc_channel *fc, int i, int status) case FC_STATUS_ERR_OFFLINE: fc->state = FC_STATE_OFFLINE; dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), - FC_DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); printk ("%s: FC is offline\n", fc->name); if (atomic_dec_and_test (&l->todo)) up(&l->sem); @@ -256,7 +252,7 @@ static void fcp_report_map_done(fc_channel *fc, int i, int status) switch (status) { case FC_STATUS_OK: /* Ok, let's have a fun on a loop */ dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), - FC_DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); p = (fc_al_posmap *)(l->logi + 3 * i); #ifdef FCDEBUG { @@ -270,13 +266,12 @@ static void fcp_report_map_done(fc_channel *fc, int i, int status) printk ("FC: Bad magic from REPORT_AL_MAP on %s - %08x\n", fc->name, p->magic); fc->state = FC_STATE_OFFLINE; } else { - fc->posmap = (fcp_posmap *)kmalloc(sizeof(fcp_posmap)+p->len, GFP_KERNEL); + fc->posmap = kzalloc(sizeof(fcp_posmap)+p->len, GFP_KERNEL); if (!fc->posmap) { printk("FC: Not enough memory, offlining channel\n"); fc->state = FC_STATE_OFFLINE; } else { int k; - memset(fc->posmap, 0, sizeof(fcp_posmap)+p->len); /* FIXME: This is where SOCAL transfers our AL-PA. Keep it here till we found out what other cards do... */ fc->sid = (p->magic & 0xff); @@ -306,7 +301,7 @@ static void fcp_report_map_done(fc_channel *fc, int i, int status) FCD(("SID %d DID %d\n", fc->sid, fc->did)) fcmd = l->fcmds + i; dma_unmap_single(fc->dev, fcmd->cmd, 3 * sizeof(logi), - FC_DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); fch = &fcmd->fch; memset(l->logi + 3 * i, 0, 3 * sizeof(logi)); FILL_FCHDR_RCTL_DID(fch, R_CTL_ELS_REQ, FS_FABRIC_F_PORT); @@ -317,7 +312,7 @@ static void fcp_report_map_done(fc_channel *fc, int i, int status) fch->param = 0; l->logi [3 * i].code = LS_FLOGI; fcmd->cmd = dma_map_single (fc->dev, l->logi + 3 * i, 3 * sizeof(logi), - FC_DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); fcmd->rsp = fcmd->cmd + sizeof(logi); fcmd->cmdlen = sizeof(logi); fcmd->rsplen = sizeof(logi); @@ -355,20 +350,19 @@ void fcp_register(fc_channel *fc, u8 type, int unregister) fc->dma_scsi_rsp = fc->dma_scsi_cmd + slots * sizeof (fcp_cmd); fc->scsi_bitmap_end = (slots + 63) & ~63; size = fc->scsi_bitmap_end / 8; - fc->scsi_bitmap = kmalloc (size, GFP_KERNEL); - memset (fc->scsi_bitmap, 0, size); + fc->scsi_bitmap = kzalloc (size, GFP_KERNEL); set_bit (0, fc->scsi_bitmap); for (i = fc->can_queue; i < fc->scsi_bitmap_end; i++) set_bit (i, fc->scsi_bitmap); fc->scsi_free = fc->can_queue; - fc->cmd_slots = (fcp_cmnd **)kmalloc(slots * sizeof(fcp_cmnd*), GFP_KERNEL); - memset(fc->cmd_slots, 0, slots * sizeof(fcp_cmnd*)); + fc->cmd_slots = kzalloc(slots * sizeof(fcp_cmnd*), GFP_KERNEL); fc->abort_count = 0; } else { fc->scsi_name[0] = 0; kfree (fc->scsi_bitmap); kfree (fc->cmd_slots); FCND(("Unregistering\n")); +#if 0 if (fc->rst_pkt) { if (fc->rst_pkt->eh_state == SCSI_STATE_UNUSED) kfree(fc->rst_pkt); @@ -377,20 +371,21 @@ void fcp_register(fc_channel *fc, u8 type, int unregister) printk("FC: Reset in progress. Now?!"); } } +#endif FCND(("Unregistered\n")); } } else printk ("FC: %segistering unknown type %02x\n", unregister ? "Unr" : "R", type); } -static void fcp_scsi_done(Scsi_Cmnd *SCpnt); +static void fcp_scsi_done(struct scsi_cmnd *SCpnt); static inline void fcp_scsi_receive(fc_channel *fc, int token, int status, fc_hdr *fch) { fcp_cmnd *fcmd; fcp_rsp *rsp; int host_status; - Scsi_Cmnd *SCpnt; + struct scsi_cmnd *SCpnt; int sense_len; int rsp_status; @@ -434,11 +429,12 @@ static inline void fcp_scsi_receive(fc_channel *fc, int token, int status, fc_hd if (fcmd->data) { if (SCpnt->use_sg) - dma_unmap_sg(fc->dev, (struct scatterlist *)SCpnt->buffer, SCpnt->use_sg, - scsi_to_fc_dma_dir(SCpnt->sc_data_direction)); + dma_unmap_sg(fc->dev, (struct scatterlist *)SCpnt->request_buffer, + SCpnt->use_sg, + SCpnt->sc_data_direction); else dma_unmap_single(fc->dev, fcmd->data, SCpnt->request_bufflen, - scsi_to_fc_dma_dir(SCpnt->sc_data_direction)); + SCpnt->sc_data_direction); } break; default: @@ -542,12 +538,11 @@ int fcp_initialize(fc_channel *fcchain, int count) FCND(("fcp_inititialize %08lx\n", (long)fcp_init)) FCND(("fc_channels %08lx\n", (long)fc_channels)) FCND((" SID %d DID %d\n", fcchain->sid, fcchain->did)) - l = kmalloc(sizeof (ls) + count, GFP_KERNEL); + l = kzalloc(sizeof (ls) + count, GFP_KERNEL); if (!l) { printk ("FC: Cannot allocate memory for initialization\n"); return -ENOMEM; } - memset (l, 0, sizeof(ls) + count); l->magic = LSMAGIC; l->count = count; FCND(("FCP Init for %d channels\n", count)) @@ -556,17 +551,15 @@ int fcp_initialize(fc_channel *fcchain, int count) l->timer.function = fcp_login_timeout; l->timer.data = (unsigned long)l; atomic_set (&l->todo, count); - l->logi = kmalloc (count * 3 * sizeof(logi), GFP_KERNEL); - l->fcmds = kmalloc (count * sizeof(fcp_cmnd), GFP_KERNEL); + l->logi = kzalloc (count * 3 * sizeof(logi), GFP_KERNEL); + l->fcmds = kzalloc (count * sizeof(fcp_cmnd), GFP_KERNEL); if (!l->logi || !l->fcmds) { - if (l->logi) kfree (l->logi); - if (l->fcmds) kfree (l->fcmds); + kfree (l->logi); + kfree (l->fcmds); kfree (l); printk ("FC: Cannot allocate DMA memory for initialization\n"); return -ENOMEM; } - memset (l->logi, 0, count * 3 * sizeof(logi)); - memset (l->fcmds, 0, count * sizeof(fcp_cmnd)); for (fc = fcchain, i = 0; fc && i < count; fc = fc->next, i++) { fc->state = FC_STATE_UNINITED; fc->rst_pkt = NULL; /* kmalloc when first used */ @@ -579,7 +572,7 @@ int fcp_initialize(fc_channel *fcchain, int count) fc->ls = (void *)l; /* Assumes sizeof(fc_al_posmap) < 3 * sizeof(logi), which is true */ fcmd->cmd = dma_map_single (fc->dev, l->logi + 3 * i, 3 * sizeof(logi), - FC_DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); fcmd->proto = PROTO_REPORT_AL_MAP; fcmd->token = i; fcmd->fc = fc; @@ -598,7 +591,7 @@ int fcp_initialize(fc_channel *fcchain, int count) } else { fc->state = FC_STATE_OFFLINE; enable_irq(fc->irq); - dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), FC_DMA_BIDIRECTIONAL); + dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), DMA_BIDIRECTIONAL); if (atomic_dec_and_test (&l->todo)) goto all_done; } @@ -615,7 +608,7 @@ int fcp_initialize(fc_channel *fcchain, int count) FCD(("SID %d DID %d\n", fc->sid, fc->did)) fcmd = l->fcmds + i; - dma_unmap_single(fc->dev, fcmd->cmd, 3 * sizeof(logi), FC_DMA_BIDIRECTIONAL); + dma_unmap_single(fc->dev, fcmd->cmd, 3 * sizeof(logi), DMA_BIDIRECTIONAL); fch = &fcmd->fch; FILL_FCHDR_RCTL_DID(fch, R_CTL_ELS_REQ, FS_FABRIC_F_PORT); FILL_FCHDR_SID(fch, 0); @@ -624,7 +617,7 @@ int fcp_initialize(fc_channel *fcchain, int count) FILL_FCHDR_OXRX(fch, 0xffff, 0xffff); fch->param = 0; l->logi [3 * i].code = LS_FLOGI; - fcmd->cmd = dma_map_single (fc->dev, l->logi + 3 * i, 3 * sizeof(logi), FC_DMA_BIDIRECTIONAL); + fcmd->cmd = dma_map_single (fc->dev, l->logi + 3 * i, 3 * sizeof(logi), DMA_BIDIRECTIONAL); fcmd->rsp = fcmd->cmd + sizeof(logi); fcmd->cmdlen = sizeof(logi); fcmd->rsplen = sizeof(logi); @@ -652,7 +645,7 @@ all_done: switch (fc->state) { case FC_STATE_ONLINE: break; case FC_STATE_OFFLINE: break; - default: dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), FC_DMA_BIDIRECTIONAL); + default: dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), DMA_BIDIRECTIONAL); break; } } @@ -679,13 +672,11 @@ int fcp_forceoffline(fc_channel *fcchain, int count) l.timer.function = fcp_login_timeout; l.timer.data = (unsigned long)&l; atomic_set (&l.todo, count); - l.fcmds = kmalloc (count * sizeof(fcp_cmnd), GFP_KERNEL); + l.fcmds = kzalloc (count * sizeof(fcp_cmnd), GFP_KERNEL); if (!l.fcmds) { - kfree (l.fcmds); printk ("FC: Cannot allocate memory for forcing offline\n"); return -ENOMEM; } - memset (l.fcmds, 0, count * sizeof(fcp_cmnd)); FCND(("Initializing OFFLINE packets\n")) for (fc = fcchain, i = 0; fc && i < count; fc = fc->next, i++) { fc->state = FC_STATE_UNINITED; @@ -766,17 +757,14 @@ void fcp_release(fc_channel *fcchain, int count) /* count must > 0 */ } -static void fcp_scsi_done (Scsi_Cmnd *SCpnt) +static void fcp_scsi_done(struct scsi_cmnd *SCpnt) { - unsigned long flags; - - spin_lock_irqsave(SCpnt->device->host->host_lock, flags); if (FCP_CMND(SCpnt)->done) FCP_CMND(SCpnt)->done(SCpnt); - spin_unlock_irqrestore(SCpnt->device->host->host_lock, flags); } -static int fcp_scsi_queue_it(fc_channel *fc, Scsi_Cmnd *SCpnt, fcp_cmnd *fcmd, int prepare) +static int fcp_scsi_queue_it(fc_channel *fc, struct scsi_cmnd *SCpnt, + fcp_cmnd *fcmd, int prepare) { long i; fcp_cmd *cmd; @@ -821,14 +809,14 @@ static int fcp_scsi_queue_it(fc_channel *fc, Scsi_Cmnd *SCpnt, fcp_cmnd *fcmd, i cmd->fcp_data_len = SCpnt->request_bufflen; fcmd->data = dma_map_single (fc->dev, (char *)SCpnt->request_buffer, SCpnt->request_bufflen, - scsi_to_fc_dma_dir(SCpnt->sc_data_direction)); + SCpnt->sc_data_direction); } else { - struct scatterlist *sg = (struct scatterlist *)SCpnt->buffer; + struct scatterlist *sg = (struct scatterlist *)SCpnt->request_buffer; int nents; FCD(("XXX: Use_sg %d %d\n", SCpnt->use_sg, sg->length)) nents = dma_map_sg (fc->dev, sg, SCpnt->use_sg, - scsi_to_fc_dma_dir(SCpnt->sc_data_direction)); + SCpnt->sc_data_direction); if (nents > 1) printk ("%s: SG for nents %d (use_sg %d) not handled yet\n", fc->name, nents, SCpnt->use_sg); fcmd->data = sg_dma_address(sg); cmd->fcp_data_len = sg_dma_len(sg); @@ -850,7 +838,8 @@ static int fcp_scsi_queue_it(fc_channel *fc, Scsi_Cmnd *SCpnt, fcp_cmnd *fcmd, i return 0; } -int fcp_scsi_queuecommand(Scsi_Cmnd *SCpnt, void (* done)(Scsi_Cmnd *)) +int fcp_scsi_queuecommand(struct scsi_cmnd *SCpnt, + void (* done)(struct scsi_cmnd *)) { fcp_cmnd *fcmd = FCP_CMND(SCpnt); fc_channel *fc = FC_SCMND(SCpnt); @@ -886,7 +875,7 @@ void fcp_queue_empty(fc_channel *fc) } } -int fcp_scsi_abort(Scsi_Cmnd *SCpnt) +int fcp_scsi_abort(struct scsi_cmnd *SCpnt) { /* Internal bookkeeping only. Lose 1 cmd_slots slot. */ fcp_cmnd *fcmd = FCP_CMND(SCpnt); @@ -912,12 +901,8 @@ int fcp_scsi_abort(Scsi_Cmnd *SCpnt) */ if (++fc->abort_count < (fc->can_queue >> 1)) { - unsigned long flags; - SCpnt->result = DID_ABORT; - spin_lock_irqsave(SCpnt->device->host->host_lock, flags); fcmd->done(SCpnt); - spin_unlock_irqrestore(SCpnt->device->host->host_lock, flags); printk("FC: soft abort\n"); return SUCCESS; } else { @@ -926,25 +911,29 @@ int fcp_scsi_abort(Scsi_Cmnd *SCpnt) } } -void fcp_scsi_reset_done(Scsi_Cmnd *SCpnt) +#if 0 +void fcp_scsi_reset_done(struct scsi_cmnd *SCpnt) { fc_channel *fc = FC_SCMND(SCpnt); fc->rst_pkt->eh_state = SCSI_STATE_FINISHED; up(fc->rst_pkt->device->host->eh_action); } +#endif #define FCP_RESET_TIMEOUT (2*HZ) -int fcp_scsi_dev_reset(Scsi_Cmnd *SCpnt) +int fcp_scsi_dev_reset(struct scsi_cmnd *SCpnt) { +#if 0 /* broken junk, but if davem wants to compile this driver, let him.. */ + unsigned long flags; fcp_cmd *cmd; fcp_cmnd *fcmd; fc_channel *fc = FC_SCMND(SCpnt); DECLARE_MUTEX_LOCKED(sem); if (!fc->rst_pkt) { - fc->rst_pkt = (Scsi_Cmnd *) kmalloc(sizeof(SCpnt), GFP_KERNEL); + fc->rst_pkt = kmalloc(sizeof(SCpnt), GFP_KERNEL); if (!fc->rst_pkt) return FAILED; fcmd = FCP_CMND(fc->rst_pkt); @@ -987,10 +976,12 @@ int fcp_scsi_dev_reset(Scsi_Cmnd *SCpnt) */ fc->rst_pkt->device->host->eh_action = &sem; - fc->rst_pkt->request->rq_status = RQ_SCSI_BUSY; fc->rst_pkt->done = fcp_scsi_reset_done; + + spin_lock_irqsave(SCpnt->device->host->host_lock, flags); fcp_scsi_queue_it(fc, fc->rst_pkt, fcmd, 0); + spin_unlock_irqrestore(SCpnt->device->host->host_lock, flags); down(&sem); @@ -1006,16 +997,11 @@ int fcp_scsi_dev_reset(Scsi_Cmnd *SCpnt) return FAILED; } fc->rst_pkt->eh_state = SCSI_STATE_UNUSED; +#endif return SUCCESS; } -int fcp_scsi_bus_reset(Scsi_Cmnd *SCpnt) -{ - printk ("FC: bus reset!\n"); - return FAILED; -} - -int fcp_scsi_host_reset(Scsi_Cmnd *SCpnt) +static int __fcp_scsi_host_reset(struct scsi_cmnd *SCpnt) { fc_channel *fc = FC_SCMND(SCpnt); fcp_cmnd *fcmd = FCP_CMND(SCpnt); @@ -1036,6 +1022,18 @@ int fcp_scsi_host_reset(Scsi_Cmnd *SCpnt) else return FAILED; } +int fcp_scsi_host_reset(struct scsi_cmnd *SCpnt) +{ + unsigned long flags; + int rc; + + spin_lock_irqsave(SCpnt->device->host->host_lock, flags); + rc = __fcp_scsi_host_reset(SCpnt); + spin_unlock_irqrestore(SCpnt->device->host->host_lock, flags); + + return rc; +} + static int fcp_els_queue_it(fc_channel *fc, fcp_cmnd *fcmd) { long i; @@ -1056,7 +1054,7 @@ static int fc_do_els(fc_channel *fc, unsigned int alpa, void *data, int len) int i; fcmd = &_fcmd; - memset(fcmd, 0, sizeof(fcmd)); + memset(fcmd, 0, sizeof(fcp_cmnd)); FCD(("PLOGI SID %d DID %d\n", fc->sid, alpa)) fch = &fcmd->fch; FILL_FCHDR_RCTL_DID(fch, R_CTL_ELS_REQ, alpa); @@ -1065,7 +1063,7 @@ static int fc_do_els(fc_channel *fc, unsigned int alpa, void *data, int len) FILL_FCHDR_SEQ_DF_SEQ(fch, 0, 0, 0); FILL_FCHDR_OXRX(fch, 0xffff, 0xffff); fch->param = 0; - fcmd->cmd = dma_map_single (fc->dev, data, 2 * len, FC_DMA_BIDIRECTIONAL); + fcmd->cmd = dma_map_single (fc->dev, data, 2 * len, DMA_BIDIRECTIONAL); fcmd->rsp = fcmd->cmd + len; fcmd->cmdlen = len; fcmd->rsplen = len; @@ -1100,7 +1098,7 @@ static int fc_do_els(fc_channel *fc, unsigned int alpa, void *data, int len) clear_bit(fcmd->token, fc->scsi_bitmap); fc->scsi_free++; - dma_unmap_single (fc->dev, fcmd->cmd, 2 * len, FC_DMA_BIDIRECTIONAL); + dma_unmap_single (fc->dev, fcmd->cmd, 2 * len, DMA_BIDIRECTIONAL); return l.status; } @@ -1109,9 +1107,8 @@ int fc_do_plogi(fc_channel *fc, unsigned char alpa, fc_wwn *node, fc_wwn *nport) logi *l; int status; - l = (logi *)kmalloc(2 * sizeof(logi), GFP_KERNEL); + l = kzalloc(2 * sizeof(logi), GFP_KERNEL); if (!l) return -ENOMEM; - memset(l, 0, 2 * sizeof(logi)); l->code = LS_PLOGI; memcpy (&l->nport_wwn, &fc->wwn_nport, sizeof(fc_wwn)); memcpy (&l->node_wwn, &fc->wwn_node, sizeof(fc_wwn)); @@ -1144,9 +1141,8 @@ int fc_do_prli(fc_channel *fc, unsigned char alpa) prli *p; int status; - p = (prli *)kmalloc(2 * sizeof(prli), GFP_KERNEL); + p = kzalloc(2 * sizeof(prli), GFP_KERNEL); if (!p) return -ENOMEM; - memset(p, 0, 2 * sizeof(prli)); p->code = LS_PRLI; p->params[0] = 0x08002000; p->params[3] = 0x00000022;