devm_regulator_get
时间: 2023-12-25 19:05:01 浏览: 149
devm_regulator_get is a function provided by the Linux kernel API that allows a device driver to obtain a reference to a regulator device. This function is a managed version of the regulator_get function, which means that it automatically handles the deallocation of the regulator device when the driver is unloaded from the system.
The devm_regulator_get function takes two arguments: a pointer to the device structure of the device that requires the regulator, and a string that specifies the name of the regulator device. The function returns a pointer to the regulator device structure if successful, or an error code if it fails.
Once a driver obtains a reference to a regulator device using devm_regulator_get, it can use the regulator API functions to control the voltage or current supplied to the device. The driver should release the reference to the regulator device when it is no longer needed, but this is handled automatically by devm_regulator_get.
阅读全文