linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: "Andreas Gröger" <andreas24groeger@gmail.com>, linux-can@vger.kernel.org
Subject: Re: [PATCH] can: janz-ican3: error handling for CAL/CANopen firmware
Date: Sun, 8 May 2016 19:18:16 +0200	[thread overview]
Message-ID: <572F74D8.8080801@pengutronix.de> (raw)
In-Reply-To: <572C5015.70601@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1880 bytes --]

On 05/06/2016 10:04 AM, Andreas Gröger wrote:
> Hi,
> 
> my patch of May 2015 was missing the changed handling of error
> indications. With CAL/CANopen firmware the NMTS-SlaveEventIndication
> must be used instead of CAN-EventIndication. An appropriate slave node
> must be configured to report the errors.
> 
> In our department (about 15 development systems with Janz ICAN3-
> modules with firmware 1.48, my system also with firmware ICANOS 1.35)
> we use the driver with this patch for about one year: no known problems.
> 
> Signed-off-by: Andreas Gröger <andreas24groeger@gmail.com>

[...]

> +/* Handle NMTS Slave Event Indication Messages from the firmware */
> +static void ican3_handle_nmtsind(struct ican3_dev *mod, struct ican3_msg *msg)
> +{
> +	u16 subspec;
> +
> +	subspec = msg->data[0] + msg->data[1] * 0x100;
> +	if (subspec == NMTS_SLAVE_EVENT_IND) {
> +		switch (msg->data[2]) {
> +		case NE_LOCAL_OCCURRED:
> +		case NE_LOCAL_RESOLVED:
> +			/* now follows the same message as Raw ICANOS CEVTIND
> +			 * shift the data at the same place and call this method
> +			 */
> +			msg->len -= 3;

> drivers/net/can/janz-ican3.c:1214:34: warning: bad assignment (-=) to restricted __le16
> drivers/net/can/janz-ican3.c:1215:62: warning: incorrect type in argument 3 (different base types)
> drivers/net/can/janz-ican3.c:1215:62:    expected unsigned int [unsigned] [usertype] <noident>
> drivers/net/can/janz-ican3.c:1215:62:    got restricted __le16 [usertype] len

msg->len is marked as __le16, so you're not allowed to work on it directly.

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: 455 bytes --]

  reply	other threads:[~2016-05-08 17:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-06  8:04 [PATCH] can: janz-ican3: error handling for CAL/CANopen firmware Andreas Gröger
2016-05-08 17:18 ` Marc Kleine-Budde [this message]
2016-05-08 17:46   ` 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=572F74D8.8080801@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=andreas24groeger@gmail.com \
    --cc=linux-can@vger.kernel.org \
    /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).