OSDN Git Service

Revert "usb: gadget: function: make current f_uac1 implementation legacy"
authorAjay Agarwal <ajaya@codeaurora.org>
Tue, 8 Jan 2019 13:56:55 +0000 (19:26 +0530)
committerAjay Agarwal <ajaya@codeaurora.org>
Wed, 9 Jan 2019 04:46:53 +0000 (10:16 +0530)
This reverts commit 8d17be60a0d7695f77b13ba476631df6e7bdb41a.
Required for clean picking of UAC opensource changes.

Change-Id: I4b1e58e4bf17f25abfb9ae6f3a9d4ad51293c586
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
Documentation/ABI/testing/configfs-usb-gadget-uac1 [moved from Documentation/ABI/testing/configfs-usb-gadget-uac1_legacy with 84% similarity]
Documentation/usb/gadget-testing.txt
drivers/usb/gadget/Kconfig
drivers/usb/gadget/function/Makefile
drivers/usb/gadget/function/f_uac1.c [moved from drivers/usb/gadget/function/f_uac1_legacy.c with 95% similarity]
drivers/usb/gadget/function/u_uac1.c [moved from drivers/usb/gadget/function/u_uac1_legacy.c with 98% similarity]
drivers/usb/gadget/function/u_uac1.h [moved from drivers/usb/gadget/function/u_uac1_legacy.h with 94% similarity]

@@ -1,4 +1,4 @@
-What:          /config/usb-gadget/gadget/functions/uac1_legacy.name
+What:          /config/usb-gadget/gadget/functions/uac1.name
 Date:          Sep 2014
 KernelVersion: 3.18
 Description:
index 0c1dc63..b24d3ef 100644 (file)
@@ -16,7 +16,7 @@ provided by gadgets.
 13. RNDIS function
 14. SERIAL function
 15. SOURCESINK function
-16. UAC1 function (legacy implementation)
+16. UAC1 function
 17. UAC2 function
 18. UVC function
 19. PRINTER function
@@ -587,16 +587,15 @@ device: run the gadget
 host: test-usb (tools/usb/testusb.c)
 
 
-16. UAC1 function (legacy implementation)
+16. UAC1 function
 =================
 
-The function is provided by usb_f_uac1_legacy.ko module.
+The function is provided by usb_f_uac1.ko module.
 
 Function-specific configfs interface
 ------------------------------------
 
-The function name to use when creating the function directory
-is "uac1_legacy".
+The function name to use when creating the function directory is "uac1".
 The uac1 function provides these attributes in its function directory:
 
        audio_buf_size - audio buffer size
index 2ca884d..1e86a29 100644 (file)
@@ -190,7 +190,7 @@ config USB_F_MASS_STORAGE
 config USB_F_FS
        tristate
 
-config USB_F_UAC1_LEGACY
+config USB_F_UAC1
        tristate
 
 config USB_F_UAC2
@@ -459,13 +459,13 @@ config USB_CONFIGFS_UEVENT
          state changes. The gadget can be in any of the following
          three states: "CONNECTED/DISCONNECTED/CONFIGURED"
 
-config USB_CONFIGFS_F_UAC1_LEGACY
-       bool "Audio Class 1.0 (legacy implementation)"
+config USB_CONFIGFS_F_UAC1
+       bool "Audio Class 1.0"
        depends on USB_CONFIGFS
        depends on SND
        select USB_LIBCOMPOSITE
        select SND_PCM
-       select USB_F_UAC1_LEGACY
+       select USB_F_UAC1
        help
          This Audio function implements 1 AudioControl interface,
          1 AudioStreaming Interface each for USB-OUT and USB-IN.
index ae35444..692f91f 100644 (file)
@@ -33,8 +33,8 @@ obj-$(CONFIG_USB_F_MASS_STORAGE)+= usb_f_mass_storage.o
 usb_f_fs-y                     := f_fs.o
 obj-$(CONFIG_USB_F_FS)         += usb_f_fs.o
 obj-$(CONFIG_USB_U_AUDIO)      += u_audio.o
-usb_f_uac1_legacy-y            := f_uac1_legacy.o u_uac1_legacy.o
-obj-$(CONFIG_USB_F_UAC1_LEGACY)        += usb_f_uac1_legacy.o
+usb_f_uac1-y                   := f_uac1.o u_uac1.o
+obj-$(CONFIG_USB_F_UAC1)       += usb_f_uac1.o
 usb_f_uac2-y                   := f_uac2.o
 obj-$(CONFIG_USB_F_UAC2)       += usb_f_uac2.o
 usb_f_uvc-y                    := f_uvc.o uvc_queue.o uvc_v4l2.o uvc_video.o uvc_configfs.o
similarity index 95%
rename from drivers/usb/gadget/function/f_uac1_legacy.c
rename to drivers/usb/gadget/function/f_uac1.c
index 0eb16ce..366e7b6 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/device.h>
 #include <linux/atomic.h>
 
-#include "u_uac1_legacy.h"
+#include "u_uac1.h"
 
 static int generic_set_cmd(struct usb_audio_control *con, u8 cmd, int value);
 static int generic_get_cmd(struct usb_audio_control *con, u8 cmd);
