Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 351684
b: refs/heads/master
c: bf03a53
h: refs/heads/master
v: v3
  • Loading branch information
Kurt Van Dijck authored and Marc Kleine-Budde committed Jan 26, 2013
1 parent 8e6b3cd commit 36c7751
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 996a953de02ffb852c9ac736f4e892008ed68884
refs/heads/master: bf03a5379cd3492fbeca42111340581ba9dee0b8
13 changes: 13 additions & 0 deletions trunk/drivers/net/can/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,19 @@ void unregister_candev(struct net_device *dev)
}
EXPORT_SYMBOL_GPL(unregister_candev);

/*
* Test if a network device is a candev based device
* and return the can_priv* if so.
*/
struct can_priv *safe_candev_priv(struct net_device *dev)
{
if ((dev->type != ARPHRD_CAN) || (dev->rtnl_link_ops != &can_link_ops))
return NULL;

return netdev_priv(dev);
}
EXPORT_SYMBOL_GPL(safe_candev_priv);

static __init int can_dev_init(void)
{
int err;
Expand Down
3 changes: 3 additions & 0 deletions trunk/include/linux/can/dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ u8 can_len2dlc(u8 len);
struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max);
void free_candev(struct net_device *dev);

/* a candev safe wrapper around netdev_priv */
struct can_priv *safe_candev_priv(struct net_device *dev);

int open_candev(struct net_device *dev);
void close_candev(struct net_device *dev);

Expand Down

0 comments on commit 36c7751

Please sign in to comment.