From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Stephane Grosjean <s.grosjean@peak-system.com>,
linux-can@vger.kernel.org
Subject: Re: [PATCH 3/3] can/peak_usb: CAN-FD: driver's core modifications
Date: Thu, 27 Nov 2014 12:43:51 +0100 [thread overview]
Message-ID: <54770E77.8080108@hartkopp.net> (raw)
In-Reply-To: <1417084329-8997-4-git-send-email-s.grosjean@peak-system.com>
Hello Stephane,
I have two more questions:
On 27.11.2014 11:32, Stephane Grosjean wrote:
> @@ -322,7 +341,9 @@ static netdev_tx_t peak_usb_ndo_start_xmit(struct sk_buff *skb,
> }
>
> context->echo_index = i;
> - context->dlc = cf->can_dlc;
> +
> + /* Note: this works with CANFD frames too */
> + context->data_len = cf->can_dlc;
>
> usb_anchor_urb(urb, &dev->tx_submitted);
>
Even with this comment the assignment looks fishy.
What about defining
struct canfd_frame *cfd = (struct can_frame *)skb->data;
instead of
struct can_frame *cf = (struct can_frame *)skb->data;
at the top of the function and assign
context->data_len = cfd->len;
??
> @@ -679,19 +700,43 @@ static int peak_usb_set_mode(struct net_device *netdev, enum can_mode mode)
> }
>
> /*
> - * candev callback used to set device bitrate.
> + * candev callback used to set device nominal bitrate.
Is this the nominal bitrate or the arbitration bitrate ?
What about stating both:
candev callback used to set device nominal/arbitration bitrate.
> @@ -735,7 +780,7 @@ static int peak_usb_create_dev(struct peak_usb_adapter *peak_usb_adapter,
> dev->cmd_buf = kmalloc(PCAN_USB_MAX_CMD_LEN, GFP_KERNEL);
> if (!dev->cmd_buf) {
> err = -ENOMEM;
> - goto lbl_set_intf_data;
> + goto lbl_free_candev;
These label changes
> }
>
> dev->udev = usb_dev;
> @@ -750,9 +795,10 @@ static int peak_usb_create_dev(struct peak_usb_adapter *peak_usb_adapter,
> dev->can.clock = peak_usb_adapter->clock;
> dev->can.bittiming_const = &peak_usb_adapter->bittiming_const;
> dev->can.do_set_bittiming = peak_usb_set_bittiming;
> + 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.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES |
> - CAN_CTRLMODE_LISTENONLY;
> + dev->can.ctrlmode_supported = peak_usb_adapter->ctrlmode_supported;
>
> netdev->netdev_ops = &peak_usb_netdev_ops;
>
> @@ -770,12 +816,11 @@ static int peak_usb_create_dev(struct peak_usb_adapter *peak_usb_adapter,
> usb_set_intfdata(intf, dev);
>
> SET_NETDEV_DEV(netdev, &intf->dev);
> - netdev->dev_id = ctrl_idx;
>
> err = register_candev(netdev);
> if (err) {
> dev_err(&intf->dev, "couldn't register CAN device: %d\n", err);
> - goto lbl_free_cmd_buf;
> + goto lbl_set_intf_data;
here
> }
>
> if (dev->prev_siblings)
> @@ -788,14 +833,14 @@ static int peak_usb_create_dev(struct peak_usb_adapter *peak_usb_adapter,
> if (dev->adapter->dev_init) {
> err = dev->adapter->dev_init(dev);
> if (err)
> - goto lbl_free_cmd_buf;
> + goto lbl_unregister;
here
> }
>
> /* set bus off */
> if (dev->adapter->dev_set_bus) {
> err = dev->adapter->dev_set_bus(dev, 0);
> if (err)
> - goto lbl_free_cmd_buf;
> + goto lbl_unregister;
here
> }
>
> /* get device number early */
> @@ -807,11 +852,14 @@ static int peak_usb_create_dev(struct peak_usb_adapter *peak_usb_adapter,
>
> return 0;
>
> -lbl_free_cmd_buf:
> - kfree(dev->cmd_buf);
> +lbl_unregister:
> + unregister_netdev(netdev);
>
> lbl_set_intf_data:
> usb_set_intfdata(intf, dev->prev_siblings);
> + kfree(dev->cmd_buf);
> +
> +lbl_free_candev:
> free_candev(netdev);
and here ...
Are these changes necessary for the current PCAN USB driver too?
Should they go into the stable tree with a separate patch?
If so this separate patch should be the first in the series to be picked.
There's something like this in patch 1/3 too - will send it after this mail.
Regards,
Oliver
next prev parent reply other threads:[~2014-11-27 11:44 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-27 10:32 [PATCH 0/3] Add support for PEAK CAN-FD USB adapters Stephane Grosjean
2014-11-27 10:32 ` [PATCH 1/3] can/peak_usb: CAN-FD: existing source files modifications Stephane Grosjean
2014-11-27 11:44 ` Oliver Hartkopp
2014-11-27 21:27 ` Marc Kleine-Budde
[not found] ` <547DBADC.2020009@pengutronix.de>
2014-12-02 13:55 ` Stephane Grosjean
2014-12-02 14:02 ` Marc Kleine-Budde
2014-11-27 10:32 ` [PATCH 2/3] can/peak_usb: CAN-FD: add new adapters specific files Stephane Grosjean
2014-11-27 22:28 ` Marc Kleine-Budde
[not found] ` <547DBAEC.6010903@pengutronix.de>
2014-12-02 15:08 ` Stephane Grosjean
2014-12-02 15:17 ` Marc Kleine-Budde
2014-12-03 9:38 ` Stephane Grosjean
2014-12-03 9:53 ` Marc Kleine-Budde
2014-12-03 10:16 ` Oliver Hartkopp
2014-12-03 10:38 ` Stephane Grosjean
2014-12-03 10:45 ` Marc Kleine-Budde
2014-12-03 10:50 ` Oliver Hartkopp
2014-12-03 11:20 ` Stephane Grosjean
2014-12-03 11:51 ` Oliver Hartkopp
2014-12-03 12:34 ` Stephane Grosjean
2014-12-03 12:57 ` Oliver Hartkopp
2014-12-03 13:18 ` Stephane Grosjean
2014-12-03 13:19 ` Marc Kleine-Budde
2014-11-27 10:32 ` [PATCH 3/3] can/peak_usb: CAN-FD: driver's core modifications Stephane Grosjean
2014-11-27 11:43 ` Oliver Hartkopp [this message]
2014-11-28 10:03 ` Stephane Grosjean
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=54770E77.8080108@hartkopp.net \
--to=socketcan@hartkopp.net \
--cc=linux-can@vger.kernel.org \
--cc=s.grosjean@peak-system.com \
/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.