Skip to content

Commit

Permalink
can: dev: sort can_changelink() by IFLA_CAN_*
Browse files Browse the repository at this point in the history
This patch sorts the handling of data[IFLA_CAN_*] by IFLA_CAN_*.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
  • Loading branch information
Marc Kleine-Budde committed Oct 31, 2013
1 parent 57a59b9 commit 49cb5c0
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions drivers/net/can/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,19 +645,6 @@ static int can_changelink(struct net_device *dev,
/* We need synchronization with dev->stop() */
ASSERT_RTNL();

if (data[IFLA_CAN_CTRLMODE]) {
struct can_ctrlmode *cm;

/* Do not allow changing controller mode while running */
if (dev->flags & IFF_UP)
return -EBUSY;
cm = nla_data(data[IFLA_CAN_CTRLMODE]);
if (cm->flags & ~priv->ctrlmode_supported)
return -EOPNOTSUPP;
priv->ctrlmode &= ~cm->mask;
priv->ctrlmode |= cm->flags;
}

if (data[IFLA_CAN_BITTIMING]) {
struct can_bittiming bt;

Expand All @@ -680,6 +667,19 @@ static int can_changelink(struct net_device *dev,
}
}

if (data[IFLA_CAN_CTRLMODE]) {
struct can_ctrlmode *cm;

/* Do not allow changing controller mode while running */
if (dev->flags & IFF_UP)
return -EBUSY;
cm = nla_data(data[IFLA_CAN_CTRLMODE]);
if (cm->flags & ~priv->ctrlmode_supported)
return -EOPNOTSUPP;
priv->ctrlmode &= ~cm->mask;
priv->ctrlmode |= cm->flags;
}

if (data[IFLA_CAN_RESTART_MS]) {
/* Do not allow changing restart delay while running */
if (dev->flags & IFF_UP)
Expand Down

0 comments on commit 49cb5c0

Please sign in to comment.