staging: most: change structure initialization
authorChristian Gromm <christian.gromm@microchip.com>
Mon, 28 Sep 2015 15:18:30 +0000 (17:18 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Sep 2015 01:18:49 +0000 (03:18 +0200)
By applying this patch the initialization of the most_aim structure is
performed at compile time.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/most/aim-network/networking.c
drivers/staging/most/aim-v4l2/video.c

index cbda189eba2f16e1a92c9f980ad8763a0e792402..dd368721b7277e34e9c6f61fd58dc6200465c484 100644 (file)
@@ -79,7 +79,6 @@ struct net_dev_context {
 
 static struct list_head net_devices = LIST_HEAD_INIT(net_devices);
 static struct spinlock list_lock;
-static struct most_aim aim;
 
 
 static int skb_to_mamac(const struct sk_buff *skb, struct mbo *mbo)
@@ -491,15 +490,18 @@ out:
        return 0;
 }
 
+static struct most_aim aim = {
+       .name = "networking",
+       .probe_channel = aim_probe_channel,
+       .disconnect_channel = aim_disconnect_channel,
+       .tx_completion = aim_resume_tx_channel,
+       .rx_completion = aim_rx_data,
+};
+
 static int __init most_net_init(void)
 {
        pr_info("most_net_init()\n");
        spin_lock_init(&list_lock);
-       aim.name = "networking";
-       aim.probe_channel = aim_probe_channel;
-       aim.disconnect_channel = aim_disconnect_channel;
-       aim.tx_completion = aim_resume_tx_channel;
-       aim.rx_completion = aim_rx_data;
        return most_register_aim(&aim);
 }
 
index 83332454974ce4a2ee2f2b2ba8f8a9090d8c93ed..377bb107c94c67f54fbdff970c68ead0cf9ee322 100644 (file)
@@ -62,7 +62,6 @@ struct aim_fh {
 
 static struct list_head video_devices = LIST_HEAD_INIT(video_devices);
 static struct spinlock list_lock;
-static struct most_aim aim_info;
 
 
 static inline bool data_ready(struct most_video_dev *mdev)
@@ -590,14 +589,16 @@ static int aim_disconnect_channel(struct most_interface *iface,
        return 0;
 }
 
+static struct most_aim aim_info = {
+       .name = "v4l",
+       .probe_channel = aim_probe_channel,
+       .disconnect_channel = aim_disconnect_channel,
+       .rx_completion = aim_rx_data,
+};
+
 static int __init aim_init(void)
 {
        spin_lock_init(&list_lock);
-
-       aim_info.name = "v4l";
-       aim_info.probe_channel = aim_probe_channel;
-       aim_info.disconnect_channel = aim_disconnect_channel;
-       aim_info.rx_completion = aim_rx_data;
        return most_register_aim(&aim_info);
 }