Linux CAN drivers development
 help / color / mirror / Atom feed
From: ajneu <ajneu1@gmail.com>
To: linux-can@vger.kernel.org
Subject: Re: Bug? -- NEVER getting controller-problem{back-to-error-active}
Date: Mon, 20 Jun 2016 13:00:39 +0000 (UTC)	[thread overview]
Message-ID: <loom.20160620T145908-586@post.gmane.org> (raw)
In-Reply-To: 5767C65D.2010303@grandegger.com

Wolfgang Grandegger <wg <at> grandegger.com> writes:

> 
> Does the following patch fix both issues?
> 
> diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
> index ce44a03..ca17ac2 100644
> --- a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
> +++ b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
>  <at>  <at>  -529,7 +529,7  <at>  <at>  static int
pcan_usb_fd_decode_status(struct pcan_usb_fd_if *usb_if,
>         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 new_state;
>         enum can_state rx_state, tx_state;
>         struct net_device *netdev = dev->netdev;
>         struct can_frame *cf;
>  <at>  <at>  -547,10 +547,7  <at>  <at>  static int
pcan_usb_fd_decode_status(struct pcan_usb_fd_if *usb_if,
>                 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;
> +               new_state = CAN_STATE_ERROR_ACTIVE;
>         }
> 
>         /* state hasn't changed */
> 
> Wolfgang.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-can" in
> the body of a message to majordomo <at> vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 


Hi Wolfgang,

yes wonderful: you patch works (and solves both issues)!
Will it be going into the mainline linux kernel?

Thanks,
ajneu


PS:
Note to self: compiling module peak_usb with Wolfgang's patch

## this is under Debian (stretch)
## (I'm currently using Kernel 4.6)
sudo aptitude install build-essential
sudo aptitude install linux-source
mkdir ~/kernel
cd    ~/kernel
tar xf /usr/src/linux-source-4.6.tar.xz
cd ~/kernel/linux-source*
cp /boot/config-4.6.0-1-amd64                          .config
cp /usr/src/linux-headers-4.6.0-1-amd64/Module.symvers .
make prepare
make modules_prepare
make SUBDIRS=scripts/mod
make SUBDIRS=drivers/net/can/usb/peak_usb modules

## perform patch and then recompile with:

make SUBDIRS=drivers/net/can/usb/peak_usb modules
lsmod | grep can  ## see if previous peak_usb 
                  ## is still loaded. If this is the case then:
sudo rmmod peak_usb

## load newly compiled driver
sudo insmod drivers/net/can/usb/peak_usb/peak_usb.ko


  parent reply	other threads:[~2016-06-20 13:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-20  9:12 Bug? -- NEVER getting controller-problem{back-to-error-active} ajneu
2016-06-20  9:22 ` ajneu
2016-06-20 10:33 ` Wolfgang Grandegger
2016-06-20 12:41   ` ajneu
2016-06-20 13:00   ` ajneu [this message]
2016-06-20 13:31     ` Wolfgang Grandegger
2016-06-20 13:53       ` ajneu
2016-06-20 14:28         ` Wolfgang Grandegger
2016-06-21  8:29           ` Stephane Grosjean
2016-06-21  9:58             ` Wolfgang Grandegger

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=loom.20160620T145908-586@post.gmane.org \
    --to=ajneu1@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