static ssize_t notification_led_status_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { unsigned int data; if (sscanf(buf, "%u\n", &data) == 1) { if (data == 1) enable_led_notification(); else if (data == 0) disable_led_notification(); else pr_err("%s: wrong input %u\n", __FUNCTION__, data); } else { pr_err("%s: input error\n", __FUNCTION__); } return size; }
static int msm_pmic_led_suspend(struct platform_device *dev, pm_message_t pm_state) { #ifdef CONFIG_KEYPAD_TOUCH_BLN /* * Disallow powering off the touchkey controller * while a led notification is ongoing */ if(!bln_notification_ongoing) #endif { msm_keypad_bl_led_set(&msm_kp_bl_led, 0); led_classdev_suspend(&msm_kp_bl_led); } #ifdef CONFIG_KEYPAD_TOUCH_BLN else enable_led_notification(); #endif return 0; }
static ssize_t notification_led_status_write( struct device *dev, struct device_attribute *attr, const char *buf, size_t size ){ unsigned int data; if(sscanf(buf,"%u\n", &data ) == 1 ){ if( data == 0 || data == 1 ){ if( data == 1 ) enable_led_notification(); if( data == 0 ) disable_led_notification(); }else{ /* error */ } }else{ /* error */ } return size; }