aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/can/mcp251x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/can/mcp251x.c')
-rw-r--r--drivers/net/can/mcp251x.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index f8cc168ec76c..b11a0cb5ed81 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -58,7 +58,6 @@
58 * 58 *
59 */ 59 */
60 60
61#include <linux/can.h>
62#include <linux/can/core.h> 61#include <linux/can/core.h>
63#include <linux/can/dev.h> 62#include <linux/can/dev.h>
64#include <linux/can/platform/mcp251x.h> 63#include <linux/can/platform/mcp251x.h>
@@ -73,6 +72,7 @@
73#include <linux/module.h> 72#include <linux/module.h>
74#include <linux/netdevice.h> 73#include <linux/netdevice.h>
75#include <linux/platform_device.h> 74#include <linux/platform_device.h>
75#include <linux/slab.h>
76#include <linux/spi/spi.h> 76#include <linux/spi/spi.h>
77#include <linux/uaccess.h> 77#include <linux/uaccess.h>
78 78
@@ -475,7 +475,6 @@ static netdev_tx_t mcp251x_hard_start_xmit(struct sk_buff *skb,
475 475
476 netif_stop_queue(net); 476 netif_stop_queue(net);
477 priv->tx_skb = skb; 477 priv->tx_skb = skb;
478 net->trans_start = jiffies;
479 queue_work(priv->wq, &priv->tx_work); 478 queue_work(priv->wq, &priv->tx_work);
480 479
481 return NETDEV_TX_OK; 480 return NETDEV_TX_OK;
@@ -922,12 +921,16 @@ static int __devinit mcp251x_can_probe(struct spi_device *spi)
922 struct net_device *net; 921 struct net_device *net;
923 struct mcp251x_priv *priv; 922 struct mcp251x_priv *priv;
924 struct mcp251x_platform_data *pdata = spi->dev.platform_data; 923 struct mcp251x_platform_data *pdata = spi->dev.platform_data;
924 int model = spi_get_device_id(spi)->driver_data;
925 int ret = -ENODEV; 925 int ret = -ENODEV;
926 926
927 if (!pdata) 927 if (!pdata)
928 /* Platform data is required for osc freq */ 928 /* Platform data is required for osc freq */
929 goto error_out; 929 goto error_out;
930 930
931 if (model)
932 pdata->model = model;
933
931 /* Allocate can/net device */ 934 /* Allocate can/net device */
932 net = alloc_candev(sizeof(struct mcp251x_priv), TX_ECHO_SKB_MAX); 935 net = alloc_candev(sizeof(struct mcp251x_priv), TX_ECHO_SKB_MAX);
933 if (!net) { 936 if (!net) {
@@ -1117,6 +1120,15 @@ static int mcp251x_can_resume(struct spi_device *spi)
1117#define mcp251x_can_resume NULL 1120#define mcp251x_can_resume NULL
1118#endif 1121#endif
1119 1122
1123static struct spi_device_id mcp251x_id_table[] = {
1124 { "mcp251x", 0 /* Use pdata.model */ },
1125 { "mcp2510", CAN_MCP251X_MCP2510 },
1126 { "mcp2515", CAN_MCP251X_MCP2515 },
1127 { },
1128};
1129
1130MODULE_DEVICE_TABLE(spi, mcp251x_id_table);
1131
1120static struct spi_driver mcp251x_can_driver = { 1132static struct spi_driver mcp251x_can_driver = {
1121 .driver = { 1133 .driver = {
1122 .name = DEVICE_NAME, 1134 .name = DEVICE_NAME,
@@ -1124,6 +1136,7 @@ static struct spi_driver mcp251x_can_driver = {
1124 .owner = THIS_MODULE, 1136 .owner = THIS_MODULE,
1125 }, 1137 },
1126 1138
1139 .id_table = mcp251x_id_table,
1127 .probe = mcp251x_can_probe, 1140 .probe = mcp251x_can_probe,
1128 .remove = __devexit_p(mcp251x_can_remove), 1141 .remove = __devexit_p(mcp251x_can_remove),
1129 .suspend = mcp251x_can_suspend, 1142 .suspend = mcp251x_can_suspend,