diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-02-25 08:05:21 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-02-25 12:12:50 +0100 |
commit | 71e2e1c147e653ee4e861b8b5dc0ae5c394870d2 (patch) | |
tree | 1701a7be7dc767eba25d1993117dd900795d81ba /sound/core/hwdep.c | |
parent | f806bdb2f7235907fcd310e6d147b3bcd281fa97 (diff) |
ALSA: hwdep: Allow to assign the given parent
Just like PCM, allow hwdep to be assigned to a different parent device
than the card. It'll be used for the HD-audio codec device in the
later patches.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/hwdep.c')
-rw-r--r-- | sound/core/hwdep.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index 825cd2847940..d6eb3ef3e3c7 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c @@ -416,6 +416,7 @@ static int snd_hwdep_dev_register(struct snd_device *device) { struct snd_hwdep *hwdep = device->device_data; struct snd_card *card = hwdep->card; + struct device *dev; int err; char name[32]; @@ -426,10 +427,14 @@ static int snd_hwdep_dev_register(struct snd_device *device) } list_add_tail(&hwdep->list, &snd_hwdep_devices); sprintf(name, "hwC%iD%i", hwdep->card->number, hwdep->device); - if ((err = snd_register_device(SNDRV_DEVICE_TYPE_HWDEP, - hwdep->card, hwdep->device, - &snd_hwdep_f_ops, hwdep, name)) < 0) { - dev_err(card->dev, + dev = hwdep->dev; + if (!dev) + dev = snd_card_get_device_link(hwdep->card); + err = snd_register_device_for_dev(SNDRV_DEVICE_TYPE_HWDEP, + hwdep->card, hwdep->device, + &snd_hwdep_f_ops, hwdep, name, dev); + if (err < 0) { + dev_err(dev, "unable to register hardware dependent device %i:%i\n", card->number, hwdep->device); list_del(&hwdep->list); @@ -445,7 +450,7 @@ static int snd_hwdep_dev_register(struct snd_device *device) dev_set_drvdata(d, hwdep->private_data); err = sysfs_create_groups(&d->kobj, hwdep->groups); if (err < 0) - dev_warn(card->dev, + dev_warn(dev, "hwdep %d:%d: cannot create sysfs groups\n", card->number, hwdep->device); put_device(d); @@ -456,13 +461,13 @@ static int snd_hwdep_dev_register(struct snd_device *device) hwdep->ossreg = 0; if (hwdep->oss_type >= 0) { if ((hwdep->oss_type == SNDRV_OSS_DEVICE_TYPE_DMFM) && (hwdep->device != 0)) { - dev_warn(card->dev, + dev_warn(dev, "only hwdep device 0 can be registered as OSS direct FM device!\n"); } else { if (snd_register_oss_device(hwdep->oss_type, card, hwdep->device, &snd_hwdep_f_ops, hwdep) < 0) { - dev_err(card->dev, + dev_err(dev, "unable to register OSS compatibility device %i:%i\n", card->number, hwdep->device); } else |