diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-02-25 08:30:50 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-02-25 12:12:49 +0100 |
commit | caa751bad444268d756b48ca03d7cceda3430cc8 (patch) | |
tree | 1bca8a78c67dc2d54e6a83c3ec81dbcc302676d0 /sound/core/hwdep.c | |
parent | d01a838c86b60fdce4fbc9e51d5d14d6cfe0a902 (diff) |
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>
Diffstat (limited to 'sound/core/hwdep.c')
-rw-r--r-- | sound/core/hwdep.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index 8c778659fa03..99f7e8515ba1 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c @@ -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) { |