[PATCH v7 1/1] alsa: jack: implement software jack injection via debugfs

Hui Wang hui.wang at canonical.com
Tue Jan 26 07:55:29 CET 2021


On 1/25/21 10:32 PM, Takashi Iwai wrote:
> On Mon, 25 Jan 2021 04:21:18 +0100,
> Hui Wang wrote:
>> This change adds audio jack injection feature through debugfs, with
>> this feature, we could validate alsa userspace changes by injecting
>> plugin or plugout events to the non-phantom audio jacks.
>>
>> With this change, the sound core will build the folders
>> $debugfs_mount_dir/sound/cardN if SND_DEBUG and DEBUG_FS are enabled.
<snip>
>> +		return -ENOMEM;
>> +
>> +	/* replace the chars which are not suitable for folder's name with _ */
>> +	for (i = 0; i < strlen(tname); i++)
> No need to use strlen(), just check the NUL character on tname[i].
OK, will change it to:     for (i = 0; tname[i] != '\0'; i++)
>
>> --- a/sound/core/sound.c
>> +++ b/sound/core/sound.c
>> @@ -9,6 +9,7 @@
>>   #include <linux/time.h>
>>   #include <linux/device.h>
>>   #include <linux/module.h>
>> +#include <linux/debugfs.h>
>>   #include <sound/core.h>
>>   #include <sound/minors.h>
>>   #include <sound/info.h>
>> @@ -39,6 +40,9 @@ MODULE_ALIAS_CHARDEV_MAJOR(CONFIG_SND_MAJOR);
>>   int snd_ecards_limit;
>>   EXPORT_SYMBOL(snd_ecards_limit);
>>   
>> +struct dentry *sound_debugfs_root;
>> +EXPORT_SYMBOL_GPL(sound_debugfs_root);
> I guess this should be wrapped with CONFIG_SND_DEBUG ifdef?

OK, will add the wrap.

thanks,

Hui.

>
>
> thanks,
>
> Takashi


More information about the Alsa-devel mailing list