linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Stephane Grosjean <s.grosjean@peak-system.com>,
	linux-can@vger.kernel.org
Cc: Oliver Hartkopp <socketcan@hartkopp.net>
Subject: Re: [PATCH] can/peak_usb: add adapter BEC callback definition
Date: Tue, 20 Jan 2015 15:50:15 +0100	[thread overview]
Message-ID: <54BE6B27.8030007@pengutronix.de> (raw)
In-Reply-To: <54BE6A3F.40405@peak-system.com>

[-- Attachment #1: Type: text/plain, Size: 2725 bytes --]

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 <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,
>>                ^^^^^^
>>
>> 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   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-01-20 14:50 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 ` [PATCH] can/peak_usb: add adapter BEC callback definition Stephane Grosjean
2015-01-20 14:19   ` Marc Kleine-Budde
2015-01-20 14:46     ` Stephane Grosjean
2015-01-20 14:50       ` Marc Kleine-Budde [this message]
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=54BE6B27.8030007@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=s.grosjean@peak-system.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).