Linux CAN drivers development
 help / color / mirror / Atom feed
From: Vincent Mailhol <mailhol@kernel.org>
To: "Stéphane Grosjean" <stephane.grosjean@free.fr>,
	"Stéphane Grosjean" <s.grosjean@peak-system.fr>
Cc: linux-can Mailing List <linux-can@vger.kernel.org>
Subject: Re: [PATCH 0/4] can: usb: Add driver for HMS IXXAT USB-to-CAN adapters
Date: Mon, 27 Jul 2026 12:08:08 +0200	[thread overview]
Message-ID: <9a8bb69e-7653-4ea1-b67d-f7cbd83a4cd2@kernel.org> (raw)
In-Reply-To: <20260723072955.32575-1-stephane.grosjean@free.fr>

Bonjour Stéphane,

On 23/07/2026 ac 09:29, Stéphane Grosjean wrote:
> From: Stéphane Grosjean <s.grosjean@peak-system.fr>

Could you put the maintainers in Cc? Use either

  ./scripts/get_maintainer.pl

or switch to the more modern b4 tool which will handle all this
automatically for you.

  https://b4.docs.kernel.org/en/latest/

I am asking because I do not put the same focus on e-mails sent to the
mailing list as I do for e-mails sent directly to me.

> This series adds a SocketCAN driver for the HMS Networks IXXAT family of
> USB-to-CAN and USB-to-CAN FD interface adapters.
> 
> The driver supports two USB communication layers:
> - CL1: the protocol for classic CAN 2.0b devices with legacy firmware
> - CL2: the newer protocol used by recent device firmware versions
> 
> Supported devices (VID 0x08d8 and 0x08db):
>   USB-to-CAN Compact / Embedded / Professional / Automotive / Plugin (CL1)
>   USB-to-CAN FD Compact / Professional / Automotive / MiniPCIe       (CL2)
>   USB-to-CAN/FD Pro / Standard / Standard Card / Pro Module /
>                       Standard Module                                (CL2)
>   USB-to-CAR, CAN-IDM101, CAN-IDM200                                 (CL2)
> 
> Supported CAN control modes (device-dependent):
>   listen-only, loopback, triple-sampling, bus-error reporting,
>   CAN FD (ISO 11898-1:2015), non-ISO CAN FD, one-shot
> 
> Additional features:
>   - Hardware receive timestamps propagated via skb_hwtstamps
>   - Bus error counter (do_get_berr_counter)
>   - TX echo via the SocketCAN echo skb mechanism (up to 32 in flight)
>   - Up to 5 independent CAN channels per physical device
>   - Automatic protocol layer selection based on firmware version
> 
> Signed-off-by: Stéphane Grosjean <s.grosjean@peak-system.fr>
> 
> Stéphane Grosjean (4):
>   can: usb: ixxat_usb: add shared header
>   can: usb: ixxat_usb: add CL1 legacy protocol layer
>   can: usb: ixxat_usb: add CL2/V2 protocol layer with CAN
>   can: usb: ixxat_usb: add core driver and Kconfig/Makefile

I think that the series is upside-down. We should be able to compile
each individual patch.

You should start by adding relevant core portion of the header and the
core driver but with an empty

  struct usb_device_id

table. And then add the different protocols while updating the core and
the header accordingly of the new needs.

>  drivers/net/can/usb/Kconfig                   |   17 +
>  drivers/net/can/usb/Makefile                  |    1 +
>  drivers/net/can/usb/ixxat_usb/Makefile        |    3 +
>  drivers/net/can/usb/ixxat_usb/ixxat_usb_cl1.c |  188 ++
>  drivers/net/can/usb/ixxat_usb/ixxat_usb_cl2.c |  347 +++
>  .../net/can/usb/ixxat_usb/ixxat_usb_core.c    | 2567 +++++++++++++++++
>  .../net/can/usb/ixxat_usb/ixxat_usb_core.h    |  862 ++++++
>  7 files changed, 3985 insertions(+)
>  create mode 100644 drivers/net/can/usb/ixxat_usb/Makefile
>  create mode 100644 drivers/net/can/usb/ixxat_usb/ixxat_usb_cl1.c
>  create mode 100644 drivers/net/can/usb/ixxat_usb/ixxat_usb_cl2.c
>  create mode 100644 drivers/net/can/usb/ixxat_usb/ixxat_usb_core.c
>  create mode 100644 drivers/net/can/usb/ixxat_usb/ixxat_usb_core.h

A few other global comments:

  - You are doing a lot of open coded mask manipulations. For example:
    IXXAT_USB_GET_BUSTYPE() or IXXAT_USB_DECODE_DLC(). Please define a
    mask with GENMASK() (or one of its GENMASK_U*() variants) and use
    FIELD_GET() and FIELD_PREP to get and set the values.

  - When you initialize a static const struct, directly put the literal
    value. It doesn't improve the readability to have an intermediate
    macro. For example do:

	static const struct can_bittiming_const usb2can_bt = {
		.name = KBUILD_MODNAME,
		.tseg1_min = 1,
		.tseg1_max = 16,
		.tseg2_min = 1,
		.tseg2_max = 8,
		.sjw_max = 4,
		.brp_min = 1,
		.brp_max = 64,
		.brp_inc = 1,
	};

    instead of:

	static const struct can_bittiming_const usb2can_bt = {
		.name = KBUILD_MODNAME,
		.tseg1_min = IXXAT_USB2CAN_TSEG1_MIN,
		.tseg1_max = IXXAT_USB2CAN_TSEG1_MAX,
		.tseg2_min = IXXAT_USB2CAN_TSEG2_MIN,
		.tseg2_max = IXXAT_USB2CAN_TSEG2_MAX,
		.sjw_max = IXXAT_USB2CAN_SJW_MAX,
		.brp_min = IXXAT_USB2CAN_BRP_MIN,
		.brp_max = IXXAT_USB2CAN_BRP_MAX,
		.brp_inc = IXXAT_USB2CAN_BRP_INC,
	};



Yours sincerely,
Vincent Mailhol


      parent reply	other threads:[~2026-07-27 10:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23  7:29 [PATCH 0/4] can: usb: Add driver for HMS IXXAT USB-to-CAN adapters Stéphane Grosjean
2026-07-23  7:29 ` [PATCH 1/4] can: usb: ixxat_usb: add shared header Stéphane Grosjean
2026-07-23  7:48   ` sashiko-bot
2026-07-23  7:29 ` [PATCH 2/4] can: usb: ixxat_usb: add CL1 legacy protocol layer Stéphane Grosjean
2026-07-23  7:51   ` sashiko-bot
2026-07-23  7:29 ` [PATCH 3/4] can: usb: ixxat_usb: add CL2/V2 protocol layer with CAN Stéphane Grosjean
2026-07-23  7:52   ` sashiko-bot
2026-07-23  7:29 ` [PATCH 4/4] can: usb: ixxat_usb: add core driver and Kconfig/Makefile Stéphane Grosjean
2026-07-23  7:55   ` sashiko-bot
2026-07-27 10:08 ` Vincent Mailhol [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=9a8bb69e-7653-4ea1-b67d-f7cbd83a4cd2@kernel.org \
    --to=mailhol@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=s.grosjean@peak-system.fr \
    --cc=stephane.grosjean@free.fr \
    /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