staging: most: enable configfs support
authorChristian Gromm <christian.gromm@microchip.com>
Wed, 3 Apr 2019 13:19:48 +0000 (15:19 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 Apr 2019 11:25:17 +0000 (13:25 +0200)
This patch enables the configfs functionality of the driver by
registering the configfs subsystems and compiling the configfs
part of the sources.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/most/Kconfig
drivers/staging/most/Makefile
drivers/staging/most/cdev/cdev.c
drivers/staging/most/core.c
drivers/staging/most/sound/sound.c

index 535455c39fba56891a570e81c7ebb1978bda0b6e..db32ea7d1743639f8f98cada873ed28b13d69abe 100644 (file)
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 menuconfig MOST
         tristate "MOST support"
-       depends on HAS_DMA
+       depends on HAS_DMA && CONFIGFS_FS
         default n
         ---help---
          Say Y here if you want to enable MOST support.
index c7662f65f6db4ca400b3b497fc299ffe5aceb594..85ea5a434ced8fc21d2eddcd33d4a3cb9350ffdd 100644 (file)
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_MOST) += most_core.o
 most_core-y := core.o
+most_core-y += configfs.o
 ccflags-y += -I $(srctree)/drivers/staging/
 
 obj-$(CONFIG_MOST_CDEV)        += cdev/
index 97408ecc182b995f7941247e4d38532de2916576..d98977c57a4b534fcb39f01847844da4928a15eb 100644 (file)
@@ -527,8 +527,13 @@ static int __init mod_init(void)
        err = most_register_component(&comp.cc);
        if (err)
                goto free_cdev;
+       err = most_register_configfs_subsys(&comp.cc);
+       if (err)
+               goto deregister_comp;
        return 0;
 
+deregister_comp:
+       most_deregister_component(&comp.cc);
 free_cdev:
        unregister_chrdev_region(comp.devno, CHRDEV_REGION_SIZE);
 dest_ida:
@@ -543,6 +548,7 @@ static void __exit mod_exit(void)
 
        pr_info("exit module\n");
 
+       most_deregister_configfs_subsys(&comp.cc);
        most_deregister_component(&comp.cc);
 
        list_for_each_entry_safe(c, tmp, &channel_list, list) {
index d5cf58fd6e3e402feaf591f7f79fe7bd05ec6a4d..e7a8d89b74b446cad9593cf6d496a0db48db4eb8 100644 (file)
@@ -1765,7 +1765,7 @@ static int __init most_init(void)
                err = -ENOMEM;
                goto err_unregister_driver;
        }
-
+       configfs_init();
        return 0;
 
 err_unregister_driver:
index 826174273b5c11e3402149a0bf70d9ed2f92bbf5..6b5438c2495b3717e6b95cba7f64a150f64877d6 100644 (file)
@@ -790,16 +790,25 @@ static struct core_component comp = {
 
 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);
 }