click: Clean up unused code in liblights

Change-Id: I315abdb3558b14f97f811688df92c2c6270e91fb
This commit is contained in:
Arne Coucheron 2011-03-01 00:18:02 +01:00
parent 8767919981
commit 149db46050

View File

@ -34,13 +34,9 @@
/******************************************************************************/
static pthread_once_t g_init = PTHREAD_ONCE_INIT;
static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER;
static struct light_state_t g_notification;
static struct light_state_t g_battery;
static int g_backlight = 255;
static int g_buttons = 0;
static int g_attention = 0;
static struct light_state_t g_notification = {0,0,0,0,0};
static struct light_state_t g_battery = {0,0,0,0,0};
char const*const GREEN_LED_FILE
= "/sys/class/leds/green/brightness";
@ -65,12 +61,6 @@ char const*const BUTTON_FILE
* device methods
*/
void init_globals(void)
{
// init the mutex
pthread_mutex_init(&g_lock, NULL);
}
static int
write_int(char const* path, int value)
{
@ -99,13 +89,6 @@ is_lit(struct light_state_t const* state)
return state->color & 0x00ffffff;
}
static int
handle_trackball_light_locked(struct light_device_t* dev)
{
//no trackball light for Tattoo
return 0;
}
static int
rgb_to_brightness(struct light_state_t const* state)
{
@ -121,7 +104,6 @@ set_light_backlight(struct light_device_t* dev,
int err = 0;
int brightness = rgb_to_brightness(state);
pthread_mutex_lock(&g_lock);
g_backlight = brightness;
err = write_int(LCD_FILE, brightness);
pthread_mutex_unlock(&g_lock);
return err;
@ -134,7 +116,6 @@ set_light_buttons(struct light_device_t* dev,
int err = 0;
int on = is_lit(state);
pthread_mutex_lock(&g_lock);
g_buttons = on;
err = write_int(BUTTON_FILE, on?255:0);
pthread_mutex_unlock(&g_lock);
return err;
@ -235,14 +216,6 @@ set_light_notifications(struct light_device_t* dev,
return 0;
}
static int
set_light_attention(struct light_device_t* dev,
struct light_state_t const* state)
{
//no attention light for Tattoo
return 0;
}
/** Close the lights device */
static int
@ -251,7 +224,6 @@ close_lights(struct light_device_t *dev)
if (dev) {
free(dev);
}
return 0;
}
@ -281,17 +253,11 @@ static int open_lights(const struct hw_module_t* module, char const* name,
else if (0 == strcmp(LIGHT_ID_NOTIFICATIONS, name)) {
set_light = set_light_notifications;
}
else if (0 == strcmp(LIGHT_ID_ATTENTION, name)) {
set_light = set_light_attention;
}
else {
return -EINVAL;
}
pthread_once(&g_init, init_globals);
struct light_device_t *dev = malloc(sizeof(struct light_device_t));
memset(dev, 0, sizeof(*dev));
struct light_device_t *dev = calloc(1, sizeof(struct light_device_t));
dev->common.tag = HARDWARE_DEVICE_TAG;
dev->common.version = 0;