diff options
Diffstat (limited to 'drivers/net/can/mcp251x.c')
| -rw-r--r-- | drivers/net/can/mcp251x.c | 16 | 
1 files changed, 15 insertions, 1 deletions
| diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c index f8cc168ec76c..8431eb08075d 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 | ||
| @@ -922,12 +922,16 @@ static int __devinit mcp251x_can_probe(struct spi_device *spi) | |||
| 922 | struct net_device *net; | 922 | struct net_device *net; | 
| 923 | struct mcp251x_priv *priv; | 923 | struct mcp251x_priv *priv; | 
| 924 | struct mcp251x_platform_data *pdata = spi->dev.platform_data; | 924 | struct mcp251x_platform_data *pdata = spi->dev.platform_data; | 
| 925 | int model = spi_get_device_id(spi)->driver_data; | ||
| 925 | int ret = -ENODEV; | 926 | int ret = -ENODEV; | 
| 926 | 927 | ||
| 927 | if (!pdata) | 928 | if (!pdata) | 
| 928 | /* Platform data is required for osc freq */ | 929 | /* Platform data is required for osc freq */ | 
| 929 | goto error_out; | 930 | goto error_out; | 
| 930 | 931 | ||
| 932 | if (model) | ||
| 933 | pdata->model = model; | ||
| 934 | |||
| 931 | /* Allocate can/net device */ | 935 | /* Allocate can/net device */ | 
| 932 | net = alloc_candev(sizeof(struct mcp251x_priv), TX_ECHO_SKB_MAX); | 936 | net = alloc_candev(sizeof(struct mcp251x_priv), TX_ECHO_SKB_MAX); | 
| 933 | if (!net) { | 937 | if (!net) { | 
| @@ -1117,6 +1121,15 @@ static int mcp251x_can_resume(struct spi_device *spi) | |||
| 1117 | #define mcp251x_can_resume NULL | 1121 | #define mcp251x_can_resume NULL | 
| 1118 | #endif | 1122 | #endif | 
| 1119 | 1123 | ||
| 1124 | static struct spi_device_id mcp251x_id_table[] = { | ||
| 1125 | { "mcp251x", 0 /* Use pdata.model */ }, | ||
| 1126 | { "mcp2510", CAN_MCP251X_MCP2510 }, | ||
| 1127 | { "mcp2515", CAN_MCP251X_MCP2515 }, | ||
| 1128 | { }, | ||
| 1129 | }; | ||
| 1130 | |||
| 1131 | MODULE_DEVICE_TABLE(spi, mcp251x_id_table); | ||
| 1132 | |||
| 1120 | static struct spi_driver mcp251x_can_driver = { | 1133 | static struct spi_driver mcp251x_can_driver = { | 
| 1121 | .driver = { | 1134 | .driver = { | 
| 1122 | .name = DEVICE_NAME, | 1135 | .name = DEVICE_NAME, | 
| @@ -1124,6 +1137,7 @@ static struct spi_driver mcp251x_can_driver = { | |||
| 1124 | .owner = THIS_MODULE, | 1137 | .owner = THIS_MODULE, | 
| 1125 | }, | 1138 | }, | 
| 1126 | 1139 | ||
| 1140 | .id_table = mcp251x_id_table, | ||
| 1127 | .probe = mcp251x_can_probe, | 1141 | .probe = mcp251x_can_probe, | 
| 1128 | .remove = __devexit_p(mcp251x_can_remove), | 1142 | .remove = __devexit_p(mcp251x_can_remove), | 
| 1129 | .suspend = mcp251x_can_suspend, | 1143 | .suspend = mcp251x_can_suspend, | 
