All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephane Grosjean <s.grosjean@peak-system.com>
To: linux-can@vger.kernel.org
Cc: Oliver Hartkopp <socketcan@hartkopp.net>,
	Stephane Grosjean <s.grosjean@peak-system.com>
Subject: [PATCH] can/peak_usb: add adapter BEC callback definition
Date: Mon, 19 Jan 2015 17:15:27 +0100	[thread overview]
Message-ID: <1421684127-12764-3-git-send-email-s.grosjean@peak-system.com> (raw)
In-Reply-To: <1421684127-12764-1-git-send-email-s.grosjean@peak-system.com>

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 <s.grosjean@peak-system.com>
---
 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,
+				       struct can_berr_counter *bec);
 	u8 ep_msg_in;
 	u8 ep_msg_out[PCAN_USB_MAX_CHANNEL];
 	u8 ts_used_bits;
-- 
1.9.1


  parent reply	other threads:[~2015-01-19 16:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-19 16:15 [PATCH] can/peak_usb: upgrade core to new CANFD extension Stephane Grosjean
2015-01-19 16:15 ` [PATCH] can/peak_usb: export ctrlmode_supported to adapter specific Stephane Grosjean
2015-01-20 14:18   ` Marc Kleine-Budde
2015-01-19 16:15 ` Stephane Grosjean [this message]
2015-01-20 14:19   ` [PATCH] can/peak_usb: add adapter BEC callback definition Marc Kleine-Budde
2015-01-20 14:46     ` Stephane Grosjean
2015-01-20 14:50       ` Marc Kleine-Budde
2015-01-20 14:17 ` [PATCH] can/peak_usb: upgrade core to new CANFD extension Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1421684127-12764-3-git-send-email-s.grosjean@peak-system.com \
    --to=s.grosjean@peak-system.com \
    --cc=linux-can@vger.kernel.org \
    --cc=socketcan@hartkopp.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.