mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-30 13:38:40 +00:00
Merge branch 'topic/devm' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-omap
This commit is contained in:
commit
3819bfa237
@ -377,6 +377,8 @@ int snd_soc_resume(struct device *dev);
|
||||
int snd_soc_poweroff(struct device *dev);
|
||||
int snd_soc_register_platform(struct device *dev,
|
||||
const struct snd_soc_platform_driver *platform_drv);
|
||||
int devm_snd_soc_register_platform(struct device *dev,
|
||||
const struct snd_soc_platform_driver *platform_drv);
|
||||
void snd_soc_unregister_platform(struct device *dev);
|
||||
int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform,
|
||||
const struct snd_soc_platform_driver *platform_drv);
|
||||
|
@ -52,6 +52,40 @@ int devm_snd_soc_register_component(struct device *dev,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(devm_snd_soc_register_component);
|
||||
|
||||
static void devm_platform_release(struct device *dev, void *res)
|
||||
{
|
||||
snd_soc_unregister_platform(*(struct device **)res);
|
||||
}
|
||||
|
||||
/**
|
||||
* devm_snd_soc_register_platform - resource managed platform registration
|
||||
* @dev: Device used to manage platform
|
||||
* @platform: platform to register
|
||||
*
|
||||
* Register a platform driver with automatic unregistration when the device is
|
||||
* unregistered.
|
||||
*/
|
||||
int devm_snd_soc_register_platform(struct device *dev,
|
||||
const struct snd_soc_platform_driver *platform_drv)
|
||||
{
|
||||
struct device **ptr;
|
||||
int ret;
|
||||
|
||||
ptr = devres_alloc(devm_platform_release, sizeof(*ptr), GFP_KERNEL);
|
||||
if (!ptr)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = snd_soc_register_platform(dev, platform_drv);
|
||||
if (ret == 0) {
|
||||
*ptr = dev;
|
||||
devres_add(dev, ptr);
|
||||
} else {
|
||||
devres_free(ptr);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void devm_card_release(struct device *dev, void *res)
|
||||
{
|
||||
snd_soc_unregister_card(*(struct snd_soc_card **)res);
|
||||
|
Loading…
Reference in New Issue
Block a user