On Wed, 26 Feb 2003, Alan Stern wrote: > As it turns out, this still generates a compiler warning. There's a > mistake in the min() and max() macros in include/linux/kernel.h. I will > post something about that on the linux kernel mailing list.
I spoke too soon (don't you just hate it when that happens?). The macros are fine; it's a problem with type incompatibility in the driver. Here is another patch (that goes on top of the first one) to fix the warning. Alan Stern
--- usb-2.4/drivers/usb/usb-skeleton.c.2 Wed Feb 26 10:40:42 2003 +++ edited/drivers/usb/usb-skeleton.c Wed Feb 26 10:43:42 2003 @@ -101,11 +101,11 @@ char num_bulk_out; /* number of bulk out endpoints we have */ unsigned char * bulk_in_buffer; /* the buffer to receive data */ - int bulk_in_size; /* the size of the receive buffer */ + size_t bulk_in_size; /* the size of the receive buffer */ __u8 bulk_in_endpointAddr; /* the address of the bulk in endpoint */ unsigned char * bulk_out_buffer; /* the buffer to send data */ - int bulk_out_size; /* the size of the send buffer */ + size_t bulk_out_size; /* the size of the send buffer */ struct urb * write_urb; /* the urb used to send data */ __u8 bulk_out_endpointAddr; /* the address of the bulk out endpoint */ atomic_t write_busy; /* true iff write urb is busy */ @@ -403,8 +403,7 @@ wait_for_completion (&dev->write_finished); /* we can only write as much as our buffer will hold */ - bytes_written = (count > dev->bulk_out_size) ? - dev->bulk_out_size : count; + bytes_written = min (dev->bulk_out_size, count); /* copy the data from userspace into our transfer buffer; * this is the only copy required. @@ -509,7 +508,7 @@ struct usb_host_interface *iface_desc; struct usb_endpoint_descriptor *endpoint; int minor; - int buffer_size; + size_t buffer_size; int i; int retval; char name[10];