Skip to content

Commit

Permalink
ASoC: hdmi-codec: remove reference to the dai drivers in the private …
Browse files Browse the repository at this point in the history
…data

Keeping the a pointer to the dai drivers is not necessary. It is not used
by the hdmi_codec after the probe.

Even if it was used, the 'struct snd_soc_dai_driver' can accessed through
the 'struct snd_soc_dai' so keeping the pointer in the private data
structure is not useful.

Signed-off-by: Jerome Brunet <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
jbrun3t authored and broonie committed May 8, 2019
1 parent 3fcf94e commit 1de005d
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions sound/soc/codecs/hdmi-codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ static const struct hdmi_codec_cea_spk_alloc hdmi_codec_channel_alloc[] = {

struct hdmi_codec_priv {
struct hdmi_codec_pdata hcd;
struct snd_soc_dai_driver *daidrv;
struct hdmi_codec_daifmt daifmt[2];
uint8_t eld[MAX_ELD_BYTES];
struct snd_pcm_chmap *chmap_info;
Expand Down Expand Up @@ -715,6 +714,7 @@ static const struct snd_soc_component_driver hdmi_driver = {
static int hdmi_codec_probe(struct platform_device *pdev)
{
struct hdmi_codec_pdata *hcd = pdev->dev.platform_data;
struct snd_soc_dai_driver *daidrv;
struct device *dev = &pdev->dev;
struct hdmi_codec_priv *hcp;
int dai_count, i = 0;
Expand All @@ -737,27 +737,25 @@ static int hdmi_codec_probe(struct platform_device *pdev)
return -ENOMEM;

hcp->hcd = *hcd;
hcp->daidrv = devm_kcalloc(dev, dai_count, sizeof(*hcp->daidrv),
GFP_KERNEL);
if (!hcp->daidrv)
daidrv = devm_kcalloc(dev, dai_count, sizeof(*daidrv), GFP_KERNEL);
if (!daidrv)
return -ENOMEM;

if (hcd->i2s) {
hcp->daidrv[i] = hdmi_i2s_dai;
hcp->daidrv[i].playback.channels_max =
hcd->max_i2s_channels;
daidrv[i] = hdmi_i2s_dai;
daidrv[i].playback.channels_max = hcd->max_i2s_channels;
i++;
}

if (hcd->spdif) {
hcp->daidrv[i] = hdmi_spdif_dai;
daidrv[i] = hdmi_spdif_dai;
hcp->daifmt[DAI_ID_SPDIF].fmt = HDMI_SPDIF;
}

dev_set_drvdata(dev, hcp);

ret = devm_snd_soc_register_component(dev, &hdmi_driver, hcp->daidrv,
dai_count);
ret = devm_snd_soc_register_component(dev, &hdmi_driver, daidrv,
dai_count);
if (ret) {
dev_err(dev, "%s: snd_soc_register_component() failed (%d)\n",
__func__, ret);
Expand Down

0 comments on commit 1de005d

Please sign in to comment.