From: Bartlomiej Zolnierkiewicz Subject: Re: [janitor] use kernel min/max (2/2) Date: Thu, 18 Mar 2004 18:17:59 +0100 Sender: linux-ide-owner@vger.kernel.org Message-ID: <200403181817.59173.bzolnier@elka.pw.edu.pl> References: <20040316163520.048ce536.rddunlap@osdl.org> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Return-path: Received: from mion.elka.pw.edu.pl ([194.29.160.35]:54203 "EHLO mion.elka.pw.edu.pl") by vger.kernel.org with ESMTP id S262776AbUCRRJi (ORCPT ); Thu, 18 Mar 2004 12:09:38 -0500 In-Reply-To: <20040316163520.048ce536.rddunlap@osdl.org> Content-Disposition: inline List-Id: linux-ide@vger.kernel.org To: "Randy.Dunlap" , Michael Veeck Cc: linux-ide@vger.kernel.org > @@ -354,7 +354,7 @@ static int idescsi_end_request (ide_driv > if (!test_bit(PC_WRITING, &pc->flags) && pc->actually_transferred && > pc->actually_transferred <= 1024 && pc->buffer) { printk(", rst = "); > scsi_buf = pc->scsi_cmd->request_buffer; > - hexdump(scsi_buf, IDE_MIN(16, pc->scsi_cmd->request_bufflen)); > + hexdump(scsi_buf, min_t(int, 16, pc->scsi_cmd->request_bufflen)); > } else printk("\n"); > } > } 'unsigned' should be used instead of 'int' (scsi_cmd->request_bufflen is 'unsigned') > @@ -371,7 +371,7 @@ static int idescsi_end_request (ide_driv > > static inline unsigned long get_timeout(idescsi_pc_t *pc) > { > - return IDE_MAX(WAIT_CMD, pc->timeout - jiffies); > + return max_t(long, WAIT_CMD, pc->timeout - jiffies); > } > > /* pc->timeout and jiffies are of 'unsigned long' type so why 'long' is used here? Timer wrapping protection? Otherwise patches look okay and I will push them to Linus as soon as somebody explains this 'long' thing to me. :-) If somebody is interested there are still related things to fix in IDE code: drivers/ide/ide-cd.c: use 'unsigned' instead of 'int' for nskip, sectors_to_transfer, len variables ide-timing.h: get rid of MIN()/MAX() macros, this should be done very carefully as they are used for calculating timings Regards, Bartlomiej