LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Why dev->init_name = NULL in device_add function ? (https://www.linuxquestions.org/questions/linux-general-1/why-dev-init_name-%3D-null-in-device_add-function-4175504848/)

Aniroop Mathur 05-13-2014 11:50 AM

Why dev->init_name = NULL in device_add function ?
 
Hello All,

In function device_add of /drivers/base/core.c file, it is mentioned:
/*
* for statically allocated devices, which should all be converted
* some day, we need to initialize the name. We prevent reading back
* the name, and force the use of dev_name()
*/
if (dev->init_name) {
dev_set_name(dev, "%s", dev->init_name);
dev->init_name = NULL;
}
Except forcing the use of dev_name to read device name,
Is there any other reason to make init_name as NULL ?
And if it is not made NULL, is there any problem or side-effect ?

Thanks!

jeremy 05-14-2014 01:44 PM

Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.


All times are GMT -5. The time now is 10:40 PM.