All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephane Grosjean <s.grosjean@peak-system.com>
To: Andri Yngvason <andri.yngvason@marel.com>, linux-can@vger.kernel.org
Cc: Oliver Hartkopp <socketcan@hartkopp.net>,
	Marc Kleine-Budde <mkl@pengutronix.de>
Subject: Re: [PATCH 7/7 v8] can/peak_usb: add support for PEAK new CANFD USB adapters
Date: Thu, 22 Jan 2015 17:07:52 +0100	[thread overview]
Message-ID: <54C12058.8060303@peak-system.com> (raw)
In-Reply-To: <20150122160238.12081.76464@shannon>


Le 22/01/2015 17:02, Andri Yngvason a écrit :
> Quoting Stephane Grosjean (2015-01-22 15:24:26)
> [...]
>> +/* handle uCAN status message */
>> +static int pcan_usb_fd_decode_status(struct pcan_usb_fd_if *usb_if,
>> +                                    struct pucan_msg *rx_msg)
>> +{
>> +       struct pucan_status_msg *sm = (struct pucan_status_msg *)rx_msg;
>> +       struct peak_usb_device *dev = usb_if->dev[pucan_stmsg_get_channel(sm)];
>> +       struct pcan_usb_fd_device *pdev =
>> +                       container_of(dev, struct pcan_usb_fd_device, dev);
>> +       enum can_state new_state = CAN_STATE_ERROR_ACTIVE;
>> +       enum can_state rx_state, tx_state;
>> +       struct net_device *netdev = dev->netdev;
>> +       struct can_frame *cf;
>> +       struct sk_buff *skb;
>> +
>> +       /* nothing should be sent while in BUS_OFF state */
>> +       if (dev->can.state == CAN_STATE_BUS_OFF)
>> +               return 0;
>> +
>> +       if (sm->channel_p_w_b & PUCAN_BUS_BUSOFF) {
>> +               new_state = CAN_STATE_BUS_OFF;
>> +       } else if (sm->channel_p_w_b & PUCAN_BUS_PASSIVE) {
>> +               new_state = CAN_STATE_ERROR_PASSIVE;
>> +       } else if (sm->channel_p_w_b & PUCAN_BUS_WARNING) {
>> +               new_state = CAN_STATE_ERROR_WARNING;
>> +       } else {
>> +               /* no error bit (so, no error skb, back to active state) */
>> +               dev->can.state = CAN_STATE_ERROR_ACTIVE;
>> +               pdev->bec.txerr = 0;
>> +               pdev->bec.rxerr = 0;
>> +               return 0;
>> +       }
>> +
>> +       /* state hasn't changed */
>> +       if (new_state == dev->can.state)
>> +               return 0;
>> +
>> +       /* handle bus state change */
>> +       tx_state = (pdev->bec.txerr >= pdev->bec.rxerr) ?  new_state : 0;
>> +       rx_state = (pdev->bec.txerr <= pdev->bec.rxerr) ?  new_state : 0;
> You seem to have extra spaces here -------------------------^

Aaarrrrgh... F*%$ !!!
>> +
>> +       /* allocate an skb to store the error frame */
>> +       skb = alloc_can_err_skb(netdev, &cf);
>> +       if (skb)
>> +               can_change_state(netdev, cf, tx_state, rx_state);
>> +
>> +       /* things must be done even in case of OOM */
>> +       if (new_state == CAN_STATE_BUS_OFF)
>> +               can_bus_off(netdev);
>> +
>> +       if (!skb)
>> +               return -ENOMEM;
>> +
>> +       peak_usb_netif_rx(skb, &usb_if->time_ref,
>> +                         le32_to_cpu(sm->ts_low), le32_to_cpu(sm->ts_high));
>> +
>> +       netdev->stats.rx_packets++;
>> +       netdev->stats.rx_bytes += cf->can_dlc;
>> +
>> +       return 0;
>> +}
>> +
> [...]
>
> ACK, but you'll probably want to remove those extra spaces *if* you post another
> version of the patch set.
>
> Best regards,
> Andri
Thank you very much for your ACK, Andri.

Best regards,

Stéphane
--
PEAK-System Technik GmbH
Sitz der Gesellschaft Darmstadt
Handelsregister Darmstadt HRB 9183 
Geschaeftsfuehrung: Alexander Gach, Uwe Wilhelm
--

      reply	other threads:[~2015-01-22 16:08 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-22 15:24 [PATCH 0/7 v8] can/peak_usb: upgrade to CANFD Stephane Grosjean
2015-01-22 15:24 ` [PATCH 1/7 v8] can/peak_usb: export ctrlmode_supported to adapter specific Stephane Grosjean
2015-01-22 15:24 ` [PATCH 2/7 v8] can/peak_usb: add adapter BEC callback definition Stephane Grosjean
2015-01-22 15:24 ` [PATCH 3/7 v8] can/peak_usb: upgrade core to data bittiming specs Stephane Grosjean
2015-01-22 15:24 ` [PATCH 4/7 v8] can/peak_usb: upgrade core to new struct canfd_frame Stephane Grosjean
2015-01-22 15:24 ` [PATCH 5/7 v8] can/peak_usb: export pcan_usb_pro functions Stephane Grosjean
2015-01-22 15:24 ` [PATCH 6/7 v8] can/peak_usb: add peak_usb_netif_rx() new function Stephane Grosjean
2015-01-22 15:31   ` Marc Kleine-Budde
2015-01-22 15:38     ` Stephane Grosjean
2015-01-22 15:40       ` Marc Kleine-Budde
2015-01-22 15:42         ` Stephane Grosjean
2015-01-22 15:46           ` Marc Kleine-Budde
2015-01-22 15:24 ` [PATCH 7/7 v8] can/peak_usb: add support for PEAK new CANFD USB adapters Stephane Grosjean
2015-01-22 15:33   ` Marc Kleine-Budde
2015-01-22 15:40     ` Stephane Grosjean
2015-01-22 15:41       ` Marc Kleine-Budde
2015-01-22 15:41   ` Marc Kleine-Budde
2015-01-22 15:59     ` Stephane Grosjean
2015-01-22 16:13       ` Marc Kleine-Budde
2015-01-22 16:19         ` Oliver Hartkopp
2015-01-22 16:24           ` Marc Kleine-Budde
2015-01-22 16:02   ` Andri Yngvason
2015-01-22 16:07     ` Stephane Grosjean [this message]

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=54C12058.8060303@peak-system.com \
    --to=s.grosjean@peak-system.com \
    --cc=andri.yngvason@marel.com \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --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.