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:
@@ -436,6 +436,20 @@ static int snd_hwdep_dev_register(struct snd_device *device)
|
||||
mutex_unlock(®ister_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) {
|
||||
|
Reference in New Issue
Block a user