Skip to content

Commit

Permalink
Merge tag 'linux-can-next-for-4.4-20151013' of git://git.kernel.org/p…
Browse files Browse the repository at this point in the history
…ub/scm/linux/kernel/git/mkl/linux-can-next

Marc Kleine-Budde says:

====================
pull-request: can-next 2015-09-17

this is a pull request of 4 patches for net-next/master.

Two patches are by Gerhard Bertelsmann, fixing some problems in the
sun4i driver. The patch by Arnd Bergmann stops using timeval for the
CAN broadcast manager. The last patch by Alexandre Belloni removes the
otherwise unused struct at91_can_data from the driver.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Oct 15, 2015
2 parents 4568637 + 42160a0 commit c350335
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 34 deletions.
21 changes: 0 additions & 21 deletions drivers/net/can/at91_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@
* Public License ("GPL") version 2 as distributed in the 'COPYING'
* file from the main directory of the linux kernel source.
*
*
* Your platform definition file should specify something like:
*
* static struct at91_can_data ek_can_data = {
* transceiver_switch = sam9263ek_transceiver_switch,
* };
*
* at91_add_device_can(&ek_can_data);
*
*/

#include <linux/clk.h>
Expand All @@ -33,7 +24,6 @@
#include <linux/spinlock.h>
#include <linux/string.h>
#include <linux/types.h>
#include <linux/platform_data/atmel.h>

#include <linux/can/dev.h>
#include <linux/can/error.h>
Expand Down Expand Up @@ -324,15 +314,6 @@ static inline u32 at91_can_id_to_reg_mid(canid_t can_id)
return reg_mid;
}

/*
* Swtich transceiver on or off
*/
static void at91_transceiver_switch(const struct at91_priv *priv, int on)
{
if (priv->pdata && priv->pdata->transceiver_switch)
priv->pdata->transceiver_switch(on);
}

static void at91_setup_mailboxes(struct net_device *dev)
{
struct at91_priv *priv = netdev_priv(dev);
Expand Down Expand Up @@ -416,7 +397,6 @@ static void at91_chip_start(struct net_device *dev)

at91_set_bittiming(dev);
at91_setup_mailboxes(dev);
at91_transceiver_switch(priv, 1);

/* enable chip */
if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)
Expand Down Expand Up @@ -444,7 +424,6 @@ static void at91_chip_stop(struct net_device *dev, enum can_state state)
reg_mr = at91_read(priv, AT91_MR);
at91_write(priv, AT91_MR, reg_mr & ~AT91_MR_CANEN);

at91_transceiver_switch(priv, 0);
priv->can.state = state;
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/net/can/sun4i_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status)
stats->tx_errors++;
if (likely(skb)) {
cf->can_id |= CAN_ERR_LOSTARB;
cf->data[0] = (alc & 0x1f) >> 8;
cf->data[0] = (alc >> 8) & 0x1f;
}
}

Expand Down Expand Up @@ -854,4 +854,4 @@ module_platform_driver(sun4i_can_driver);
MODULE_AUTHOR("Peter Chen <xingkongcp@gmail.com>");
MODULE_AUTHOR("Gerhard Bertelsmann <info@gerhard-bertelsmann.de>");
MODULE_LICENSE("Dual BSD/GPL");
MODULE_DESCRIPTION(DRV_NAME "CAN driver for Allwinner SoCs (A10/A20)");
MODULE_DESCRIPTION("CAN driver for Allwinner SoCs (A10/A20)");
5 changes: 0 additions & 5 deletions include/linux/platform_data/atmel.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ struct atmel_uart_data {
struct serial_rs485 rs485; /* rs485 settings */
};

/* CAN */
struct at91_can_data {
void (*transceiver_switch)(int on);
};

/* FIXME: this needs a better location, but gets stuff building again */
extern int at91_suspend_entering_slow_clock(void);

Expand Down
7 changes: 6 additions & 1 deletion include/uapi/linux/can/bcm.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
#include <linux/types.h>
#include <linux/can.h>

struct bcm_timeval {
long tv_sec;
long tv_usec;
};

/**
* struct bcm_msg_head - head of messages to/from the broadcast manager
* @opcode: opcode, see enum below.
Expand All @@ -62,7 +67,7 @@ struct bcm_msg_head {
__u32 opcode;
__u32 flags;
__u32 count;
struct timeval ival1, ival2;
struct bcm_timeval ival1, ival2;
canid_t can_id;
__u32 nframes;
struct can_frame frames[0];
Expand Down
15 changes: 10 additions & 5 deletions net/can/bcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ struct bcm_op {
canid_t can_id;
u32 flags;
unsigned long frames_abs, frames_filtered;
struct timeval ival1, ival2;
struct bcm_timeval ival1, ival2;
struct hrtimer timer, thrtimer;
struct tasklet_struct tsklet, thrtsklet;
ktime_t rx_stamp, kt_ival1, kt_ival2, kt_lastmsg;
Expand Down Expand Up @@ -131,6 +131,11 @@ static inline struct bcm_sock *bcm_sk(const struct sock *sk)
return (struct bcm_sock *)sk;
}

static inline ktime_t bcm_timeval_to_ktime(struct bcm_timeval tv)
{
return ktime_set(tv.tv_sec, tv.tv_usec * NSEC_PER_USEC);
}

#define CFSIZ sizeof(struct can_frame)
#define OPSIZ sizeof(struct bcm_op)
#define MHSIZ sizeof(struct bcm_msg_head)
Expand Down Expand Up @@ -953,8 +958,8 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
op->count = msg_head->count;
op->ival1 = msg_head->ival1;
op->ival2 = msg_head->ival2;
op->kt_ival1 = timeval_to_ktime(msg_head->ival1);
op->kt_ival2 = timeval_to_ktime(msg_head->ival2);
op->kt_ival1 = bcm_timeval_to_ktime(msg_head->ival1);
op->kt_ival2 = bcm_timeval_to_ktime(msg_head->ival2);

/* disable an active timer due to zero values? */
if (!op->kt_ival1.tv64 && !op->kt_ival2.tv64)
Expand Down Expand Up @@ -1134,8 +1139,8 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
/* set timer value */
op->ival1 = msg_head->ival1;
op->ival2 = msg_head->ival2;
op->kt_ival1 = timeval_to_ktime(msg_head->ival1);
op->kt_ival2 = timeval_to_ktime(msg_head->ival2);
op->kt_ival1 = bcm_timeval_to_ktime(msg_head->ival1);
op->kt_ival2 = bcm_timeval_to_ktime(msg_head->ival2);

/* disable an active timer due to zero value? */
if (!op->kt_ival1.tv64)
Expand Down

0 comments on commit c350335

Please sign in to comment.