OSDN Git Service

staging: most: net: remove useless variable channels_opened
authorAndrey Shvetsov <andrey.shvetsov@k2l.de>
Fri, 12 May 2017 10:59:49 +0000 (12:59 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 May 2017 09:59:08 +0000 (11:59 +0200)
The function most_nd_stop is only called by successful return from the
function most_nd_open, so the channels_opened is always true in the
function most_nd_stop.

The functions aim_resume_tx_channel and aim_rx_data are only called
after successful most_start_channel in the function most_nd_open, so the
channels_opened is always true in the functions aim_resume_tx_channel
and aim_rx_data.

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

index ce1764c..004dd7b 100644 (file)
@@ -65,7 +65,6 @@ struct net_dev_channel {
 
 struct net_dev_context {
        struct most_interface *iface;
-       bool channels_opened;
        bool is_mamac;
        struct net_device *dev;
        struct net_dev_channel rx;
@@ -187,9 +186,6 @@ static int most_nd_open(struct net_device *dev)
 
        BUG_ON(nd->dev != dev);
 
-       if (nd->channels_opened)
-               return -EFAULT;
-
        BUG_ON(!nd->tx.linked || !nd->rx.linked);
 
        if (most_start_channel(nd->iface, nd->rx.ch_id, &aim)) {
@@ -219,7 +215,6 @@ static int most_nd_open(struct net_device *dev)
                }
        }
 
-       nd->channels_opened = true;
        netif_wake_queue(dev);
        return 0;
 
@@ -237,12 +232,8 @@ static int most_nd_stop(struct net_device *dev)
 
        BUG_ON(nd->dev != dev);
        netif_stop_queue(dev);
-
-       if (nd->channels_opened) {
-               most_stop_channel(nd->iface, nd->rx.ch_id, &aim);
-               most_stop_channel(nd->iface, nd->tx.ch_id, &aim);
-               nd->channels_opened = false;
-       }
+       most_stop_channel(nd->iface, nd->rx.ch_id, &aim);
+       most_stop_channel(nd->iface, nd->tx.ch_id, &aim);
 
        return 0;
 }
@@ -431,7 +422,7 @@ static int aim_resume_tx_channel(struct most_interface *iface,
        struct net_dev_context *nd;
 
        nd = get_net_dev_context(iface);
-       if (!nd || !nd->channels_opened || nd->tx.ch_id != channel_idx)
+       if (!nd || nd->tx.ch_id != channel_idx)
                return 0;
 
        if (!nd->dev)
@@ -452,7 +443,7 @@ static int aim_rx_data(struct mbo *mbo)
        unsigned int skb_len;
 
        nd = get_net_dev_context(mbo->ifp);
-       if (!nd || !nd->channels_opened || nd->rx.ch_id != mbo->hdm_channel_id)
+       if (!nd || nd->rx.ch_id != mbo->hdm_channel_id)
                return -EIO;
 
        dev = nd->dev;