mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
ASoC: core: Create new components in sane state
Cezary Rojewski <cezary.rojewski@intel.com> says: There is a gap between snd_soc_component_alloc() and snd_soc_register_component(). A driver that obtains a component object through snd_soc_component_alloc() receives an object in uninitialized state. soc_component_initialize() is the function responsible for bringing it into a sane one but it is not accessible by the framework users. Example of the uninitialized members are the lists e.g.: comp->dai_list. The framework shall prevent manipulation of uninitialized components. Introduce snd_soc_component_new() which acts as a constructor: allocates and initializes the component object before returning it to the caller. Given the quite recent discussion related to all things component-register [1], decided to stick to the "register" wording and renamed soc_component_add() to snd_soc_component_register(). With that, register/unregister pattern is kept. At the same time, the update brings a clear division between: 1) snd_soc_component_register(component..) 2) snd_soc_register_component(dev..) A driver uses 1) when operating on pre-constructed component object explicitly and 2) when they want the ASoC framework to do everything for them. Parameter "name" is added to the ctor parameter list as it is one of the fields that is always initialized, see the 'if (!component->name)' within soc_component_initialize(). Private data on the other hand is not so opted out of including it. And thus snd_soc_component_set_priv() remains intact. [1]: https://lore.kernel.org/all/87y0f2rz8l.wl-kuninori.morimoto.gx@renesas.com/ Link: https://patch.msgid.link/20261007133353.455185-1-cezary.rojewski@intel.com
This commit is contained in:
commit
4f173a0fee
|
|
@ -292,9 +292,12 @@ static inline int snd_soc_component_cache_sync(
|
|||
return regcache_sync(component->regmap);
|
||||
}
|
||||
|
||||
struct snd_soc_component *snd_soc_component_alloc(struct device *dev);
|
||||
struct snd_soc_component *snd_soc_component_new(struct device *dev, const char *name,
|
||||
const struct snd_soc_component_driver *driver);
|
||||
int snd_soc_component_register(struct snd_soc_component *component,
|
||||
struct snd_soc_dai_driver *dai_drv,
|
||||
int num_dai);
|
||||
|
||||
void snd_soc_component_set_name(struct snd_soc_component *component, const char *name);
|
||||
const char *snd_soc_component_name(struct snd_soc_component *component);
|
||||
|
||||
void snd_soc_component_set_priv(struct snd_soc_component *component, void *priv);
|
||||
|
|
|
|||
|
|
@ -447,15 +447,9 @@ static inline int snd_soc_resume(struct device *dev)
|
|||
}
|
||||
#endif
|
||||
int snd_soc_poweroff(struct device *dev);
|
||||
int snd_soc_register_component_c(struct snd_soc_component *component,
|
||||
const struct snd_soc_component_driver *component_driver,
|
||||
struct snd_soc_dai_driver *dai_drv, int num_dai);
|
||||
int snd_soc_register_component_d(struct device *dev,
|
||||
int snd_soc_register_component(struct device *dev,
|
||||
const struct snd_soc_component_driver *component_driver,
|
||||
struct snd_soc_dai_driver *dai_drv, int num_dai);
|
||||
#define snd_soc_register_component(x, ...) _Generic((x), \
|
||||
struct device * : snd_soc_register_component_d, \
|
||||
struct snd_soc_component * : snd_soc_register_component_c)(x, __VA_ARGS__)
|
||||
|
||||
int devm_snd_soc_register_component(struct device *dev,
|
||||
const struct snd_soc_component_driver *component_driver,
|
||||
|
|
|
|||
|
|
@ -1399,10 +1399,6 @@ int avs_register_component(struct device *dev, const char *name,
|
|||
if (!acomp)
|
||||
return -ENOMEM;
|
||||
|
||||
acomp->base = snd_soc_component_alloc(dev);
|
||||
if (!acomp->base)
|
||||
return -ENOMEM;
|
||||
|
||||
comp_name = devm_kstrdup(dev, name, GFP_KERNEL);
|
||||
if (!comp_name)
|
||||
return -ENOMEM;
|
||||
|
|
@ -1411,10 +1407,13 @@ int avs_register_component(struct device *dev, const char *name,
|
|||
|
||||
drv->use_dai_pcm_id = !obsolete_card_names;
|
||||
|
||||
snd_soc_component_set_name(acomp->base, comp_name);
|
||||
acomp->base = snd_soc_component_new(dev, comp_name, drv);
|
||||
if (IS_ERR(acomp->base))
|
||||
return PTR_ERR(acomp->base);
|
||||
|
||||
snd_soc_component_set_priv(acomp->base, acomp);
|
||||
|
||||
return snd_soc_register_component(acomp->base, drv, cpu_dais, num_cpu_dais);
|
||||
return snd_soc_component_register(acomp->base, cpu_dais, num_cpu_dais);
|
||||
}
|
||||
|
||||
static struct snd_soc_dai_driver dmic_cpu_dais[] = {
|
||||
|
|
|
|||
|
|
@ -298,17 +298,13 @@ int avs_register_probe_component(struct avs_dev *adev, const char *name)
|
|||
struct snd_soc_component *component;
|
||||
const char *comp_name;
|
||||
|
||||
component = snd_soc_component_alloc(adev->dev);
|
||||
if (!component)
|
||||
return -ENOMEM;
|
||||
|
||||
comp_name = devm_kstrdup(adev->dev, name, GFP_KERNEL);
|
||||
if (!comp_name)
|
||||
return -ENOMEM;
|
||||
|
||||
snd_soc_component_set_name(component, comp_name);
|
||||
component = snd_soc_component_new(adev->dev, comp_name, &avs_probe_component_driver);
|
||||
if (IS_ERR(component))
|
||||
return PTR_ERR(component);
|
||||
|
||||
return snd_soc_register_component(component,
|
||||
&avs_probe_component_driver,
|
||||
probe_cpu_dais, ARRAY_SIZE(probe_cpu_dais));
|
||||
return snd_soc_component_register(component, probe_cpu_dais, ARRAY_SIZE(probe_cpu_dais));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1073,13 +1073,9 @@ int catpt_register_plat_component(struct catpt_dev *cdev)
|
|||
{
|
||||
struct snd_soc_component *component;
|
||||
|
||||
component = snd_soc_component_alloc(cdev->dev);
|
||||
if (!component)
|
||||
return -ENOMEM;
|
||||
component = snd_soc_component_new(cdev->dev, catpt_comp_driver.name, &catpt_comp_driver);
|
||||
if (IS_ERR(component))
|
||||
return PTR_ERR(component);
|
||||
|
||||
snd_soc_component_set_name(component, catpt_comp_driver.name);
|
||||
|
||||
return snd_soc_register_component(component,
|
||||
&catpt_comp_driver,
|
||||
dai_drivers, ARRAY_SIZE(dai_drivers));
|
||||
return snd_soc_component_register(component, dai_drivers, ARRAY_SIZE(dai_drivers));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,25 +29,6 @@ static inline int _soc_component_ret_reg_rw(struct snd_soc_component *component,
|
|||
func, component->name, reg);
|
||||
}
|
||||
|
||||
struct snd_soc_component *snd_soc_component_alloc(struct device *dev)
|
||||
{
|
||||
struct snd_soc_component *component = devm_kzalloc(dev, sizeof(*component), GFP_KERNEL);
|
||||
|
||||
if (!component)
|
||||
return NULL;
|
||||
|
||||
component->dev = dev;
|
||||
|
||||
return component;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_alloc);
|
||||
|
||||
void snd_soc_component_set_name(struct snd_soc_component *component, const char *name)
|
||||
{
|
||||
component->name = name;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_set_name);
|
||||
|
||||
const char *snd_soc_component_name(struct snd_soc_component *component)
|
||||
{
|
||||
return component->name;
|
||||
|
|
|
|||
|
|
@ -2560,14 +2560,30 @@ static void snd_soc_del_component_unlocked(struct snd_soc_component *component)
|
|||
list_del(&component->list);
|
||||
}
|
||||
|
||||
static int soc_component_initialize(struct snd_soc_component *component,
|
||||
const struct snd_soc_component_driver *driver)
|
||||
struct snd_soc_component *snd_soc_component_new(struct device *dev, const char *name,
|
||||
const struct snd_soc_component_driver *driver)
|
||||
{
|
||||
struct device *dev = component->dev;
|
||||
struct snd_soc_component *component;
|
||||
|
||||
component = devm_kzalloc(dev, sizeof(*component), GFP_KERNEL);
|
||||
if (!component)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
component->dapm = snd_soc_dapm_alloc(dev);
|
||||
if (!component->dapm)
|
||||
return -ENOMEM;
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
if (!name) {
|
||||
name = snd_soc_fmt_single_name(dev, NULL);
|
||||
if (!name) {
|
||||
dev_err(dev, "ASoC: Failed to allocate name\n");
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
}
|
||||
|
||||
component->dev = dev;
|
||||
component->name = name;
|
||||
component->driver = driver;
|
||||
|
||||
INIT_LIST_HEAD(&component->dai_list);
|
||||
INIT_LIST_HEAD(&component->dobj_list);
|
||||
|
|
@ -2576,22 +2592,13 @@ static int soc_component_initialize(struct snd_soc_component *component,
|
|||
INIT_LIST_HEAD(&component->card_aux_list);
|
||||
mutex_init(&component->io_mutex);
|
||||
|
||||
if (!component->name) {
|
||||
component->name = snd_soc_fmt_single_name(dev, NULL);
|
||||
if (!component->name) {
|
||||
dev_err(dev, "ASoC: Failed to allocate name\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
}
|
||||
|
||||
component->driver = driver;
|
||||
|
||||
return 0;
|
||||
return component;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_new);
|
||||
|
||||
static int soc_component_add(struct snd_soc_component *component,
|
||||
struct snd_soc_dai_driver *dai_drv,
|
||||
int num_dai)
|
||||
int snd_soc_component_register(struct snd_soc_component *component,
|
||||
struct snd_soc_dai_driver *dai_drv,
|
||||
int num_dai)
|
||||
{
|
||||
struct snd_soc_card *card, *c;
|
||||
int ret;
|
||||
|
|
@ -2630,36 +2637,22 @@ static int soc_component_add(struct snd_soc_component *component,
|
|||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_register);
|
||||
|
||||
int snd_soc_register_component_c(struct snd_soc_component *component,
|
||||
const struct snd_soc_component_driver *component_driver,
|
||||
struct snd_soc_dai_driver *dai_drv,
|
||||
int num_dai)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = soc_component_initialize(component, component_driver);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return soc_component_add(component, dai_drv, num_dai);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_register_component_c);
|
||||
|
||||
int snd_soc_register_component_d(struct device *dev,
|
||||
const struct snd_soc_component_driver *component_driver,
|
||||
struct snd_soc_dai_driver *dai_drv,
|
||||
int num_dai)
|
||||
int snd_soc_register_component(struct device *dev,
|
||||
const struct snd_soc_component_driver *component_driver,
|
||||
struct snd_soc_dai_driver *dai_drv,
|
||||
int num_dai)
|
||||
{
|
||||
struct snd_soc_component *component;
|
||||
|
||||
component = snd_soc_component_alloc(dev);
|
||||
if (!component)
|
||||
return -ENOMEM;
|
||||
component = snd_soc_component_new(dev, NULL, component_driver);
|
||||
if (IS_ERR(component))
|
||||
return PTR_ERR(component);
|
||||
|
||||
return snd_soc_register_component_c(component, component_driver, dai_drv, num_dai);
|
||||
return snd_soc_component_register(component, dai_drv, num_dai);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_register_component_d);
|
||||
EXPORT_SYMBOL_GPL(snd_soc_register_component);
|
||||
|
||||
/**
|
||||
* snd_soc_unregister_component_by_driver - Unregister component using a given driver
|
||||
|
|
|
|||
|
|
@ -454,10 +454,6 @@ int snd_dmaengine_pcm_register(struct device *dev,
|
|||
struct dmaengine_pcm *pcm;
|
||||
int ret;
|
||||
|
||||
component = snd_soc_component_alloc(dev);
|
||||
if (!component)
|
||||
return -ENOMEM;
|
||||
|
||||
pcm = kzalloc_obj(*pcm);
|
||||
if (!pcm)
|
||||
return -ENOMEM;
|
||||
|
|
@ -467,10 +463,6 @@ int snd_dmaengine_pcm_register(struct device *dev,
|
|||
pcm->config = config;
|
||||
pcm->flags = flags;
|
||||
|
||||
if (config->name)
|
||||
snd_soc_component_set_name(component, config->name);
|
||||
snd_soc_component_set_priv(component, pcm);
|
||||
|
||||
ret = dmaengine_pcm_request_chan_of(pcm, dev, config);
|
||||
if (ret)
|
||||
goto err_free_dma;
|
||||
|
|
@ -480,7 +472,15 @@ int snd_dmaengine_pcm_register(struct device *dev,
|
|||
else
|
||||
driver = &dmaengine_pcm_component;
|
||||
|
||||
ret = snd_soc_register_component(component, driver, NULL, 0);
|
||||
component = snd_soc_component_new(dev, config->name, driver);
|
||||
if (IS_ERR(component)) {
|
||||
ret = PTR_ERR(component);
|
||||
goto err_free_dma;
|
||||
}
|
||||
|
||||
snd_soc_component_set_priv(component, pcm);
|
||||
|
||||
ret = snd_soc_component_register(component, NULL, 0);
|
||||
if (ret)
|
||||
goto err_free_dma;
|
||||
|
||||
|
|
|
|||
|
|
@ -246,8 +246,8 @@ static void snd_soc_tplg_test_load_with_null_comp(struct kunit *test)
|
|||
kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
|
||||
kunit_comp->card.fully_routed = true;
|
||||
|
||||
component = snd_soc_component_alloc(test_dev);
|
||||
KUNIT_ASSERT_NOT_NULL(test, component);
|
||||
component = snd_soc_component_new(test_dev, NULL, &test_component_null_comp);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, component);
|
||||
|
||||
snd_soc_component_set_priv(component, kunit_comp);
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ static void snd_soc_tplg_test_load_with_null_comp(struct kunit *test)
|
|||
if (ret != 0 && ret != -EPROBE_DEFER)
|
||||
KUNIT_FAIL(test, "Failed to register card");
|
||||
|
||||
ret = snd_soc_register_component(component, &test_component_null_comp, NULL, 0);
|
||||
ret = snd_soc_component_register(component, NULL, 0);
|
||||
KUNIT_EXPECT_EQ(test, 0, ret);
|
||||
|
||||
/* cleanup */
|
||||
|
|
@ -291,8 +291,8 @@ static void snd_soc_tplg_test_load_with_null_ops(struct kunit *test)
|
|||
kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
|
||||
kunit_comp->card.fully_routed = true;
|
||||
|
||||
component = snd_soc_component_alloc(test_dev);
|
||||
KUNIT_ASSERT_NOT_NULL(test, component);
|
||||
component = snd_soc_component_new(test_dev, NULL, &test_component);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, component);
|
||||
|
||||
snd_soc_component_set_priv(component, kunit_comp);
|
||||
|
||||
|
|
@ -301,7 +301,7 @@ static void snd_soc_tplg_test_load_with_null_ops(struct kunit *test)
|
|||
if (ret != 0 && ret != -EPROBE_DEFER)
|
||||
KUNIT_FAIL(test, "Failed to register card");
|
||||
|
||||
ret = snd_soc_register_component(component, &test_component, NULL, 0);
|
||||
ret = snd_soc_component_register(component, NULL, 0);
|
||||
KUNIT_EXPECT_EQ(test, 0, ret);
|
||||
|
||||
/* cleanup */
|
||||
|
|
@ -355,8 +355,8 @@ static void snd_soc_tplg_test_load_with_null_fw(struct kunit *test)
|
|||
kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
|
||||
kunit_comp->card.fully_routed = true;
|
||||
|
||||
component = snd_soc_component_alloc(test_dev);
|
||||
KUNIT_ASSERT_NOT_NULL(test, component);
|
||||
component = snd_soc_component_new(test_dev, NULL, &test_component_null_fw);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, component);
|
||||
|
||||
snd_soc_component_set_priv(component, kunit_comp);
|
||||
|
||||
|
|
@ -365,7 +365,7 @@ static void snd_soc_tplg_test_load_with_null_fw(struct kunit *test)
|
|||
if (ret != 0 && ret != -EPROBE_DEFER)
|
||||
KUNIT_FAIL(test, "Failed to register card");
|
||||
|
||||
ret = snd_soc_register_component(component, &test_component_null_fw, NULL, 0);
|
||||
ret = snd_soc_component_register(component, NULL, 0);
|
||||
KUNIT_EXPECT_EQ(test, 0, ret);
|
||||
|
||||
/* cleanup */
|
||||
|
|
@ -406,8 +406,8 @@ static void snd_soc_tplg_test_load_empty_tplg(struct kunit *test)
|
|||
kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
|
||||
kunit_comp->card.fully_routed = true;
|
||||
|
||||
component = snd_soc_component_alloc(test_dev);
|
||||
KUNIT_ASSERT_NOT_NULL(test, component);
|
||||
component = snd_soc_component_new(test_dev, NULL, &test_component);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, component);
|
||||
|
||||
snd_soc_component_set_priv(component, kunit_comp);
|
||||
|
||||
|
|
@ -416,7 +416,7 @@ static void snd_soc_tplg_test_load_empty_tplg(struct kunit *test)
|
|||
if (ret != 0 && ret != -EPROBE_DEFER)
|
||||
KUNIT_FAIL(test, "Failed to register card");
|
||||
|
||||
ret = snd_soc_register_component(component, &test_component, NULL, 0);
|
||||
ret = snd_soc_component_register(component, NULL, 0);
|
||||
KUNIT_EXPECT_EQ(test, 0, ret);
|
||||
|
||||
/* cleanup */
|
||||
|
|
@ -464,8 +464,8 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_magic(struct kunit *test)
|
|||
kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
|
||||
kunit_comp->card.fully_routed = true;
|
||||
|
||||
component = snd_soc_component_alloc(test_dev);
|
||||
KUNIT_ASSERT_NOT_NULL(test, component);
|
||||
component = snd_soc_component_new(test_dev, NULL, &test_component);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, component);
|
||||
|
||||
snd_soc_component_set_priv(component, kunit_comp);
|
||||
|
||||
|
|
@ -474,7 +474,7 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_magic(struct kunit *test)
|
|||
if (ret != 0 && ret != -EPROBE_DEFER)
|
||||
KUNIT_FAIL(test, "Failed to register card");
|
||||
|
||||
ret = snd_soc_register_component(component, &test_component, NULL, 0);
|
||||
ret = snd_soc_component_register(component, NULL, 0);
|
||||
KUNIT_EXPECT_EQ(test, 0, ret);
|
||||
|
||||
/* cleanup */
|
||||
|
|
@ -522,8 +522,8 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_abi(struct kunit *test)
|
|||
kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
|
||||
kunit_comp->card.fully_routed = true;
|
||||
|
||||
component = snd_soc_component_alloc(test_dev);
|
||||
KUNIT_ASSERT_NOT_NULL(test, component);
|
||||
component = snd_soc_component_new(test_dev, NULL, &test_component);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, component);
|
||||
|
||||
snd_soc_component_set_priv(component, kunit_comp);
|
||||
|
||||
|
|
@ -532,7 +532,7 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_abi(struct kunit *test)
|
|||
if (ret != 0 && ret != -EPROBE_DEFER)
|
||||
KUNIT_FAIL(test, "Failed to register card");
|
||||
|
||||
ret = snd_soc_register_component(component, &test_component, NULL, 0);
|
||||
ret = snd_soc_component_register(component, NULL, 0);
|
||||
KUNIT_EXPECT_EQ(test, 0, ret);
|
||||
|
||||
/* cleanup */
|
||||
|
|
@ -580,8 +580,8 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_size(struct kunit *test)
|
|||
kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
|
||||
kunit_comp->card.fully_routed = true;
|
||||
|
||||
component = snd_soc_component_alloc(test_dev);
|
||||
KUNIT_ASSERT_NOT_NULL(test, component);
|
||||
component = snd_soc_component_new(test_dev, NULL, &test_component);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, component);
|
||||
|
||||
snd_soc_component_set_priv(component, kunit_comp);
|
||||
|
||||
|
|
@ -590,7 +590,7 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_size(struct kunit *test)
|
|||
if (ret != 0 && ret != -EPROBE_DEFER)
|
||||
KUNIT_FAIL(test, "Failed to register card");
|
||||
|
||||
ret = snd_soc_register_component(component, &test_component, NULL, 0);
|
||||
ret = snd_soc_component_register(component, NULL, 0);
|
||||
KUNIT_EXPECT_EQ(test, 0, ret);
|
||||
|
||||
/* cleanup */
|
||||
|
|
@ -639,8 +639,8 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_payload_size(struct kunit *tes
|
|||
kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
|
||||
kunit_comp->card.fully_routed = true;
|
||||
|
||||
component = snd_soc_component_alloc(test_dev);
|
||||
KUNIT_ASSERT_NOT_NULL(test, component);
|
||||
component = snd_soc_component_new(test_dev, NULL, &test_component);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, component);
|
||||
|
||||
snd_soc_component_set_priv(component, kunit_comp);
|
||||
|
||||
|
|
@ -649,7 +649,7 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_payload_size(struct kunit *tes
|
|||
if (ret != 0 && ret != -EPROBE_DEFER)
|
||||
KUNIT_FAIL(test, "Failed to register card");
|
||||
|
||||
ret = snd_soc_register_component(component, &test_component, NULL, 0);
|
||||
ret = snd_soc_component_register(component, NULL, 0);
|
||||
KUNIT_EXPECT_EQ(test, 0, ret);
|
||||
|
||||
/* cleanup */
|
||||
|
|
@ -690,8 +690,8 @@ static void snd_soc_tplg_test_load_pcm_tplg(struct kunit *test)
|
|||
kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
|
||||
kunit_comp->card.fully_routed = true;
|
||||
|
||||
component = snd_soc_component_alloc(test_dev);
|
||||
KUNIT_ASSERT_NOT_NULL(test, component);
|
||||
component = snd_soc_component_new(test_dev, NULL, &test_component);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, component);
|
||||
|
||||
snd_soc_component_set_priv(component, kunit_comp);
|
||||
|
||||
|
|
@ -700,7 +700,7 @@ static void snd_soc_tplg_test_load_pcm_tplg(struct kunit *test)
|
|||
if (ret != 0 && ret != -EPROBE_DEFER)
|
||||
KUNIT_FAIL(test, "Failed to register card");
|
||||
|
||||
ret = snd_soc_register_component(component, &test_component, NULL, 0);
|
||||
ret = snd_soc_component_register(component, NULL, 0);
|
||||
KUNIT_EXPECT_EQ(test, 0, ret);
|
||||
|
||||
snd_soc_unregister_component(test_dev);
|
||||
|
|
@ -743,8 +743,8 @@ static void snd_soc_tplg_test_load_pcm_tplg_reload_comp(struct kunit *test)
|
|||
kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
|
||||
kunit_comp->card.fully_routed = true;
|
||||
|
||||
component = snd_soc_component_alloc(test_dev);
|
||||
KUNIT_ASSERT_NOT_NULL(test, component);
|
||||
component = snd_soc_component_new(test_dev, NULL, &test_component);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, component);
|
||||
|
||||
snd_soc_component_set_priv(component, kunit_comp);
|
||||
|
||||
|
|
@ -755,7 +755,7 @@ static void snd_soc_tplg_test_load_pcm_tplg_reload_comp(struct kunit *test)
|
|||
|
||||
for (i = 0; i < 100; i++) {
|
||||
|
||||
ret = snd_soc_register_component(component, &test_component, NULL, 0);
|
||||
ret = snd_soc_component_register(component, NULL, 0);
|
||||
KUNIT_EXPECT_EQ(test, 0, ret);
|
||||
|
||||
snd_soc_unregister_component(test_dev);
|
||||
|
|
@ -799,13 +799,13 @@ static void snd_soc_tplg_test_load_pcm_tplg_reload_card(struct kunit *test)
|
|||
kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
|
||||
kunit_comp->card.fully_routed = true;
|
||||
|
||||
component = snd_soc_component_alloc(test_dev);
|
||||
KUNIT_ASSERT_NOT_NULL(test, component);
|
||||
component = snd_soc_component_new(test_dev, NULL, &test_component);
|
||||
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, component);
|
||||
|
||||
snd_soc_component_set_priv(component, kunit_comp);
|
||||
|
||||
/* run test */
|
||||
ret = snd_soc_register_component(component, &test_component, NULL, 0);
|
||||
ret = snd_soc_component_register(component, NULL, 0);
|
||||
KUNIT_EXPECT_EQ(test, 0, ret);
|
||||
|
||||
for (i = 0; i < 100; i++) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user