October 2017
Intermediate to advanced
586 pages
14h 8m
English
The remove function must release every resource grabbed in the probe function. Its structure is as follows:
static int my_remove(struct spi_device *spi);
A typical remove function may look like the following:
static int mc33880_remove(struct spi_device *spi)
{
struct mc33880 *mc;
mc = spi_get_drvdata(spi); /* Get our data back */
if (!mc)
return -ENODEV;
/*
* unregister from frameworks with which we registered in the
* probe function
*/
[...]
mutex_destroy(&mc->lock);
return 0;
}