staging: line6: Pass *_init() `usb_line6' pointers
authorChris Rorvick <chris@rorvick.com>
Mon, 12 Jan 2015 20:42:56 +0000 (12:42 -0800)
committerTakashi Iwai <tiwai@suse.de>
Mon, 12 Jan 2015 21:24:09 +0000 (22:24 +0100)
Casting the `struct usb_line6' pointer at the call point makes the code
difficult to read.  This is substantially cleaned up by moving the cast
into the callees.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
drivers/staging/line6/driver.c
drivers/staging/line6/pod.c
drivers/staging/line6/pod.h
drivers/staging/line6/podhd.c
drivers/staging/line6/podhd.h
drivers/staging/line6/toneport.c
drivers/staging/line6/toneport.h
drivers/staging/line6/variax.c
drivers/staging/line6/variax.h

index 4bfef2126931b6f9ee49d21ab6c7a70b338f91a6..08f80515733082e8d6c1d4a5533e3fcd5ed5311a 100644 (file)
@@ -959,33 +959,26 @@ static int line6_probe(struct usb_interface *interface,
        case LINE6_POCKETPOD:
        case LINE6_PODXT:
        case LINE6_PODXTPRO:
-               ret = line6_pod_init(interface, (struct usb_line6_pod *)line6);
+               ret = line6_pod_init(interface, line6);
                break;
 
        case LINE6_PODHD300:
        case LINE6_PODHD400:
        case LINE6_PODHD500_0:
        case LINE6_PODHD500_1:
-               ret = line6_podhd_init(interface,
-                                      (struct usb_line6_podhd *)line6);
+               ret = line6_podhd_init(interface, line6);
                break;
 
        case LINE6_PODXTLIVE_POD:
-               ret =
-                   line6_pod_init(interface,
-                                  (struct usb_line6_pod *)line6);
+               ret = line6_pod_init(interface, line6);
                break;
 
        case LINE6_PODXTLIVE_VARIAX:
-               ret =
-                   line6_variax_init(interface,
-                                     (struct usb_line6_variax *)line6);
+               ret = line6_variax_init(interface, line6);
                break;
 
        case LINE6_VARIAX:
-               ret =
-                   line6_variax_init(interface,
-                                     (struct usb_line6_variax *)line6);
+               ret = line6_variax_init(interface, line6);
                break;
 
        case LINE6_PODSTUDIO_GX:
@@ -995,9 +988,7 @@ static int line6_probe(struct usb_interface *interface,
        case LINE6_TONEPORT_UX1:
        case LINE6_TONEPORT_UX2:
        case LINE6_GUITARPORT:
-               ret =
-                   line6_toneport_init(interface,
-                                       (struct usb_line6_toneport *)line6);
+               ret = line6_toneport_init(interface, line6);
                break;
 
        default:
index 0fb17884818243349d7fb4ae02f5ddf0b5718f35..9292b7215d646773475f876960baed49d8b91252 100644 (file)
@@ -353,10 +353,10 @@ static int pod_create_files2(struct device *dev)
         Try to init POD device.
 */
 static int pod_try_init(struct usb_interface *interface,
-                       struct usb_line6_pod *pod)
+                       struct usb_line6 *line6)
 {
        int err;
-       struct usb_line6 *line6 = &pod->line6;
+       struct usb_line6_pod *pod = (struct usb_line6_pod *) line6;
 
        init_timer(&pod->startup_timer);
        INIT_WORK(&pod->startup_work, pod_startup4);
@@ -409,9 +409,9 @@ static int pod_try_init(struct usb_interface *interface,
 /*
         Init POD device (and clean up in case of failure).
 */
-int line6_pod_init(struct usb_interface *interface, struct usb_line6_pod *pod)
+int line6_pod_init(struct usb_interface *interface, struct usb_line6 *line6)
 {
-       int err = pod_try_init(interface, pod);
+       int err = pod_try_init(interface, line6);
 
        if (err < 0)
                pod_destruct(interface);
index 91fd4c58f63ccae0ba47afea9cada979c91d2bbc..cf6c75cd67605834aed942b256f8f4eda84a6898 100644 (file)
@@ -88,7 +88,7 @@ struct usb_line6_pod {
 
 extern void line6_pod_disconnect(struct usb_interface *interface);
 extern int line6_pod_init(struct usb_interface *interface,
-                         struct usb_line6_pod *pod);
+                         struct usb_line6 *line6);
 extern void line6_pod_process_message(struct usb_line6_pod *pod);
 
 #endif
index 7ef45437b4f2392726ea7c7493495c049ce170f8..3bb942e7ff93a268bc6a69be57d9a3fef2b4838e 100644 (file)
@@ -121,9 +121,9 @@ static int podhd_try_init(struct usb_interface *interface,
 /*
        Init POD HD device (and clean up in case of failure).
 */
-int line6_podhd_init(struct usb_interface *interface,
-                    struct usb_line6_podhd *podhd)
+int line6_podhd_init(struct usb_interface *interface, struct usb_line6 *line6)
 {
+       struct usb_line6_podhd *podhd = (struct usb_line6_podhd *) line6;
        int err = podhd_try_init(interface, podhd);
 
        if (err < 0)
index 652f74056bb977d9a526103fcdba54426fd661db..b7d9568e3a6ce9fa6b470379af372448a41de4d4 100644 (file)
@@ -25,6 +25,6 @@ struct usb_line6_podhd {
 
 extern void line6_podhd_disconnect(struct usb_interface *interface);
 extern int line6_podhd_init(struct usb_interface *interface,
-                           struct usb_line6_podhd *podhd);
+                           struct usb_line6 *line6);
 
 #endif /* PODHD_H */
index 9e5cee18b54275cbb7625c9fb27be5f882233fdb..de91910a102c690690b19d6260389060ebc6e920 100644 (file)
@@ -339,10 +339,10 @@ static void toneport_setup(struct usb_line6_toneport *toneport)
         Try to init Toneport device.
 */
 static int toneport_try_init(struct usb_interface *interface,
-                            struct usb_line6_toneport *toneport)
+                            struct usb_line6 *line6)
 {
        int err;
-       struct usb_line6 *line6 = &toneport->line6;
+       struct usb_line6_toneport *toneport =  (struct usb_line6_toneport *) line6;
 
        if ((interface == NULL) || (toneport == NULL))
                return -ENODEV;
@@ -411,9 +411,9 @@ static int toneport_try_init(struct usb_interface *interface,
         Init Toneport device (and clean up in case of failure).
 */
 int line6_toneport_init(struct usb_interface *interface,
-                       struct usb_line6_toneport *toneport)
+                       struct usb_line6 *line6)
 {
-       int err = toneport_try_init(interface, toneport);
+       int err = toneport_try_init(interface, line6);
 
        if (err < 0)
                toneport_destruct(interface);
index 8576b72636487ae0aa01e9ca8fe33af8ccfce792..af2b4e06ce941382f4c7433735c7f89d4385107f 100644 (file)
@@ -46,7 +46,7 @@ struct usb_line6_toneport {
 
 extern void line6_toneport_disconnect(struct usb_interface *interface);
 extern int line6_toneport_init(struct usb_interface *interface,
-                              struct usb_line6_toneport *toneport);
+                              struct usb_line6 *line6);
 extern void line6_toneport_reset_resume(struct usb_line6_toneport *toneport);
 
 #endif
index ae2be99f9a922a997ba7cea6e56cbd55bfc0053c..f5b618bc3dbe9cd29c0d8baa2d8ac9f943eb2436 100644 (file)
@@ -174,8 +174,9 @@ static void variax_destruct(struct usb_interface *interface)
         Try to init workbench device.
 */
 static int variax_try_init(struct usb_interface *interface,
-                          struct usb_line6_variax *variax)
+                          struct usb_line6 *line6)
 {
+       struct usb_line6_variax *variax = (struct usb_line6_variax *) line6;
        int err;
 
        init_timer(&variax->startup_timer1);
@@ -212,10 +213,9 @@ static int variax_try_init(struct usb_interface *interface,
 /*
         Init workbench device (and clean up in case of failure).
 */
-int line6_variax_init(struct usb_interface *interface,
-                     struct usb_line6_variax *variax)
+int line6_variax_init(struct usb_interface *interface, struct usb_line6 *line6)
 {
-       int err = variax_try_init(interface, variax);
+       int err = variax_try_init(interface, line6);
 
        if (err < 0)
                variax_destruct(interface);
index 24de79620d8963ddbe313ba60927a0ea5e0af530..9bf1464d45ec12f027459b3bba38c36c716e5566 100644 (file)
@@ -66,7 +66,7 @@ struct usb_line6_variax {
 
 extern void line6_variax_disconnect(struct usb_interface *interface);
 extern int line6_variax_init(struct usb_interface *interface,
-                            struct usb_line6_variax *variax);
+                            struct usb_line6 *line6);
 extern void line6_variax_process_message(struct usb_line6_variax *variax);
 
 #endif