diff options
author | Wolfram Sang <w.sang@pengutronix.de> | 2009-11-16 07:57:45 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-17 06:54:00 -0500 |
commit | 0285e7ceaaec9ef2d2e74dd37e2b557c0e017b5c (patch) | |
tree | 8c0ec34c81f52b15cee294fdb576b1d674343a0d /drivers/net/can/mscan | |
parent | 622ed7e9cfa931cefc423562d414cb6cd0b08991 (diff) |
net/can/mscan: trivial fixes
- remove whitespaces
- use ! and ?: when apropriate
- make braces consistent
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/can/mscan')
-rw-r--r-- | drivers/net/can/mscan/mpc52xx_can.c | 16 | ||||
-rw-r--r-- | drivers/net/can/mscan/mscan.c | 25 |
2 files changed, 18 insertions, 23 deletions
diff --git a/drivers/net/can/mscan/mpc52xx_can.c b/drivers/net/can/mscan/mpc52xx_can.c index 4707a82f1ae0..34ae2baec5d1 100644 --- a/drivers/net/can/mscan/mpc52xx_can.c +++ b/drivers/net/can/mscan/mpc52xx_can.c | |||
@@ -34,7 +34,6 @@ | |||
34 | 34 | ||
35 | #include "mscan.h" | 35 | #include "mscan.h" |
36 | 36 | ||
37 | |||
38 | #define DRV_NAME "mpc5xxx_can" | 37 | #define DRV_NAME "mpc5xxx_can" |
39 | 38 | ||
40 | static struct of_device_id mpc52xx_cdm_ids[] __devinitdata = { | 39 | static struct of_device_id mpc52xx_cdm_ids[] __devinitdata = { |
@@ -71,15 +70,10 @@ static unsigned int __devinit mpc52xx_can_xtal_freq(struct of_device *of) | |||
71 | 70 | ||
72 | if (in_8(&cdm->ipb_clk_sel) & 0x1) | 71 | if (in_8(&cdm->ipb_clk_sel) & 0x1) |
73 | freq *= 2; | 72 | freq *= 2; |
74 | val = in_be32(&cdm->rstcfg); | 73 | val = in_be32(&cdm->rstcfg); |
75 | if (val & (1 << 5)) | 74 | |
76 | freq *= 8; | 75 | freq *= (val & (1 << 5)) ? 8 : 4; |
77 | else | 76 | freq /= (val & (1 << 6)) ? 12 : 16; |
78 | freq *= 4; | ||
79 | if (val & (1 << 6)) | ||
80 | freq /= 12; | ||
81 | else | ||
82 | freq /= 16; | ||
83 | 77 | ||
84 | iounmap(cdm); | 78 | iounmap(cdm); |
85 | 79 | ||
@@ -222,7 +216,7 @@ static int mpc5xxx_can_resume(struct of_device *ofdev) | |||
222 | struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base; | 216 | struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base; |
223 | 217 | ||
224 | regs->canctl0 |= MSCAN_INITRQ; | 218 | regs->canctl0 |= MSCAN_INITRQ; |
225 | while ((regs->canctl1 & MSCAN_INITAK) == 0) | 219 | while (!(regs->canctl1 & MSCAN_INITAK)) |
226 | udelay(10); | 220 | udelay(10); |
227 | 221 | ||
228 | regs->canctl1 = saved_regs.canctl1; | 222 | regs->canctl1 = saved_regs.canctl1; |
diff --git a/drivers/net/can/mscan/mscan.c b/drivers/net/can/mscan/mscan.c index 2539ebe21bc4..6394de840427 100644 --- a/drivers/net/can/mscan/mscan.c +++ b/drivers/net/can/mscan/mscan.c | |||
@@ -69,7 +69,6 @@ static int mscan_set_mode(struct net_device *dev, u8 mode) | |||
69 | u8 canctl1; | 69 | u8 canctl1; |
70 | 70 | ||
71 | if (mode != MSCAN_NORMAL_MODE) { | 71 | if (mode != MSCAN_NORMAL_MODE) { |
72 | |||
73 | if (priv->tx_active) { | 72 | if (priv->tx_active) { |
74 | /* Abort transfers before going to sleep */# | 73 | /* Abort transfers before going to sleep */# |
75 | out_8(®s->cantarq, priv->tx_active); | 74 | out_8(®s->cantarq, priv->tx_active); |
@@ -78,7 +77,7 @@ static int mscan_set_mode(struct net_device *dev, u8 mode) | |||
78 | } | 77 | } |
79 | 78 | ||
80 | canctl1 = in_8(®s->canctl1); | 79 | canctl1 = in_8(®s->canctl1); |
81 | if ((mode & MSCAN_SLPRQ) && (canctl1 & MSCAN_SLPAK) == 0) { | 80 | if ((mode & MSCAN_SLPRQ) && !(canctl1 & MSCAN_SLPAK)) { |
82 | out_8(®s->canctl0, | 81 | out_8(®s->canctl0, |
83 | in_8(®s->canctl0) | MSCAN_SLPRQ); | 82 | in_8(®s->canctl0) | MSCAN_SLPRQ); |
84 | for (i = 0; i < MSCAN_SET_MODE_RETRIES; i++) { | 83 | for (i = 0; i < MSCAN_SET_MODE_RETRIES; i++) { |
@@ -105,7 +104,7 @@ static int mscan_set_mode(struct net_device *dev, u8 mode) | |||
105 | priv->can.state = CAN_STATE_SLEEPING; | 104 | priv->can.state = CAN_STATE_SLEEPING; |
106 | } | 105 | } |
107 | 106 | ||
108 | if ((mode & MSCAN_INITRQ) && (canctl1 & MSCAN_INITAK) == 0) { | 107 | if ((mode & MSCAN_INITRQ) && !(canctl1 & MSCAN_INITAK)) { |
109 | out_8(®s->canctl0, | 108 | out_8(®s->canctl0, |
110 | in_8(®s->canctl0) | MSCAN_INITRQ); | 109 | in_8(®s->canctl0) | MSCAN_INITRQ); |
111 | for (i = 0; i < MSCAN_SET_MODE_RETRIES; i++) { | 110 | for (i = 0; i < MSCAN_SET_MODE_RETRIES; i++) { |
@@ -233,7 +232,8 @@ static netdev_tx_t mscan_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
233 | 232 | ||
234 | if (!rtr) { | 233 | if (!rtr) { |
235 | void __iomem *data = ®s->tx.dsr1_0; | 234 | void __iomem *data = ®s->tx.dsr1_0; |
236 | u16 *payload = (u16 *) frame->data; | 235 | u16 *payload = (u16 *)frame->data; |
236 | |||
237 | /* It is safe to write into dsr[dlc+1] */ | 237 | /* It is safe to write into dsr[dlc+1] */ |
238 | for (i = 0; i < (frame->can_dlc + 1) / 2; i++) { | 238 | for (i = 0; i < (frame->can_dlc + 1) / 2; i++) { |
239 | out_be16(data, *payload++); | 239 | out_be16(data, *payload++); |
@@ -300,7 +300,8 @@ static void mscan_get_rx_frame(struct net_device *dev, struct can_frame *frame) | |||
300 | 300 | ||
301 | if (!(frame->can_id & CAN_RTR_FLAG)) { | 301 | if (!(frame->can_id & CAN_RTR_FLAG)) { |
302 | void __iomem *data = ®s->rx.dsr1_0; | 302 | void __iomem *data = ®s->rx.dsr1_0; |
303 | u16 *payload = (u16 *) frame->data; | 303 | u16 *payload = (u16 *)frame->data; |
304 | |||
304 | for (i = 0; i < (frame->can_dlc + 1) / 2; i++) { | 305 | for (i = 0; i < (frame->can_dlc + 1) / 2; i++) { |
305 | *payload++ = in_be16(data); | 306 | *payload++ = in_be16(data); |
306 | data += 2 + _MSCAN_RESERVED_DSR_SIZE; | 307 | data += 2 + _MSCAN_RESERVED_DSR_SIZE; |
@@ -326,8 +327,9 @@ static void mscan_get_err_frame(struct net_device *dev, struct can_frame *frame, | |||
326 | frame->data[1] = CAN_ERR_CRTL_RX_OVERFLOW; | 327 | frame->data[1] = CAN_ERR_CRTL_RX_OVERFLOW; |
327 | stats->rx_over_errors++; | 328 | stats->rx_over_errors++; |
328 | stats->rx_errors++; | 329 | stats->rx_errors++; |
329 | } else | 330 | } else { |
330 | frame->data[1] = 0; | 331 | frame->data[1] = 0; |
332 | } | ||
331 | 333 | ||
332 | old_state = check_set_state(dev, canrflg); | 334 | old_state = check_set_state(dev, canrflg); |
333 | /* State changed */ | 335 | /* State changed */ |
@@ -339,7 +341,6 @@ static void mscan_get_err_frame(struct net_device *dev, struct can_frame *frame, | |||
339 | if ((priv->shadow_statflg & MSCAN_RSTAT_MSK) < | 341 | if ((priv->shadow_statflg & MSCAN_RSTAT_MSK) < |
340 | (canrflg & MSCAN_RSTAT_MSK)) | 342 | (canrflg & MSCAN_RSTAT_MSK)) |
341 | frame->data[1] |= CAN_ERR_CRTL_RX_WARNING; | 343 | frame->data[1] |= CAN_ERR_CRTL_RX_WARNING; |
342 | |||
343 | if ((priv->shadow_statflg & MSCAN_TSTAT_MSK) < | 344 | if ((priv->shadow_statflg & MSCAN_TSTAT_MSK) < |
344 | (canrflg & MSCAN_TSTAT_MSK)) | 345 | (canrflg & MSCAN_TSTAT_MSK)) |
345 | frame->data[1] |= CAN_ERR_CRTL_TX_WARNING; | 346 | frame->data[1] |= CAN_ERR_CRTL_TX_WARNING; |
@@ -397,7 +398,7 @@ static int mscan_rx_poll(struct napi_struct *napi, int quota) | |||
397 | 398 | ||
398 | if (canrflg & MSCAN_RXF) | 399 | if (canrflg & MSCAN_RXF) |
399 | mscan_get_rx_frame(dev, frame); | 400 | mscan_get_rx_frame(dev, frame); |
400 | else if (canrflg & MSCAN_ERR_IF) | 401 | else if (canrflg & MSCAN_ERR_IF) |
401 | mscan_get_err_frame(dev, frame, canrflg); | 402 | mscan_get_err_frame(dev, frame, canrflg); |
402 | 403 | ||
403 | stats->rx_packets++; | 404 | stats->rx_packets++; |
@@ -429,7 +430,6 @@ static irqreturn_t mscan_isr(int irq, void *dev_id) | |||
429 | cantflg = in_8(®s->cantflg) & cantier; | 430 | cantflg = in_8(®s->cantflg) & cantier; |
430 | 431 | ||
431 | if (cantier && cantflg) { | 432 | if (cantier && cantflg) { |
432 | |||
433 | struct list_head *tmp, *pos; | 433 | struct list_head *tmp, *pos; |
434 | 434 | ||
435 | list_for_each_safe(pos, tmp, &priv->tx_head) { | 435 | list_for_each_safe(pos, tmp, &priv->tx_head) { |
@@ -452,8 +452,9 @@ static irqreturn_t mscan_isr(int irq, void *dev_id) | |||
452 | clear_bit(F_TX_WAIT_ALL, &priv->flags); | 452 | clear_bit(F_TX_WAIT_ALL, &priv->flags); |
453 | clear_bit(F_TX_PROGRESS, &priv->flags); | 453 | clear_bit(F_TX_PROGRESS, &priv->flags); |
454 | priv->cur_pri = 0; | 454 | priv->cur_pri = 0; |
455 | } else | 455 | } else { |
456 | dev->trans_start = jiffies; | 456 | dev->trans_start = jiffies; |
457 | } | ||
457 | 458 | ||
458 | if (!test_bit(F_TX_WAIT_ALL, &priv->flags)) | 459 | if (!test_bit(F_TX_WAIT_ALL, &priv->flags)) |
459 | netif_wake_queue(dev); | 460 | netif_wake_queue(dev); |
@@ -470,15 +471,15 @@ static irqreturn_t mscan_isr(int irq, void *dev_id) | |||
470 | out_8(®s->canrier, 0); | 471 | out_8(®s->canrier, 0); |
471 | napi_schedule(&priv->napi); | 472 | napi_schedule(&priv->napi); |
472 | ret = IRQ_HANDLED; | 473 | ret = IRQ_HANDLED; |
473 | } else | 474 | } else { |
474 | clear_bit(F_RX_PROGRESS, &priv->flags); | 475 | clear_bit(F_RX_PROGRESS, &priv->flags); |
476 | } | ||
475 | } | 477 | } |
476 | return ret; | 478 | return ret; |
477 | } | 479 | } |
478 | 480 | ||
479 | static int mscan_do_set_mode(struct net_device *dev, enum can_mode mode) | 481 | static int mscan_do_set_mode(struct net_device *dev, enum can_mode mode) |
480 | { | 482 | { |
481 | |||
482 | struct mscan_priv *priv = netdev_priv(dev); | 483 | struct mscan_priv *priv = netdev_priv(dev); |
483 | int ret = 0; | 484 | int ret = 0; |
484 | 485 | ||