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

The remove() function

The prototype of the remove function looks as follows:

static int foo_remove(struct i2c_client *client) 

The remove() function also provides the same struct i2c_client* as the probe() function, so you can retrieve your private data. For example, you may need to process some cleaning or any other stuff, based on the private data you set up in the probe function:

static int mc9s08dz60_remove(struct i2c_client *client) 
{ 
    struct mc9s08dz60 *mc9s; 
 
    /* We retrieve our private data */ 
    mc9s = i2c_get_clientdata(client); 
 
    /* Which hold gpiochip we want to work on */ 
   return gpiochip_remove(&mc9s->chip); 
} 

The remove function has the responsibility to unregister us from the subsystem where we registered in the probe() function. ...

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