Commit 49cb5c0e authored by Marc Kleine-Budde's avatar Marc Kleine-Budde

can: dev: sort can_changelink() by IFLA_CAN_*

This patch sorts the handling of data[IFLA_CAN_*] by IFLA_CAN_*.
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 57a59b9e
......@@ -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;
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment