Is this bug ? dev_set/get_drvdata() of rtd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi ALSA SoC

I'm now checking ALSA SoC framework, and I noticed strange operation.
Is this bug ?

I think device data of "rtd->dev" is set as "rtd" on soc_post_component_init()
by using dev_set_drvdata(),
and many soc-core functions are based on it (= they are using dev_get_drvdata())

But, soc.h has snd_soc_pcm_set_drvdata(). 
device data of rtd->dev will be overwrite by this function ?
But is this OK ? or bug ?
It seems below drivers are using this
	sound/soc/intel/haswell/sst-haswell-pcm.c
	sound/soc/qcom/lpass-platform.c

linux/sound/soc/soc-core.c
static int soc_post_component_init(xxx)
{
	...
	dev_set_drvdata(rtd->dev, rtd);
	...
}

static ssize_t codec_reg_show(xxx)
{
	struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
	...
}

static ssize_t pmdown_time_show(xxx)
{
	struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
	...
}

static ssize_t pmdown_time_set(xxx)
{
	struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
	...
}

static umode_t soc_dev_attr_is_visible(xxx)
{
	struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
	...
}

linux/include/sound/soc.h
static inline void snd_soc_pcm_set_drvdata(struct snd_soc_pcm_runtime *rtd,
		void *data)
{
	dev_set_drvdata(rtd->dev, data);
}


Best regards
---
Kuninori Morimoto
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux