提交 0285e7ce 编写于 作者: W Wolfram Sang 提交者: David S. Miller

net/can/mscan: trivial fixes

- remove whitespaces
- use ! and ?: when apropriate
- make braces consistent
Signed-off-by: NWolfram Sang <w.sang@pengutronix.de>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 622ed7e9
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include "mscan.h" #include "mscan.h"
#define DRV_NAME "mpc5xxx_can" #define DRV_NAME "mpc5xxx_can"
static struct of_device_id mpc52xx_cdm_ids[] __devinitdata = { 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,15 +70,10 @@ static unsigned int __devinit mpc52xx_can_xtal_freq(struct of_device *of)
if (in_8(&cdm->ipb_clk_sel) & 0x1) if (in_8(&cdm->ipb_clk_sel) & 0x1)
freq *= 2; freq *= 2;
val = in_be32(&cdm->rstcfg); val = in_be32(&cdm->rstcfg);
if (val & (1 << 5))
freq *= 8; freq *= (val & (1 << 5)) ? 8 : 4;
else freq /= (val & (1 << 6)) ? 12 : 16;
freq *= 4;
if (val & (1 << 6))
freq /= 12;
else
freq /= 16;
iounmap(cdm); iounmap(cdm);
...@@ -222,7 +216,7 @@ static int mpc5xxx_can_resume(struct of_device *ofdev) ...@@ -222,7 +216,7 @@ static int mpc5xxx_can_resume(struct of_device *ofdev)
struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base; struct mscan_regs *regs = (struct mscan_regs *)priv->reg_base;
regs->canctl0 |= MSCAN_INITRQ; regs->canctl0 |= MSCAN_INITRQ;
while ((regs->canctl1 & MSCAN_INITAK) == 0) while (!(regs->canctl1 & MSCAN_INITAK))
udelay(10); udelay(10);
regs->canctl1 = saved_regs.canctl1; regs->canctl1 = saved_regs.canctl1;
......
...@@ -69,7 +69,6 @@ static int mscan_set_mode(struct net_device *dev, u8 mode) ...@@ -69,7 +69,6 @@ static int mscan_set_mode(struct net_device *dev, u8 mode)
u8 canctl1; u8 canctl1;
if (mode != MSCAN_NORMAL_MODE) { if (mode != MSCAN_NORMAL_MODE) {
if (priv->tx_active) { if (priv->tx_active) {
/* Abort transfers before going to sleep */# /* Abort transfers before going to sleep */#
out_8(&regs->cantarq, priv->tx_active); out_8(&regs->cantarq, priv->tx_active);
...@@ -78,7 +77,7 @@ static int mscan_set_mode(struct net_device *dev, u8 mode) ...@@ -78,7 +77,7 @@ static int mscan_set_mode(struct net_device *dev, u8 mode)
} }
canctl1 = in_8(&regs->canctl1); canctl1 = in_8(&regs->canctl1);
if ((mode & MSCAN_SLPRQ) && (canctl1 & MSCAN_SLPAK) == 0) { if ((mode & MSCAN_SLPRQ) && !(canctl1 & MSCAN_SLPAK)) {
out_8(&regs->canctl0, out_8(&regs->canctl0,
in_8(&regs->canctl0) | MSCAN_SLPRQ); in_8(&regs->canctl0) | MSCAN_SLPRQ);
for (i = 0; i < MSCAN_SET_MODE_RETRIES; i++) { 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,7 +104,7 @@ static int mscan_set_mode(struct net_device *dev, u8 mode)
priv->can.state = CAN_STATE_SLEEPING; priv->can.state = CAN_STATE_SLEEPING;
} }
if ((mode & MSCAN_INITRQ) && (canctl1 & MSCAN_INITAK) == 0) { if ((mode & MSCAN_INITRQ) && !(canctl1 & MSCAN_INITAK)) {
out_8(&regs->canctl0, out_8(&regs->canctl0,
in_8(&regs->canctl0) | MSCAN_INITRQ); in_8(&regs->canctl0) | MSCAN_INITRQ);
for (i = 0; i < MSCAN_SET_MODE_RETRIES; i++) { 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,7 +232,8 @@ static netdev_tx_t mscan_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (!rtr) { if (!rtr) {
void __iomem *data = &regs->tx.dsr1_0; void __iomem *data = &regs->tx.dsr1_0;
u16 *payload = (u16 *) frame->data; u16 *payload = (u16 *)frame->data;
/* It is safe to write into dsr[dlc+1] */ /* It is safe to write into dsr[dlc+1] */
for (i = 0; i < (frame->can_dlc + 1) / 2; i++) { for (i = 0; i < (frame->can_dlc + 1) / 2; i++) {
out_be16(data, *payload++); out_be16(data, *payload++);
...@@ -300,7 +300,8 @@ static void mscan_get_rx_frame(struct net_device *dev, struct can_frame *frame) ...@@ -300,7 +300,8 @@ static void mscan_get_rx_frame(struct net_device *dev, struct can_frame *frame)
if (!(frame->can_id & CAN_RTR_FLAG)) { if (!(frame->can_id & CAN_RTR_FLAG)) {
void __iomem *data = &regs->rx.dsr1_0; void __iomem *data = &regs->rx.dsr1_0;
u16 *payload = (u16 *) frame->data; u16 *payload = (u16 *)frame->data;
for (i = 0; i < (frame->can_dlc + 1) / 2; i++) { for (i = 0; i < (frame->can_dlc + 1) / 2; i++) {
*payload++ = in_be16(data); *payload++ = in_be16(data);
data += 2 + _MSCAN_RESERVED_DSR_SIZE; 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,8 +327,9 @@ static void mscan_get_err_frame(struct net_device *dev, struct can_frame *frame,
frame->data[1] = CAN_ERR_CRTL_RX_OVERFLOW; frame->data[1] = CAN_ERR_CRTL_RX_OVERFLOW;
stats->rx_over_errors++; stats->rx_over_errors++;
stats->rx_errors++; stats->rx_errors++;
} else } else {
frame->data[1] = 0; frame->data[1] = 0;
}
old_state = check_set_state(dev, canrflg); old_state = check_set_state(dev, canrflg);
/* State changed */ /* State changed */
...@@ -339,7 +341,6 @@ static void mscan_get_err_frame(struct net_device *dev, struct can_frame *frame, ...@@ -339,7 +341,6 @@ static void mscan_get_err_frame(struct net_device *dev, struct can_frame *frame,
if ((priv->shadow_statflg & MSCAN_RSTAT_MSK) < if ((priv->shadow_statflg & MSCAN_RSTAT_MSK) <
(canrflg & MSCAN_RSTAT_MSK)) (canrflg & MSCAN_RSTAT_MSK))
frame->data[1] |= CAN_ERR_CRTL_RX_WARNING; frame->data[1] |= CAN_ERR_CRTL_RX_WARNING;
if ((priv->shadow_statflg & MSCAN_TSTAT_MSK) < if ((priv->shadow_statflg & MSCAN_TSTAT_MSK) <
(canrflg & MSCAN_TSTAT_MSK)) (canrflg & MSCAN_TSTAT_MSK))
frame->data[1] |= CAN_ERR_CRTL_TX_WARNING; frame->data[1] |= CAN_ERR_CRTL_TX_WARNING;
...@@ -397,7 +398,7 @@ static int mscan_rx_poll(struct napi_struct *napi, int quota) ...@@ -397,7 +398,7 @@ static int mscan_rx_poll(struct napi_struct *napi, int quota)
if (canrflg & MSCAN_RXF) if (canrflg & MSCAN_RXF)
mscan_get_rx_frame(dev, frame); mscan_get_rx_frame(dev, frame);
else if (canrflg & MSCAN_ERR_IF) else if (canrflg & MSCAN_ERR_IF)
mscan_get_err_frame(dev, frame, canrflg); mscan_get_err_frame(dev, frame, canrflg);
stats->rx_packets++; stats->rx_packets++;
...@@ -429,7 +430,6 @@ static irqreturn_t mscan_isr(int irq, void *dev_id) ...@@ -429,7 +430,6 @@ static irqreturn_t mscan_isr(int irq, void *dev_id)
cantflg = in_8(&regs->cantflg) & cantier; cantflg = in_8(&regs->cantflg) & cantier;
if (cantier && cantflg) { if (cantier && cantflg) {
struct list_head *tmp, *pos; struct list_head *tmp, *pos;
list_for_each_safe(pos, tmp, &priv->tx_head) { list_for_each_safe(pos, tmp, &priv->tx_head) {
...@@ -452,8 +452,9 @@ static irqreturn_t mscan_isr(int irq, void *dev_id) ...@@ -452,8 +452,9 @@ static irqreturn_t mscan_isr(int irq, void *dev_id)
clear_bit(F_TX_WAIT_ALL, &priv->flags); clear_bit(F_TX_WAIT_ALL, &priv->flags);
clear_bit(F_TX_PROGRESS, &priv->flags); clear_bit(F_TX_PROGRESS, &priv->flags);
priv->cur_pri = 0; priv->cur_pri = 0;
} else } else {
dev->trans_start = jiffies; dev->trans_start = jiffies;
}
if (!test_bit(F_TX_WAIT_ALL, &priv->flags)) if (!test_bit(F_TX_WAIT_ALL, &priv->flags))
netif_wake_queue(dev); netif_wake_queue(dev);
...@@ -470,15 +471,15 @@ static irqreturn_t mscan_isr(int irq, void *dev_id) ...@@ -470,15 +471,15 @@ static irqreturn_t mscan_isr(int irq, void *dev_id)
out_8(&regs->canrier, 0); out_8(&regs->canrier, 0);
napi_schedule(&priv->napi); napi_schedule(&priv->napi);
ret = IRQ_HANDLED; ret = IRQ_HANDLED;
} else } else {
clear_bit(F_RX_PROGRESS, &priv->flags); clear_bit(F_RX_PROGRESS, &priv->flags);
}
} }
return ret; return ret;
} }
static int mscan_do_set_mode(struct net_device *dev, enum can_mode mode) static int mscan_do_set_mode(struct net_device *dev, enum can_mode mode)
{ {
struct mscan_priv *priv = netdev_priv(dev); struct mscan_priv *priv = netdev_priv(dev);
int ret = 0; int ret = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册