gpio-button-hotplug: fix active_low handling, possibly broken in r37643
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 37664
This commit is contained in:
		@@ -274,23 +274,24 @@ struct gpio_keys_polled_dev {
 | 
				
			|||||||
	struct gpio_keys_button_data data[0];
 | 
						struct gpio_keys_button_data data[0];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline int gpio_button_get_value(struct gpio_keys_button *button,
 | 
					static int gpio_button_get_value(struct gpio_keys_button *button,
 | 
				
			||||||
			  struct gpio_keys_button_data *bdata)
 | 
									 struct gpio_keys_button_data *bdata)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						int val;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (bdata->can_sleep)
 | 
						if (bdata->can_sleep)
 | 
				
			||||||
		return !!gpio_get_value_cansleep(button->gpio);
 | 
							val = !!gpio_get_value_cansleep(button->gpio);
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		return !!gpio_get_value(button->gpio);
 | 
							val = !!gpio_get_value(button->gpio);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return val ^ button->active_low;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void gpio_keys_polled_check_state(struct gpio_keys_button *button,
 | 
					static void gpio_keys_polled_check_state(struct gpio_keys_button *button,
 | 
				
			||||||
					 struct gpio_keys_button_data *bdata)
 | 
										 struct gpio_keys_button_data *bdata)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int state;
 | 
						int state = gpio_button_get_value(button, bdata);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	state = gpio_button_get_value(button, bdata);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	state = !!(state ^ button->active_low);
 | 
					 | 
				
			||||||
	if (state != bdata->last_state) {
 | 
						if (state != bdata->last_state) {
 | 
				
			||||||
		unsigned int type = button->type ?: EV_KEY;
 | 
							unsigned int type = button->type ?: EV_KEY;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user