mirror of https://github.com/nirenjan/libx52.git
libx52: Clean up compiler warnings
parent
65c889827a
commit
3b8b98e74c
|
@ -262,6 +262,7 @@ static int _x52_write_time(libx52_device *x52, uint32_t bit)
|
|||
uint16_t value = 0;
|
||||
uint16_t index;
|
||||
libx52_clock_id clock;
|
||||
uint16_t h24;
|
||||
|
||||
switch (bit) {
|
||||
case X52_BIT_MFD_TIME:
|
||||
|
@ -276,9 +277,12 @@ static int _x52_write_time(libx52_device *x52, uint32_t bit)
|
|||
clock = LIBX52_CLOCK_3;
|
||||
index = X52_OFFS_CLOCK3;
|
||||
break;
|
||||
default:
|
||||
/* We should never get here, but put in a dummy case to satisfy the compiler */
|
||||
return LIBX52_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
uint16_t h24 = !!(x52->time_format[clock]);
|
||||
h24 = !!(x52->time_format[clock]);
|
||||
|
||||
if (clock != LIBX52_CLOCK_1) {
|
||||
value = libx52_calculate_clock_offset(x52, clock, h24);
|
||||
|
|
|
@ -32,6 +32,8 @@ static int libx52_check_product(uint16_t idVendor, uint16_t idProduct)
|
|||
case X52_PROD_X52_2:
|
||||
case X52_PROD_X52PRO:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -190,6 +192,8 @@ int libx52_check_feature(libx52_device *dev, libx52_feature feature)
|
|||
return tst_bit(&(dev->flags), X52_FLAG_IS_PRO) ?
|
||||
LIBX52_SUCCESS :
|
||||
LIBX52_ERROR_NOT_SUPPORTED;
|
||||
default:
|
||||
return LIBX52_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
return LIBX52_ERROR_INVALID_PARAM;
|
||||
|
|
|
@ -168,8 +168,11 @@ int libx52_set_clock_timezone(libx52_device *x52, libx52_clock_id clock, int off
|
|||
set_bit(&x52->update_mask, X52_BIT_MFD_OFFS2);
|
||||
break;
|
||||
|
||||
default:
|
||||
case LIBX52_CLOCK_1:
|
||||
return LIBX52_ERROR_NOT_SUPPORTED;
|
||||
|
||||
default:
|
||||
return LIBX52_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
return LIBX52_SUCCESS;
|
||||
|
|
|
@ -58,7 +58,15 @@ static int x52pro_set_led_state(libx52_device *x52, libx52_led_id led, libx52_le
|
|||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
case LIBX52_LED_A:
|
||||
case LIBX52_LED_B:
|
||||
case LIBX52_LED_D:
|
||||
case LIBX52_LED_E:
|
||||
case LIBX52_LED_T1:
|
||||
case LIBX52_LED_T2:
|
||||
case LIBX52_LED_T3:
|
||||
case LIBX52_LED_POV:
|
||||
case LIBX52_LED_CLUTCH:
|
||||
/* All other LEDs support OFF, RED, AMBER and GREEN states
|
||||
* However, they are composed of individual RED and GREEN LEDs which
|
||||
* must be turned on or off individually.
|
||||
|
@ -84,15 +92,23 @@ static int x52pro_set_led_state(libx52_device *x52, libx52_led_id led, libx52_le
|
|||
set_bit(&x52->led_mask, led + 1); // Green
|
||||
break;
|
||||
|
||||
default:
|
||||
case LIBX52_LED_STATE_ON:
|
||||
/* Cannot set the LED to "ON" */
|
||||
return LIBX52_ERROR_NOT_SUPPORTED;
|
||||
|
||||
default:
|
||||
/* Any other state is not valid */
|
||||
return LIBX52_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
/* Set the update mask bits */
|
||||
set_bit(&x52->update_mask, led + 0); // Red
|
||||
set_bit(&x52->update_mask, led + 1); // Green
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Any other LED is not valid */
|
||||
return LIBX52_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
return LIBX52_SUCCESS;
|
||||
|
|
Loading…
Reference in New Issue