On Tue, Nov 18, 2014 at 10:25:23PM +0100, Willy Tarreau wrote: > On Tue, Nov 18, 2014 at 09:56:13PM +0100, Mariusz Gorski wrote: > > Use a macro instead of magic number comparison for checking > > whether a module param value has been set. > > > > Signed-off-by: Mariusz Gorski <marius.gor...@gmail.com> > > --- > > drivers/staging/panel/panel.c | 21 +++++++++++---------- > > 1 file changed, 11 insertions(+), 10 deletions(-) > > > > diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c > > index ee48bca..268ad2e 100644 > > --- a/drivers/staging/panel/panel.c > > +++ b/drivers/staging/panel/panel.c > > @@ -136,6 +136,7 @@ > > #define NOT_SET -1 > > > > #define IS_NOT_SET(x) (x == NOT_SET) > > +#define IS_SET(x) (x > NOT_SET) > > > > /* macros to simplify use of the parallel port */ > > #define r_ctr(x) (parport_read_control((x)->port)) > > @@ -1496,17 +1497,17 @@ static void lcd_init(void) > > } > > > > /* Overwrite with module params set on loading */ > > - if (lcd_height > -1) > > + if (IS_SET(lcd_height)) > > lcd.height = lcd_height; > > - if (lcd_width > -1) > > + if (IS_SET(lcd_width)) > > lcd.width = lcd_width; > > (...) > > Same as for the other patch, better open-code the test for readability : > > - if (lcd_height > -1) > + if (lcd_height != NOT_SET) > lcd.height = lcd_height; > > Note that we take the freedom to change the operator since we only want > to check equality and not sign in practice. > > Willy >
Good point, will apply :) Thanks, Mariusz _______________________________________________ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel