ALSA: Create sysfs attribute files via groups

Instead of calling each time device_create_file(), create the groups
of sysfs attribute files at once in a normal way.  Add a new helper
function, snd_get_device(), to return the associated device object,
so that we can handle the sysfs addition locally.

Since the sysfs file addition is done differently now,
snd_add_device_sysfs_file() helper function is removed.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai
2014-02-25 08:30:50 +01:00
szülő d01a838c86
commit caa751bad4
8 fájl változott, egészen pontosan 112 új sor hozzáadva és 103 régi sor törölve

Fájl megtekintése

@@ -436,6 +436,20 @@ static int snd_hwdep_dev_register(struct snd_device *device)
mutex_unlock(&register_mutex);
return err;
}
if (hwdep->groups) {
struct device *d = snd_get_device(SNDRV_DEVICE_TYPE_HWDEP,
hwdep->card, hwdep->device);
if (d) {
err = sysfs_create_groups(&d->kobj, hwdep->groups);
if (err < 0)
dev_warn(card->dev,
"hwdep %d:%d: cannot create sysfs groups\n",
card->number, hwdep->device);
put_device(d);
}
}
#ifdef CONFIG_SND_OSSEMUL
hwdep->ossreg = 0;
if (hwdep->oss_type >= 0) {