On 01/20/2015 03:46 PM, Stephane Grosjean wrote: > > Le 20/01/2015 15:19, Marc Kleine-Budde a écrit : >> On 01/19/2015 05:15 PM, Stephane Grosjean wrote: >>> Add the definition of a new callback that enable any PEAK-System CAN USB >>> adapter to grant read access to its Bus Error Counters value. >>> This ability is not supported by all the PEAK-System adapters, thus, >>> for those, the callback pointer will be initiaized to NULL, which is >>> correct regarding the linux-can device driver specs. >>> >>> Signed-off-by: Stephane Grosjean >>> --- >>> drivers/net/can/usb/peak_usb/pcan_usb_core.c | 2 ++ >>> drivers/net/can/usb/peak_usb/pcan_usb_core.h | 2 ++ >>> 2 files changed, 4 insertions(+) >>> >>> diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c >>> index c23609a..7a73060 100644 >>> --- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c >>> +++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c >>> @@ -794,6 +794,8 @@ static int peak_usb_create_dev(struct peak_usb_adapter *peak_usb_adapter, >>> dev->can.data_bittiming_const = &peak_usb_adapter->data_bittiming_const; >>> dev->can.do_set_data_bittiming = peak_usb_set_data_bittiming; >>> dev->can.do_set_mode = peak_usb_set_mode; >>> + dev->can.do_get_berr_counter = >>> + peak_usb_adapter->candev_get_berr_counter; >>> dev->can.ctrlmode_supported = peak_usb_adapter->ctrlmode_supported; >>> >>> netdev->netdev_ops = &peak_usb_netdev_ops; >>> diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.h b/drivers/net/can/usb/peak_usb/pcan_usb_core.h >>> index a58d971..fb402d2 100644 >>> --- a/drivers/net/can/usb/peak_usb/pcan_usb_core.h >>> +++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.h >>> @@ -70,6 +70,8 @@ struct peak_usb_adapter { >>> int (*dev_stop)(struct peak_usb_device *dev); >>> int (*dev_restart_async)(struct peak_usb_device *dev, struct urb *urb, >>> u8 *buf); >>> + int (*candev_get_berr_counter)(const struct net_device *netdev, >> ^^^^^^ >> >> I think this prefix can be removed. I've done so in my series. > > FYI: I added this specific prefix because this is the only callback I'm > obliged to use with the "struct net_device *" argument. > No other way to setup a specific callback to get the BEC. IC, however the compiler will warn you, if you use the wrong arguments. Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |