static void send_key_event(struct cpcap_3mm5_data *data, unsigned int state) { dev_info(&data->cpcap->spi->dev, "Headset key event: old=%d, new=%d\n", data->key_state, state); if (data->key_state != state) { data->key_state = state; cpcap_broadcast_key_event(data->cpcap, KEY_MEDIA, state); } }
static void send_key_event(struct cpcap_3mm5_data *data, unsigned int state) { unsigned long now, discard; dev_info(&data->cpcap->spi->dev, "Headset key event: old=%d, new=%d\n", data->key_state, state); now = jiffies; discard = headset_in_stamp + 2*HZ; if (data->key_state != state && time_after(now, discard)) { data->key_state = state; cpcap_broadcast_key_event(data->cpcap, KEY_MEDIA, state); } else { dev_info(&data->cpcap->spi->dev, "Headset key event ignored: " "now=%ld, discard=%ld\n", now, discard); } }