@@ -326,11 +326,11 @@ static int f_audio_out_ep_complete(struct usb_ep *ep, struct usb_request *req)
        struct f_audio *audio = req->context;
        struct usb_composite_dev *cdev = audio->card.func.config->cdev;
        struct f_audio_buf *copy_buf = audio->copy_buf;
-       struct f_uac1_legacy_opts *opts;
+       struct f_uac1_opts *opts;
        int audio_buf_size;
        int err;
 
-       opts = container_of(audio->card.func.fi, struct f_uac1_legacy_opts,
+       opts = container_of(audio->card.func.fi, struct f_uac1_opts,
                            func_inst);
        audio_buf_size = opts->audio_buf_size;
 
@@ -578,13 +578,13 @@ static int f_audio_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
        struct usb_composite_dev *cdev = f->config->cdev;
        struct usb_ep *out_ep = audio->out_ep;
        struct usb_request *req;
-       struct f_uac1_legacy_opts *opts;
+       struct f_uac1_opts *opts;
        int req_buf_size, req_count, audio_buf_size;
        int i = 0, err = 0;
 
        DBG(cdev, "intf %d, alt %d\n", intf, alt);
 
-       opts = container_of(f->fi, struct f_uac1_legacy_opts, func_inst);
+       opts = container_of(f->fi, struct f_uac1_opts, func_inst);
        req_buf_size = opts->req_buf_size;
        req_count = opts->req_count;
        audio_buf_size = opts->audio_buf_size;
@@ -705,9 +705,9 @@ f_audio_bind(struct usb_configuration *c, struct usb_function *f)
        struct usb_string       *us;
        int                     status;
        struct usb_ep           *ep = NULL;
-       struct f_uac1_legacy_opts       *audio_opts;
+       struct f_uac1_opts      *audio_opts;
 
-       audio_opts = container_of(f->fi, struct f_uac1_legacy_opts, func_inst);
+       audio_opts = container_of(f->fi, struct f_uac1_opts, func_inst);
        audio->card.gadget = c->cdev->gadget;
        /* set up ASLA audio devices */
        if (!audio_opts->bound) {
@@ -800,16 +800,15 @@ static int control_selector_init(struct f_audio *audio)
        return 0;
 }
 
-static inline
-struct f_uac1_legacy_opts *to_f_uac1_opts(struct config_item *item)
+static inline struct f_uac1_opts *to_f_uac1_opts(struct config_item *item)
 {
-       return container_of(to_config_group(item), struct f_uac1_legacy_opts,
+       return container_of(to_config_group(item), struct f_uac1_opts,
                            func_inst.group);
 }
 
 static void f_uac1_attr_release(struct config_item *item)
 {
-       struct f_uac1_legacy_opts *opts = to_f_uac1_opts(item);
+       struct f_uac1_opts *opts = to_f_uac1_opts(item);
 
        usb_put_function_instance(&opts->func_inst);
 }
@@ -822,7 +821,7 @@ static struct configfs_item_operations f_uac1_item_ops = {
 static ssize_t f_uac1_opts_##name##_show(struct config_item *item,     \
                                         char *page)                    \
 {                                                                      \
-       struct f_uac1_legacy_opts *opts = to_f_uac1_opts(item);         \
+       struct f_uac1_opts *opts = to_f_uac1_opts(item);                \
        int result;                                                     \
                                                                        \
        mutex_lock(&opts->lock);                                        \
@@ -835,7 +834,7 @@ static ssize_t f_uac1_opts_##name##_show(struct config_item *item,  \
 static ssize_t f_uac1_opts_##name##_store(struct config_item *item,            \
                                          const char *page, size_t len) \
 {                                                                      \
-       struct f_uac1_legacy_opts *opts = to_f_uac1_opts(item);         \
+       struct f_uac1_opts *opts = to_f_uac1_opts(item);                \
        int ret;                                                        \
        u32 num;                                                        \
                                                                        \
@@ -867,7 +866,7 @@ UAC1_INT_ATTRIBUTE(audio_buf_size);
 static ssize_t f_uac1_opts_##name##_show(struct config_item *item,     \
                                         char *page)                    \
 {                                                                      \
-       struct f_uac1_legacy_opts *opts = to_f_uac1_opts(item);         \
+       struct f_uac1_opts *opts = to_f_uac1_opts(item);                \
        int result;                                                     \
                                                                        \
        mutex_lock(&opts->lock);                                        \
@@ -880,7 +879,7 @@ static ssize_t f_uac1_opts_##name##_show(struct config_item *item,  \
 static ssize_t f_uac1_opts_##name##_store(struct config_item *item,    \
                                          const char *page, size_t len) \
 {                                                                      \
-       struct f_uac1_legacy_opts *opts = to_f_uac1_opts(item);         \
+       struct f_uac1_opts *opts = to_f_uac1_opts(item);                \
        int ret = -EBUSY;                                               \
        char *tmp;                                                      \
                                                                        \
@@ -928,9 +927,9 @@ static struct config_item_type f_uac1_func_type = {
 
 static void f_audio_free_inst(struct usb_function_instance *f)
 {
-       struct f_uac1_legacy_opts *opts;
+       struct f_uac1_opts *opts;
 
-       opts = container_of(f, struct f_uac1_legacy_opts, func_inst);
+       opts = container_of(f, struct f_uac1_opts, func_inst);
        if (opts->fn_play_alloc)
                kfree(opts->fn_play);
        if (opts->fn_cap_alloc)
@@ -942,7 +941,7 @@ static void f_audio_free_inst(struct usb_function_instance *f)
 
 static struct usb_function_instance *f_audio_alloc_inst(void)
 {
-       struct f_uac1_legacy_opts *opts;
+       struct f_uac1_opts *opts;
 
        opts = kzalloc(sizeof(*opts), GFP_KERNEL);
        if (!opts)
@@ -966,10 +965,10 @@ static struct usb_function_instance *f_audio_alloc_inst(void)
 static void f_audio_free(struct usb_function *f)
 {
        struct f_audio *audio = func_to_audio(f);
-       struct f_uac1_legacy_opts *opts;
+       struct f_uac1_opts *opts;
 
        gaudio_cleanup(&audio->card);
-       opts = container_of(f->fi, struct f_uac1_legacy_opts, func_inst);
+       opts = container_of(f->fi, struct f_uac1_opts, func_inst);
        kfree(audio);
        mutex_lock(&opts->lock);
        --opts->refcnt;
@@ -984,7 +983,7 @@ static void f_audio_unbind(struct usb_configuration *c, struct usb_function *f)
 static struct usb_function *f_audio_alloc(struct usb_function_instance *fi)
 {
        struct f_audio *audio;
-       struct f_uac1_legacy_opts *opts;
+       struct f_uac1_opts *opts;
 
        /* allocate and initialize one new instance */
        audio = kzalloc(sizeof(*audio), GFP_KERNEL);
@@ -993,7 +992,7 @@ static struct usb_function *f_audio_alloc(struct usb_function_instance *fi)
 
        audio->card.func.name = "g_audio";
 
-       opts = container_of(fi, struct f_uac1_legacy_opts, func_inst);
+       opts = container_of(fi, struct f_uac1_opts, func_inst);
        mutex_lock(&opts->lock);
        ++opts->refcnt;
        mutex_unlock(&opts->lock);
@@ -1015,6 +1014,6 @@ static struct usb_function *f_audio_alloc(struct usb_function_instance *fi)
        return &audio->card.func;
 }
 
-DECLARE_USB_FUNCTION_INIT(uac1_legacy, f_audio_alloc_inst, f_audio_alloc);
+DECLARE_USB_FUNCTION_INIT(uac1, f_audio_alloc_inst, f_audio_alloc);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Bryan Wu");
similarity index 98%
rename from drivers/usb/gadget/function/u_uac1_legacy.c
rename to drivers/usb/gadget/function/u_uac1.c
index 4d32492..5905fb1 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/random.h>
 #include <linux/syscalls.h>
 
-#include "u_uac1_legacy.h"
+#include "u_uac1.h"
 
 /*
  * This component encapsulates the ALSA devices for USB audio gadget
@@ -205,11 +205,10 @@ static int gaudio_open_snd_dev(struct gaudio *card)
 {
        struct snd_pcm_file *pcm_file;
        struct gaudio_snd_dev *snd;
-       struct f_uac1_legacy_opts *opts;
+       struct f_uac1_opts *opts;
        char *fn_play, *fn_cap, *fn_cntl;
 
-       opts = container_of(card->func.fi, struct f_uac1_legacy_opts,
-                           func_inst);
+       opts = container_of(card->func.fi, struct f_uac1_opts, func_inst);
        fn_play = opts->fn_play;
        fn_cap = opts->fn_cap;
        fn_cntl = opts->fn_cntl;
similarity index 94%
rename from drivers/usb/gadget/function/u_uac1_legacy.h
rename to drivers/usb/gadget/function/u_uac1.h
index d715b1a..5c2ac8e 100644 (file)
@@ -9,8 +9,8 @@
  * Licensed under the GPL-2 or later.
  */
 
-#ifndef __U_UAC1_LEGACY_H
-#define __U_UAC1_LEGACY_H
+#ifndef __U_AUDIO_H
+#define __U_AUDIO_H
 
 #include <linux/device.h>
 #include <linux/err.h>
@@ -56,7 +56,7 @@ struct gaudio {
        /* TODO */
 };
 
-struct f_uac1_legacy_opts {
+struct f_uac1_opts {
        struct usb_function_instance    func_inst;
        int                             req_buf_size;
        int                             req_count;
@@ -79,4 +79,4 @@ size_t u_audio_playback(struct gaudio *card, void *buf, size_t count);
 int u_audio_get_playback_channels(struct gaudio *card);
 int u_audio_get_playback_rate(struct gaudio *card);
 
-#endif /* __U_UAC1_LEGACY_H */
+#endif /* __U_AUDIO_H */