diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-07 13:31:29 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-07 13:31:29 -0700 |
commit | e0dccbdf5ac7ccb9da5612100dedba302f3ebcfe (patch) | |
tree | 0bdabbf13844ae18da61bc060348850a8038f0ba /drivers/staging/most/sound/sound.c | |
parent | cf482a49af564a3044de3178ea28f10ad5921b38 (diff) | |
parent | e2a5be107f52cefb9010ccae6f569c3ddaa954cc (diff) |
Merge tag 'staging-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging / IIO driver updates from Greg KH:
"Here is the big staging and iio driver update for 5.2-rc1.
Lots of tiny fixes all over the staging and IIO driver trees here,
along with some new IIO drivers.
The "counter" subsystem was added in here as well, as it is needed by
the IIO drivers and subsystem.
Also we ended up deleting two drivers, making this pull request remove
a few hundred thousand lines of code, always a nice thing to see. Both
of the drivers removed have been replaced with "real" drivers in their
various subsystem directories, and they will be coming to you from
those locations during this merge window.
There are some core vt/selection changes in here, that was due to some
cleanups needed for the speakup fixes. Those have all been acked by
the various subsystem maintainers (i.e. me), so those are ok.
We also added a few new drivers, for some odd hardware, giving new
developers plenty to work on with basic coding style cleanups to come
in the near future.
Other than that, nothing unusual here.
All of these have been in linux-next for a while with no reported
issues, other than an odd gcc warning for one of the new drivers that
should be fixed up soon"
[ I fixed up the warning myself - Linus ]
* tag 'staging-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (663 commits)
staging: kpc2000: kpc_spi: Fix build error for {read,write}q
Staging: rtl8192e: Remove extra space before break statement
Staging: rtl8192u: ieee80211: Fix if-else indentation warning
Staging: rtl8192u: ieee80211: Fix indentation errors by removing extra spaces
staging: most: cdev: fix chrdev_region leak in mod_exit
staging: wlan-ng: Fix improper SPDX comment style
staging: rtl8192u: ieee80211: Resolve ERROR reported by checkpatch
staging: vc04_services: bcm2835-camera: Compress two lines into one line
staging: rtl8723bs: core: Use !x in place of NULL comparison.
staging: rtl8723bs: core: Prefer using the BIT Macro.
staging: fieldbus: anybus-s: fix wait_for_completion_timeout return handling
staging: kpc2000: fix up build problems with readq()
staging: rtlwifi: move remaining phydm .h files
staging: rtlwifi: strip down phydm .h files
staging: rtlwifi: delete the staging driver
staging: fieldbus: anybus-s: rename bus id field to avoid confusion
staging: fieldbus: anybus-s: keep device bus id in bus endianness
Staging: sm750fb: Change *array into *const array
staging: rtl8192u: ieee80211: Fix spelling mistake
staging: rtl8192u: ieee80211: Replace bit shifting with BIT macro
...
Diffstat (limited to 'drivers/staging/most/sound/sound.c')
-rw-r--r-- | drivers/staging/most/sound/sound.c | 61 |
1 files changed, 38 insertions, 23 deletions
diff --git a/drivers/staging/most/sound/sound.c b/drivers/staging/most/sound/sound.c index 79ab3a78c5ec..342f390d68b3 100644 --- a/drivers/staging/most/sound/sound.c +++ b/drivers/staging/most/sound/sound.c @@ -20,6 +20,7 @@ #include <most/core.h> #define DRIVER_NAME "sound" +#define STRING_SIZE 80 static struct core_component comp; @@ -471,17 +472,11 @@ static const struct snd_pcm_ops pcm_ops = { .page = snd_pcm_lib_get_vmalloc_page, }; -static int split_arg_list(char *buf, char **device_name, u16 *ch_num, - char **sample_res, u8 *create) +static int split_arg_list(char *buf, u16 *ch_num, char **sample_res) { char *num; int ret; - *device_name = strsep(&buf, "."); - if (!*device_name) { - pr_err("Missing sound card name\n"); - return -EIO; - } num = strsep(&buf, "x"); if (!num) goto err; @@ -492,8 +487,6 @@ static int split_arg_list(char *buf, char **device_name, u16 *ch_num, if (!*sample_res) goto err; - if (buf && !strcmp(buf, "create")) - *create = 1; return 0; err: @@ -579,7 +572,7 @@ static void release_adapter(struct sound_adapter *adpt) */ static int audio_probe_channel(struct most_interface *iface, int channel_id, struct most_channel_config *cfg, - char *arg_list) + char *device_name, char *arg_list) { struct channel *channel; struct sound_adapter *adpt; @@ -588,10 +581,9 @@ static int audio_probe_channel(struct most_interface *iface, int channel_id, int capture_count = 0; int ret; int direction; - char *device_name; u16 ch_num; - u8 create = 0; char *sample_res; + char arg_list_cpy[STRING_SIZE]; if (!iface) return -EINVAL; @@ -600,9 +592,8 @@ static int audio_probe_channel(struct most_interface *iface, int channel_id, pr_err("Incompatible channel type\n"); return -EINVAL; } - - ret = split_arg_list(arg_list, &device_name, &ch_num, &sample_res, - &create); + strlcpy(arg_list_cpy, arg_list, STRING_SIZE); + ret = split_arg_list(arg_list_cpy, &ch_num, &sample_res); if (ret < 0) return ret; @@ -622,7 +613,7 @@ static int audio_probe_channel(struct most_interface *iface, int channel_id, INIT_LIST_HEAD(&adpt->dev_list); iface->priv = adpt; list_add_tail(&adpt->list, &adpt_list); - ret = snd_card_new(&iface->dev, -1, "INIC", THIS_MODULE, + ret = snd_card_new(iface->driver_dev, -1, "INIC", THIS_MODULE, sizeof(*channel), &adpt->card); if (ret < 0) goto err_free_adpt; @@ -673,12 +664,6 @@ skip_adpt_alloc: strscpy(pcm->name, device_name, sizeof(pcm->name)); snd_pcm_set_ops(pcm, direction, &pcm_ops); - if (create) { - ret = snd_card_register(adpt->card); - if (ret < 0) - goto err_free_adpt; - adpt->registered = true; - } return 0; err_free_adpt: @@ -686,6 +671,26 @@ err_free_adpt: return ret; } +static int audio_create_sound_card(void) +{ + int ret; + struct sound_adapter *adpt; + + list_for_each_entry(adpt, &adpt_list, list) { + if (!adpt->registered) + goto adpt_alloc; + } + return -ENODEV; +adpt_alloc: + ret = snd_card_register(adpt->card); + if (ret < 0) { + release_adapter(adpt); + return ret; + } + adpt->registered = true; + return 0; +} + /** * audio_disconnect_channel - function to disconnect a channel * @iface: pointer to interface instance @@ -782,20 +787,30 @@ static struct core_component comp = { .disconnect_channel = audio_disconnect_channel, .rx_completion = audio_rx_completion, .tx_completion = audio_tx_completion, + .cfg_complete = audio_create_sound_card, }; static int __init audio_init(void) { + int ret; + pr_info("init()\n"); INIT_LIST_HEAD(&adpt_list); - return most_register_component(&comp); + ret = most_register_component(&comp); + if (ret) + pr_err("Failed to register %s\n", comp.name); + ret = most_register_configfs_subsys(&comp); + if (ret) + pr_err("Failed to register %s configfs subsys\n", comp.name); + return ret; } static void __exit audio_exit(void) { pr_info("exit()\n"); + most_deregister_configfs_subsys(&comp); most_deregister_component(&comp); } |