Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

177
Views
purpose of __devexit_p in driver files

Can anyone please tell me the purpose of __devexit_p part in driver files ?

I find __devexit_p is normally using with remove functions in the driver code

Example 1:

static struct i2c_driver lsm9ds0_driver = {
    .driver = {
        .owner = THIS_MODULE,
        .name = LSM9DS0_DEV_NAME,
    },
    .probe = lsm9ds0_probe,
    .remove = __devexit_p(lsm9ds0_remove),
    .id_table = lsm9ds0_id,
};

Example 2:

static struct spi_driver light_driver = {
    .driver = {
        .name = "light",
        .owner = THIS_MODULE,
    },
    .probe = light_probe,
    .remove = __devexit_p(light_remove),
};

Is there any difference if I removed __devexit_p from above examples? Will it affect the performance of the driver when __devexit_p removed?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Based on this LXR listing from 2.6.32:

/*
Functions marked as __devexit may be discarded at kernel link time,
depending on config options.  Newer versions of binutils detect references 
from retained sections to discarded sections and flag an error.  Pointers to 
__devexit functions must use __devexit_p(function_name), the wrapper will 
insert either the function_name or NULL, depending on the config options.
*/

#if defined(MODULE) || defined(CONFIG_HOTPLUG)
#define __devexit_p(x) x
#else
#define __devexit_p(x) NULL
#endif

it seems to be used to conditionally expand it to the given parameter or NULL based on the code being compiled as part of a kernel module (MODULE) and on the CONFIG_HOTPLUG kernel option.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!