diff options
| author | Linus Torvalds <torvalds@athlon.transmeta.com> | 2002-02-04 20:10:26 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@athlon.transmeta.com> | 2002-02-04 20:10:26 -0800 |
| commit | bb5b6e6c4dea4242f6ff75fa7adecea4f34935f1 (patch) | |
| tree | dbdda6fdd7f0bfadb4c10a997bfb15660f3223c0 /drivers | |
| parent | 0b9ded43ee424791d9283cee2a33dcb4a97da57d (diff) | |
v2.4.8.4 -> v2.4.9
- David Miller: sparc updates, FAT fs fixes, btaudio build fix
- David Gibson: Orinoco driver update
- Kevin Fleming: more disks the HPT controller doesn't like
- David Miller: "min()/max()" cleanups. Understands signs and sizes.
- Ben LaHaise: make vma merging more generous, help Mozilla /proc/<>/maps
- Jens Axboe: CD updates
- Trond Myklebust: save away NFS credentials in inode, so that mmap can
writeout.
- Mark Hemment: HIGHMEM ops cleanups
- Jes Sorensen: use "unsigned long" for flags in various drivers
Diffstat (limited to 'drivers')
98 files changed, 491 insertions, 446 deletions
diff --git a/drivers/acorn/scsi/acornscsi.c b/drivers/acorn/scsi/acornscsi.c index a5184513f7fd..66525f304374 100644 --- a/drivers/acorn/scsi/acornscsi.c +++ b/drivers/acorn/scsi/acornscsi.c @@ -1059,7 +1059,7 @@ void acornscsi_dma_setup(AS_Host *host, dmadir_t direction) /* * Allocate some buffer space, limited to half the buffer size */ - length = min(host->scsi.SCp.this_residual, DMAC_BUFFER_SIZE / 2); + length = min(unsigned int, host->scsi.SCp.this_residual, DMAC_BUFFER_SIZE / 2); if (length) { host->dma.start_addr = address = host->dma.free_addr; host->dma.free_addr = (host->dma.free_addr + length) & @@ -1187,7 +1187,7 @@ void acornscsi_dma_intr(AS_Host *host) /* * Allocate some buffer space, limited to half the on-board RAM size */ - length = min(host->scsi.SCp.this_residual, DMAC_BUFFER_SIZE / 2); + length = min(unsigned int, host->scsi.SCp.this_residual, DMAC_BUFFER_SIZE / 2); if (length) { host->dma.start_addr = address = host->dma.free_addr; host->dma.free_addr = (host->dma.free_addr + length) & @@ -1656,8 +1656,8 @@ void acornscsi_message(AS_Host *host) * to be in operation AFTER the target leaves message out phase. */ acornscsi_sbic_issuecmd(host, CMND_ASSERTATN); - period = max(message[3], sdtr_period / 4); - length = min(message[4], sdtr_size); + period = max(unsigned int, message[3], sdtr_period / 4); + length = min(unsigned int, message[4], sdtr_size); msgqueue_addmsg(&host->scsi.msgs, 5, EXTENDED_MESSAGE, 3, EXTENDED_SDTR, period, length); host->device[host->SCpnt->target].sync_xfer = diff --git a/drivers/acorn/scsi/acornscsi.h b/drivers/acorn/scsi/acornscsi.h index 74a92d525c0a..191d16af8c45 100644 --- a/drivers/acorn/scsi/acornscsi.h +++ b/drivers/acorn/scsi/acornscsi.h @@ -183,9 +183,6 @@ #define MASK_ON (MASKREG_M3|MASKREG_M2|MASKREG_M1|MASKREG_M0) #define MASK_OFF (MASKREG_M3|MASKREG_M2|MASKREG_M1) -#define min(x,y) ((x) < (y) ? (x) : (y)) -#define max(x,y) ((x) < (y) ? (y) : (x)) - /* * SCSI driver phases */ diff --git a/drivers/block/acsi.c b/drivers/block/acsi.c index 7992a8739516..e1d1a3566674 100644 --- a/drivers/block/acsi.c +++ b/drivers/block/acsi.c @@ -292,9 +292,6 @@ static char pa_med_rem_cmd[6] = { 0x1e, 0, 0, 0, 0, 0 }; cmd[4] = (len); \ } while(0) -#define min(a,b) (((a)<(b))?(a):(b)) - - /* ACSI errors (from REQUEST SENSE); There are two tables, one for the * old Atari disks and one for SCSI on ACSI disks. */ diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index b3b6c9d6c249..6e68c18d7bca 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -2246,8 +2246,13 @@ int cdrom_get_track_info(kdev_t dev, __u16 track, __u8 type, if ((ret = cdo->generic_packet(cdi, &cgc))) return ret; - cgc.cmd[8] = cgc.buflen = be16_to_cpu(ti->track_information_length) + + cgc.buflen = be16_to_cpu(ti->track_information_length) + sizeof(ti->track_information_length); + + if (cgc.buflen > sizeof(track_information)) + cgc.buflen = sizeof(track_information); + + cgc.cmd[8] = cgc.buflen; return cdo->generic_packet(cdi, &cgc); } diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h index ac94c07dcf31..7057a62d73fe 100644 --- a/drivers/char/agp/agp.h +++ b/drivers/char/agp/agp.h @@ -142,10 +142,6 @@ struct agp_bridge_data { #define A_IDXFIX() (A_SIZE_FIX(agp_bridge.aperture_sizes) + i) #define MAXKEY (4096 * 32) -#ifndef min -#define min(a,b) (((a)<(b))?(a):(b)) -#endif - #define AGPGART_MODULE_NAME "agpgart" #define PFX AGPGART_MODULE_NAME ": " diff --git a/drivers/char/agp/agpgart_be.c b/drivers/char/agp/agpgart_be.c index e1bd9f6b74b2..3658ef10cbd5 100644 --- a/drivers/char/agp/agpgart_be.c +++ b/drivers/char/agp/agpgart_be.c @@ -428,8 +428,8 @@ static void agp_generic_agp_enable(u32 mode) /* adjust RQ depth */ command = ((command & ~0xff000000) | - min((mode & 0xff000000), - min((command & 0xff000000), + min(u32, (mode & 0xff000000), + min(u32, (command & 0xff000000), (scratch & 0xff000000)))); /* disable SBA if it's not supported */ @@ -2657,8 +2657,8 @@ static void serverworks_agp_enable(u32 mode) /* adjust RQ depth */ command = ((command & ~0xff000000) | - min((mode & 0xff000000), - min((command & 0xff000000), + min(u32, (mode & 0xff000000), + min(u32, (command & 0xff000000), (scratch & 0xff000000)))); /* disable SBA if it's not supported */ diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index ba42e8e2853c..a9c385602cde 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c @@ -628,8 +628,6 @@ static char rcsid[] = #define PAUSE ; #endif -#define cy_min(a,b) (((a)<(b))?(a):(b)) - /* * Include section */ @@ -1631,8 +1629,8 @@ cyz_handle_rx(struct cyclades_port *info, volatile struct CH_CTRL *ch_ctrl, for performance, but because of buffer boundaries, there may be several steps to the operation */ while(0 < (small_count = - cy_min((rx_bufsize - new_rx_get), - cy_min((TTY_FLIPBUF_SIZE - tty->flip.count), char_count)) + min(unsigned int, (rx_bufsize - new_rx_get), + min(unsigned int, (TTY_FLIPBUF_SIZE - tty->flip.count), char_count)) )) { memcpy_fromio(tty->flip.char_buf_ptr, (char *)(cinfo->base_addr @@ -1726,9 +1724,9 @@ cyz_handle_tx(struct cyclades_port *info, volatile struct CH_CTRL *ch_ctrl, } #ifdef BLOCKMOVE while(0 < (small_count = - cy_min((tx_bufsize - tx_put), - cy_min ((SERIAL_XMIT_SIZE - info->xmit_tail), - cy_min(info->xmit_cnt, char_count))))){ + min(unsigned int, (tx_bufsize - tx_put), + min(unsigned int, (SERIAL_XMIT_SIZE - info->xmit_tail), + min(unsigned int, info->xmit_cnt, char_count))))) { memcpy_toio((char *)(cinfo->base_addr + tx_bufaddr + tx_put), &info->xmit_buf[info->xmit_tail], diff --git a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c index 845b5d61e03c..28d92604b111 100644 --- a/drivers/char/dsp56k.c +++ b/drivers/char/dsp56k.c @@ -59,9 +59,6 @@ #define DSP56K_TRANSMIT (dsp56k_host_interface.isr & DSP56K_ISR_TXDE) #define DSP56K_RECEIVE (dsp56k_host_interface.isr & DSP56K_ISR_RXDF) -#define max(a,b) ((a) > (b) ? (a) : (b)) -#define min(a,b) ((a) < (b) ? (a) : (b)) - #define wait_some(n) \ { \ set_current_state(TASK_INTERRUPTIBLE); \ @@ -72,7 +69,7 @@ { \ long i, t, m; \ while (count > 0) { \ - m = min(count, maxio); \ + m = min(unsigned long, count, maxio); \ for (i = 0; i < m; i++) { \ for (t = 0; t < timeout && !ENABLE; t++) \ wait_some(HZ/50); \ diff --git a/drivers/char/dz.c b/drivers/char/dz.c index 94876285307c..9104b838d41d 100644 --- a/drivers/char/dz.c +++ b/drivers/char/dz.c @@ -1279,7 +1279,8 @@ static void show_serial_version (void) int __init dz_init(void) { - int i, flags; + int i; + unsigned long flags; struct dz_serial *info; /* Setup base handler, and timer table. */ diff --git a/drivers/char/n_r3964.c b/drivers/char/n_r3964.c index 5c34fd07f5cf..ca5e0c752191 100644 --- a/drivers/char/n_r3964.c +++ b/drivers/char/n_r3964.c @@ -1421,7 +1421,7 @@ static unsigned int r3964_poll(struct tty_struct * tty, struct file * file, int pid=current->pid; struct r3964_client_info *pClient; struct r3964_message *pMsg=NULL; - unsigned int flags; + unsigned long flags; int result = POLLOUT; TRACE_L("POLL"); diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index 3124ccf965bd..d4c94cc492f2 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c @@ -71,10 +71,6 @@ #define PP_VERSION "ppdev: user-space parallel port driver" #define CHRDEV "ppdev" -#ifndef min -#define min(a,b) ((a) < (b) ? (a) : (b)) -#endif - struct pp_struct { struct pardevice * pdev; wait_queue_head_t irq_wait; @@ -122,7 +118,7 @@ static ssize_t pp_read (struct file * file, char * buf, size_t count, return -EINVAL; } - kbuffer = kmalloc (min (count, PP_BUFFER_SIZE), GFP_KERNEL); + kbuffer = kmalloc(min(unsigned int, count, PP_BUFFER_SIZE), GFP_KERNEL); if (!kbuffer) { return -ENOMEM; } @@ -130,7 +126,7 @@ static ssize_t pp_read (struct file * file, char * buf, size_t count, mode = pport->ieee1284.mode & ~(IEEE1284_DEVICEID | IEEE1284_ADDR); while (bytes_read < count) { - ssize_t need = min(count - bytes_read, PP_BUFFER_SIZE); + ssize_t need = min(unsigned long, count - bytes_read, PP_BUFFER_SIZE); if (mode == IEEE1284_MODE_EPP) { /* various specials for EPP mode */ @@ -202,7 +198,7 @@ static ssize_t pp_write (struct file * file, const char * buf, size_t count, return -EINVAL; } - kbuffer = kmalloc (min (count, PP_BUFFER_SIZE), GFP_KERNEL); + kbuffer = kmalloc(min(unsigned int, count, PP_BUFFER_SIZE), GFP_KERNEL); if (!kbuffer) { return -ENOMEM; } @@ -210,7 +206,7 @@ static ssize_t pp_write (struct file * file, const char * buf, size_t count, mode = pport->ieee1284.mode & ~(IEEE1284_DEVICEID | IEEE1284_ADDR); while (bytes_written < count) { - ssize_t n = min(count - bytes_written, PP_BUFFER_SIZE); + ssize_t n = min(unsigned long, count - bytes_written, PP_BUFFER_SIZE); if (copy_from_user (kbuffer, buf + bytes_written, n)) { bytes_written = -EFAULT; diff --git a/drivers/char/rio/rio.h b/drivers/char/rio/rio.h index a66e4efa280d..88aa1f34254e 100644 --- a/drivers/char/rio/rio.h +++ b/drivers/char/rio/rio.h @@ -210,16 +210,6 @@ static char *_rio_h_sccs_ = "@(#)rio.h 1.3"; #define RIO_PORT(DEV,FIRST_MAJ) ( (major(DEV) - FIRST_MAJ) * PORTS_PER_HOST) \ + minor(DEV) -/* -** Min and Max -*/ -#ifndef min -#define min(A,B) ((A)<(B)?(A):(B)) -#endif -#ifndef max -#define max(A,B) ((A)>(B)?(A):(B)) -#endif - #define splrio spltty #define RIO_IPL 5 diff --git a/drivers/char/rio/riointr.c b/drivers/char/rio/riointr.c index c97f88640f40..ad8a70df19f8 100644 --- a/drivers/char/rio/riointr.c +++ b/drivers/char/rio/riointr.c @@ -819,7 +819,7 @@ struct Port * PortP; ** and available space. */ - transCount = min(PacketP->len & PKT_LEN_MASK, + transCount = min(unsigned int, PacketP->len & PKT_LEN_MASK, TTY_FLIPBUF_SIZE - TtyP->flip.count); rio_dprintk (RIO_DEBUG_REC, "port %d: Copy %d bytes\n", PortP->PortNum, transCount); diff --git a/drivers/i2o/i2o_block.c b/drivers/i2o/i2o_block.c index c2b755546d6f..039a176c49e6 100644 --- a/drivers/i2o/i2o_block.c +++ b/drivers/i2o/i2o_block.c @@ -713,7 +713,7 @@ static void i2o_block_reply(struct i2o_handler *h, struct i2o_controller *c, str static int i2ob_evt(void *dummy) { unsigned int evt; - unsigned int flags; + unsigned long flags; int unit; int i; //The only event that has data is the SCSI_SMART event. @@ -1698,7 +1698,7 @@ void i2ob_del_device(struct i2o_controller *c, struct i2o_device *d) { int unit = 0; int i = 0; - int flags; + unsigned long flags; spin_lock_irqsave(&io_request_lock, flags); diff --git a/drivers/i2o/i2o_config.c b/drivers/i2o/i2o_config.c index 02d0946dbe86..311b535279cf 100644 --- a/drivers/i2o/i2o_config.c +++ b/drivers/i2o/i2o_config.c @@ -790,7 +790,7 @@ static int ioctl_evt_get(unsigned long arg, struct file *fp) struct i2o_cfg_info *p = NULL; struct i2o_evt_get *uget = (struct i2o_evt_get*)arg; struct i2o_evt_get kget; - unsigned int flags; + unsigned long flags; for(p = open_files; p; p = p->next) if(p->q_id == id) @@ -819,7 +819,7 @@ static int cfg_open(struct inode *inode, struct file *file) { struct i2o_cfg_info *tmp = (struct i2o_cfg_info *)kmalloc(sizeof(struct i2o_cfg_info), GFP_KERNEL); - unsigned int flags; + unsigned long flags; if(!tmp) return -ENOMEM; @@ -845,7 +845,7 @@ static int cfg_release(struct inode *inode, struct file *file) { u32 id = (u32)file->private_data; struct i2o_cfg_info *p1, *p2; - unsigned int flags; + unsigned long flags; lock_kernel(); p1 = p2 = NULL; diff --git a/drivers/i2o/i2o_core.c b/drivers/i2o/i2o_core.c index 61ae192b8cb9..d4d0d0e75351 100644 --- a/drivers/i2o/i2o_core.c +++ b/drivers/i2o/i2o_core.c @@ -890,7 +890,7 @@ static int i2o_core_evt(void *reply_data) struct reply_info *reply = (struct reply_info *) reply_data; u32 *msg = reply->msg; struct i2o_controller *c = NULL; - int flags; + unsigned long flags; lock_kernel(); daemonize(); @@ -2535,7 +2535,7 @@ int i2o_post_wait_mem(struct i2o_controller *c, u32 *msg, int len, int timeout, DECLARE_WAIT_QUEUE_HEAD(wq_i2o_post); int complete = 0; int status; - int flags = 0; + unsigned long flags = 0; struct i2o_post_wait_data *wait_data = kmalloc(sizeof(struct i2o_post_wait_data), GFP_KERNEL); diff --git a/drivers/ide/hpt366.c b/drivers/ide/hpt366.c index 1e07e0736a2a..9e98c56969d3 100644 --- a/drivers/ide/hpt366.c +++ b/drivers/ide/hpt366.c @@ -60,6 +60,11 @@ const char *bad_ata100_5[] = { "IBM-DTLA-305040", "IBM-DTLA-305030", "IBM-DTLA-305020", + "IC35L010AVER07-0", + "IC35L020AVER07-0", + "IC35L030AVER07-0", + "IC35L040AVER07-0", + "IC35L060AVER07-0", "WDC AC310200R", NULL }; @@ -74,6 +79,11 @@ const char *bad_ata66_4[] = { "IBM-DTLA-305040", "IBM-DTLA-305030", "IBM-DTLA-305020", + "IC35L010AVER07-0", + "IC35L020AVER07-0", + "IC35L030AVER07-0", + "IC35L040AVER07-0", + "IC35L060AVER07-0", "WDC AC310200R", NULL }; diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 87ae9b61d438..7320b177e7bd 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -1885,7 +1885,7 @@ static int cdrom_eject(ide_drive_t *drive, int ejectflag, return cdrom_queue_packet_command (drive, &pc); } -static int cdrom_read_capacity(ide_drive_t *drive, unsigned *capacity, +static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity, struct request_sense *sense) { struct { @@ -2927,7 +2927,7 @@ void ide_cdrom_revalidate (ide_drive_t *drive) static unsigned long ide_cdrom_capacity (ide_drive_t *drive) { - unsigned capacity; + unsigned long capacity; if (cdrom_read_capacity(drive, &capacity, NULL)) return 0; diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h index 702f3be3c85c..aa46a912ab31 100644 --- a/drivers/ide/ide-cd.h +++ b/drivers/ide/ide-cd.h @@ -150,7 +150,7 @@ struct atapi_toc_entry { struct atapi_toc { int last_session_lba; int xa_flag; - unsigned capacity; + unsigned long capacity; struct atapi_toc_header hdr; struct atapi_toc_entry ent[MAX_TRACKS+1]; /* One extra for the leadout. */ diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c index 0b3228949be3..fffc893b7774 100644 --- a/drivers/ieee1394/nodemgr.c +++ b/drivers/ieee1394/nodemgr.c @@ -358,7 +358,7 @@ static void nodemgr_node_probe(void *data) nodeid_t nodeid = LOCAL_BUS; quadlet_t buffer[5], quad; octlet_t base = CSR_REGISTER_BASE + CSR_CONFIG_ROM; - int flags; + unsigned long flags; /* We need to detect when the ConfigROM's generation has changed, * so we only update the node's info when it needs to be. */ @@ -508,7 +508,7 @@ int hpsb_guid_fill_packet(struct node_entry *ne, struct hpsb_packet *pkt) static void nodemgr_add_host(struct hpsb_host *host) { struct host_info *hi = kmalloc (sizeof (struct host_info), GFP_KERNEL); - int flags; + unsigned long flags; if (!hi) { HPSB_ERR ("Out of memory in Node Manager"); @@ -532,7 +532,7 @@ static void nodemgr_host_reset(struct hpsb_host *host) { struct list_head *lh; struct host_info *hi = NULL; - int flags; + unsigned long flags; spin_lock_irqsave (&host_info_lock, flags); list_for_each(lh, &host_info_list) { @@ -561,7 +561,7 @@ static void nodemgr_remove_host(struct hpsb_host *host) struct list_head *lh; struct host_info *hi = NULL; struct node_entry *ne; - int flags; + unsigned long flags; /* Make sure we have no active scans */ flush_scheduled_tasks(); diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c index 090104a81a73..8e0509de9ac6 100644 --- a/drivers/ieee1394/ohci1394.c +++ b/drivers/ieee1394/ohci1394.c @@ -200,7 +200,8 @@ static void dma_trm_reset(struct dma_trm_ctx *d); static u8 get_phy_reg(struct ti_ohci *ohci, u8 addr) { - int i, flags; + int i; + unsigned long flags; quadlet_t r; spin_lock_irqsave (&ohci->phy_reg_lock, flags); @@ -227,7 +228,8 @@ static u8 get_phy_reg(struct ti_ohci *ohci, u8 addr) static void set_phy_reg(struct ti_ohci *ohci, u8 addr, u8 data) { - int i, flags; + int i; + unsigned long flags; u32 r; spin_lock_irqsave (&ohci->phy_reg_lock, flags); @@ -1078,7 +1080,8 @@ static void ohci_irq_handler(int irq, void *dev_id, quadlet_t event, node_id; struct ti_ohci *ohci = (struct ti_ohci *)dev_id; struct hpsb_host *host = ohci->host; - int phyid = -1, isroot = 0, flags; + int phyid = -1, isroot = 0; + unsigned long flags; /* Read the interrupt event register. We don't clear the bus reset * here. We wait till we get a selfid complete interrupt and clear @@ -1343,7 +1346,8 @@ static void dma_rcv_tasklet (unsigned long data) struct ti_ohci *ohci = (struct ti_ohci*)(d->ohci); unsigned int split_left, idx, offset, rescount; unsigned char tcode; - int length, bytes_left, ack, flags; + int length, bytes_left, ack; + unsigned long flags; quadlet_t *buf_ptr; char *split_ptr; char msg[256]; diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index 2fb0d374a6e9..a69131f98d82 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c @@ -965,7 +965,7 @@ void sbp2_cleanup(void) static void sbp2_add_host(struct hpsb_host *host) { struct sbp2scsi_host_info *hi; - unsigned int flags; + unsigned long flags; SBP2_DEBUG("sbp2: sbp2_add_host"); @@ -1048,7 +1048,7 @@ static void sbp2_remove_host(struct hpsb_host *host) { struct sbp2scsi_host_info *hi; int i; - unsigned int flags; + unsigned long flags; SBP2_DEBUG("sbp2: sbp2_remove_host"); diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c index bea5d771057d..291d2579d600 100644 --- a/drivers/ieee1394/video1394.c +++ b/drivers/ieee1394/video1394.c @@ -1313,7 +1313,8 @@ int video1394_mmap(struct file *file, struct vm_area_struct *vma) { struct video_card *video = NULL; struct ti_ohci *ohci; - int res = -EINVAL, flags; + int res = -EINVAL; + unsigned long flags; struct list_head *lh; spin_lock_irqsave(&video1394_cards_lock, flags); @@ -1350,7 +1351,8 @@ int video1394_mmap(struct file *file, struct vm_area_struct *vma) static int video1394_open(struct inode *inode, struct file *file) { - int i = MINOR(inode->i_rdev), flags; + int i = MINOR(inode->i_rdev); + unsigned long flags; struct video_card *video = NULL; struct list_head *lh; @@ -1380,7 +1382,8 @@ static int video1394_release(struct inode *inode, struct file *file) struct video_card *video = NULL; struct ti_ohci *ohci; u64 mask; - int i, flags; + int i; + unsigned long flags; struct list_head *lh; spin_lock_irqsave(&video1394_cards_lock, flags); @@ -1446,7 +1449,8 @@ static int video1394_release(struct inode *inode, struct file *file) static void irq_handler(int card, quadlet_t isoRecvIntEvent, quadlet_t isoXmitIntEvent) { - int i, flags; + int i; + unsigned long flags; struct video_card *video = NULL; struct list_head *lh; @@ -1495,7 +1499,7 @@ static struct file_operations video1394_fops= static int video1394_init(struct ti_ohci *ohci) { struct video_card *video = kmalloc(sizeof(struct video_card), GFP_KERNEL); - int flags; + unsigned long flags; char name[16]; if (video == NULL) { @@ -1555,7 +1559,8 @@ static int video1394_init(struct ti_ohci *ohci) /* Must be called under spinlock */ static void remove_card(struct video_card *video) { - int i, flags; + int i; + unsigned long flags; ohci1394_unregister_video(video->ohci, &video_tmpl); @@ -1586,7 +1591,7 @@ static void remove_card(struct video_card *video) static void video1394_remove_host (struct hpsb_host *host) { struct ti_ohci *ohci; - int flags; + unsigned long flags; struct list_head *lh; /* We only work with the OHCI-1394 driver */ diff --git a/drivers/md/lvm-snap.c b/drivers/md/lvm-snap.c index 20e40c022e90..ed19d45fc895 100644 --- a/drivers/md/lvm-snap.c +++ b/drivers/md/lvm-snap.c @@ -386,8 +386,8 @@ int lvm_snapshot_COW(kdev_t org_phys_dev, blksize_org = lvm_get_blksize(org_phys_dev); blksize_snap = lvm_get_blksize(snap_phys_dev); - max_blksize = max(blksize_org, blksize_snap); - min_blksize = min(blksize_org, blksize_snap); + max_blksize = max(int, blksize_org, blksize_snap); + min_blksize = min(int, blksize_org, blksize_snap); max_sectors = KIO_MAX_SECTORS * (min_blksize>>9); if (chunk_size % (max_blksize>>9)) @@ -395,7 +395,7 @@ int lvm_snapshot_COW(kdev_t org_phys_dev, while (chunk_size) { - nr_sectors = min(chunk_size, max_sectors); + nr_sectors = min(int, chunk_size, max_sectors); chunk_size -= nr_sectors; iobuf->length = nr_sectors << 9; @@ -503,7 +503,7 @@ int lvm_snapshot_alloc_hash_table(lv_t * lv) buckets = lv->lv_remap_end; max_buckets = calc_max_buckets(); - buckets = min(buckets, max_buckets); + buckets = min(unsigned long, buckets, max_buckets); while (buckets & (buckets-1)) buckets &= (buckets-1); diff --git a/drivers/mtd/devices/docecc.c b/drivers/mtd/devices/docecc.c index c10ff2b88bcc..f161a130a12f 100644 --- a/drivers/mtd/devices/docecc.c +++ b/drivers/mtd/devices/docecc.c @@ -80,8 +80,6 @@ modnn(int x) return x; } -#define min(a,b) ((a) < (b) ? (a) : (b)) - #define CLEAR(a,n) {\ int ci;\ for(ci=(n)-1;ci >=0;ci--)\ @@ -404,7 +402,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1], den = 0; /* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */ - for (i = min(deg_lambda,NN-KK-1) & ~1; i >= 0; i -=2) { + for (i = min(int, deg_lambda,NN-KK-1) & ~1; i >= 0; i -=2) { if(lambda[i+1] != A0) den ^= Alpha_to[modnn(lambda[i+1] + i * root[j])]; } diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c index bc8ef6891a33..3b5f6df4f130 100644 --- a/drivers/net/acenic.c +++ b/drivers/net/acenic.c @@ -157,10 +157,6 @@ MODULE_DEVICE_TABLE(pci, acenic_pci_tbl); #define __devinit __init #endif -#ifndef min -#define min(a,b) (((a)<(b))?(a):(b)) -#endif - #ifndef SMP_CACHE_BYTES #define SMP_CACHE_BYTES L1_CACHE_BYTES #endif @@ -2999,8 +2995,8 @@ static void __init ace_copy(struct ace_regs *regs, void *src, return; while (size > 0) { - tsize = min(((~dest & (ACE_WINDOW_SIZE - 1)) + 1), - min(size, ACE_WINDOW_SIZE)); + tsize = min(u32, ((~dest & (ACE_WINDOW_SIZE - 1)) + 1), + min(u32, size, ACE_WINDOW_SIZE)); tdest = (unsigned long)®s->Window + (dest & (ACE_WINDOW_SIZE - 1)); writel(dest & ~(ACE_WINDOW_SIZE - 1), ®s->WinBase); @@ -3030,8 +3026,8 @@ static void __init ace_clear(struct ace_regs *regs, u32 dest, int size) return; while (size > 0) { - tsize = min(((~dest & (ACE_WINDOW_SIZE - 1)) + 1), - min(size, ACE_WINDOW_SIZE)); + tsize = min(u32, ((~dest & (ACE_WINDOW_SIZE - 1)) + 1), + min(u32, size, ACE_WINDOW_SIZE)); tdest = (unsigned long)®s->Window + (dest & (ACE_WINDOW_SIZE - 1)); writel(dest & ~(ACE_WINDOW_SIZE - 1), ®s->WinBase); diff --git a/drivers/net/de600.c b/drivers/net/de600.c index d161342c0896..d582b16db936 100644 --- a/drivers/net/de600.c +++ b/drivers/net/de600.c @@ -801,7 +801,6 @@ adapter_init(struct net_device *dev) * This differs from the standard function, that can return an * arbitrarily small window! */ -#define min(a,b) ((a)<(b)?(a):(b)) static unsigned long de600_rspace(struct sock *sk) { @@ -815,7 +814,7 @@ de600_rspace(struct sock *sk) */ if (atomic_read(&sk->rmem_alloc) >= sk->rcvbuf-2*DE600_MIN_WINDOW) return(0); - amt = min((sk->rcvbuf-atomic_read(&sk->rmem_alloc))/2/*-DE600_MIN_WINDOW*/, DE600_MAX_WINDOW); + amt = min(int, (sk->rcvbuf-atomic_read(&sk->rmem_alloc))/2/*-DE600_MIN_WINDOW*/, DE600_MAX_WINDOW); if (amt < 0) return(0); return(amt); } diff --git a/drivers/net/dgrs.c b/drivers/net/dgrs.c index 65616e697179..542f526a004d 100644 --- a/drivers/net/dgrs.c +++ b/drivers/net/dgrs.c @@ -693,7 +693,6 @@ static int dgrs_start_xmit(struct sk_buff *skb, struct net_device *devN) I596_RBD *rbdp; int count; int i, len, amt; -# define mymin(A,B) ( (A) < (B) ? (A) : (B) ) /* * Determine 0th priv and dev structure pointers @@ -734,7 +733,7 @@ static int dgrs_start_xmit(struct sk_buff *skb, struct net_device *devN) goto no_resources; } - amt = mymin(len, rbdp->size - count); + amt = min(unsigned int, len, rbdp->size - count); memcpy( (char *) S2H(rbdp->buf) + count, skb->data + i, amt); i += amt; count += amt; diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c index 7c8aef881001..403577fda957 100644 --- a/drivers/net/hamradio/baycom_epp.c +++ b/drivers/net/hamradio/baycom_epp.c @@ -246,11 +246,6 @@ struct baycom_state { /* --------------------------------------------------------------------- */ -#define min(a, b) (((a) < (b)) ? (a) : (b)) -#define max(a, b) (((a) > (b)) ? (a) : (b)) - -/* --------------------------------------------------------------------- */ - #define KISS_VERBOSE /* --------------------------------------------------------------------- */ @@ -615,7 +610,7 @@ static int transmit(struct baycom_state *bc, int cnt, unsigned char stat) while (cnt > 0) { switch (bc->hdlctx.state) { case tx_keyup: - i = min(cnt, bc->hdlctx.flags); + i = min(int, cnt, bc->hdlctx.flags); cnt -= i; bc->hdlctx.flags -= i; if (bc->hdlctx.flags <= 0) @@ -638,7 +633,7 @@ static int transmit(struct baycom_state *bc, int cnt, unsigned char stat) break; } } - i = min(cnt, bc->hdlctx.bufcnt); + i = min(int, cnt, bc->hdlctx.bufcnt); bc->hdlctx.bufcnt -= i; cnt -= i; if (i != pp->ops->epp_write_data(pp, bc->hdlctx.bufptr, i, 0)) @@ -652,7 +647,7 @@ static int transmit(struct baycom_state *bc, int cnt, unsigned char stat) bc->hdlctx.state = tx_data; break; } - i = min(cnt, bc->hdlctx.flags); + i = min(int, cnt, bc->hdlctx.flags); if (i) { cnt -= i; bc->hdlctx.flags -= i; @@ -669,7 +664,7 @@ static int transmit(struct baycom_state *bc, int cnt, unsigned char stat) default: /* fall through */ if (bc->hdlctx.calibrate <= 0) return 0; - i = min(cnt, bc->hdlctx.calibrate); + i = min(int, cnt, bc->hdlctx.calibrate); cnt -= i; bc->hdlctx.calibrate -= i; memset(tmp, 0, sizeof(tmp)); diff --git a/drivers/net/hamradio/baycom_par.c b/drivers/net/hamradio/baycom_par.c index 61cfd41480b2..508b6dc37463 100644 --- a/drivers/net/hamradio/baycom_par.c +++ b/drivers/net/hamradio/baycom_par.c @@ -157,11 +157,6 @@ struct baycom_state { /* --------------------------------------------------------------------- */ -#define min(a, b) (((a) < (b)) ? (a) : (b)) -#define max(a, b) (((a) > (b)) ? (a) : (b)) - -/* --------------------------------------------------------------------- */ - static void __inline__ baycom_int_freq(struct baycom_state *bc) { #ifdef BAYCOM_DEBUG diff --git a/drivers/net/hamradio/baycom_ser_fdx.c b/drivers/net/hamradio/baycom_ser_fdx.c index 2b19dc9058a6..c1c3fc6ca023 100644 --- a/drivers/net/hamradio/baycom_ser_fdx.c +++ b/drivers/net/hamradio/baycom_ser_fdx.c @@ -152,11 +152,6 @@ struct baycom_state { /* --------------------------------------------------------------------- */ -#define min(a, b) (((a) < (b)) ? (a) : (b)) -#define max(a, b) (((a) > (b)) ? (a) : (b)) - -/* --------------------------------------------------------------------- */ - static void inline baycom_int_freq(struct baycom_state *bc) { #ifdef BAYCOM_DEBUG diff --git a/drivers/net/hamradio/baycom_ser_hdx.c b/drivers/net/hamradio/baycom_ser_hdx.c index f3d84911edcd..d2b82e589a5a 100644 --- a/drivers/net/hamradio/baycom_ser_hdx.c +++ b/drivers/net/hamradio/baycom_ser_hdx.c @@ -143,11 +143,6 @@ struct baycom_state { /* --------------------------------------------------------------------- */ -#define min(a, b) (((a) < (b)) ? (a) : (b)) -#define max(a, b) (((a) > (b)) ? (a) : (b)) - -/* --------------------------------------------------------------------- */ - static void inline baycom_int_freq(struct baycom_state *bc) { #ifdef BAYCOM_DEBUG diff --git a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c index 7ff2c9cfae52..573203606027 100644 --- a/drivers/net/hamradio/hdlcdrv.c +++ b/drivers/net/hamradio/hdlcdrv.c @@ -95,11 +95,6 @@ static char ax25_nocall[AX25_ADDR_LEN] = #define PARAM_RETURN 255 /* --------------------------------------------------------------------- */ - -#define min(a, b) (((a) < (b)) ? (a) : (b)) -#define max(a, b) (((a) > (b)) ? (a) : (b)) - -/* --------------------------------------------------------------------- */ /* * the CRC routines are stolen from WAMPES * by Dieter Deyke diff --git a/drivers/net/hamradio/soundmodem/sm.h b/drivers/net/hamradio/soundmodem/sm.h index 045e7e053402..367b045b8086 100644 --- a/drivers/net/hamradio/soundmodem/sm.h +++ b/drivers/net/hamradio/soundmodem/sm.h @@ -150,11 +150,6 @@ struct hardware_info { /* --------------------------------------------------------------------- */ -#define min(a, b) (((a) < (b)) ? (a) : (b)) -#define max(a, b) (((a) > (b)) ? (a) : (b)) - -/* --------------------------------------------------------------------- */ - extern const char sm_drvname[]; extern const char sm_drvinfo[]; diff --git a/drivers/net/sk98lin/skproc.c b/drivers/net/sk98lin/skproc.c index 9c07f9c270bb..1abb4dd124bb 100644 --- a/drivers/net/sk98lin/skproc.c +++ b/drivers/net/sk98lin/skproc.c @@ -293,7 +293,7 @@ void *data) if (buffer_length >= len - offset) { *eof = 1; } - return (min(buffer_length, len - offset)); + return (min(int, buffer_length, len - offset)); } diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index 230ae012f71e..b80a4d8a4a58 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c @@ -1,4 +1,4 @@ -/* $Id: sungem.c,v 1.18 2001/08/06 13:34:47 davem Exp $ +/* $Id: sungem.c,v 1.19 2001/08/13 14:40:07 davem Exp $ * sungem.c: Sun GEM ethernet driver. * * Copyright (C) 2000, 2001 David S. Miller (davem@redhat.com) @@ -558,7 +558,7 @@ static void gem_rx(struct gem *gp) skb = copy_skb; } - skb->csum = ((status & RXDCTRL_TCPCSUM) ^ 0xffff); + skb->csum = ntohs((status & RXDCTRL_TCPCSUM) ^ 0xffff); skb->ip_summed = CHECKSUM_HW; skb->protocol = eth_type_trans(skb, gp->dev); netif_rx(skb); diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c index 42f737de5fd4..654e2db9256c 100644 --- a/drivers/net/sunhme.c +++ b/drivers/net/sunhme.c @@ -1,4 +1,4 @@ -/* $Id: sunhme.c,v 1.121 2001/07/27 10:22:57 davem Exp $ +/* $Id: sunhme.c,v 1.122 2001/08/13 14:40:07 davem Exp $ * sunhme.c: Sparc HME/BigMac 10/100baseT half/full duplex auto switching, * auto carrier detecting ethernet driver. Also known as the * "Happy Meal Ethernet" found on SunSwift SBUS cards. @@ -2109,7 +2109,7 @@ static void happy_meal_rx(struct happy_meal *hp, struct net_device *dev) } /* This card is _fucking_ hot... */ - skb->csum = (csum ^ 0xffff); + skb->csum = ntohs(csum ^ 0xffff); skb->ip_summed = CHECKSUM_HW; RXD(("len=%d csum=%4x]", len, csum)); diff --git a/drivers/net/wan/comx-hw-comx.c b/drivers/net/wan/comx-hw-comx.c index e3b72a5af525..86737b11e28a 100644 --- a/drivers/net/wan/comx-hw-comx.c +++ b/drivers/net/wan/comx-hw-comx.c @@ -1044,7 +1044,7 @@ static int comxhw_write_proc(struct file *file, const char *buffer, if (!(page = (char *)__get_free_page(GFP_KERNEL))) { return -ENOMEM; } - if(copy_from_user(page, buffer, count = (min(count, PAGE_SIZE)))) + if(copy_from_user(page, buffer, count = (min(int, count, PAGE_SIZE)))) { count = -EFAULT; goto out; @@ -1182,8 +1182,10 @@ static int comxhw_read_proc(char *page, char **start, off_t off, int count, len = sprintf(page, "external\n"); } } else if (strcmp(file->name, FILENAME_FIRMWARE) == 0) { - len = min(FILE_PAGESIZE, min(count, - hw->firmware ? (hw->firmware->len - off) : 0)); + len = min(int, FILE_PAGESIZE, + min(int, count, + hw->firmware ? + (hw->firmware->len - off) : 0)); if (len < 0) { len = 0; } @@ -1203,7 +1205,7 @@ static int comxhw_read_proc(char *page, char **start, off_t off, int count, if (count >= len - off) { *eof = 1; } - return(min(count, len - off)); + return min(int, count, len - off); } /* Called on echo comx >boardtype */ diff --git a/drivers/net/wan/comx-hw-locomx.c b/drivers/net/wan/comx-hw-locomx.c index 3714c6e60640..4b64939e864e 100644 --- a/drivers/net/wan/comx-hw-locomx.c +++ b/drivers/net/wan/comx-hw-locomx.c @@ -324,7 +324,7 @@ static int locomx_read_proc(char *page, char **start, off_t off, int count, if (count >= len - off) { *eof = 1; } - return ( min(count, len - off) ); + return min(int, count, len - off); } static int locomx_write_proc(struct file *file, const char *buffer, @@ -339,7 +339,7 @@ static int locomx_write_proc(struct file *file, const char *buffer, return -ENOMEM; } - copy_from_user(page, buffer, count = min(count, PAGE_SIZE)); + copy_from_user(page, buffer, count = min(unsigned long, count, PAGE_SIZE)); if (*(page + count - 1) == '\n') { *(page + count - 1) = 0; } diff --git a/drivers/net/wan/comx-hw-mixcom.c b/drivers/net/wan/comx-hw-mixcom.c index 8c367b5cca02..adf829894ff2 100644 --- a/drivers/net/wan/comx-hw-mixcom.c +++ b/drivers/net/wan/comx-hw-mixcom.c @@ -121,7 +121,7 @@ static inline void hscx_fill_fifo(struct net_device *dev) outsb(dev->base_addr + HSCX_FIFO, - &(hw->sending->data[hw->tx_ptr]), min(to_send, 32)); + &(hw->sending->data[hw->tx_ptr]), min(unsigned int, to_send, 32)); if (to_send <= 32) { hscx_cmd(dev, HSCX_XTF | HSCX_XME); kfree_skb(hw->sending); @@ -696,7 +696,7 @@ static int mixcom_read_proc(char *page, char **start, off_t off, int count, } *start = page + off; if (count >= len - off) *eof = 1; - return ( min(count, len - off) ); + return min(int, count, len - off); } @@ -763,7 +763,7 @@ static int mixcom_write_proc(struct file *file, const char *buffer, return -ENOMEM; } - copy_from_user(page, buffer, count = min(count, PAGE_SIZE)); + copy_from_user(page, buffer, count = min(unsigned long, count, PAGE_SIZE)); if (*(page + count - 1) == '\n') { *(page + count - 1) = 0; } diff --git a/drivers/net/wan/comx-proto-fr.c b/drivers/net/wan/comx-proto-fr.c index 124c66e102f3..75ef5c56c9a4 100644 --- a/drivers/net/wan/comx-proto-fr.c +++ b/drivers/net/wan/comx-proto-fr.c @@ -634,7 +634,7 @@ static int fr_read_proc(char *page, char **start, off_t off, int count, *start = page + off; if (count >= len - off) *eof = 1; - return ( min(count, len - off) ); + return min(int, count, len - off); } static int fr_write_proc(struct file *file, const char *buffer, diff --git a/drivers/net/wan/comx-proto-lapb.c b/drivers/net/wan/comx-proto-lapb.c index 64129018bdf1..520074f72f94 100644 --- a/drivers/net/wan/comx-proto-lapb.c +++ b/drivers/net/wan/comx-proto-lapb.c @@ -212,7 +212,7 @@ static int comxlapb_read_proc(char *page, char **start, off_t off, int count, if (count >= len - off) { *eof = 1; } - return ( min(count, len - off) ); + return min(int, count, len - off); } static int comxlapb_write_proc(struct file *file, const char *buffer, diff --git a/drivers/net/wan/comx.c b/drivers/net/wan/comx.c index 8e76b39b9bd4..3d4986ea7ca1 100644 --- a/drivers/net/wan/comx.c +++ b/drivers/net/wan/comx.c @@ -151,8 +151,8 @@ int comx_debug(struct net_device *dev, char *fmt, ...) int free = (ch->debug_start - ch->debug_end + ch->debug_size) % ch->debug_size; - to_copy = min( free ? free : ch->debug_size, - min (ch->debug_size - ch->debug_end, len) ); + to_copy = min(int, free ? free : ch->debug_size, + min(int, ch->debug_size - ch->debug_end, len)); memcpy(ch->debug_area + ch->debug_end, str, to_copy); str += to_copy; len -= to_copy; @@ -567,7 +567,7 @@ static int comx_read_proc(char *page, char **start, off_t off, int count, if (count >= len - off) { *eof = 1; } - return( min(count, len - off) ); + return min(int, count, len - off); } @@ -597,7 +597,7 @@ static int comx_root_read_proc(char *page, char **start, off_t off, int count, if (count >= len - off) { *eof = 1; } - return( min(count, len - off) ); + return min(int, count, len - off); } diff --git a/drivers/net/wan/comx.h b/drivers/net/wan/comx.h index 1461d5fb18cb..0f7404f21470 100644 --- a/drivers/net/wan/comx.h +++ b/drivers/net/wan/comx.h @@ -190,14 +190,6 @@ struct comx_debugflags_struct { #endif -#ifndef min -#define min(a,b) ((a) > (b) ? (b) : (a)) -#endif -#ifndef max -#define max(a,b) ((a) > (b) ? (a) : (b)) -#endif - - #define COMX_CHANNEL(dev) ((struct comx_channel*)dev->priv) #define TWIN(dev) (COMX_CHANNEL(dev)->twin) diff --git a/drivers/net/wan/cycx_main.c b/drivers/net/wan/cycx_main.c index 0c5e72d05d39..22ffa2e56a34 100644 --- a/drivers/net/wan/cycx_main.c +++ b/drivers/net/wan/cycx_main.c @@ -111,8 +111,8 @@ int __init cyclomx_init (void) fullname, DRV_VERSION, DRV_RELEASE, copyright); /* Verify number of cards and allocate adapter data space */ - ncards = min(ncards, MAX_CARDS); - ncards = max(ncards, 1); + ncards = min(int, ncards, MAX_CARDS); + ncards = max(int, ncards, 1); card_array = kmalloc(sizeof(cycx_t) * ncards, GFP_KERNEL); if (!card_array) goto out; diff --git a/drivers/net/wan/cycx_x25.c b/drivers/net/wan/cycx_x25.c index a65238c704b4..125a07b7eab2 100644 --- a/drivers/net/wan/cycx_x25.c +++ b/drivers/net/wan/cycx_x25.c @@ -260,13 +260,13 @@ int cyx_init (cycx_t *card, wandev_conf_t *conf) cfg.flags = 0; /* FIXME just reset the 2nd bit */ if (conf->u.x25.hi_pvc) { - card->u.x.hi_pvc = min(conf->u.x25.hi_pvc, 4095); - card->u.x.lo_pvc = min(conf->u.x25.lo_pvc, card->u.x.hi_pvc); + card->u.x.hi_pvc = min(unsigned int, conf->u.x25.hi_pvc, 4095); + card->u.x.lo_pvc = min(unsigned int, conf->u.x25.lo_pvc, card->u.x.hi_pvc); } if (conf->u.x25.hi_svc) { - card->u.x.hi_svc = min(conf->u.x25.hi_svc, 4095); - card->u.x.lo_svc = min(conf->u.x25.lo_svc, card->u.x.hi_svc); + card->u.x.hi_svc = min(unsigned int, conf->u.x25.hi_svc, 4095); + card->u.x.lo_svc = min(unsigned int, conf->u.x25.lo_svc, card->u.x.hi_svc); } if (card->u.x.lo_pvc == 255) @@ -277,25 +277,25 @@ int cyx_init (cycx_t *card, wandev_conf_t *conf) cfg.nvc = card->u.x.hi_svc - card->u.x.lo_svc + 1 + cfg.npvc; if (conf->u.x25.hdlc_window) - cfg.n2win = min(conf->u.x25.hdlc_window, 7); + cfg.n2win = min(unsigned int, conf->u.x25.hdlc_window, 7); if (conf->u.x25.pkt_window) - cfg.n3win = min(conf->u.x25.pkt_window, 7); + cfg.n3win = min(unsigned int, conf->u.x25.pkt_window, 7); if (conf->u.x25.t1) - cfg.t1 = min(conf->u.x25.t1, 30); + cfg.t1 = min(unsigned int, conf->u.x25.t1, 30); if (conf->u.x25.t2) - cfg.t2 = min(conf->u.x25.t2, 30); + cfg.t2 = min(unsigned int, conf->u.x25.t2, 30); if (conf->u.x25.t11_t21) - cfg.t21 = min(conf->u.x25.t11_t21, 30); + cfg.t21 = min(unsigned int, conf->u.x25.t11_t21, 30); if (conf->u.x25.t13_t23) - cfg.t23 = min(conf->u.x25.t13_t23, 30); + cfg.t23 = min(unsigned int, conf->u.x25.t13_t23, 30); if (conf->u.x25.n2) - cfg.n2 = min(conf->u.x25.n2, 30); + cfg.n2 = min(unsigned int, conf->u.x25.n2, 30); /* initialize adapter */ if (x25_configure(card, &cfg)) diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c index 61c3f79f3ec8..3b3bd1707ac8 100644 --- a/drivers/net/wan/sbni.c +++ b/drivers/net/wan/sbni.c @@ -659,7 +659,7 @@ download_data( struct net_device *dev, u32 *crc_p ) struct net_local *nl = (struct net_local *) dev->priv; struct sk_buff *skb = nl->tx_buf_p; - unsigned len = min( skb->len - nl->outpos, nl->framelen ); + unsigned len = min(unsigned int, skb->len - nl->outpos, nl->framelen); outsb( dev->base_addr + DAT, skb->data + nl->outpos, len ); *crc_p = calc_crc32( *crc_p, skb->data + nl->outpos, len ); @@ -760,8 +760,9 @@ interpret_ack( struct net_device *dev, unsigned ack ) nl->outpos += nl->framelen; if( --nl->tx_frameno ) - nl->framelen = min( nl->maxframe, - nl->tx_buf_p->len - nl->outpos ); + nl->framelen = min(unsigned int, + nl->maxframe, + nl->tx_buf_p->len - nl->outpos); else send_complete( nl ), #ifdef CONFIG_SBNI_MULTILINE diff --git a/drivers/net/wan/sbni.h b/drivers/net/wan/sbni.h index 335dbf13f4d6..8e83e274824d 100644 --- a/drivers/net/wan/sbni.h +++ b/drivers/net/wan/sbni.h @@ -137,7 +137,5 @@ struct sbni_flags { #define __initdata #endif -#define min( x, y ) ( (x) < (y) ? (x) : (y) ) - #endif diff --git a/drivers/net/wan/sdla_chdlc.c b/drivers/net/wan/sdla_chdlc.c index afd1fef9bc29..b5f027c17c41 100644 --- a/drivers/net/wan/sdla_chdlc.c +++ b/drivers/net/wan/sdla_chdlc.c @@ -505,13 +505,13 @@ int wpc_init (sdla_t* card, wandev_conf_t* conf) /* For Primary Port 0 */ card->wandev.mtu = (conf->mtu >= MIN_LGTH_CHDLC_DATA_CFG) ? - min(conf->mtu, PRI_MAX_NO_DATA_BYTES_IN_FRAME) : + min(unsigned int, conf->mtu, PRI_MAX_NO_DATA_BYTES_IN_FRAME) : CHDLC_DFLT_DATA_LEN; } else if(port_num == WANOPT_SEC) { /* For Secondary Port 1 */ card->wandev.mtu = (conf->mtu >= MIN_LGTH_CHDLC_DATA_CFG) ? - min(conf->mtu, SEC_MAX_NO_DATA_BYTES_IN_FRAME) : + min(unsigned int, conf->mtu, SEC_MAX_NO_DATA_BYTES_IN_FRAME) : CHDLC_DFLT_DATA_LEN; } @@ -827,19 +827,19 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) card->u.c.kpalv_tx = ((conf->keepalive_tx_tmr - MIN_Tx_KPALV_TIMER) >= 0) ? - min(conf->keepalive_tx_tmr,MAX_Tx_KPALV_TIMER) : + min(unsigned int, conf->keepalive_tx_tmr,MAX_Tx_KPALV_TIMER) : DEFAULT_Tx_KPALV_TIMER; card->u.c.kpalv_rx = ((conf->keepalive_rx_tmr - MIN_Rx_KPALV_TIMER) >= 0) ? - min(conf->keepalive_rx_tmr,MAX_Rx_KPALV_TIMER) : + min(unsigned int, conf->keepalive_rx_tmr,MAX_Rx_KPALV_TIMER) : DEFAULT_Rx_KPALV_TIMER; card->u.c.kpalv_err = ((conf->keepalive_err_margin-MIN_KPALV_ERR_TOL) >= 0) ? - min(conf->keepalive_err_margin, + min(unsigned int, conf->keepalive_err_margin, MAX_KPALV_ERR_TOL) : DEFAULT_KPALV_ERR_TOL; } @@ -847,7 +847,7 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) /* Setup slarp timer to control delay between slarps */ card->u.c.slarp_timer = ((conf->slarp_timer - MIN_SLARP_REQ_TIMER) >= 0) ? - min (conf->slarp_timer, MAX_SLARP_REQ_TIMER) : + min(unsigned int, conf->slarp_timer, MAX_SLARP_REQ_TIMER) : DEFAULT_SLARP_REQ_TIMER; #ifdef LINUX_2_0 diff --git a/drivers/net/wan/sdla_fr.c b/drivers/net/wan/sdla_fr.c index 4f5a9def99ae..1032346d596a 100644 --- a/drivers/net/wan/sdla_fr.c +++ b/drivers/net/wan/sdla_fr.c @@ -548,10 +548,10 @@ int wpf_init(sdla_t *card, wandev_conf_t *conf) /* Adjust configuration */ conf->mtu += FR_HEADER_LEN; conf->mtu = (conf->mtu >= MIN_LGTH_FR_DATA_CFG) ? - min(conf->mtu, FR_MAX_NO_DATA_BYTES_IN_FRAME) : + min(unsigned int, conf->mtu, FR_MAX_NO_DATA_BYTES_IN_FRAME) : FR_CHANNEL_MTU + FR_HEADER_LEN; - conf->bps = min(conf->bps, 2048000); + conf->bps = min(unsigned int, conf->bps, 2048000); /* Initialze the configuration structure sent to the board to zero */ memset(&u.cfg, 0, sizeof(u.cfg)); @@ -618,7 +618,7 @@ int wpf_init(sdla_t *card, wandev_conf_t *conf) * command in fr_configure() routine. */ - card->u.f.dlci_num = min(max(conf->u.fr.dlci_num, 1), 100); + card->u.f.dlci_num = min(unsigned int, max(unsigned int, conf->u.fr.dlci_num, 1), 100); for ( i = 0; i < card->u.f.dlci_num; i++) { @@ -635,27 +635,27 @@ int wpf_init(sdla_t *card, wandev_conf_t *conf) u.cfg.port |= 0x0002; if (conf->u.fr.t391) - u.cfg.t391 = min(conf->u.fr.t391, 30); + u.cfg.t391 = min(unsigned int, conf->u.fr.t391, 30); else u.cfg.t391 = 5; if (conf->u.fr.t392) - u.cfg.t392 = min(conf->u.fr.t392, 30); + u.cfg.t392 = min(unsigned int, conf->u.fr.t392, 30); else u.cfg.t392 = 15; if (conf->u.fr.n391) - u.cfg.n391 = min(conf->u.fr.n391, 255); + u.cfg.n391 = min(unsigned int, conf->u.fr.n391, 255); else u.cfg.n391 = 2; if (conf->u.fr.n392) - u.cfg.n392 = min(conf->u.fr.n392, 10); + u.cfg.n392 = min(unsigned int, conf->u.fr.n392, 10); else u.cfg.n392 = 3; if (conf->u.fr.n393) - u.cfg.n393 = min(conf->u.fr.n393, 10); + u.cfg.n393 = min(unsigned int, conf->u.fr.n393, 10); else u.cfg.n393 = 4; @@ -952,7 +952,8 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) */ if (conf->cir) { - chan->cir = max( 1, min( conf->cir, 512 ) ); + chan->cir = max(unsigned int, 1, + min(unsigned int, conf->cir, 512)); chan->cir_status = CIR_ENABLED; @@ -963,7 +964,8 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) chan->bc = chan->cir; if (conf->be){ - chan->be = max( 0, min( conf->be, 511) ); + chan->be = max(unsigned int, + 0, min(unsigned int, conf->be, 511)); }else{ conf->be = 0; } diff --git a/drivers/net/wan/sdla_ppp.c b/drivers/net/wan/sdla_ppp.c index 9af93fa18b69..00d53beb38d0 100644 --- a/drivers/net/wan/sdla_ppp.c +++ b/drivers/net/wan/sdla_ppp.c @@ -400,7 +400,7 @@ int wpp_init(sdla_t *card, wandev_conf_t *conf) printk(KERN_INFO "%s: running PPP firmware v%s\n",card->devname, u.str); /* Adjust configuration and set defaults */ card->wandev.mtu = (conf->mtu) ? - min(conf->mtu, PPP_MAX_MTU) : PPP_DFLT_MTU; + min(unsigned int, conf->mtu, PPP_MAX_MTU) : PPP_DFLT_MTU; card->wandev.bps = conf->bps; card->wandev.interface = conf->interface; @@ -629,7 +629,7 @@ static int new_if(wan_device_t *wandev, netdevice_t *dev, wanif_conf_t *conf) dev->init = &if_init; dev->priv = ppp_priv_area; - dev->mtu = min(dev->mtu, card->wandev.mtu); + dev->mtu = min(unsigned int, dev->mtu, card->wandev.mtu); /* Initialize the polling task routine */ #ifndef LINUX_2_4 diff --git a/drivers/net/wan/sdla_x25.c b/drivers/net/wan/sdla_x25.c index c60d00f68901..928327df0f22 100644 --- a/drivers/net/wan/sdla_x25.c +++ b/drivers/net/wan/sdla_x25.c @@ -653,13 +653,13 @@ int wpx_init (sdla_t* card, wandev_conf_t* conf) u.cfg.defPktSize = u.cfg.pktMTU = card->wandev.mtu; if (conf->u.x25.hi_pvc){ - card->u.x.hi_pvc = min(conf->u.x25.hi_pvc, MAX_LCN_NUM); - card->u.x.lo_pvc = min(conf->u.x25.lo_pvc, card->u.x.hi_pvc); + card->u.x.hi_pvc = min(unsigned int, conf->u.x25.hi_pvc, MAX_LCN_NUM); + card->u.x.lo_pvc = min(unsigned int, conf->u.x25.lo_pvc, card->u.x.hi_pvc); } if (conf->u.x25.hi_svc){ - card->u.x.hi_svc = min(conf->u.x25.hi_svc, MAX_LCN_NUM); - card->u.x.lo_svc = min(conf->u.x25.lo_svc, card->u.x.hi_svc); + card->u.x.hi_svc = min(unsigned int, conf->u.x25.hi_svc, MAX_LCN_NUM); + card->u.x.lo_svc = min(unsigned int, conf->u.x25.lo_svc, card->u.x.hi_svc); } /* Figure out the total number of channels to configure */ @@ -684,38 +684,38 @@ int wpx_init (sdla_t* card, wandev_conf_t* conf) u.cfg.hiTwoWaySVC = card->u.x.hi_svc; if (conf->u.x25.hdlc_window) - u.cfg.hdlcWindow = min(conf->u.x25.hdlc_window, 7); + u.cfg.hdlcWindow = min(unsigned int, conf->u.x25.hdlc_window, 7); if (conf->u.x25.pkt_window) - u.cfg.pktWindow = min(conf->u.x25.pkt_window, 7); + u.cfg.pktWindow = min(unsigned int, conf->u.x25.pkt_window, 7); if (conf->u.x25.t1) - u.cfg.t1 = min(conf->u.x25.t1, 30); + u.cfg.t1 = min(unsigned int, conf->u.x25.t1, 30); if (conf->u.x25.t2) - u.cfg.t2 = min(conf->u.x25.t2, 29); + u.cfg.t2 = min(unsigned int, conf->u.x25.t2, 29); if (conf->u.x25.t4) - u.cfg.t4 = min(conf->u.x25.t4, 240); + u.cfg.t4 = min(unsigned int, conf->u.x25.t4, 240); if (conf->u.x25.n2) - u.cfg.n2 = min(conf->u.x25.n2, 30); + u.cfg.n2 = min(unsigned int, conf->u.x25.n2, 30); if (conf->u.x25.t10_t20) - u.cfg.t10t20 = min(conf->u.x25.t10_t20,255); + u.cfg.t10t20 = min(unsigned int, conf->u.x25.t10_t20,255); if (conf->u.x25.t11_t21) - u.cfg.t11t21 = min(conf->u.x25.t11_t21,255); + u.cfg.t11t21 = min(unsigned int, conf->u.x25.t11_t21,255); if (conf->u.x25.t12_t22) - u.cfg.t12t22 = min(conf->u.x25.t12_t22,255); + u.cfg.t12t22 = min(unsigned int, conf->u.x25.t12_t22,255); if (conf->u.x25.t13_t23) - u.cfg.t13t23 = min(conf->u.x25.t13_t23,255); + u.cfg.t13t23 = min(unsigned int, conf->u.x25.t13_t23,255); if (conf->u.x25.t16_t26) - u.cfg.t16t26 = min(conf->u.x25.t16_t26, 255); + u.cfg.t16t26 = min(unsigned int, conf->u.x25.t16_t26, 255); if (conf->u.x25.t28) - u.cfg.t28 = min(conf->u.x25.t28, 255); + u.cfg.t28 = min(unsigned int, conf->u.x25.t28, 255); if (conf->u.x25.r10_r20) - u.cfg.r10r20 = min(conf->u.x25.r10_r20,250); + u.cfg.r10r20 = min(unsigned int, conf->u.x25.r10_r20,250); if (conf->u.x25.r12_r22) - u.cfg.r12r22 = min(conf->u.x25.r12_r22,250); + u.cfg.r12r22 = min(unsigned int, conf->u.x25.r12_r22,250); if (conf->u.x25.r13_r23) - u.cfg.r13r23 = min(conf->u.x25.r13_r23,250); + u.cfg.r13r23 = min(unsigned int, conf->u.x25.r13_r23,250); if (conf->u.x25.ccitt_compat) diff --git a/drivers/net/wan/wanpipe_multppp.c b/drivers/net/wan/wanpipe_multppp.c index 448341d5bbd7..d190eb322e2c 100644 --- a/drivers/net/wan/wanpipe_multppp.c +++ b/drivers/net/wan/wanpipe_multppp.c @@ -375,13 +375,13 @@ int wsppp_init (sdla_t* card, wandev_conf_t* conf) /* For Primary Port 0 */ card->wandev.mtu = (conf->mtu >= MIN_LGTH_CHDLC_DATA_CFG) ? - min(conf->mtu, PRI_MAX_NO_DATA_BYTES_IN_FRAME) : + min(unsigned int, conf->mtu, PRI_MAX_NO_DATA_BYTES_IN_FRAME) : CHDLC_DFLT_DATA_LEN; } else if(port_num == WANOPT_SEC) { /* For Secondary Port 1 */ card->wandev.mtu = (conf->mtu >= MIN_LGTH_CHDLC_DATA_CFG) ? - min(conf->mtu, SEC_MAX_NO_DATA_BYTES_IN_FRAME) : + min(unsigned int, conf->mtu, SEC_MAX_NO_DATA_BYTES_IN_FRAME) : CHDLC_DFLT_DATA_LEN; } diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index ff2ac1ccd2d6..78b666462b01 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c @@ -259,8 +259,6 @@ MODULE_PARM_DESC(proc_perm, "The permission bits of the files in /proc"); #include <asm/uaccess.h> -#define min(x,y) ((x<y)?x:y) - /* This is a kind of sloppy hack to get this information to OUT4500 and IN4500. I would be extremely interested in the situation where this doesnt work though!!! */ @@ -1755,7 +1753,7 @@ static int PC4500_readrid(struct airo_info *ai, u16 rid, void *pBuf, int len) // read the rid length field bap_read(ai, pBuf, 2, BAP1); // length for remaining part of rid - len = min(len, le16_to_cpu(*(u16*)pBuf)) - 2; + len = min(unsigned int, len, le16_to_cpu(*(u16*)pBuf)) - 2; if ( len <= 2 ) { printk( KERN_ERR @@ -3998,7 +3996,8 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) { * 9/22/2000 Honor user given length */ - if (copy_to_user(comp->data, iobuf, min (comp->len, sizeof(iobuf)))) + if (copy_to_user(comp->data, iobuf, + min(unsigned int, comp->len, sizeof(iobuf)))) return -EFAULT; return 0; } @@ -4057,7 +4056,8 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) { PC4500_readrid(dev->priv,ridcode,iobuf,sizeof(iobuf)); - if (copy_to_user(comp->data,iobuf,min(comp->len,sizeof(iobuf)))) + if (copy_to_user(comp->data, iobuf, + min(unsigned int, comp->len, sizeof(iobuf)))) return -EFAULT; return 0; diff --git a/drivers/net/wireless/airport.c b/drivers/net/wireless/airport.c index daa24801b818..3cd86b130d4a 100644 --- a/drivers/net/wireless/airport.c +++ b/drivers/net/wireless/airport.c @@ -1,4 +1,4 @@ -/* airport.c 0.05 +/* airport.c 0.06f * * A driver for "Hermes" chipset based Apple Airport wireless * card. @@ -32,6 +32,10 @@ #include "hermes.h" #include "orinoco.h" +static const char version[] __initdata = "airport.c 0.06f (Benjamin Herrenschmidt <benh@kernel.crashing.org>)"; +MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>"); +MODULE_DESCRIPTION("Driver for the Apple Airport wireless card."); + typedef struct dldwd_card { struct device_node* node; int irq_requested; @@ -40,8 +44,6 @@ typedef struct dldwd_card { struct dldwd_priv priv; } dldwd_card_t; -static char *version = "airport.c 0.05 (Benjamin Herrenschmidt <benh@kernel.crashing.org>)"; - /* * Function prototypes */ @@ -186,7 +188,7 @@ airport_attach(struct device_node* of_node) printk(KERN_ERR "airport: register_netdev() failed\n"); goto failed; } - printk(KERN_INFO "airport: card registered for interface %s\n", ndev->name); + printk(KERN_DEBUG "airport: card registered for interface %s\n", ndev->name); card->ndev_registered = 1; SET_MODULE_OWNER(ndev); @@ -242,7 +244,7 @@ init_airport(void) { struct device_node* airport_node; - printk(KERN_INFO "%s\n", version); + printk(KERN_DEBUG "%s\n", version); MOD_INC_USE_COUNT; diff --git a/drivers/net/wireless/hermes.c b/drivers/net/wireless/hermes.c index 923850119e41..c6a684b7a579 100644 --- a/drivers/net/wireless/hermes.c +++ b/drivers/net/wireless/hermes.c @@ -3,21 +3,19 @@ * Driver core for the "Hermes" wireless MAC controller, as used in * the Lucent Orinoco and Cabletron RoamAbout cards. It should also * work on the hfa3841 and hfa3842 MAC controller chips used in the - * Prism I & II chipsets. + * Prism II chipsets. * * This is not a complete driver, just low-level access routines for * the MAC controller itself. * * Based on the prism2 driver from Absolute Value Systems' linux-wlan * project, the Linux wvlan_cs driver, Lucent's HCF-Light - * (wvlan_hcf.c) library, and the NetBSD wireless driver. + * (wvlan_hcf.c) library, and the NetBSD wireless driver (in no + * particular order). * * Copyright (C) 2000, David Gibson, Linuxcare Australia <hermes@gibson.dropbear.id.au> * - * This file distributed under the GPL, version 2. - */ - -static const char *version = "hermes.c: 12 Dec 2000 David Gibson <hermes@gibson.dropbear.id.au>"; + * This file distributed under the GPL, version 2. */ #include <linux/module.h> #include <linux/types.h> @@ -32,6 +30,10 @@ static const char *version = "hermes.c: 12 Dec 2000 David Gibson <hermes@gibson. #include "hermes.h" +static const char version[] __initdata = "hermes.c: 1 Aug 2001 David Gibson <hermes@gibson.dropbear.id.au>"; +MODULE_DESCRIPTION("Low-level driver helper for Lucent Hermes chipset and Prism II HFA384x wireless MAC controller"); +MODULE_AUTHOR("David Gibson <hermes@gibson.dropbear.id.au>"); + /* These are maximum timeouts. Most often, card wil react much faster */ #define CMD_BUSY_TIMEOUT (100) /* In iterations of ~1us */ #define CMD_INIT_TIMEOUT (50000) /* in iterations of ~10us */ @@ -70,10 +72,6 @@ static const char *version = "hermes.c: 12 Dec 2000 David Gibson <hermes@gibson. static int hermes_issue_cmd(hermes_t *hw, uint16_t cmd, uint16_t param0); /* - * Internal inline functions - */ - -/* * Internal functions */ @@ -87,7 +85,6 @@ static int hermes_issue_cmd(hermes_t *hw, uint16_t cmd, uint16_t param0); static int hermes_issue_cmd(hermes_t *hw, uint16_t cmd, uint16_t param0) { uint16_t reg; -/* unsigned long k = CMD_BUSY_TIMEOUT; */ /* First check that the command register is not busy */ reg = hermes_read_regn(hw, CMD); @@ -124,9 +121,12 @@ int hermes_reset(hermes_t *hw) hermes_write_regn(hw, INTEN, 0); hermes_write_regn(hw, EVACK, 0xffff); - /* Because we hope we can reset the card even if it gets into - a stupid state, we actually wait to see if the command - register will unbusy itself */ + /* Normally it's a "can't happen" for the command register to + be busy when we go to issue a command because we are + serializing all commands. However we want to have some + chance of resetting the card even if it gets into a stupid + state, so we actually wait to see if the command register + will unbusy itself here. */ k = CMD_BUSY_TIMEOUT; reg = hermes_read_regn(hw, CMD); while (k && (reg & HERMES_CMD_BUSY)) { @@ -139,8 +139,8 @@ int hermes_reset(hermes_t *hw) reg = hermes_read_regn(hw, CMD); } - /* No need to explicitly handle the timeout - hermes_issue_cmd() will - probably return -EBUSY */ + /* No need to explicitly handle the timeout - if we've timed + out hermes_issue_cmd() will probably return -EBUSY below */ /* According to the documentation, EVSTAT may contain obsolete event occurrence information. We have to acknowledge @@ -503,7 +503,7 @@ EXPORT_SYMBOL(hermes_write_ltv); static int __init init_hermes(void) { - printk(KERN_INFO "%s\n", version); + printk(KERN_DEBUG "%s\n", version); return 0; } diff --git a/drivers/net/wireless/hermes.h b/drivers/net/wireless/hermes.h index 10c841316743..bc74036f247c 100644 --- a/drivers/net/wireless/hermes.h +++ b/drivers/net/wireless/hermes.h @@ -101,7 +101,7 @@ #define HERMES_STATUS_CMDCODE (0x003f) /* - * OFFSET refister bitmasks + * OFFSET register bitmasks */ #define HERMES_OFFSET_BUSY (0x8000) #define HERMES_OFFSET_ERR (0x4000) diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c index 76a913335ba9..2560a38c884d 100644 --- a/drivers/net/wireless/orinoco.c +++ b/drivers/net/wireless/orinoco.c @@ -1,4 +1,4 @@ -/* orinoco.c 0.06 - (formerly known as dldwd_cs.c and orinoco_cs.c) +/* orinoco.c 0.06f - (formerly known as dldwd_cs.c and orinoco_cs.c) * * A driver for "Hermes" chipset based PCMCIA wireless adaptors, such * as the Lucent WavelanIEEE/Orinoco cards and their OEM (Cabletron/ @@ -33,10 +33,10 @@ * Reserved. * * Alternatively, the contents of this file may be used under the - * terms of the GNU Public License version 2 (the "GPL"), in which - * case the provisions of the GPL are applicable instead of the above. - * If you wish to allow the use of your version of this file only - * under the terms of the GPL and not to allow others to use your + * terms of the GNU General Public License version 2 (the "GPL"), in + * which case the provisions of the GPL are applicable instead of the + * above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use your * version of this file under the MPL, indicate your decision by * deleting the provisions above and replace them with the notice and * other provisions required by the GPL. If you do not delete the @@ -166,6 +166,24 @@ * v0.06b -> v0.06c - 29/5/2001 - Jean II * o Show first spy address in /proc/net/wireless for IBSS mode as well * + * v0.06c -> v0.06d - 6/7/2001 - David Gibson + * o Change a bunch of KERN_INFO messages to KERN_DEBUG, as per Linus' + * wishes to reduce the number of unecessary messages. + * o Removed bogus message on CRC error. + * o Merged fixeds for v0.08 Prism 2 firmware from William Waghorn + * <willwaghorn@yahoo.co.uk> + * o Slight cleanup/re-arrangement of firmware detection code. + * + * v0.06d -> v0.06e - 1/8/2001 - David Gibson + * o Removed some redundant global initializers (orinoco_cs.c). + * o Added some module metadataa + * + * v0.06e -> v0.06f - 14/8/2001 - David Gibson + * o Wording fix to license + * o Added a 'use_alternate_encaps' module parameter for APs which need an oui of + * 00:00:00. We really need a better way of handling this, but the module flag + * is better than nothing for now. + * * TODO - Jean II * o inline functions (lot's of candidate, need to reorder code) * o Test PrismII/Symbol cards & firmware versions @@ -202,7 +220,9 @@ #include "hermes.h" #include "orinoco.h" -static char *version = "orinoco.c 0.06c (David Gibson <hermes@gibson.dropbear.id.au> and others)"; +static const char version[] __initdata = "orinoco.c 0.06f (David Gibson <hermes@gibson.dropbear.id.au> and others)"; +MODULE_AUTHOR("David Gibson <hermes@gibson.dropbear.id.au>"); +MODULE_DESCRIPTION("Driver for Lucent Orinoco, Prism II based and similar wireless cards"); /* Level of debugging. Used in the macros in orinoco.h */ #ifdef ORINOCO_DEBUG @@ -210,6 +230,11 @@ int dldwd_debug = ORINOCO_DEBUG; MODULE_PARM(dldwd_debug, "i"); #endif +/* FIXME: We need a better way of handling this */ +/* Set this flag to use 00:00:00 for the encapsulation oui instead of 00:00:F8 */ +static int use_alternate_encaps; /* =0 */ +MODULE_PARM(use_alternate_encaps, "i"); + const long channel_frequency[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484 @@ -274,6 +299,9 @@ struct dldwd_frame_hdr { struct p8022_hdr encaps_hdr = { 0xaa, 0xaa, 0x03, {0x00, 0x00, 0xf8} }; +struct p8022_hdr alternate_encaps_hdr = { + 0xaa, 0xaa, 0x03, {0x00, 0x00, 0x00} +}; /* * Function prototypes @@ -396,6 +424,7 @@ set_port_type(dldwd_priv_t *priv) priv->port_type = 4; else priv->port_type = 1; + priv->port_type = priv->ibss_port; priv->allow_ibss = 1; } break; @@ -1050,8 +1079,7 @@ static void __dldwd_ev_rx(dldwd_priv_t *priv, hermes_t *hw) if (status & HERMES_RXSTAT_ERR) { if ((status & HERMES_RXSTAT_ERR) == HERMES_RXSTAT_BADCRC) { stats->rx_crc_errors++; - printk(KERN_WARNING "%s: Bad CRC on Rx. Frame dropped.\n", - dev->name); + DEBUG(1, "%s: Bad CRC on Rx. Frame dropped.\n", dev->name); show_rx_frame(&hdr); } else if ((status & HERMES_RXSTAT_ERR) == HERMES_RXSTAT_UNDECRYPTABLE) { @@ -1198,34 +1226,14 @@ static void __dldwd_ev_alloc(dldwd_priv_t *priv, hermes_t *hw) /* hermes_write_regn(hw, ALLOCFID, 0); */ } -/* - * struct net_device methods - */ - -int -dldwd_init(struct net_device *dev) +static void determine_firmware(struct net_device *dev) { dldwd_priv_t *priv = dev->priv; hermes_t *hw = &priv->hw; - int err = 0; - hermes_id_t nickbuf; - uint16_t reclen; - int len; - char *vendor_str; + int err; uint32_t firmver; + char *vendor_str; - TRACE_ENTER("dldwd"); - - dldwd_lock(priv); - - /* Do standard firmware reset */ - err = hermes_reset(hw); - if (err != 0) { - printk(KERN_ERR "%s: failed to reset hardware (err = %d)\n", - dev->name, err); - goto out; - } - /* Get the firmware version */ err = hermes_read_staidentity(hw, USER_BAP, &priv->firmware_info); if (err) { @@ -1361,18 +1369,54 @@ dldwd_init(struct net_device *dev) priv->has_pm = 0; priv->has_preamble = 0; } + + if (priv->firmware_type == FIRMWARE_TYPE_SYMBOL) + priv->ibss_port = 4; + else if ( (priv->firmware_type == FIRMWARE_TYPE_PRISM2) && (firmver >= 0x00008) ) + priv->ibss_port = 0; + else + priv->ibss_port = 1; - printk(KERN_INFO "%s: Firmware ID %02X vendor 0x%x (%s) version %d.%02d\n", + printk(KERN_DEBUG "%s: Firmware ID %02X vendor 0x%x (%s) version %d.%02d\n", dev->name, priv->firmware_info.id, priv->firmware_info.vendor, vendor_str, priv->firmware_info.major, priv->firmware_info.minor); +} + +/* + * struct net_device methods + */ + +int +dldwd_init(struct net_device *dev) +{ + dldwd_priv_t *priv = dev->priv; + hermes_t *hw = &priv->hw; + int err = 0; + hermes_id_t nickbuf; + uint16_t reclen; + int len; + + TRACE_ENTER("dldwd"); + + dldwd_lock(priv); + + /* Do standard firmware reset */ + err = hermes_reset(hw); + if (err != 0) { + printk(KERN_ERR "%s: failed to reset hardware (err = %d)\n", + dev->name, err); + goto out; + } + + determine_firmware(dev); if (priv->has_port3) - printk(KERN_INFO "%s: Ad-hoc demo mode supported.\n", dev->name); + printk(KERN_DEBUG "%s: Ad-hoc demo mode supported.\n", dev->name); if (priv->has_ibss) - printk(KERN_INFO "%s: IEEE standard IBSS ad-hoc mode supported.\n", + printk(KERN_DEBUG "%s: IEEE standard IBSS ad-hoc mode supported.\n", dev->name); if (priv->has_wep) { - printk(KERN_INFO "%s: WEP supported, ", dev->name); + printk(KERN_DEBUG "%s: WEP supported, ", dev->name); if (priv->has_big_wep) printk("\"128\"-bit key.\n"); else @@ -1388,7 +1432,7 @@ dldwd_init(struct net_device *dev) goto out; } - printk(KERN_INFO "%s: MAC address %02X:%02X:%02X:%02X:%02X:%02X\n", + printk(KERN_DEBUG "%s: MAC address %02X:%02X:%02X:%02X:%02X:%02X\n", dev->name, dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]); @@ -1408,7 +1452,7 @@ dldwd_init(struct net_device *dev) memcpy(priv->nick, &nickbuf.val, len); priv->nick[len] = '\0'; - printk(KERN_INFO "%s: Station name \"%s\"\n", dev->name, priv->nick); + printk(KERN_DEBUG "%s: Station name \"%s\"\n", dev->name, priv->nick); /* Get allowed channels */ err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CHANNEL_LIST, &priv->channel_mask); @@ -1482,7 +1526,7 @@ dldwd_init(struct net_device *dev) priv->wep_on = 0; priv->tx_key = 0; - printk(KERN_INFO "%s: ready\n", dev->name); + printk(KERN_DEBUG "%s: ready\n", dev->name); out: dldwd_unlock(priv); @@ -1668,7 +1712,11 @@ dldwd_xmit(struct sk_buff *skb, struct net_device *dev) hdr.p8023.h_proto = htons(data_len + ENCAPS_OVERHEAD); /* 802.2 header */ - memcpy(&hdr.p8022, &encaps_hdr, sizeof(encaps_hdr)); + /* FIXME: ugh, what a hack for the 00:00:00 APs. Need to find a better way */ + if (use_alternate_encaps) + memcpy(&hdr.p8022, &alternate_encaps_hdr, sizeof(alternate_encaps_hdr)); + else + memcpy(&hdr.p8022, &encaps_hdr, sizeof(encaps_hdr)); hdr.ethertype = eh->h_proto; err = hermes_bap_pwrite(hw, USER_BAP, &hdr, sizeof(hdr), @@ -2546,6 +2594,33 @@ static int dldwd_ioctl_getretry(struct net_device *dev, struct iw_param *rrq) } #endif /* WIRELESS_EXT > 10 */ +static int dldwd_ioctl_setibssport(struct net_device *dev, struct iwreq *wrq) +{ + dldwd_priv_t *priv = dev->priv; + int val = *( (int *) wrq->u.name ); + + dldwd_lock(priv); + priv->ibss_port = val ; + + /* Actually update the mode we are using */ + set_port_type(priv); + + dldwd_unlock(priv); + return 0; +} + +static int dldwd_ioctl_getibssport(struct net_device *dev, struct iwreq *wrq) +{ + dldwd_priv_t *priv = dev->priv; + int *val = (int *)wrq->u.name; + + dldwd_lock(priv); + *val = priv->ibss_port; + dldwd_unlock(priv); + + return 0; +} + static int dldwd_ioctl_setport3(struct net_device *dev, struct iwreq *wrq) { dldwd_priv_t *priv = dev->priv; @@ -2941,7 +3016,13 @@ dldwd_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 0, "set_preamble" }, { SIOCDEVPRIVATE + 0x5, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, - "get_preamble" } + "get_preamble" }, + { SIOCDEVPRIVATE + 0x6, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, + 0, "set_ibssport" }, + { SIOCDEVPRIVATE + 0x7, 0, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, + "get_ibssport" } }; err = verify_area(VERIFY_WRITE, wrq->u.data.pointer, sizeof(privtab)); @@ -3038,6 +3119,25 @@ dldwd_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) } else err = -EOPNOTSUPP; break; + case SIOCDEVPRIVATE + 0x6: /* set_ibssport */ + DEBUG(1, "%s: SIOCDEVPRIVATE + 0x6 (set_ibssport)\n", + dev->name); + if (! capable(CAP_NET_ADMIN)) { + err = -EPERM; + break; + } + + err = dldwd_ioctl_setibssport(dev, wrq); + if (! err) + changed = 1; + break; + + case SIOCDEVPRIVATE + 0x7: /* get_ibssport */ + DEBUG(1, "%s: SIOCDEVPRIVATE + 0x7 (get_ibssport)\n", + dev->name); + err = dldwd_ioctl_getibssport(dev, wrq); + break; + default: err = -EOPNOTSUPP; @@ -3601,7 +3701,7 @@ static int __init init_dldwd(void) err = dldwd_proc_init(); - printk(KERN_INFO "%s\n", version); + printk(KERN_DEBUG "%s\n", version); return 0; } diff --git a/drivers/net/wireless/orinoco.h b/drivers/net/wireless/orinoco.h index b90d323d2fa1..db2b6638cc4a 100644 --- a/drivers/net/wireless/orinoco.h +++ b/drivers/net/wireless/orinoco.h @@ -69,7 +69,7 @@ typedef struct dldwd_priv { #define FIRMWARE_TYPE_LUCENT 1 #define FIRMWARE_TYPE_PRISM2 2 #define FIRMWARE_TYPE_SYMBOL 3 - int has_ibss, has_port3, prefer_port3, has_ibss_any; + int has_ibss, has_port3, prefer_port3, has_ibss_any, ibss_port; int has_wep, has_big_wep; int has_mwo; int has_pm; @@ -107,10 +107,10 @@ typedef struct dldwd_priv { /*====================================================================*/ -extern int dldwd_debug; extern struct list_head dldwd_instances; #ifdef ORINOCO_DEBUG +extern int dldwd_debug; #define DEBUG(n, args...) if (dldwd_debug>(n)) printk(KERN_DEBUG args) #define DEBUGMORE(n, args...) do { if (dldwd_debug>(n)) printk(args); } while (0) #else diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c index 8bf94dc46acd..2a26a07c4c1c 100644 --- a/drivers/net/wireless/orinoco_cs.c +++ b/drivers/net/wireless/orinoco_cs.c @@ -1,4 +1,4 @@ -/* orinoco_cs.c 0.06 - (formerly known as dldwd_cs.c) +/* orinoco_cs.c 0.06f - (formerly known as dldwd_cs.c) * * A driver for "Hermes" chipset based PCMCIA wireless adaptors, such * as the Lucent WavelanIEEE/Orinoco cards and their OEM (Cabletron/ @@ -40,20 +40,12 @@ #include "hermes.h" #include "orinoco.h" -/* Pcmcia specific structure */ -typedef struct dldwd_card { - dev_link_t link; - dev_node_t node; - int instance; - - /* Common structure (fully included), see orinoco.h */ - struct dldwd_priv priv; -} dldwd_card_t; +/*====================================================================*/ -static char version[] __initdata = -"orinoco_cs.c 0.06 (David Gibson <hermes@gibson.dropbear.id.au> and others)"; +static const char version[] __initdata = "orinoco_cs.c 0.06f (David Gibson <hermes@gibson.dropbear.id.au> and others)"; -/*====================================================================*/ +MODULE_AUTHOR("David Gibson <hermes@gibson.dropbear.id.au>"); +MODULE_DESCRIPTION("Driver for PCMCIA Lucent Orinoco, Prism II based and similar wireless cards"); /* Parameters that can be set with 'insmod' */ @@ -66,13 +58,24 @@ static int irq_list[4] = { -1 }; static int reset_cor = 0; /* Some D-Link cards have buggy CIS. They do work at 5v properly, but * don't have any CIS entry for it. This workaround it... */ -static int ignore_cis_vcc = 0; +static int ignore_cis_vcc; /* = 0 */ MODULE_PARM(irq_mask, "i"); MODULE_PARM(irq_list, "1-4i"); MODULE_PARM(reset_cor, "i"); MODULE_PARM(ignore_cis_vcc, "i"); + +/* Pcmcia specific structure */ +typedef struct dldwd_card { + dev_link_t link; + dev_node_t node; + int instance; + + /* Common structure (fully included), see orinoco.h */ + struct dldwd_priv priv; +} dldwd_card_t; + /* * Function prototypes */ @@ -108,8 +111,8 @@ static dev_info_t dev_info = "orinoco_cs"; device numbers are used to derive the corresponding array index. */ -static dev_link_t *dev_list; -static int num_instances; +static dev_link_t *dev_list; /* = NULL */ +static int num_instances; /* = 0 */ /*====================================================================*/ @@ -595,7 +598,7 @@ dldwd_cs_config(dev_link_t * link) strcpy(card->node.dev_name, ndev->name); /* Finally, report what we've done */ - printk(KERN_INFO "%s: index 0x%02x: Vcc %d.%d", + printk(KERN_DEBUG "%s: index 0x%02x: Vcc %d.%d", ndev->name, link->conf.ConfigIndex, link->conf.Vcc / 10, link->conf.Vcc % 10); if (link->conf.Vpp1) @@ -777,8 +780,8 @@ init_dldwd_cs(void) TRACE_ENTER("dldwd"); - printk(KERN_INFO "dldwd: David's Less Dodgy WaveLAN/IEEE Driver\n" - KERN_INFO "%s\n", version); + printk(KERN_DEBUG "dldwd: David's Less Dodgy WaveLAN/IEEE Driver\n" + KERN_DEBUG "%s\n", version); CardServices(GetCardServicesInfo, &serv); if (serv.Revision != CS_RELEASE_CODE) { diff --git a/drivers/s390/net/iucv.c b/drivers/s390/net/iucv.c index 4f1caa5210eb..8b6b662f1124 100644 --- a/drivers/s390/net/iucv.c +++ b/drivers/s390/net/iucv.c @@ -39,13 +39,6 @@ #include <asm/s390_ext.h> #include <asm/ebcdic.h> -#ifndef min -#define min(a,b) (((a)<(b))?(a):(b)) -#endif -#ifndef max -#define max(a,b) (((a)>(b))?(a):(b)) -#endif - #ifdef DEBUG #undef KERN_INFO #undef KERN_DEBUG @@ -1316,7 +1309,7 @@ iucv_receive (u16 pathid, u32 msgid, u32 trgcls, if (residual_buffer) *residual_buffer = parm.ipbfadr1; } else { - moved = min (buflen, 8); + moved = min(unsigned int, buflen, 8); memcpy ((char *) buffer, (char *) &parm.ipbfadr1, moved); @@ -1409,7 +1402,8 @@ iucv_receive_array (u16 pathid, while ((moved < 8) && (moved < buflen)) { dyn_len = - min ((buffer + i)->length, need_to_move); + min(unsigned int, + (buffer + i)->length, need_to_move); memcpy ((char *)((ulong)((buffer + i)->address)), ((char *) &parm.ipbfadr1) + moved, diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c index da068f42a517..09660e03ac75 100644 --- a/drivers/s390/net/netiucv.c +++ b/drivers/s390/net/netiucv.c @@ -91,7 +91,6 @@ MODULE_PARM_DESC (iucv, #include <linux/init.h> /* __setup() */ #include <asm/string.h> /* memset, memcpy, etc. */ #include "iucv.h" -#define min(a,b) (a < b) ? a : b #if defined( DEBUG ) #undef KERN_INFO @@ -828,7 +827,8 @@ register_iucv_dev (int devnumber, char *userid) net_device *dev; memset (iucv_userid[devnumber], ' ', 8); - memcpy (iucv_userid[devnumber], userid, min (strlen (userid), 8)); + memcpy (iucv_userid[devnumber], userid, + min(unsigned int, strlen(userid), 8)); dev = &iucv_netdev[devnumber]; sprintf (dev->name, "iucv%i", devnumber); diff --git a/drivers/sbus/audio/audio.c b/drivers/sbus/audio/audio.c index 581bdc847c2c..e8d9daca2de7 100644 --- a/drivers/sbus/audio/audio.c +++ b/drivers/sbus/audio/audio.c @@ -1,4 +1,4 @@ -/* $Id: audio.c,v 1.60 2001/05/21 09:05:05 davem Exp $ +/* $Id: audio.c,v 1.61 2001/08/13 14:40:12 davem Exp $ * drivers/sbus/audio/audio.c * * Copyright 1996 Thomas K. Dyas (tdyas@noc.rutgers.edu) diff --git a/drivers/sbus/char/aurora.c b/drivers/sbus/char/aurora.c index 0d7cf3557ed0..1e43c35111b8 100644 --- a/drivers/sbus/char/aurora.c +++ b/drivers/sbus/char/aurora.c @@ -1,4 +1,4 @@ -/* $Id: aurora.c,v 1.14 2001/06/29 23:07:37 davem Exp $ +/* $Id: aurora.c,v 1.15 2001/08/13 14:40:08 davem Exp $ * linux/drivers/sbus/char/aurora.c -- Aurora multiport driver * * Copyright (c) 1999 by Oliver Aldulea (oli at bv dot ro) diff --git a/drivers/sbus/char/pcikbd.c b/drivers/sbus/char/pcikbd.c index 4163a131cad2..dd650c6836fe 100644 --- a/drivers/sbus/char/pcikbd.c +++ b/drivers/sbus/char/pcikbd.c @@ -1,4 +1,4 @@ -/* $Id: pcikbd.c,v 1.58 2001/06/10 06:51:03 davem Exp $ +/* $Id: pcikbd.c,v 1.59 2001/08/13 14:40:08 davem Exp $ * pcikbd.c: Ultra/AX PC keyboard support. * * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) @@ -478,6 +478,11 @@ void pcikbd_leds(unsigned char leds) send_data(KBD_CMD_ENABLE); } +int pcikbd_rate(struct kbd_repeat *rep) +{ + return -EIO; +} + static int pcikbd_wait_for_input(void) { int status, data; diff --git a/drivers/sbus/char/rtc.c b/drivers/sbus/char/rtc.c index f380538c14c5..37fd2110a0f5 100644 --- a/drivers/sbus/char/rtc.c +++ b/drivers/sbus/char/rtc.c @@ -1,4 +1,4 @@ -/* $Id: rtc.c,v 1.26 2001/03/14 09:30:31 davem Exp $ +/* $Id: rtc.c,v 1.27 2001/08/13 14:40:08 davem Exp $ * * Linux/SPARC Real Time Clock Driver * Copyright (C) 1996 Thomas K. Dyas (tdyas@eden.rutgers.edu) diff --git a/drivers/sbus/char/uctrl.c b/drivers/sbus/char/uctrl.c index 01739b537c56..3a12bbe10031 100644 --- a/drivers/sbus/char/uctrl.c +++ b/drivers/sbus/char/uctrl.c @@ -1,4 +1,4 @@ -/* $Id: uctrl.c,v 1.10 2001/02/13 01:17:00 davem Exp $ +/* $Id: uctrl.c,v 1.11 2001/08/13 14:40:08 davem Exp $ * uctrl.c: TS102 Microcontroller interface on Tadpole Sparcbook 3 * * Copyright 1999 Derrick J Brashear (shadow@dementia.org) diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index 3ab0811a8e57..d748be4e4fb1 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c @@ -1202,15 +1202,14 @@ static void tw_interrupt(int irq, void *dev_instance, struct pt_regs *regs) int do_attention_interrupt=0; int do_host_interrupt=0; int do_command_interrupt=0; - int flags = 0; - int flags2 = 0; + unsigned long flags = 0; TW_Command *command_packet; if (test_and_set_bit(TW_IN_INTR, &tw_dev->flags)) return; spin_lock_irqsave(&io_request_lock, flags); if (tw_dev->tw_pci_dev->irq == irq) { - spin_lock_irqsave(&tw_dev->tw_lock, flags2); + spin_lock(&tw_dev->tw_lock); dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt()\n"); /* Read the registers */ @@ -1349,7 +1348,7 @@ static void tw_interrupt(int irq, void *dev_instance, struct pt_regs *regs) } } } - spin_unlock_irqrestore(&tw_dev->tw_lock, flags2); + spin_unlock(&tw_dev->tw_lock); } spin_unlock_irqrestore(&io_request_lock, flags); clear_bit(TW_IN_INTR, &tw_dev->flags); @@ -1918,7 +1917,7 @@ int tw_scsi_queue(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) unsigned char *command = SCpnt->cmnd; int request_id = 0; int error = 0; - int flags = 0; + unsigned long flags = 0; TW_Device_Extension *tw_dev = (TW_Device_Extension *)SCpnt->host->hostdata; if (tw_dev == NULL) { diff --git a/drivers/scsi/eata_generic.h b/drivers/scsi/eata_generic.h index c884def02a2f..b25cfbf9e7b3 100644 --- a/drivers/scsi/eata_generic.h +++ b/drivers/scsi/eata_generic.h @@ -25,8 +25,6 @@ #define FALSE 0 #endif -#define min(a,b) ((a<b)?(a):(b)) - #define R_LIMIT 0x20000 #define MAXISA 4 diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c index ce5b3800106e..7a070be69aa4 100644 --- a/drivers/scsi/eata_pio.c +++ b/drivers/scsi/eata_pio.c @@ -161,7 +161,7 @@ void eata_pio_int_handler(int irq, void *dev_id, struct pt_regs * regs) IncStat(&cmd->SCp,1); odd=FALSE; } - x=min(z,cmd->SCp.this_residual/2); + x=min(unsigned int,z,cmd->SCp.this_residual/2); insw(base+HA_RDATA,cmd->SCp.ptr,x); z-=x; IncStat(&cmd->SCp,2*x); @@ -191,7 +191,7 @@ void eata_pio_int_handler(int irq, void *dev_id, struct pt_regs * regs) z--; odd=FALSE; } - x=min(z,cmd->SCp.this_residual/2); + x=min(unsigned int,z,cmd->SCp.this_residual/2); outsw(base+HA_RDATA,cmd->SCp.ptr,x); z-=x; IncStat(&cmd->SCp,2*x); diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index d75f0f29e589..f8f37161b838 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c @@ -1416,7 +1416,7 @@ int ips_eh_reset(Scsi_Cmnd *SC) { int ret; int i; - u32 cpu_flags; + unsigned long cpu_flags; ips_ha_t *ha; ips_scb_t *scb; ips_copp_wait_item_t *item; @@ -1607,7 +1607,7 @@ ips_eh_reset(Scsi_Cmnd *SC) { int ips_queue(Scsi_Cmnd *SC, void (*done) (Scsi_Cmnd *)) { ips_ha_t *ha; - u32 cpu_flags; + unsigned long cpu_flags; DECLARE_MUTEX_LOCKED(sem); METHOD_TRACE("ips_queue", 1); @@ -1854,7 +1854,7 @@ ips_select_queue_depth(struct Scsi_Host *host, Scsi_Device *scsi_devs) { void do_ipsintr(int irq, void *dev_id, struct pt_regs *regs) { ips_ha_t *ha; - u32 cpu_flags; + unsigned long cpu_flags; METHOD_TRACE("do_ipsintr", 2); @@ -1909,7 +1909,7 @@ ips_intr_copperhead(ips_ha_t *ha) { ips_scb_t *scb; IPS_STATUS cstatus; int intrstatus; - u32 cpu_flags; + unsigned long cpu_flags; METHOD_TRACE("ips_intr", 2); @@ -1981,7 +1981,7 @@ ips_intr_morpheus(ips_ha_t *ha) { ips_scb_t *scb; IPS_STATUS cstatus; int intrstatus; - u32 cpu_flags; + unsigned long cpu_flags; METHOD_TRACE("ips_intr_morpheus", 2); @@ -3548,8 +3548,8 @@ ips_next(ips_ha_t *ha, int intr) { ips_copp_wait_item_t *item; int ret; int intr_status; - u32 cpu_flags; - u32 cpu_flags2; + unsigned long cpu_flags; + unsigned long cpu_flags2; METHOD_TRACE("ips_next", 1); @@ -4403,7 +4403,7 @@ ipsintr_done(ips_ha_t *ha, ips_scb_t *scb) { static void ips_done(ips_ha_t *ha, ips_scb_t *scb) { int ret; - u32 cpu_flags; + unsigned long cpu_flags; METHOD_TRACE("ips_done", 1); @@ -5520,7 +5520,7 @@ ips_init_scb(ips_ha_t *ha, ips_scb_t *scb) { static ips_scb_t * ips_getscb(ips_ha_t *ha) { ips_scb_t *scb; - u32 cpu_flags; + unsigned long cpu_flags; METHOD_TRACE("ips_getscb", 1); @@ -5554,7 +5554,7 @@ ips_getscb(ips_ha_t *ha) { /****************************************************************************/ static void ips_freescb(ips_ha_t *ha, ips_scb_t *scb) { - u32 cpu_flags; + unsigned long cpu_flags; METHOD_TRACE("ips_freescb", 1); @@ -5967,7 +5967,7 @@ ips_init_morpheus(ips_ha_t *ha) { static int ips_reset_copperhead(ips_ha_t *ha) { int reset_counter; - u32 cpu_flags; + unsigned long cpu_flags; METHOD_TRACE("ips_reset_copperhead", 1); @@ -6012,7 +6012,7 @@ ips_reset_copperhead(ips_ha_t *ha) { static int ips_reset_copperhead_memio(ips_ha_t *ha) { int reset_counter; - u32 cpu_flags; + unsigned long cpu_flags; METHOD_TRACE("ips_reset_copperhead_memio", 1); @@ -6058,7 +6058,7 @@ static int ips_reset_morpheus(ips_ha_t *ha) { int reset_counter; u8 junk; - u32 cpu_flags; + unsigned long cpu_flags; METHOD_TRACE("ips_reset_morpheus", 1); @@ -6237,7 +6237,7 @@ static int ips_issue_copperhead(ips_ha_t *ha, ips_scb_t *scb) { u32 TimeOut; u16 val; - u32 cpu_flags; + unsigned long cpu_flags; METHOD_TRACE("ips_issue_copperhead", 1); @@ -6300,7 +6300,7 @@ static int ips_issue_copperhead_memio(ips_ha_t *ha, ips_scb_t *scb) { u32 TimeOut; u32 val; - u32 cpu_flags; + unsigned long cpu_flags; METHOD_TRACE("ips_issue_copperhead_memio", 1); @@ -6361,7 +6361,7 @@ ips_issue_copperhead_memio(ips_ha_t *ha, ips_scb_t *scb) { /****************************************************************************/ static int ips_issue_i2o(ips_ha_t *ha, ips_scb_t *scb) { - u32 cpu_flags; + unsigned long cpu_flags; METHOD_TRACE("ips_issue_i2o", 1); @@ -6401,7 +6401,7 @@ ips_issue_i2o(ips_ha_t *ha, ips_scb_t *scb) { /****************************************************************************/ static int ips_issue_i2o_memio(ips_ha_t *ha, ips_scb_t *scb) { - u32 cpu_flags; + unsigned long cpu_flags; METHOD_TRACE("ips_issue_i2o_memio", 1); diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c index e3af0dbcfc29..dc4681cd4d7c 100644 --- a/drivers/scsi/scsi_ioctl.c +++ b/drivers/scsi/scsi_ioctl.c @@ -34,8 +34,6 @@ #define MAX_BUF PAGE_SIZE -#define max(a,b) (((a) > (b)) ? (a) : (b)) - /* * If we are told to probe a host, we will return 0 if the host is not * present, 1 if the host is present, and will return an identifying diff --git a/drivers/scsi/sr_ioctl.c b/drivers/scsi/sr_ioctl.c index 65439514eece..6abdd0360e6c 100644 --- a/drivers/scsi/sr_ioctl.c +++ b/drivers/scsi/sr_ioctl.c @@ -545,7 +545,7 @@ int sr_dev_ioctl(struct cdrom_device_info *cdi, switch (cmd) { case BLKGETSIZE: - return put_user(scsi_CDs[target].capacity >> 1, (long *) arg); + return put_user(scsi_CDs[target].capacity, (long *) arg); case BLKROSET: case BLKROGET: case BLKRASET: diff --git a/drivers/sound/btaudio.c b/drivers/sound/btaudio.c index 66cf93a9aa3a..f52500046f3f 100644 --- a/drivers/sound/btaudio.c +++ b/drivers/sound/btaudio.c @@ -32,7 +32,9 @@ #include <linux/poll.h> #include <linux/sound.h> #include <linux/soundcard.h> +#include <linux/slab.h> #include <asm/uaccess.h> +#include <asm/io.h> /* mmio access */ @@ -850,7 +852,7 @@ static int __devinit btaudio_probe(struct pci_dev *pci_dev, /* init hw */ btwrite(0, REG_GPIO_DMA_CTL); btwrite(0, REG_INT_MASK); - btwrite(~0x0UL, REG_INT_STAT); + btwrite(~(u32)0x0, REG_INT_STAT); pci_set_master(pci_dev); if ((rc = request_irq(bta->irq, btaudio_irq, SA_SHIRQ|SA_INTERRUPT, @@ -902,7 +904,7 @@ static void __devexit btaudio_remove(struct pci_dev *pci_dev) /* turn off all DMA / IRQs */ btand(~15, REG_GPIO_DMA_CTL); btwrite(0, REG_INT_MASK); - btwrite(~0x0UL, REG_INT_STAT); + btwrite(~(u32)0x0, REG_INT_STAT); /* unregister devices */ unregister_sound_dsp(bta->dsp_dev); diff --git a/drivers/sound/dmasound/dmasound.h b/drivers/sound/dmasound/dmasound.h index ff799552269d..7d77b9f7ae41 100644 --- a/drivers/sound/dmasound/dmasound.h +++ b/drivers/sound/dmasound/dmasound.h @@ -47,7 +47,6 @@ #define MAX_BUFSIZE 128 /* Limit for Amiga in KB */ -#define min(x, y) ((x) < (y) ? (x) : (y)) #define le2be16(x) (((x)<<8 & 0xff00) | ((x)>>8 & 0x00ff)) #define le2be16dbl(x) (((x)<<8 & 0xff00ff00) | ((x)>>8 & 0x00ff00ff)) diff --git a/drivers/sound/dmasound/dmasound_atari.c b/drivers/sound/dmasound/dmasound_atari.c index 0845ecd522ba..619a3e874c28 100644 --- a/drivers/sound/dmasound/dmasound_atari.c +++ b/drivers/sound/dmasound/dmasound_atari.c @@ -154,7 +154,7 @@ static ssize_t ata_ct_law(const u_char *userPtr, size_t userCount, ssize_t count, used; u_char *p = &frame[*frameUsed]; - count = min(userCount, frameLeft); + count = min(unsigned long, userCount, frameLeft); if (dmasound.soft.stereo) count &= ~1; used = count; @@ -177,7 +177,7 @@ static ssize_t ata_ct_s8(const u_char *userPtr, size_t userCount, ssize_t count, used; void *p = &frame[*frameUsed]; - count = min(userCount, frameLeft); + count = min(unsigned long, userCount, frameLeft); if (dmasound.soft.stereo) count &= ~1; used = count; @@ -196,7 +196,7 @@ static ssize_t ata_ct_u8(const u_char *userPtr, size_t userCount, if (!dmasound.soft.stereo) { u_char *p = &frame[*frameUsed]; - count = min(userCount, frameLeft); + count = min(unsigned long, userCount, frameLeft); used = count; while (count > 0) { u_char data; @@ -207,7 +207,7 @@ static ssize_t ata_ct_u8(const u_char *userPtr, size_t userCount, } } else { u_short *p = (u_short *)&frame[*frameUsed]; - count = min(userCount, frameLeft)>>1; + count = min(unsigned long, userCount, frameLeft)>>1; used = count*2; while (count > 0) { u_short data; @@ -230,7 +230,7 @@ static ssize_t ata_ct_s16be(const u_char *userPtr, size_t userCount, if (!dmasound.soft.stereo) { u_short *p = (u_short *)&frame[*frameUsed]; - count = min(userCount, frameLeft)>>1; + count = min(unsigned long, userCount, frameLeft)>>1; used = count*2; while (count > 0) { u_short data; @@ -243,7 +243,7 @@ static ssize_t ata_ct_s16be(const u_char *userPtr, size_t userCount, *frameUsed += used*2; } else { void *p = (u_short *)&frame[*frameUsed]; - count = min(userCount, frameLeft) & ~3; + count = min(unsigned long, userCount, frameLeft) & ~3; used = count; if (copy_from_user(p, userPtr, count)) return -EFAULT; @@ -261,7 +261,7 @@ static ssize_t ata_ct_u16be(const u_char *userPtr, size_t userCount, if (!dmasound.soft.stereo) { u_short *p = (u_short *)&frame[*frameUsed]; - count = min(userCount, frameLeft)>>1; + count = min(unsigned long, userCount, frameLeft)>>1; used = count*2; while (count > 0) { u_short data; @@ -275,7 +275,7 @@ static ssize_t ata_ct_u16be(const u_char *userPtr, size_t userCount, *frameUsed += used*2; } else { u_long *p = (u_long *)&frame[*frameUsed]; - count = min(userCount, frameLeft)>>2; + count = min(unsigned long, userCount, frameLeft)>>2; used = count*4; while (count > 0) { u_long data; @@ -299,7 +299,7 @@ static ssize_t ata_ct_s16le(const u_char *userPtr, size_t userCount, count = frameLeft; if (!dmasound.soft.stereo) { u_short *p = (u_short *)&frame[*frameUsed]; - count = min(userCount, frameLeft)>>1; + count = min(unsigned long, userCount, frameLeft)>>1; used = count*2; while (count > 0) { u_short data; @@ -313,7 +313,7 @@ static ssize_t ata_ct_s16le(const u_char *userPtr, size_t userCount, *frameUsed += used*2; } else { u_long *p = (u_long *)&frame[*frameUsed]; - count = min(userCount, frameLeft)>>2; + count = min(unsigned long, userCount, frameLeft)>>2; used = count*4; while (count > 0) { u_long data; @@ -338,7 +338,7 @@ static ssize_t ata_ct_u16le(const u_char *userPtr, size_t userCount, count = frameLeft; if (!dmasound.soft.stereo) { u_short *p = (u_short *)&frame[*frameUsed]; - count = min(userCount, frameLeft)>>1; + count = min(unsigned long, userCount, frameLeft)>>1; used = count*2; while (count > 0) { u_short data; @@ -351,7 +351,7 @@ static ssize_t ata_ct_u16le(const u_char *userPtr, size_t userCount, *frameUsed += used*2; } else { u_long *p = (u_long *)&frame[*frameUsed]; - count = min(userCount, frameLeft)>>2; + count = min(unsigned long, userCount, frameLeft)>>2; used = count; while (count > 0) { u_long data; diff --git a/drivers/sound/dmasound/dmasound_awacs.c b/drivers/sound/dmasound/dmasound_awacs.c index 2f85ffc27234..9143101a52ea 100644 --- a/drivers/sound/dmasound/dmasound_awacs.c +++ b/drivers/sound/dmasound/dmasound_awacs.c @@ -267,7 +267,7 @@ static ssize_t pmac_ct_law(const u_char *userPtr, size_t userCount, frameLeft >>= 2; if (stereo) userCount >>= 1; - used = count = min(userCount, frameLeft); + used = count = min(unsigned long, userCount, frameLeft); while (count > 0) { u_char data; if (get_user(data, userPtr++)) @@ -298,7 +298,7 @@ static ssize_t pmac_ct_s8(const u_char *userPtr, size_t userCount, frameLeft >>= 2; if (stereo) userCount >>= 1; - used = count = min(userCount, frameLeft); + used = count = min(unsigned long, userCount, frameLeft); while (count > 0) { u_char data; if (get_user(data, userPtr++)) @@ -329,7 +329,7 @@ static ssize_t pmac_ct_u8(const u_char *userPtr, size_t userCount, frameLeft >>= 2; if (stereo) userCount >>= 1; - used = count = min(userCount, frameLeft); + used = count = min(unsigned long, userCount, frameLeft); while (count > 0) { u_char data; if (get_user(data, userPtr++)) @@ -359,7 +359,7 @@ static ssize_t pmac_ct_s16(const u_char *userPtr, size_t userCount, frameLeft >>= 2; userCount >>= (stereo? 2: 1); - used = count = min(userCount, frameLeft); + used = count = min(unsigned long, userCount, frameLeft); if (!stereo) { short *up = (short *) userPtr; while (count > 0) { @@ -390,7 +390,7 @@ static ssize_t pmac_ct_u16(const u_char *userPtr, size_t userCount, frameLeft >>= 2; userCount >>= (stereo? 2: 1); - used = count = min(userCount, frameLeft); + used = count = min(unsigned long, userCount, frameLeft); while (count > 0) { int data; if (get_user(data, up++)) @@ -648,7 +648,7 @@ static ssize_t pmac_ct_s8_read(const u_char *userPtr, size_t userCount, frameLeft >>= 2; if (stereo) userCount >>= 1; - used = count = min(userCount, frameLeft); + used = count = min(unsigned long, userCount, frameLeft); while (count > 0) { u_char data; @@ -681,7 +681,7 @@ static ssize_t pmac_ct_u8_read(const u_char *userPtr, size_t userCount, frameLeft >>= 2; if (stereo) userCount >>= 1; - used = count = min(userCount, frameLeft); + used = count = min(unsigned long, userCount, frameLeft); while (count > 0) { u_char data; @@ -713,7 +713,7 @@ static ssize_t pmac_ct_s16_read(const u_char *userPtr, size_t userCount, frameLeft >>= 2; userCount >>= (stereo? 2: 1); - used = count = min(userCount, frameLeft); + used = count = min(unsigned long, userCount, frameLeft); if (!stereo) { short *up = (short *) userPtr; while (count > 0) { @@ -744,7 +744,7 @@ static ssize_t pmac_ct_u16_read(const u_char *userPtr, size_t userCount, frameLeft >>= 2; userCount >>= (stereo? 2: 1); - used = count = min(userCount, frameLeft); + used = count = min(unsigned long, userCount, frameLeft); while (count > 0) { int data; diff --git a/drivers/sound/dmasound/dmasound_paula.c b/drivers/sound/dmasound/dmasound_paula.c index d76c079371d2..1ec6382759e5 100644 --- a/drivers/sound/dmasound/dmasound_paula.c +++ b/drivers/sound/dmasound/dmasound_paula.c @@ -155,14 +155,14 @@ static ssize_t ami_ct_s8(const u_char *userPtr, size_t userCount, if (!dmasound.soft.stereo) { void *p = &frame[*frameUsed]; - count = min(userCount, frameLeft) & ~1; + count = min(unsigned long, userCount, frameLeft) & ~1; used = count; if (copy_from_user(p, userPtr, count)) return -EFAULT; } else { u_char *left = &frame[*frameUsed>>1]; u_char *right = left+write_sq_block_size_half; - count = min(userCount, frameLeft)>>1 & ~1; + count = min(unsigned long, userCount, frameLeft)>>1 & ~1; used = count*2; while (count > 0) { if (get_user(*left++, userPtr++) @@ -189,7 +189,7 @@ static ssize_t funcname(const u_char *userPtr, size_t userCount, \ \ if (!dmasound.soft.stereo) { \ u_char *p = &frame[*frameUsed]; \ - count = min(userCount, frameLeft) & ~1; \ + count = min(unsigned long, userCount, frameLeft) & ~1; \ used = count; \ while (count > 0) { \ u_char data; \ @@ -201,7 +201,7 @@ static ssize_t funcname(const u_char *userPtr, size_t userCount, \ } else { \ u_char *left = &frame[*frameUsed>>1]; \ u_char *right = left+write_sq_block_size_half; \ - count = min(userCount, frameLeft)>>1 & ~1; \ + count = min(unsigned long, userCount, frameLeft)>>1 & ~1;\ used = count*2; \ while (count > 0) { \ u_char data; \ @@ -242,7 +242,7 @@ static ssize_t funcname(const u_char *userPtr, size_t userCount, \ if (!dmasound.soft.stereo) { \ u_char *high = &frame[*frameUsed>>1]; \ u_char *low = high+write_sq_block_size_half; \ - count = min(userCount, frameLeft)>>1 & ~1; \ + count = min(unsigned long, userCount, frameLeft)>>1 & ~1;\ used = count*2; \ while (count > 0) { \ if (get_user(data, ((u_short *)userPtr)++)) \ @@ -257,7 +257,7 @@ static ssize_t funcname(const u_char *userPtr, size_t userCount, \ u_char *leftl = lefth+write_sq_block_size_quarter; \ u_char *righth = lefth+write_sq_block_size_half; \ u_char *rightl = righth+write_sq_block_size_quarter; \ - count = min(userCount, frameLeft)>>2 & ~1; \ + count = min(unsigned long, userCount, frameLeft)>>2 & ~1;\ used = count*4; \ while (count > 0) { \ if (get_user(data, ((u_short *)userPtr)++)) \ diff --git a/drivers/sound/dmasound/dmasound_q40.c b/drivers/sound/dmasound/dmasound_q40.c index db6960c147da..542935113ecf 100644 --- a/drivers/sound/dmasound/dmasound_q40.c +++ b/drivers/sound/dmasound/dmasound_q40.c @@ -58,7 +58,7 @@ static ssize_t q40_ct_law(const u_char *userPtr, size_t userCount, ssize_t count, used; u_char *p = (u_char *) &frame[*frameUsed]; - used = count = min(userCount, frameLeft); + used = count = min(unsigned long, userCount, frameLeft); if (copy_from_user(p,userPtr,count)) return -EFAULT; while (count > 0) { @@ -84,7 +84,7 @@ static ssize_t q40_ct_law(const u_char *userPtr, size_t userCount, frameLeft >>= 1; if (stereo) userCount >>= 1; - used = count = min(userCount, frameLeft); + used = count = min(unsigned long, userCount, frameLeft); while (count > 0) { u_char data; if (get_user(data, userPtr++)) @@ -112,7 +112,7 @@ static ssize_t q40_ct_s8(const u_char *userPtr, size_t userCount, ssize_t count, used; u_char *p = (u_char *) &frame[*frameUsed]; - used = count = min(userCount, frameLeft); + used = count = min(unsigned long, userCount, frameLeft); if (copy_from_user(p,userPtr,count)) return -EFAULT; while (count > 0) { @@ -136,7 +136,7 @@ static ssize_t q40_ct_s8(const u_char *userPtr, size_t userCount, frameLeft >>= 1; if (stereo) userCount >>= 1; - used = count = min(userCount, frameLeft); + used = count = min(unsigned long, userCount, frameLeft); while (count > 0) { u_char data; if (get_user(data, userPtr++)) @@ -164,7 +164,7 @@ static ssize_t q40_ct_u8(const u_char *userPtr, size_t userCount, ssize_t count, used; u_char *p = (u_char *) &frame[*frameUsed]; - used = count = min(userCount, frameLeft); + used = count = min(unsigned long, userCount, frameLeft); if (copy_from_user(p,userPtr,count)) return -EFAULT; *frameUsed += used; @@ -184,7 +184,7 @@ static ssize_t q40_ct_u8(const u_char *userPtr, size_t userCount, frameLeft >>= 1; if (stereo) userCount >>= 1; - used = count = min(userCount, frameLeft); + used = count = min(unsigned long, userCount, frameLeft); while (count > 0) { u_char data; if (get_user(data, userPtr++)) diff --git a/drivers/sound/emu10k1/audio.c b/drivers/sound/emu10k1/audio.c index 15b5e3fb5de0..dd49c2f4a128 100644 --- a/drivers/sound/emu10k1/audio.c +++ b/drivers/sound/emu10k1/audio.c @@ -115,7 +115,7 @@ static ssize_t emu10k1_audio_read(struct file *file, char *buffer, size_t count, if ((bytestocopy >= wiinst->buffer.fragment_size) || (bytestocopy >= count)) { - bytestocopy = min(bytestocopy, count); + bytestocopy = min(u32, bytestocopy, count); emu10k1_wavein_xferdata(wiinst, (u8 *) buffer, &bytestocopy); @@ -215,7 +215,7 @@ static ssize_t emu10k1_audio_write(struct file *file, const char *buffer, size_t if ((bytestocopy >= woinst->buffer.fragment_size) || (bytestocopy >= count)) { - bytestocopy = min(bytestocopy, count); + bytestocopy = min(u32, bytestocopy, count); emu10k1_waveout_xferdata(woinst, (u8 *) buffer, &bytestocopy); diff --git a/drivers/sound/emu10k1/cardwi.c b/drivers/sound/emu10k1/cardwi.c index 03c459512bd6..184dcd5a8c8d 100644 --- a/drivers/sound/emu10k1/cardwi.c +++ b/drivers/sound/emu10k1/cardwi.c @@ -325,7 +325,7 @@ void emu10k1_wavein_xferdata(struct wiinst *wiinst, u8 * data, u32 * size) u32 sizetocopy, sizetocopy_now, start; unsigned long flags; - sizetocopy = min(buffer->size, *size); + sizetocopy = min(u32, buffer->size, *size); *size = sizetocopy; if (!sizetocopy) diff --git a/drivers/sound/emu10k1/cardwo.c b/drivers/sound/emu10k1/cardwo.c index 0d72f4d6348f..c01919627663 100644 --- a/drivers/sound/emu10k1/cardwo.c +++ b/drivers/sound/emu10k1/cardwo.c @@ -581,7 +581,7 @@ void emu10k1_waveout_xferdata(struct woinst *woinst, u8 *data, u32 *size) u32 sizetocopy, sizetocopy_now, start; unsigned long flags; - sizetocopy = min(buffer->size, *size); + sizetocopy = min(u32, buffer->size, *size); *size = sizetocopy; if (!sizetocopy) diff --git a/drivers/sound/emu10k1/hwaccess.h b/drivers/sound/emu10k1/hwaccess.h index 300ca5e4fbd5..bde2e866bc70 100644 --- a/drivers/sound/emu10k1/hwaccess.h +++ b/drivers/sound/emu10k1/hwaccess.h @@ -53,8 +53,6 @@ #define FLAGS_AVAILABLE 0x0001 #define FLAGS_READY 0x0002 -#define min(x,y) ((x) < (y)) ? (x) : (y) - struct memhandle { dma_addr_t dma_handle; diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c index 18e82fdf9ca7..1089b9408817 100644 --- a/drivers/telephony/ixj.c +++ b/drivers/telephony/ixj.c @@ -1844,14 +1844,15 @@ ssize_t ixj_read(struct file * file_p, char *buf, size_t length, loff_t * ppos) remove_wait_queue(&j->read_q, &wait); set_current_state(TASK_RUNNING); /* Don't ever copy more than the user asks */ - i = copy_to_user(buf, j->read_buffer, min(length, j->read_buffer_size)); + i = copy_to_user(buf, j->read_buffer, + min(unsigned int, length, j->read_buffer_size)); j->read_buffer_ready = 0; if (i) { j->flags.inread = 0; return -EFAULT; } else { j->flags.inread = 0; - return min(length, j->read_buffer_size); + return min(unsigned int, length, j->read_buffer_size); } } @@ -1934,13 +1935,14 @@ ssize_t ixj_write(struct file *file_p, const char *buf, size_t count, loff_t * p remove_wait_queue(&j->write_q, &wait); if (j->write_buffer_wp + count >= j->write_buffer_end) j->write_buffer_wp = j->write_buffer; - i = copy_from_user(j->write_buffer_wp, buf, min(count, j->write_buffer_size)); + i = copy_from_user(j->write_buffer_wp, buf, + min(unsigned int, count, j->write_buffer_size)); if (i) { j->flags.inwrite = 0; return -EFAULT; } j->flags.inwrite = 0; - return min(count, j->write_buffer_size); + return min(unsigned int, count, j->write_buffer_size); } ssize_t ixj_enhanced_write(struct file * file_p, const char *buf, size_t count, loff_t * ppos) diff --git a/drivers/telephony/ixj.h b/drivers/telephony/ixj.h index 560c10271f5d..43cc9fe436e1 100644 --- a/drivers/telephony/ixj.h +++ b/drivers/telephony/ixj.h @@ -54,13 +54,6 @@ typedef __u8 BOOL; #define TRUE 1 #define FALSE 0 -#ifndef min -#define min(a,b) (((a)<(b))?(a):(b)) -#endif -#ifndef max -#define max(a,b) (((a)>(b))?(a):(b)) -#endif - /****************************************************************************** * * This structure when unioned with the structures below makes simple byte diff --git a/drivers/usb/devio.c b/drivers/usb/devio.c index 7f0c0df732c5..714449eb437d 100644 --- a/drivers/usb/devio.c +++ b/drivers/usb/devio.c @@ -1082,7 +1082,7 @@ static int proc_ioctl (struct dev_state *ps, void *arg) if (retval == 0) /* ifno might usefully be passed ... */ retval = ifp->driver->ioctl (ps->dev, ctrl.ioctl_code, buf); - /* size = min (size, retval)? */ + /* size = min(int, size, retval)? */ } /* cleanup and return */ diff --git a/drivers/usb/serial/io_usbvend.h b/drivers/usb/serial/io_usbvend.h index 9a0f75198c30..3cfac6cf6838 100644 --- a/drivers/usb/serial/io_usbvend.h +++ b/drivers/usb/serial/io_usbvend.h @@ -115,7 +115,7 @@ // TxCredits value below which driver won't bother sending (to prevent too many small writes). // Send only if above 25% -#define EDGE_FW_GET_TX_CREDITS_SEND_THRESHOLD(InitialCredit) (max( ((InitialCredit) / 4), EDGE_FW_BULK_MAX_PACKET_SIZE )) +#define EDGE_FW_GET_TX_CREDITS_SEND_THRESHOLD(InitialCredit) (max(int, ((InitialCredit) / 4), EDGE_FW_BULK_MAX_PACKET_SIZE)) #define EDGE_FW_BULK_MAX_PACKET_SIZE 64 // Max Packet Size for Bulk In Endpoint (EP1) #define EDGE_FW_BULK_READ_BUFFER_SIZE 1024 // Size to use for Bulk reads diff --git a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c index 57b18b765a55..c98b8caac680 100644 --- a/drivers/usb/storage/datafab.c +++ b/drivers/usb/storage/datafab.c @@ -204,7 +204,7 @@ static int datafab_read_data(struct us_data *us, do { // loop, never allocate or transfer more than 64k at once (min(128k, 255*info->ssize) is the real limit) - len = min(totallen, 65536); + len = min(int, totallen, 65536); if (use_sg) { sg = (struct scatterlist *) dest; @@ -329,7 +329,7 @@ static int datafab_write_data(struct us_data *us, do { // loop, never allocate or transfer more than 64k at once (min(128k, 255*info->ssize) is the real limit) - len = min(totallen, 65536); + len = min(int, totallen, 65536); if (use_sg) { sg = (struct scatterlist *) src; diff --git a/drivers/usb/storage/datafab.h b/drivers/usb/storage/datafab.h index 7453d8b39aa3..5515583ddce3 100644 --- a/drivers/usb/storage/datafab.h +++ b/drivers/usb/storage/datafab.h @@ -24,8 +24,6 @@ #ifndef _USB_DATAFAB_MDCFE_B_H #define _USB_DATAFAB_MDCFE_B_H -#define min(a,b) (((a)<(b))?(a):(b)) // this is defined in tons of header files, i wish it had a standard single definition... - extern int datafab_transport(Scsi_Cmnd *srb, struct us_data *us); struct datafab_info { diff --git a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c index 0730eac4ca4f..9462a601572a 100644 --- a/drivers/usb/storage/jumpshot.c +++ b/drivers/usb/storage/jumpshot.c @@ -280,7 +280,7 @@ static int jumpshot_read_data(struct us_data *us, do { // loop, never allocate or transfer more than 64k at once (min(128k, 255*info->ssize) is the real limit) - len = min(totallen, 65536); + len = min(int, totallen, 65536); if (use_sg) { sg = (struct scatterlist *) dest; @@ -395,7 +395,7 @@ static int jumpshot_write_data(struct us_data *us, do { // loop, never allocate or transfer more than 64k at once (min(128k, 255*info->ssize) is the real limit) - len = min(totallen, 65536); + len = min(int, totallen, 65536); if (use_sg) { sg = (struct scatterlist *) src; diff --git a/drivers/usb/storage/jumpshot.h b/drivers/usb/storage/jumpshot.h index 6d28cb204f1f..8147197cd4fc 100644 --- a/drivers/usb/storage/jumpshot.h +++ b/drivers/usb/storage/jumpshot.h @@ -24,8 +24,6 @@ #ifndef _USB_JUMPSHOT_H #define _USB_JUMPSHOT_H -#define min(a,b) (((a)<(b))?(a):(b)) // this is defined in tons of header files, i wish it had a standar single definition... - extern int jumpshot_transport(Scsi_Cmnd *srb, struct us_data *us); struct jumpshot_info { diff --git a/drivers/usb/uhci.c b/drivers/usb/uhci.c index 1edd3b1ae1ea..dbba809ff82e 100644 --- a/drivers/usb/uhci.c +++ b/drivers/usb/uhci.c @@ -98,8 +98,6 @@ static int ports_active(struct uhci *uhci); static void suspend_hc(struct uhci *uhci); static void wakeup_hc(struct uhci *uhci); -#define min(a,b) (((a)<(b))?(a):(b)) - /* If a transfer is still active after this much time, turn off FSBR */ #define IDLE_TIMEOUT (HZ / 20) /* 50 ms */ @@ -2133,11 +2131,15 @@ static int rh_submit_urb(struct urb *urb) case RH_GET_DESCRIPTOR: switch ((wValue & 0xff00) >> 8) { case 0x01: /* device descriptor */ - len = min(leni, min(sizeof(root_hub_dev_des), wLength)); + len = min(unsigned int, leni, + min(unsigned int, + sizeof(root_hub_dev_des), wLength)); memcpy(data, root_hub_dev_des, len); OK(len); case 0x02: /* configuration descriptor */ - len = min(leni, min(sizeof(root_hub_config_des), wLength)); + len = min(unsigned int, leni, + min(unsigned int, + sizeof(root_hub_config_des), wLength)); memcpy (data, root_hub_config_des, len); OK(len); case 0x03: /* string descriptors */ @@ -2145,14 +2147,15 @@ static int rh_submit_urb(struct urb *urb) uhci->io_addr, "UHCI-alt", data, wLength); if (len > 0) { - OK (min (leni, len)); + OK(min(int, leni, len)); } else stat = -EPIPE; } break; case RH_GET_DESCRIPTOR | RH_CLASS: root_hub_hub_des[2] = uhci->rh.numports; - len = min(leni, min(sizeof(root_hub_hub_des), wLength)); + len = min(unsigned int, leni, + min(unsigned int, sizeof(root_hub_hub_des), wLength)); memcpy(data, root_hub_hub_des, len); OK(len); case RH_GET_CONFIGURATION: diff --git a/drivers/usb/usb-ohci.c b/drivers/usb/usb-ohci.c index 5e264d766fca..dd1c2d0d2f31 100644 --- a/drivers/usb/usb-ohci.c +++ b/drivers/usb/usb-ohci.c @@ -1805,7 +1805,9 @@ static int rh_send_irq (ohci_t * ohci, void * rh_data, int rh_len) len = i/8 + 1; if (ret > 0) { - memcpy (rh_data, data, min (len, min (rh_len, sizeof(data)))); + memcpy(rh_data, data, + min(unsigned int, len, + min(unsigned int, rh_len, sizeof(data)))); return len; } return 0; @@ -1987,10 +1989,18 @@ static int rh_submit_urb (urb_t * urb) case RH_GET_DESCRIPTOR: switch ((wValue & 0xff00) >> 8) { case (0x01): /* device descriptor */ - len = min (leni, min (sizeof (root_hub_dev_des), wLength)); + len = min(unsigned int, + leni, + min(unsigned int, + sizeof (root_hub_dev_des), + wLength)); data_buf = root_hub_dev_des; OK(len); case (0x02): /* configuration descriptor */ - len = min (leni, min (sizeof (root_hub_config_des), wLength)); + len = min(unsigned int, + leni, + min(unsigned int, + sizeof (root_hub_config_des), + wLength)); data_buf = root_hub_config_des; OK(len); case (0x03): /* string descriptors */ len = usb_root_hub_string (wValue & 0xff, @@ -1998,7 +2008,7 @@ static int rh_submit_urb (urb_t * urb) data, wLength); if (len > 0) { data_buf = data; - OK (min (leni, len)); + OK(min(int, leni, len)); } // else fallthrough default: @@ -2033,7 +2043,8 @@ static int rh_submit_urb (urb_t * urb) data_buf [10] = data_buf [9] = 0xff; } - len = min (leni, min (data_buf [0], wLength)); + len = min(unsigned int, leni, + min(unsigned int, data_buf [0], wLength)); OK (len); } @@ -2050,7 +2061,7 @@ static int rh_submit_urb (urb_t * urb) // ohci_dump_roothub (ohci, 0); #endif - len = min(len, leni); + len = min(int, len, leni); if (data != data_buf) memcpy (data, data_buf, len); urb->actual_length = len; diff --git a/drivers/usb/usb-ohci.h b/drivers/usb/usb-ohci.h index 75288d333f7e..0ad3813ae32e 100644 --- a/drivers/usb/usb-ohci.h +++ b/drivers/usb/usb-ohci.h @@ -329,9 +329,6 @@ struct virt_root_hub { #define RH_A_NOCP (1 << 12) /* no over current protection */ #define RH_A_POTPGT (0xff << 24) /* power on to power good time */ -#define min(a,b) (((a)<(b))?(a):(b)) - - /* urb */ typedef struct { diff --git a/drivers/usb/usb-uhci.c b/drivers/usb/usb-uhci.c index 4aa3080d39c2..4b23cfe1adcc 100644 --- a/drivers/usb/usb-uhci.c +++ b/drivers/usb/usb-uhci.c @@ -2159,11 +2159,15 @@ _static int rh_submit_urb (urb_t *urb) case RH_GET_DESCRIPTOR: switch ((wValue & 0xff00) >> 8) { case (0x01): /* device descriptor */ - len = min (leni, min (sizeof (root_hub_dev_des), wLength)); + len = min(unsigned int, leni, + min(unsigned int, + sizeof (root_hub_dev_des), wLength)); memcpy (data, root_hub_dev_des, len); OK (len); case (0x02): /* configuration descriptor */ - len = min (leni, min (sizeof (root_hub_config_des), wLength)); + len = min(unsigned int, leni, + min(unsigned int, + sizeof (root_hub_config_des), wLength)); memcpy (data, root_hub_config_des, len); OK (len); case (0x03): /* string descriptors */ @@ -2171,7 +2175,7 @@ _static int rh_submit_urb (urb_t *urb) uhci->io_addr, "UHCI", data, wLength); if (len > 0) { - OK (min (leni, len)); + OK(min(int, leni, len)); } else stat = -EPIPE; } @@ -2179,7 +2183,8 @@ _static int rh_submit_urb (urb_t *urb) case RH_GET_DESCRIPTOR | RH_CLASS: root_hub_hub_des[2] = uhci->rh.numports; - len = min (leni, min (sizeof (root_hub_hub_des), wLength)); + len = min(unsigned int, leni, + min(unsigned int, sizeof (root_hub_hub_des), wLength)); memcpy (data, root_hub_hub_des, len); OK (len); diff --git a/drivers/usb/usb-uhci.h b/drivers/usb/usb-uhci.h index 84b47949c769..7ab3757bb8ae 100644 --- a/drivers/usb/usb-uhci.h +++ b/drivers/usb/usb-uhci.h @@ -282,6 +282,4 @@ typedef struct uhci { #define RH_REQ_ERR -1 #define RH_NACK 0x00 -#define min(a,b) (((a)<(b))?(a):(b)) - #endif diff --git a/drivers/video/amifb.c b/drivers/video/amifb.c index 38633668ebd7..825959e18998 100644 --- a/drivers/video/amifb.c +++ b/drivers/video/amifb.c @@ -592,9 +592,6 @@ static u_short maxfmode, chipset; ((((long)((unsigned long long)x1 >> 8) % x2) << 8) / x2)) #endif -#define min(a, b) ((a) < (b) ? (a) : (b)) -#define max(a, b) ((a) > (b) ? (a) : (b)) - #define highw(x) ((u_long)(x)>>16 & 0xffff) #define loww(x) ((u_long)(x) & 0xffff) diff --git a/drivers/video/cyberfb.h b/drivers/video/cyberfb.h index 2acff941a099..8435c430ad27 100644 --- a/drivers/video/cyberfb.h +++ b/drivers/video/cyberfb.h @@ -100,14 +100,6 @@ /**************************************************/ -#ifndef min -#define min(a,b) ((a) < (b) ? (a) : (b)) -#endif /* !min */ - -#ifndef max -#define max(a,b) ((a) > (b) ? (a) : (b)) -#endif /* !max */ - /* support for a BitBlt operation. The op-codes are identical to X11 GCs */ #define GRFBBOPclear 0x0 /* 0 */ |
