Skip to Content
Linux Device Drivers Development
book

Linux Device Drivers Development

by John Madieu
October 2017
Intermediate to advanced
586 pages
14h 8m
English
Packt Publishing
Content preview from Linux Device Drivers Development

Threaded bottom half

The following simple excerpt is a demonstration of how you can implement the threaded bottom half mechanism:

static irqreturn_t pcf8574_kp_irq_handler(int irq, void *dev_id) { struct custom_data *lp = dev_id; unsigned char nextstate = read_state(lp); if (lp->laststate != nextstate) { int key_down = nextstate < ARRAY_SIZE(lp->btncode); unsigned short keycode = key_down ? p->btncode[nextstate] : lp->btncode[lp->laststate]; input_report_key(lp->idev, keycode, key_down); input_sync(lp->idev); lp->laststate = nextstate; } return IRQ_HANDLED; } static int pcf8574_kp_probe(struct i2c_client *client, \ const struct i2c_device_id *id) { struct custom_data *lp = init_custom_data(); [...] /* * @handler is NULL and @thread_fn != ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Device Drivers, Second Edition

Linux Device Drivers, Second Edition

Jonathan Corbet, Alessandro Rubini
Linux Device Drivers, 3rd Edition

Linux Device Drivers, 3rd Edition

Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman

Publisher Resources

ISBN: 9781785280009Supplemental Content