From: Johan Hedberg <johan.hedberg@gmail.com>
To: Matthew Wilson <mtwilson@codeaurora.org>
Cc: linux-bluetooth@vger.kernel.org, marcel@holtmann.org,
rshaffer@codeaurora.org
Subject: Re: [PATCH v3] Firmware download for Qualcomm Bluetooth devices
Date: Sat, 21 Aug 2010 01:37:57 +0300 [thread overview]
Message-ID: <20100820223757.GA23924@jh-x301> (raw)
In-Reply-To: <1282340251-10676-1-git-send-email-mtwilson@codeaurora.org>
Hi Matt,
On Fri, Aug 20, 2010, Matthew Wilson wrote:
> Configures device address from hciattach parameter.
> UART speed limited to 115200.
> Requires separate device specific firmware.
> ---
> Makefile.tools | 3 +-
> tools/hciattach.c | 10 ++
> tools/hciattach.h | 1 +
> tools/hciattach_qualcomm.c | 279 ++++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 292 insertions(+), 1 deletions(-)
> create mode 100644 tools/hciattach_qualcomm.c
Thanks, the patch applies cleanly now. However, I spotted a couple of
whitespace/coding style issues that would be good to get fixed before
pushing this upstream:
> +#define FAILIF(x, args...) do { \
> + if (x) { \
> + fprintf(stderr, ##args); \
> + return -1; \
> + } \
> +} while(0)
Before each \ at the end of the line you use a mix of tabs and spaces.
Please just use tabs.
> +typedef struct {
> + uint8_t uart_prefix;
> + hci_event_hdr hci_hdr;
> + evt_cmd_complete cmd_complete;
> + uint8_t status;
> + uint8_t data[16];
> +} __attribute__((packed)) command_complete_t;
> +
> +
Why the two consecutive empty lines? Please remove one.
> +static int read_command_complete(int fd, unsigned short opcode, unsigned char len) {
This one looks like it goes beyond 80 columns. Please split it. Also,
the coding style is to put the opening brace of a function on its own
line.
> + FAILIF(resp.hci_hdr.evt != EVT_CMD_COMPLETE, /* event must be event-complete */
> + "Error in response: not a cmd-complete event, "
> + "but 0x%02x!\n", resp.hci_hdr.evt);
Mixed tabs and spaces for indentation. Please just use tabs.
> + FAILIF(resp.hci_hdr.plen < 4, /* plen >= 4 for EVT_CMD_COMPLETE */
> + "Error in response: plen is not >= 4, but 0x%02x!\n",
> + resp.hci_hdr.plen);
Same here.
> +
> + /* cmd-complete event: opcode */
> + FAILIF(resp.cmd_complete.opcode != 0,
> + "Error in response: opcode is 0x%04x, not 0!",
> + resp.cmd_complete.opcode);
And here.
> +static int qualcomm_load_firmware(int fd, const char *firmware, const char *bdaddr_s) {
This one goes beyond 80 columns too and the opening brace should be on
its own line.
> + FAILIF(fw < 0,
> + "Could not open firmware file %s: %s (%d).\n",
> + firmware, strerror(errno), errno);
Mixed tabs and spaces for indentation.
> + FAILIF(read(fw, data, cmd->plen) != cmd->plen,
> + "Could not read %d bytes of data for command with opcode %04x!\n",
> + cmd->plen,
> + cmd->opcode);
Same here.
> + FAILIF(nw != (int) sizeof(cmdp) + cmd->plen,
> + "Could not send entire command (sent only %d bytes)!\n",
> + nw);
And here.
> + if (read_command_complete(fd,
> + cmd->opcode,
> + cmd->plen) < 0) {
And here. Why do you split it into three lines when it all fits within
80 columns?
Johan
next prev parent reply other threads:[~2010-08-20 22:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-10 18:51 patch for firmware download to Qualcomm Bluetooth chip Ron Shaffer
2010-08-10 21:14 ` Marcel Holtmann
2010-08-11 2:27 ` Ron Shaffer
2010-08-13 15:33 ` [PATCH v2] Firmware download for Qualcomm Bluetooth devices Matthew Wilson
2010-08-18 15:40 ` Ron Shaffer
2010-08-18 22:35 ` Johan Hedberg
2010-08-20 21:37 ` [PATCH v3] " Matthew Wilson
2010-08-20 22:37 ` Johan Hedberg [this message]
2010-08-23 14:36 ` Matt Wilson
2010-08-23 14:38 ` Matt Wilson
2010-08-23 16:17 ` [PATCH v4] " Matthew Wilson
2010-08-23 20:41 ` Johan Hedberg
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=20100820223757.GA23924@jh-x301 \
--to=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=mtwilson@codeaurora.org \
--cc=rshaffer@codeaurora.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 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.