Skip to content

Commit

Permalink
Merge branch 'master' of git://gitorious.org/linux-can/linux-can
Browse files Browse the repository at this point in the history
  • Loading branch information
David S. Miller committed Jun 4, 2012
2 parents bec4596 + dc605db commit 3ab2cdd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
16 changes: 9 additions & 7 deletions drivers/net/can/c_can/c_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ static int c_can_get_berr_counter(const struct net_device *dev,
*
* We iterate from priv->tx_echo to priv->tx_next and check if the
* packet has been transmitted, echo it back to the CAN framework.
* If we discover a not yet transmitted package, stop looking for more.
* If we discover a not yet transmitted packet, stop looking for more.
*/
static void c_can_do_tx(struct net_device *dev)
{
Expand All @@ -698,14 +698,16 @@ static void c_can_do_tx(struct net_device *dev)
for (/* nix */; (priv->tx_next - priv->tx_echo) > 0; priv->tx_echo++) {
msg_obj_no = get_tx_echo_msg_obj(priv);
val = c_can_read_reg32(priv, &priv->regs->txrqst1);
if (!(val & (1 << msg_obj_no))) {
if (!(val & (1 << (msg_obj_no - 1)))) {
can_get_echo_skb(dev,
msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST);
stats->tx_bytes += priv->read_reg(priv,
&priv->regs->ifregs[0].msg_cntrl)
& IF_MCONT_DLC_MASK;
stats->tx_packets++;
c_can_inval_msg_object(dev, 0, msg_obj_no);
} else {
break;
}
}

Expand Down Expand Up @@ -950,7 +952,7 @@ static int c_can_poll(struct napi_struct *napi, int quota)
struct net_device *dev = napi->dev;
struct c_can_priv *priv = netdev_priv(dev);

irqstatus = priv->read_reg(priv, &priv->regs->interrupt);
irqstatus = priv->irqstatus;
if (!irqstatus)
goto end;

Expand Down Expand Up @@ -1028,12 +1030,11 @@ static int c_can_poll(struct napi_struct *napi, int quota)

static irqreturn_t c_can_isr(int irq, void *dev_id)
{
u16 irqstatus;
struct net_device *dev = (struct net_device *)dev_id;
struct c_can_priv *priv = netdev_priv(dev);

irqstatus = priv->read_reg(priv, &priv->regs->interrupt);
if (!irqstatus)
priv->irqstatus = priv->read_reg(priv, &priv->regs->interrupt);
if (!priv->irqstatus)
return IRQ_NONE;

/* disable all interrupts and schedule the NAPI */
Expand Down Expand Up @@ -1063,10 +1064,11 @@ static int c_can_open(struct net_device *dev)
goto exit_irq_fail;
}

napi_enable(&priv->napi);

/* start the c_can controller */
c_can_start(dev);

napi_enable(&priv->napi);
netif_start_queue(dev);

return 0;
Expand Down
1 change: 1 addition & 0 deletions drivers/net/can/c_can/c_can.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ struct c_can_priv {
unsigned int tx_next;
unsigned int tx_echo;
void *priv; /* for board-specific data */
u16 irqstatus;
};

struct net_device *alloc_c_can_dev(void);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/can/cc770/cc770_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static int __devinit cc770_get_platform_data(struct platform_device *pdev,
struct cc770_platform_data *pdata = pdev->dev.platform_data;

priv->can.clock.freq = pdata->osc_freq;
if (priv->cpu_interface | CPUIF_DSC)
if (priv->cpu_interface & CPUIF_DSC)
priv->can.clock.freq /= 2;
priv->clkout = pdata->cor;
priv->bus_config = pdata->bcr;
Expand Down

0 comments on commit 3ab2cdd

Please sign in to comment.