diff options
author | Subhransu S. Prusty <subhransu.s.prusty@intel.com> | 2014-10-30 06:51:47 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2014-10-31 12:57:32 -0400 |
commit | 2559d9928f36f3c0bfb4ded9bb47d47b36337b09 (patch) | |
tree | 253201d223f5e3922d405b2dbc453a525f8c4bba | |
parent | 54adc0ad647792b3a8557520477a40f76d99a007 (diff) |
ASoC: Intel: move the driver context allocation to routine
This will be used by ACPI code as well, so moving to common routine helps
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/intel/sst/sst.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/sound/soc/intel/sst/sst.c b/sound/soc/intel/sst/sst.c index 0863471a2c86..55bb1f7764f9 100644 --- a/sound/soc/intel/sst/sst.c +++ b/sound/soc/intel/sst/sst.c | |||
@@ -230,6 +230,20 @@ static void sst_init_locks(struct intel_sst_drv *ctx) | |||
230 | spin_lock_init(&ctx->block_lock); | 230 | spin_lock_init(&ctx->block_lock); |
231 | } | 231 | } |
232 | 232 | ||
233 | int sst_alloc_drv_context(struct intel_sst_drv **ctx, | ||
234 | struct device *dev, unsigned int dev_id) | ||
235 | { | ||
236 | *ctx = devm_kzalloc(dev, sizeof(struct intel_sst_drv), GFP_KERNEL); | ||
237 | if (!(*ctx)) | ||
238 | return -ENOMEM; | ||
239 | |||
240 | (*ctx)->dev = dev; | ||
241 | (*ctx)->dev_id = dev_id; | ||
242 | |||
243 | return 0; | ||
244 | } | ||
245 | |||
246 | |||
233 | /* | 247 | /* |
234 | * intel_sst_probe - PCI probe function | 248 | * intel_sst_probe - PCI probe function |
235 | * | 249 | * |
@@ -247,12 +261,11 @@ static int intel_sst_probe(struct pci_dev *pci, | |||
247 | int ddr_base; | 261 | int ddr_base; |
248 | 262 | ||
249 | dev_dbg(&pci->dev, "Probe for DID %x\n", pci->device); | 263 | dev_dbg(&pci->dev, "Probe for DID %x\n", pci->device); |
250 | sst_drv_ctx = devm_kzalloc(&pci->dev, sizeof(*sst_drv_ctx), GFP_KERNEL); | ||
251 | if (!sst_drv_ctx) | ||
252 | return -ENOMEM; | ||
253 | 264 | ||
254 | sst_drv_ctx->dev = &pci->dev; | 265 | ret = sst_alloc_drv_context(&sst_drv_ctx, &pci->dev, pci->device); |
255 | sst_drv_ctx->dev_id = pci->device; | 266 | if (ret < 0) |
267 | return ret; | ||
268 | |||
256 | if (!sst_pdata) | 269 | if (!sst_pdata) |
257 | return -EINVAL; | 270 | return -EINVAL; |
258 | 271 | ||