drivers/message/fusion/ MIN/MAX removal
Subsystems (2)
PATCH 1/1 drivers/message/fusion/ MIN/MAX removal
Patch (against 2.6.3) removes unnecessary min/max macros and changes calls to use kernel.h macros instead.
Feedback is always welcome
Michael
drivers/message/fusion/mptbase.c +7 -7
@@ -2485,10 +2485,10 @@* Set values for this IOC's request & reply frame sizes, * and request & reply queue depths... */ - ioc->req_sz =MIN (MPT_DEFAULT_FRAME_SIZE , facts->RequestFrameSize *4 ); - ioc->req_depth =MIN (MPT_MAX_REQ_DEPTH , facts->GlobalCredits); + ioc->req_sz =min (MPT_DEFAULT_FRAME_SIZE , facts->RequestFrameSize *4 ); + ioc->req_depth =min_t (int,MPT_MAX_REQ_DEPTH , facts->GlobalCredits); ioc->reply_sz = ioc->req_sz; - ioc->reply_depth =MIN (MPT_DEFAULT_REPLY_DEPTH , facts->ReplyQueueDepth); + ioc->reply_depth =min_t (int,MPT_DEFAULT_REPLY_DEPTH , facts->ReplyQueueDepth);dprintk ((MYIOC_s_INFO_FMT"reply_sz=%3d, reply_depth=%4d\n" , ioc->name, ioc->reply_sz, ioc->reply_depth));
@@ -3969,7 +3969,7 @@/* * Copy out the cached reply... */ -for (ii=0 ; ii <MIN (replyBytes/2 ,mptReply->MsgLength*2 ); ii++) +for (ii=0 ; ii <min (replyBytes/2 ,mptReply->MsgLength*2 ); ii++) u16reply[ii] = ioc->hs_reply[ii]; }else {return -99 ;
@@ -4216,7 +4216,7 @@if ((rc =mpt_config (ioc, &cfg)) ==0 ) {/* save the data */ - copy_sz =MIN (sizeof (LANPage0_t), data_sz); + copy_sz =min_t (int,sizeof (LANPage0_t), data_sz);memcpy (&ioc->lan_cnfg_page0, ppage0_alloc, copy_sz); }
@@ -4261,7 +4261,7 @@if ((rc =mpt_config (ioc, &cfg)) ==0 ) {/* save the data */ - copy_sz =MIN (sizeof (LANPage1_t), data_sz); + copy_sz =min_t (int,sizeof (LANPage1_t), data_sz);memcpy (&ioc->lan_cnfg_page1, ppage1_alloc, copy_sz); }
@@ -4330,7 +4330,7 @@if ((rc =mpt_config (ioc, &cfg)) ==0 ) {/* save the data */ pp0dest = &ioc->fc_port_page0[portnum]; - copy_sz =MIN (sizeof (FCPortPage0_t), data_sz); + copy_sz =min_t (int,sizeof (FCPortPage0_t), data_sz);memcpy (pp0dest, ppage0_alloc, copy_sz);/*
drivers/message/fusion/mptbase.h +0 -7
@@ -1057,13 +1057,6 @@/* * More (public) macros... */ -#ifndef MIN -#define MIN (a, b) (((a) < (b)) ? (a) : (b)) -#endif -#ifndef MAX -#define MAX (a, b) (((a) > (b)) ? (a) : (b)) -#endif -#ifndef offsetof#define offsetof (t, m) ((size_t) (&((t *)0)->m))#endif
drivers/message/fusion/mptctl.c +7 -7
@@ -283,7 +283,7 @@dctlprintk ((MYIOC_s_INFO_FMT": Copying Reply Frame @%p to IOC!\n" , ioc->name, reply));memcpy (ioc->ioctl->ReplyFrame, reply, -MIN (ioc->reply_sz,4 *reply->u.reply.MsgLength)); +min (ioc->reply_sz,4 *reply->u.reply.MsgLength)); ioc->ioctl->status |=MPT_IOCTL_STATUS_RF_VALID ;/* Set the command status to GOOD if IOC Status is GOOD
@@ -334,7 +334,7 @@// NOTE: Expects/requires non-Turbo reply! dctlprintk ((MYIOC_s_INFO_FMT":Caching MPI_FUNCTION_FW_DOWNLOAD reply!\n" , ioc->name)); -memcpy (fwReplyBuffer, reply,MIN (sizeof (fwReplyBuffer),4 *reply->u.reply.MsgLength)); +memcpy (fwReplyBuffer, reply,min_t (int,sizeof (fwReplyBuffer),4 *reply->u.reply.MsgLength)); ReplyMsg = (pMPIDefaultReply_t ) fwReplyBuffer; } }
@@ -992,7 +992,7 @@MptSge_t *sgl;int numfrags =0 ;int fragcnt =0 ; -int alloc_sz =MIN (bytes,MAX_KMALLOC_SZ );// avoid kernel warning msg! +int alloc_sz =min (bytes,MAX_KMALLOC_SZ );// avoid kernel warning msg! int bytes_allocd =0 ;int this_alloc;dma_addr_t pa;// phys addr
@@ -1037,7 +1037,7 @@ sgl = sglbuf; sg_spill = ((ioc->req_sz - sge_offset)/(sizeof (dma_addr_t) +sizeof (u32))) -1 ;while (bytes_allocd < bytes) { - this_alloc =MIN (alloc_sz, bytes-bytes_allocd); + this_alloc =min (alloc_sz, bytes-bytes_allocd); buflist[buflist_ent].len = this_alloc; buflist[buflist_ent].kptr = pci_alloc_consistent(ioc->pcidev, this_alloc,
@@ -2280,9 +2280,9 @@*/ if (ioc->ioctl->status &MPT_IOCTL_STATUS_RF_VALID ) {if (karg.maxReplyBytes < ioc->reply_sz) { - sz =MIN (karg.maxReplyBytes,4 *ioc->ioctl->ReplyFrame[2 ]); + sz =min (karg.maxReplyBytes,4 *ioc->ioctl->ReplyFrame[2 ]); }else { - sz =MIN (ioc->reply_sz,4 *ioc->ioctl->ReplyFrame[2 ]); + sz =min (ioc->reply_sz,4 *ioc->ioctl->ReplyFrame[2 ]); }if (sz >0 ) {
@@ -2301,7 +2301,7 @@/* If valid sense data, copy to user. */ if (ioc->ioctl->status &MPT_IOCTL_STATUS_SENSE_VALID ) { - sz =MIN (karg.maxSenseBytes,MPT_SENSE_BUFFER_SIZE ); + sz =min (karg.maxSenseBytes,MPT_SENSE_BUFFER_SIZE );if (sz >0 ) {if (copy_to_user ((char *)karg.senseDataPtr, ioc->ioctl->sense, sz)) { printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
drivers/message/fusion/mptscsih.c +9 -9
@@ -3663,7 +3663,7 @@if (nfactor < pspi_data->minSyncFactor ) nfactor = pspi_data->minSyncFactor; - factor =MAX (factor, nfactor); + factor =max (factor, nfactor);if (factor ==MPT_ASYNC ) offset =0 ; }else {
@@ -4721,7 +4721,7 @@ maxid = ioc->sh->max_id -1 ; }else if (ioc->sh) { id = target_id; - maxid =MIN (id, ioc->sh->max_id -1 ); + maxid =min_t (int, id, ioc->sh->max_id -1 ); }for (; id <= maxid; id++) {
@@ -5054,7 +5054,7 @@ sense_data = ((u8 *)hd->ioc->sense_buf_pool + (req_idx *MPT_SENSE_BUFFER_ALLOC )); - sz =MIN (pReq->SenseBufferLength, + sz =min_t (int, pReq->SenseBufferLength,SCSI_STD_SENSE_BYTES );memcpy (hd->pLocal->sense, sense_data, sz);
@@ -5703,7 +5703,7 @@ ioc->spi_data.forceDv &= ~MPT_SCSICFG_RELOAD_IOC_PG3 ; } - maxid =MIN (ioc->sh->max_id,MPT_MAX_SCSI_DEVICES ); + maxid =min_t (int, ioc->sh->max_id,MPT_MAX_SCSI_DEVICES );for (id =0 ; id < maxid; id++) {spin_lock_irqsave (&dvtaskQ_lock, flags);
@@ -6379,7 +6379,7 @@if (echoBufSize >0 ) { iocmd.flags |=MPT_ICFLAG_ECHO ;if (dataBufSize >0 ) - bufsize =MIN (echoBufSize, dataBufSize); + bufsize =min (echoBufSize, dataBufSize);else bufsize = echoBufSize; }else if (dataBufSize ==0 )
@@ -6390,7 +6390,7 @@/* Data buffers for write-read-compare test max 1K. */ - sz =MIN (bufsize,1024 ); + sz =min (bufsize,1024 );/* --- loop ---- * On first pass, always issue a reserve.
@@ -6745,9 +6745,9 @@ }/* limit by adapter capabilities */ - width =MIN (width, hd->ioc->spi_data.maxBusWidth); - offset =MIN (offset, hd->ioc->spi_data.maxSyncOffset); - factor =MAX (factor, hd->ioc->spi_data.minSyncFactor); + width =min (width, hd->ioc->spi_data.maxBusWidth); + offset =min (offset, hd->ioc->spi_data.maxSyncOffset); + factor =max (factor, hd->ioc->spi_data.minSyncFactor);/* Check Consistency */ if (offset && (factor <MPT_ULTRA2 ) && !width)
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors