[tip:core/locking] ASoC: Automatically determine control_data for soc-cache users

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

 



Commit-ID:  a6d14342dc46f0ef94cccf323fd9481de84b458f
Gitweb:     http://git.kernel.org/tip/a6d14342dc46f0ef94cccf323fd9481de84b458f
Author:     Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
AuthorDate: Thu, 12 Aug 2010 10:59:15 +0100
Committer:  Liam Girdwood <lrg@xxxxxxxxxxxxxxx>
CommitDate: Thu, 12 Aug 2010 14:02:06 +0100

ASoC: Automatically determine control_data for soc-cache users

Since the provision of a struct device for the CODEC is now mandatory
we can use container_of() to locate the struct i2c_client and struct
spi_device for relevant devices, removing the need to manually set it
in each driver.

A further patch will automate selection of the control type based on
the bus_type of the struct device, further reducing the amount of
driver code required.

Signed-off-by: Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Liam Girdwood <lrg@xxxxxxxxxxxxxxx>
---
 sound/soc/soc-cache.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 83cd8ed..b856177 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -584,11 +584,19 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
 #endif
 		if (io_types[i].i2c_read)
 			codec->hw_read = io_types[i].i2c_read;
+
+		codec->control_data = container_of(codec->dev,
+						   struct i2c_client,
+						   dev);
 		break;
 
 	case SND_SOC_SPI:
 		if (io_types[i].spi_write)
 			codec->hw_write = io_types[i].spi_write;
+
+		codec->control_data = container_of(codec->dev,
+						   struct spi_device,
+						   dev);
 		break;
 	}
 
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux