提交 5aa3e249 编写于 作者: D David S. Miller

Merge tag 'linux-can-fixes-for-4.7-20160623' of...

Merge tag 'linux-can-fixes-for-4.7-20160623' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can

Marc Kleine-Budde says:

====================
pull-request: can 2016-06-23

this is a pull request of 3 patches for the upcoming linux-4.7 release.

The first two patches are by Oliver Hartkopp fixing oopes in the generic CAN
device netlink handling. Jimmy Assarsson's patch for the kvaser_usb driver adds
support for more devices by adding their USB product ids.
====================
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
...@@ -798,6 +798,9 @@ static int can_validate(struct nlattr *tb[], struct nlattr *data[]) ...@@ -798,6 +798,9 @@ static int can_validate(struct nlattr *tb[], struct nlattr *data[])
* - control mode with CAN_CTRLMODE_FD set * - control mode with CAN_CTRLMODE_FD set
*/ */
if (!data)
return 0;
if (data[IFLA_CAN_CTRLMODE]) { if (data[IFLA_CAN_CTRLMODE]) {
struct can_ctrlmode *cm = nla_data(data[IFLA_CAN_CTRLMODE]); struct can_ctrlmode *cm = nla_data(data[IFLA_CAN_CTRLMODE]);
...@@ -1008,6 +1011,11 @@ static int can_newlink(struct net *src_net, struct net_device *dev, ...@@ -1008,6 +1011,11 @@ static int can_newlink(struct net *src_net, struct net_device *dev,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
static void can_dellink(struct net_device *dev, struct list_head *head)
{
return;
}
static struct rtnl_link_ops can_link_ops __read_mostly = { static struct rtnl_link_ops can_link_ops __read_mostly = {
.kind = "can", .kind = "can",
.maxtype = IFLA_CAN_MAX, .maxtype = IFLA_CAN_MAX,
...@@ -1016,6 +1024,7 @@ static struct rtnl_link_ops can_link_ops __read_mostly = { ...@@ -1016,6 +1024,7 @@ static struct rtnl_link_ops can_link_ops __read_mostly = {
.validate = can_validate, .validate = can_validate,
.newlink = can_newlink, .newlink = can_newlink,
.changelink = can_changelink, .changelink = can_changelink,
.dellink = can_dellink,
.get_size = can_get_size, .get_size = can_get_size,
.fill_info = can_fill_info, .fill_info = can_fill_info,
.get_xstats_size = can_get_xstats_size, .get_xstats_size = can_get_xstats_size,
......
...@@ -47,6 +47,8 @@ config CAN_KVASER_USB ...@@ -47,6 +47,8 @@ config CAN_KVASER_USB
- Kvaser USBcan R - Kvaser USBcan R
- Kvaser Leaf Light v2 - Kvaser Leaf Light v2
- Kvaser Mini PCI Express HS - Kvaser Mini PCI Express HS
- Kvaser Mini PCI Express 2xHS
- Kvaser USBcan Light 2xHS
- Kvaser USBcan II HS/HS - Kvaser USBcan II HS/HS
- Kvaser USBcan II HS/LS - Kvaser USBcan II HS/LS
- Kvaser USBcan Rugged ("USBcan Rev B") - Kvaser USBcan Rugged ("USBcan Rev B")
......
...@@ -59,11 +59,14 @@ ...@@ -59,11 +59,14 @@
#define USB_CAN_R_PRODUCT_ID 39 #define USB_CAN_R_PRODUCT_ID 39
#define USB_LEAF_LITE_V2_PRODUCT_ID 288 #define USB_LEAF_LITE_V2_PRODUCT_ID 288
#define USB_MINI_PCIE_HS_PRODUCT_ID 289 #define USB_MINI_PCIE_HS_PRODUCT_ID 289
#define USB_LEAF_LIGHT_HS_V2_OEM_PRODUCT_ID 290
#define USB_USBCAN_LIGHT_2HS_PRODUCT_ID 291
#define USB_MINI_PCIE_2HS_PRODUCT_ID 292
static inline bool kvaser_is_leaf(const struct usb_device_id *id) static inline bool kvaser_is_leaf(const struct usb_device_id *id)
{ {
return id->idProduct >= USB_LEAF_DEVEL_PRODUCT_ID && return id->idProduct >= USB_LEAF_DEVEL_PRODUCT_ID &&
id->idProduct <= USB_MINI_PCIE_HS_PRODUCT_ID; id->idProduct <= USB_MINI_PCIE_2HS_PRODUCT_ID;
} }
/* Kvaser USBCan-II devices */ /* Kvaser USBCan-II devices */
...@@ -537,6 +540,9 @@ static const struct usb_device_id kvaser_usb_table[] = { ...@@ -537,6 +540,9 @@ static const struct usb_device_id kvaser_usb_table[] = {
.driver_info = KVASER_HAS_TXRX_ERRORS }, .driver_info = KVASER_HAS_TXRX_ERRORS },
{ USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_V2_PRODUCT_ID) }, { USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LITE_V2_PRODUCT_ID) },
{ USB_DEVICE(KVASER_VENDOR_ID, USB_MINI_PCIE_HS_PRODUCT_ID) }, { USB_DEVICE(KVASER_VENDOR_ID, USB_MINI_PCIE_HS_PRODUCT_ID) },
{ USB_DEVICE(KVASER_VENDOR_ID, USB_LEAF_LIGHT_HS_V2_OEM_PRODUCT_ID) },
{ USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN_LIGHT_2HS_PRODUCT_ID) },
{ USB_DEVICE(KVASER_VENDOR_ID, USB_MINI_PCIE_2HS_PRODUCT_ID) },
/* USBCANII family IDs */ /* USBCANII family IDs */
{ USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN2_PRODUCT_ID), { USB_DEVICE(KVASER_VENDOR_ID, USB_USBCAN2_PRODUCT_ID),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册