netdev: ehea: port_lock semaphore to mutex
Convert the port_lock to a mutex. There is also some additional cleanup. The line length inside the ehea_rereg_mrs was getting long so I made some adjustments to shorten them. [akpm@linux-foundation.org: dec99ification] Signed-off-by: Daniel Walker <dwalker@mvista.com> Cc: Christoph Raisch <raisch@de.ibm.com> Cc: Jan-Bernd Themann <themann@de.ibm.com> Cc: Thomas Klein <tklein@de.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
parent
da59cde482
commit
a5af6ad3a0
|
@ -452,7 +452,7 @@ struct ehea_port {
|
||||||
struct vlan_group *vgrp;
|
struct vlan_group *vgrp;
|
||||||
struct ehea_eq *qp_eq;
|
struct ehea_eq *qp_eq;
|
||||||
struct work_struct reset_task;
|
struct work_struct reset_task;
|
||||||
struct semaphore port_lock;
|
struct mutex port_lock;
|
||||||
char int_aff_name[EHEA_IRQ_NAME_SIZE];
|
char int_aff_name[EHEA_IRQ_NAME_SIZE];
|
||||||
int allmulti; /* Indicates IFF_ALLMULTI state */
|
int allmulti; /* Indicates IFF_ALLMULTI state */
|
||||||
int promisc; /* Indicates IFF_PROMISC state */
|
int promisc; /* Indicates IFF_PROMISC state */
|
||||||
|
|
|
@ -2543,7 +2543,7 @@ static int ehea_open(struct net_device *dev)
|
||||||
int ret;
|
int ret;
|
||||||
struct ehea_port *port = netdev_priv(dev);
|
struct ehea_port *port = netdev_priv(dev);
|
||||||
|
|
||||||
down(&port->port_lock);
|
mutex_lock(&port->port_lock);
|
||||||
|
|
||||||
if (netif_msg_ifup(port))
|
if (netif_msg_ifup(port))
|
||||||
ehea_info("enabling port %s", dev->name);
|
ehea_info("enabling port %s", dev->name);
|
||||||
|
@ -2554,7 +2554,7 @@ static int ehea_open(struct net_device *dev)
|
||||||
netif_start_queue(dev);
|
netif_start_queue(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
up(&port->port_lock);
|
mutex_unlock(&port->port_lock);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -2600,11 +2600,11 @@ static int ehea_stop(struct net_device *dev)
|
||||||
ehea_info("disabling port %s", dev->name);
|
ehea_info("disabling port %s", dev->name);
|
||||||
|
|
||||||
flush_scheduled_work();
|
flush_scheduled_work();
|
||||||
down(&port->port_lock);
|
mutex_lock(&port->port_lock);
|
||||||
netif_stop_queue(dev);
|
netif_stop_queue(dev);
|
||||||
port_napi_disable(port);
|
port_napi_disable(port);
|
||||||
ret = ehea_down(dev);
|
ret = ehea_down(dev);
|
||||||
up(&port->port_lock);
|
mutex_unlock(&port->port_lock);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2802,7 +2802,7 @@ static void ehea_reset_port(struct work_struct *work)
|
||||||
struct net_device *dev = port->netdev;
|
struct net_device *dev = port->netdev;
|
||||||
|
|
||||||
port->resets++;
|
port->resets++;
|
||||||
down(&port->port_lock);
|
mutex_lock(&port->port_lock);
|
||||||
netif_stop_queue(dev);
|
netif_stop_queue(dev);
|
||||||
|
|
||||||
port_napi_disable(port);
|
port_napi_disable(port);
|
||||||
|
@ -2822,7 +2822,7 @@ static void ehea_reset_port(struct work_struct *work)
|
||||||
|
|
||||||
netif_wake_queue(dev);
|
netif_wake_queue(dev);
|
||||||
out:
|
out:
|
||||||
up(&port->port_lock);
|
mutex_unlock(&port->port_lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2839,21 +2839,23 @@ static void ehea_rereg_mrs(struct work_struct *work)
|
||||||
/* Shutdown all ports */
|
/* Shutdown all ports */
|
||||||
for (i = 0; i < EHEA_MAX_PORTS; i++) {
|
for (i = 0; i < EHEA_MAX_PORTS; i++) {
|
||||||
struct ehea_port *port = adapter->port[i];
|
struct ehea_port *port = adapter->port[i];
|
||||||
|
struct net_device *dev;
|
||||||
|
|
||||||
if (port) {
|
if (!port)
|
||||||
struct net_device *dev = port->netdev;
|
continue;
|
||||||
|
|
||||||
if (dev->flags & IFF_UP) {
|
dev = port->netdev;
|
||||||
down(&port->port_lock);
|
|
||||||
netif_stop_queue(dev);
|
if (dev->flags & IFF_UP) {
|
||||||
ret = ehea_stop_qps(dev);
|
mutex_lock(&port->port_lock);
|
||||||
if (ret) {
|
netif_stop_queue(dev);
|
||||||
up(&port->port_lock);
|
ret = ehea_stop_qps(dev);
|
||||||
goto out;
|
if (ret) {
|
||||||
}
|
mutex_unlock(&port->port_lock);
|
||||||
port_napi_disable(port);
|
goto out;
|
||||||
up(&port->port_lock);
|
|
||||||
}
|
}
|
||||||
|
port_napi_disable(port);
|
||||||
|
mutex_unlock(&port->port_lock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2893,12 +2895,12 @@ static void ehea_rereg_mrs(struct work_struct *work)
|
||||||
struct net_device *dev = port->netdev;
|
struct net_device *dev = port->netdev;
|
||||||
|
|
||||||
if (dev->flags & IFF_UP) {
|
if (dev->flags & IFF_UP) {
|
||||||
down(&port->port_lock);
|
mutex_lock(&port->port_lock);
|
||||||
port_napi_enable(port);
|
port_napi_enable(port);
|
||||||
ret = ehea_restart_qps(dev);
|
ret = ehea_restart_qps(dev);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
netif_wake_queue(dev);
|
netif_wake_queue(dev);
|
||||||
up(&port->port_lock);
|
mutex_unlock(&port->port_lock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3064,7 +3066,7 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter,
|
||||||
|
|
||||||
port = netdev_priv(dev);
|
port = netdev_priv(dev);
|
||||||
|
|
||||||
sema_init(&port->port_lock, 1);
|
mutex_init(&port->port_lock);
|
||||||
port->state = EHEA_PORT_DOWN;
|
port->state = EHEA_PORT_DOWN;
|
||||||
port->sig_comp_iv = sq_entries / 10;
|
port->sig_comp_iv = sq_entries / 10;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue