diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2010-09-23 15:34:28 -0400 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2010-10-18 09:19:51 -0400 |
commit | beab675cb45f28a4a76780e43fd03e33bc773555 (patch) | |
tree | 14bba37566fd75bf4bd9a17e6cbbe76e59706603 /drivers/net/can | |
parent | f1f8c6cbe6f08f93ac2a4ca19625891d8a82b7f8 (diff) |
can: mcp251x: define helper functions mcp251x_is_2510, mcp251x_is_2515
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Diffstat (limited to 'drivers/net/can')
-rw-r--r-- | drivers/net/can/mcp251x.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c index 0386bed43551..7f8aa4ce02c5 100644 --- a/drivers/net/can/mcp251x.c +++ b/drivers/net/can/mcp251x.c | |||
@@ -258,6 +258,16 @@ struct mcp251x_priv { | |||
258 | int restart_tx; | 258 | int restart_tx; |
259 | }; | 259 | }; |
260 | 260 | ||
261 | #define MCP251X_IS(_model) \ | ||
262 | static inline int mcp251x_is_##_model(struct spi_device *spi) \ | ||
263 | { \ | ||
264 | struct mcp251x_priv *priv = dev_get_drvdata(&spi->dev); \ | ||
265 | return priv->model == CAN_MCP251X_MCP##_model; \ | ||
266 | } | ||
267 | |||
268 | MCP251X_IS(2510); | ||
269 | MCP251X_IS(2515); | ||
270 | |||
261 | static void mcp251x_clean(struct net_device *net) | 271 | static void mcp251x_clean(struct net_device *net) |
262 | { | 272 | { |
263 | struct mcp251x_priv *priv = netdev_priv(net); | 273 | struct mcp251x_priv *priv = netdev_priv(net); |
@@ -370,7 +380,7 @@ static void mcp251x_hw_tx_frame(struct spi_device *spi, u8 *buf, | |||
370 | { | 380 | { |
371 | struct mcp251x_priv *priv = dev_get_drvdata(&spi->dev); | 381 | struct mcp251x_priv *priv = dev_get_drvdata(&spi->dev); |
372 | 382 | ||
373 | if (priv->model == CAN_MCP251X_MCP2510) { | 383 | if (mcp251x_is_2510(spi)) { |
374 | int i; | 384 | int i; |
375 | 385 | ||
376 | for (i = 1; i < TXBDAT_OFF + len; i++) | 386 | for (i = 1; i < TXBDAT_OFF + len; i++) |
@@ -414,7 +424,7 @@ static void mcp251x_hw_rx_frame(struct spi_device *spi, u8 *buf, | |||
414 | { | 424 | { |
415 | struct mcp251x_priv *priv = dev_get_drvdata(&spi->dev); | 425 | struct mcp251x_priv *priv = dev_get_drvdata(&spi->dev); |
416 | 426 | ||
417 | if (priv->model == CAN_MCP251X_MCP2510) { | 427 | if (mcp251x_is_2510(spi)) { |
418 | int i, len; | 428 | int i, len; |
419 | 429 | ||
420 | for (i = 1; i < RXBDAT_OFF; i++) | 430 | for (i = 1; i < RXBDAT_OFF; i++) |