Skip to content

Commit

Permalink
f_phonet: lock-less MTU change
Browse files Browse the repository at this point in the history
With the current driver, the MTU is purely indicative, so there is no
need to synchronize with the receive path.

Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Rémi Denis-Courmont authored and David S. Miller committed Aug 13, 2009
1 parent aa11d95 commit 5da63cc
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions drivers/usb/gadget/f_phonet.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,20 +261,10 @@ static int pn_net_xmit(struct sk_buff *skb, struct net_device *dev)

static int pn_net_mtu(struct net_device *dev, int new_mtu)
{
struct phonet_port *port = netdev_priv(dev);
unsigned long flags;
int err = -EBUSY;

if ((new_mtu < PHONET_MIN_MTU) || (new_mtu > PHONET_MAX_MTU))
return -EINVAL;

spin_lock_irqsave(&port->lock, flags);
if (!netif_carrier_ok(dev)) {
dev->mtu = new_mtu;
err = 0;
}
spin_unlock_irqrestore(&port->lock, flags);
return err;
dev->mtu = new_mtu;
return 0;
}

static const struct net_device_ops pn_netdev_ops = {
Expand Down

0 comments on commit 5da63cc

Please sign in to comment.