linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: "Pali Rohár" <pali.rohar@gmail.com>
Cc: "Marcel Holtmann" <marcel@holtmann.org>,
	"Gustavo Padovan" <gustavo@padovan.org>,
	"Johan Hedberg" <johan.hedberg@gmail.com>,
	"Pavel Machek" <pavel@ucw.cz>,
	linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org,
	"Ивайло Димитров" <freemangordon@abv.bg>,
	"Joni Lapilainen" <joni.lapilainen@gmail.com>,
	"Sebastian Reichel" <sre@ring0.de>,
	"Aaro Koskinen" <aaro.koskinen@iki.fi>
Subject: Re: [PATCH] Bluetooth: Add hci_h4p driver
Date: Thu, 24 Oct 2013 11:41:53 -0700	[thread overview]
Message-ID: <1382640113.22433.69.camel@joe-AO722> (raw)
In-Reply-To: <201310181230.45351@pali>

On Fri, 2013-10-18 at 12:30 +0200, Pali Rohár wrote:

> I rebased patch on top of https://git.kernel.org/cgit/linux/kernel/git/bluetooth/bluetooth-next.git branch master

Hi Pali, just some trivial notes:

[]

+static ssize_t hci_h4p_show_bdaddr(struct device *dev,
> +                                  struct device_attribute *attr, char *buf)
> +{
> +       struct hci_h4p_info *info = dev_get_drvdata(dev);
> +
> +       return sprintf(buf, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
> +                      info->bd_addr[0], info->bd_addr[1], info->bd_addr[2],
> +                      info->bd_addr[3], info->bd_addr[4], info->bd_addr[5]);

sprintf(buf, "%pM", info->bd_addr)

and if this is really bluetooth, does the output need to
be emitted in reverse order?  ie: %pMR

[]

> +#define NBT_DBG(fmt, arg...) \
> +               pr_debug("%s: " fmt "" , __func__ , ## arg)
> +
> +#define NBT_DBG_FW(fmt, arg...) \
> +               pr_debug("%s: " fmt "" , __func__ , ## arg)
> +
> +#define NBT_DBG_POWER(fmt, arg...) \
> +               pr_debug("%s: " fmt "" , __func__ , ## arg)
> +
> +#define NBT_DBG_TRANSFER(fmt, arg...) \
> +               pr_debug("%s: " fmt "" , __func__ , ## arg)
> +
> +#define NBT_DBG_TRANSFER_NF(fmt, arg...) \
> +               pr_debug(fmt "" , ## arg)
> +
> +#define NBT_DBG_DMA(fmt, arg...) \
> +               pr_debug("%s: " fmt "" , __func__ , ## arg)

The "" isn't useful.

dynamic_debugging can add __func__ to each message output
with +f.

I think all of these should be converted to pr_debug
where used or consolidated into a single
#define nbt_dbg(mask, fmt, ...)			\
do {						\
	if (mask & debug)			\
		pr_debug(fmt, ##__VA_ARGS__);
} while (0)

and used like:
	nbt_dbg(TRANSFER, fmt, etc...);
where debug is some static.

Also there are many uses missing "\n" which can
cause interleaving problems with other printks.

[]

> +int hci_h4p_wait_for_cts(struct hci_h4p_info *info, int active,
> +                        int timeout_ms)
> +{
> +       unsigned long timeout;
> +       int state;
> +
> +       timeout = jiffies + msecs_to_jiffies(timeout_ms);
> +       for (;;) {

	while (time_before(jiffies, timeout)) {

> +               state = hci_h4p_inb(info, UART_MSR) & UART_MSR_CTS;
> +               if (active) {
> +                       if (state)
> +                               return 0;
> +               } else {
> +                       if (!state)
> +                               return 0;
> +               }
> +               if (time_after(jiffies, timeout))
> +                       return -ETIMEDOUT;

> +               msleep(1);
> +       }

	return -ETIMEDOUT;

> +}

  parent reply	other threads:[~2013-10-24 18:41 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-20 19:01 [PATCH] Bluetooth: Add hci_h4p driver Pali Rohár
2013-10-17 20:25 ` Pali Rohár
2013-10-17 22:11   ` Marcel Holtmann
     [not found]     ` <201310180739.47841@pali>
2013-10-18  8:56       ` Marcel Holtmann
2013-10-18 10:30     ` Pali Rohár
2013-10-24 16:41       ` Pali Rohár
2013-10-24 18:41       ` Joe Perches [this message]
2013-10-26 19:28         ` Pali Rohár
2013-12-27 11:02 ` [PATCH v2] " Pali Rohár
2013-12-27 11:34   ` Pali Rohár
2013-12-28  1:21   ` Marcel Holtmann
2013-12-30 12:13     ` Pavel Machek
2013-12-30 12:25       ` Pavel Machek
2013-12-30 13:19       ` Sebastian Reichel
2013-12-30 14:04         ` Pali Rohár
2013-12-30 13:54       ` Pali Rohár
2013-12-30 12:23     ` Pavel Machek
2013-12-30 14:31     ` Pali Rohár
2013-12-30 14:52       ` Sebastian Reichel
2013-12-30 23:42         ` Sebastian Reichel
2014-01-08 21:36         ` Pali Rohár
2014-02-13 15:33           ` Pali Rohár
2014-02-14 17:28             ` Sebastian Reichel
2014-02-15 22:30               ` Pavel Machek
2014-02-19  1:12                 ` Ben Hutchings
2013-12-30 22:18     ` Pavel Machek
2013-12-30 22:19     ` [PATCH] wilink: mention name of module in help text Pavel Machek
2013-12-30 22:28     ` [PATCH v2] Bluetooth: Add hci_h4p driver Pavel Machek
2013-12-30 22:48     ` Pavel Machek
2013-12-31 22:12     ` Pavel Machek
2013-12-31 23:23       ` Marcel Holtmann
2014-01-01 20:09         ` Pavel Machek
2014-01-02 16:18   ` [PATCH v3] " Pavel Machek
2014-01-02 16:34     ` Marcel Holtmann
2014-01-03  0:17       ` [PATCH v4] " Pavel Machek
2014-01-03  1:05         ` Sebastian Reichel
2014-01-05 22:32           ` Pavel Machek
2014-01-05 23:01             ` Sebastian Reichel
2014-01-06  0:27               ` Pavel Machek
2014-01-03  1:36         ` Sebastian Reichel
2014-01-09 23:38           ` Pavel Machek
2014-01-10  0:32             ` Sebastian Reichel
2014-01-10 12:18               ` Pavel Machek
2014-01-10 13:44                 ` Sebastian Reichel
2014-01-10 14:49                   ` Pavel Machek
2014-01-10 14:52         ` [PATCH v5] " Pavel Machek
2014-01-10 17:33           ` Joe Perches
2014-01-11  0:19             ` Pavel Machek
2014-01-11  0:28           ` [PATCH v6] " Pavel Machek
2014-01-16  0:22             ` Pavel Machek
2014-01-16  3:01             ` Marcel Holtmann
2014-01-17 12:14               ` Pavel Machek
2014-01-17 13:29               ` [PATCH v7] staging/bluetooth: " Pavel Machek
  -- strict thread matches above, loose matches on Subject: below --
2014-12-13 22:37 bluetooth: " Pavel Machek
2014-12-20 20:23 ` [PATCH] " Pavel Machek
2014-12-20 20:43   ` Paul Bolle
2014-12-20 23:35   ` Marcel Holtmann
2014-12-23 12:00     ` Pavel Machek
2014-12-23 12:41     ` Pavel Machek
2014-12-23 13:02 Pavel Machek
2015-01-18 12:02 ` Pavel Machek
2015-01-19 21:36 ` Marcel Holtmann
2015-01-20 17:36   ` Pavel Machek
2015-01-20 18:34     ` Marcel Holtmann
2015-01-21 11:01       ` Pavel Machek
2015-01-21 11:46         ` Pali Rohár
2015-01-20  8:28 ` Johan Hedberg
2015-01-20 21:49   ` Pavel Machek

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=1382640113.22433.69.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=freemangordon@abv.bg \
    --cc=gustavo@padovan.org \
    --cc=johan.hedberg@gmail.com \
    --cc=joni.lapilainen@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=pali.rohar@gmail.com \
    --cc=pavel@ucw.cz \
    --cc=sre@ring0.de \
    /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).