Hi,
I've replaced the custom MIN/MAX macros in drivers/ide/ide-timing.h with
the corresponding min/max macros from kernel.h, as suggested by the TODO
list.
The macros are used for the FIT macro, which returns the value of the
first parameter, delimited by the range specified by the second and
third parameters. This is done by a combination of min/max:
#define FIT(v,vmin,vmax) max(min(v,vmax),vmin)
This expands to something like this:
max(
({
typeof(x) _x = (x);
typeof(y) _y = (y);
(void) (&_x == &_y);
_x < _y ? _x : _y;
}),
vmin
);
So min() returns a value of the same type as v and vmax, and vmin should
be of this type as well.
Nevertheless, I get a warning when I cast the vmin value to a short in
the following use of FIT() (drivers/ide/pci/via82cxxx.c):
FIT(timing->setup, 1, (short)4)
timing->setup is of type short, and only this typecast combination
compiles without warning.
What's going on here?
Regards,
Clemens
minmax.patch
Description: Text document
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@xxxxxxxxxxxxxx
http://lists.osdl.org/mailman/listinfo/kernel-janitors
|