Linux CAN drivers development
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Bernd Krumboeck <b.krumboeck@gmail.com>
Cc: linux-can@vger.kernel.org, linux-usb@vger.kernel.org,
	info@gerhard-bertelsmann.de, gediminas@8devices.com,
	Bernd Krumboeck <krumboeck@universalnet.at>
Subject: Re: [PATCH v10] usb_8dev: Add support for USB2CAN interface from 8 devices
Date: Fri, 18 Jan 2013 21:19:50 +0100	[thread overview]
Message-ID: <50F9AE66.8010602@hartkopp.net> (raw)
In-Reply-To: <1358519049-13551-1-git-send-email-krumboeck@universalnet.at>

On 18.01.2013 15:24, Bernd Krumboeck wrote:

> Add device driver for USB2CAN interface from "8 devices" (http://www.8devices.com).

>

> Signed-off-by: Bernd Krumboeck <krumboeck@universalnet.at>
> Acked-by: Wolfgang Grandegger <wg@grandegger.com>



You can add my

Tested-by: Oliver Hartkopp <socketcan@hartkopp.net>

in the v11 post :-)

I have only one small cosmetic change request:

Please remove/split up this #define block.


> +
> +/* bittiming constants */
> +#define USB_8DEV_ABP_CLOCK		32000000


/* device CAN clock */
#define USB_8DEV_ABP_CLOCK		32000000

> +#define USB_8DEV_BAUD_MANUAL		0x09


-> moved down, see below

> +#define USB_8DEV_TSEG1_MIN		1
> +#define USB_8DEV_TSEG1_MAX		16
> +#define USB_8DEV_TSEG2_MIN		1
> +#define USB_8DEV_TSEG2_MAX		8
> +#define USB_8DEV_SJW_MAX		4
> +#define USB_8DEV_BRP_MIN		1
> +#define USB_8DEV_BRP_MAX		1024
> +#define USB_8DEV_BRP_INC		1


It makes no sense to define these values when you can specify them directly in
the const struct can_bittiming_const below.

This is usual and does not reduce the readability.

> +
> +/* setup flags */
> +#define USB_8DEV_SILENT			0x01
> +#define USB_8DEV_LOOPBACK		0x02
> +#define USB_8DEV_DISABLE_AUTO_RESTRANS	0x04
> +#define USB_8DEV_STATUS_FRAME		0x08
> +
> +/* commands */
> +enum usb_8dev_cmd {
> +	USB_8DEV_RESET = 1,
> +	USB_8DEV_OPEN,
> +	USB_8DEV_CLOSE,
> +	USB_8DEV_SET_SPEED,
> +	USB_8DEV_SET_MASK_FILTER,
> +	USB_8DEV_GET_STATUS,
> +	USB_8DEV_GET_STATISTICS,
> +	USB_8DEV_GET_SERIAL,
> +	USB_8DEV_GET_SOFTW_VER,
> +	USB_8DEV_GET_HARDW_VER,
> +	USB_8DEV_RESET_TIMESTAMP,
> +	USB_8DEV_GET_SOFTW_HARDW_VER
> +};


/* command options */
#define USB_8DEV_BAUD_MANUAL		0x09

> +
> +#define USB_8DEV_CMD_START		0x11
> +#define USB_8DEV_CMD_END		0x22
> +

(..)

> +
> +static const struct can_bittiming_const usb_8dev_bittiming_const = {
> +	.name = "usb_8dev",
> +	.tseg1_min = USB_8DEV_TSEG1_MIN,
> +	.tseg1_max = USB_8DEV_TSEG1_MAX,
> +	.tseg2_min = USB_8DEV_TSEG2_MIN,
> +	.tseg2_max = USB_8DEV_TSEG2_MAX,
> +	.sjw_max = USB_8DEV_SJW_MAX,
> +	.brp_min = USB_8DEV_BRP_MIN,
> +	.brp_max = USB_8DEV_BRP_MAX,
> +	.brp_inc = USB_8DEV_BRP_INC,
> +};
> +


insert values directly here.

Regards,
Oliver


  reply	other threads:[~2013-01-18 20:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-18 14:24 [PATCH v10] usb_8dev: Add support for USB2CAN interface from 8 devices Bernd Krumboeck
2013-01-18 20:19 ` Oliver Hartkopp [this message]
2013-01-18 22:13   ` "Bernd Krumböck"

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=50F9AE66.8010602@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=b.krumboeck@gmail.com \
    --cc=gediminas@8devices.com \
    --cc=info@gerhard-bertelsmann.de \
    --cc=krumboeck@universalnet.at \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-usb@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