From: Bernd Krumboeck <krumboeck-Hi41barv6paIERSsAYjmKA@public.gmane.org>
To: Shawn Fisher <fishbot-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-can-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
info-La43T0Mi4bH5xCKuJOYmCvaTkwRoYoCU@public.gmane.org,
gediminas-LljXPT5IorFWk0Htik3J/w@public.gmane.org
Subject: Re: [PATCH v5] usb_8dev: Add support for USB2CAN interface from 8 devices
Date: Thu, 06 Dec 2012 20:40:20 +0100 [thread overview]
Message-ID: <50C0F4A4.3030106@universalnet.at> (raw)
In-Reply-To: <CALiqQcp+t+WhvCGm0m4UJC-3do1U9njHX73p+4y-jsQktt_gEg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
Hi!
Am 2012-12-06 17:44, schrieb Shawn Fisher:
> +static int usb_8dev_send_cmd(struct usb_8dev_priv *priv,
>
> + struct usb_8dev_cmd_msg *out,
> + struct usb_8dev_cmd_msg *in)
> +{
> + int err;
> + int num_bytes_read;
> + struct net_device *netdev;
> +
> + netdev = priv->netdev;
> +
> + out->begin = USB_8DEV_CMD_START;
> + out->end = USB_8DEV_CMD_END;
> +
> + mutex_lock(&priv->usb_8dev_cmd_lock);
> +
> + memcpy(priv->cmd_msg_buffer, out,
> + sizeof(struct usb_8dev_cmd_msg));
> +
> + err = usb_8dev_send_cmd_msg(priv, priv->cmd_msg_buffer,
> + sizeof(struct usb_8dev_cmd_msg));
> + if (err < 0) {
> + netdev_err(netdev, "sending command message failed\n");
> + return err;
> + }
> +
> + err = usb_8dev_wait_cmd_msg(priv, priv->cmd_msg_buffer,
> + sizeof(struct usb_8dev_cmd_msg),
> + &num_bytes_read);
> + if (err < 0) {
> + netdev_err(netdev, "no command message answer\n");
> + return err;
> + }
> +
> + memcpy(in, priv->cmd_msg_buffer, sizeof(struct usb_8dev_cmd_msg));
> +
> + mutex_unlock(&priv->usb_8dev_cmd_lock);
> +
> + if (in->begin != USB_8DEV_CMD_START || in->end != USB_8DEV_CMD_END ||
> + num_bytes_read != 16 || in->opt1 != 0)
> + return -EPROTO;
> +
> + return 0;
> +}
>
>
> Don't forget to unlock that mutex when an error occurs.
Thanks! I will create a new patch in the next days.
In the meanwhile you can find the fixed version here: https://github.com/krumboeck/usb2can
regards,
Bernd
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2012-12-06 19:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-06 9:24 [PATCH v5] usb_8dev: Add support for USB2CAN interface from 8 devices Bernd Krumboeck
[not found] ` <CALiqQcp+t+WhvCGm0m4UJC-3do1U9njHX73p+4y-jsQktt_gEg@mail.gmail.com>
[not found] ` <CALiqQcp+t+WhvCGm0m4UJC-3do1U9njHX73p+4y-jsQktt_gEg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-12-06 19:40 ` Bernd Krumboeck [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=50C0F4A4.3030106@universalnet.at \
--to=krumboeck-hi41barv6paierssayjmka@public.gmane.org \
--cc=fishbot-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=gediminas-LljXPT5IorFWk0Htik3J/w@public.gmane.org \
--cc=info-La43T0Mi4bH5xCKuJOYmCvaTkwRoYoCU@public.gmane.org \
--cc=linux-can-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.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;
as well as URLs for NNTP newsgroup(s).