summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2016-08-26 03:10:25 +0000
committerMark Brown <broonie@kernel.org>2016-09-01 21:22:59 +0100
commitb0133d9c4d7600fa43499c12897136fb4f38fd57 (patch)
tree441185136f0367b58c0c8d45ca3ab9f5a764562f /sound
parent2c86dda74ceae739eb3c0ada5cd8f2ddf903ce35 (diff)
downloadlinux-b0133d9c4d7600fa43499c12897136fb4f38fd57.tar.gz
linux-b0133d9c4d7600fa43499c12897136fb4f38fd57.tar.bz2
linux-b0133d9c4d7600fa43499c12897136fb4f38fd57.zip
ASoC: simple-card: use kzalloc() for dai_props / dai_link
simple sound card family are using very similar style, but because of its historical reason, there are small differences. For example pointer style, function name, caller postion etc... This patch synchronized simple card style to other simple card family. Now, simple card needs to 2 type of buffer for dai_props and dai_link. But, these used different style for buffer allocation. This patch make these same style as other simple card family. (= use kzalloc() for both) Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/generic/simple-card.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 93163c9d46af..fe0bc5c469e2 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -37,7 +37,7 @@ struct simple_card_data {
unsigned int mclk_fs;
struct asoc_simple_jack hp_jack;
struct asoc_simple_jack mic_jack;
- struct snd_soc_dai_link dai_link[]; /* dynamically allocated */
+ struct snd_soc_dai_link *dai_link;
};
#define simple_priv_to_dev(priv) ((priv)->snd_card.dev)
@@ -383,6 +383,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
{
struct simple_card_data *priv;
struct snd_soc_dai_link *dai_link;
+ struct simple_dai_props *dai_props;
struct device_node *np = pdev->dev.of_node;
struct device *dev = &pdev->dev;
int num, ret;
@@ -394,26 +395,24 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
num = 1;
/* Allocate the private data and the DAI link array */
- priv = devm_kzalloc(dev,
- sizeof(*priv) + sizeof(*dai_link) * num,
- GFP_KERNEL);
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
+ dai_props = devm_kzalloc(dev, sizeof(*dai_props) * num, GFP_KERNEL);
+ dai_link = devm_kzalloc(dev, sizeof(*dai_link) * num, GFP_KERNEL);
+ if (!dai_props || !dai_link)
+ return -ENOMEM;
+
+ priv->dai_props = dai_props;
+ priv->dai_link = dai_link;
+
/* Init snd_soc_card */
- dai_link = priv->dai_link;
priv->snd_card.owner = THIS_MODULE;
priv->snd_card.dev = dev;
priv->snd_card.dai_link = priv->dai_link;
priv->snd_card.num_links = num;
- /* Get room for the other properties */
- priv->dai_props = devm_kzalloc(dev,
- sizeof(*priv->dai_props) * num,
- GFP_KERNEL);
- if (!priv->dai_props)
- return -ENOMEM;
-
if (np && of_device_is_available(np)) {
ret = asoc_simple_card_parse_of(np, priv);