From: Pavel Machek <pavel@ucw.cz>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: "Pali Rohár" <pali.rohar@gmail.com>,
"Sebastian Reichel" <sre@debian.org>,
"Sebastian Reichel" <sre@ring0.de>,
"kernel list" <linux-kernel@vger.kernel.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
linux-omap <linux-omap@vger.kernel.org>,
"Tony Lindgren" <tony@atomide.com>,
khilman@kernel.org, "Aaro Koskinen" <aaro.koskinen@iki.fi>,
"Ivaylo Dimitrov" <ivo.g.dimitrov.75@gmail.com>,
linux-bluetooth@vger.kernel.org
Subject: Re: bluetooth: Add hci_h4p driver
Date: Fri, 19 Dec 2014 10:50:00 +0100 [thread overview]
Message-ID: <20141219095000.GA24703@amd> (raw)
In-Reply-To: <97C706D6-765B-446A-8180-600F5FB6C68B@holtmann.org>
Hi!
> And you want to set the QUIRK_INVALID_BADDR. At least you want to do that in the final submission.
>
Ok, I found out that I can do it and result works, provided that I do
hciconfig hci0 up/down first.
I have trouble understanding... h4p_hci_open() seems to be called as
soon as I insmod the driver. Who does that? Is it some kind of udev
magic?
...
> > +#include "hci_h4p.h"
> > +
> > +#define BT_DBG(a...) do {} while(0)
>
> Why is this needed? BT_DBG is hooked up with dynamic debug.
...
I did all the changes as requested. Thanks. I did't see harm in
include guards, but I removed them; it is not important.
> > + if (info->rx_count == 0) {
> > + /* H4+ devices should always send word aligned packets */
> > + if (!(info->rx_skb->len % 2))
> > + info->garbage_bytes++;
> > + h4p_recv_frame(info, info->rx_skb);
>
> The h4p_recv_frame should maybe done inline here since it only handles 2 exception packets. Also to make it easy, just leave the function if (info->rx_count).
>
> This packet processing feels like a bit of spaghetti code. I think that is better handled in a proper function that goes through it and not with many tiny sub functions.
>
Well, CodingStyle says something about functions that should be kept
short... And when manually inlined, the inner function would have to
be made less readable, as it uses return to shortcut processing.
To use __hci_cmd_sync()
> > +
> > + SET_HCIDEV_DEV(hdev, info->dev);
> > +
> > + if (hci_register_dev(hdev) >= 0)
> > + return 0;
> > +
> > + dev_err(info->dev, "hci_register failed %s.\n", hdev->name);
> > + hci_free_dev(info->hdev);
> > + return -ENODEV;
> > +}
>
> And normally this is folded into the probe handling and not in a
> separate function.
The probe function is too long, already...
> > +#include <linux/delay.h>
> > +#include <linux/clk.h>
> > +
> > +#include <linux/io.h>
> > +
> > +#include "hci_h4p.h"
>
> Why is this a separate file? And if so, why not all UART specific details are in this file. Including bunch of the defines you have in the header.
>
Well, you wanted less global functions, so I moved some as inlines to
headers. I guess I can merge nokia_core and nokia_uart if really wanted.
I did rest of requested changes.
Thanks,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
next prev parent reply other threads:[~2014-12-19 9:50 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-13 22:37 bluetooth: Add hci_h4p driver Pavel Machek
2014-12-13 23:30 ` Marcel Holtmann
2014-12-13 23:51 ` Pavel Machek
2014-12-14 0:07 ` Marcel Holtmann
2014-12-14 9:47 ` Pavel Machek
[not found] ` <570BAC61-3137-42E5-B4F8-A61AEED380DE-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
2014-12-14 10:40 ` Pavel Machek
2014-12-14 19:21 ` Pavel Machek
2014-12-14 20:28 ` Marcel Holtmann
[not found] ` <D1F25806-07C6-4876-8E62-A16CFB6827EA-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
2014-12-14 22:41 ` Pavel Machek
2014-12-14 11:16 ` Pavel Machek
2014-12-14 21:52 ` Pavel Machek
2014-12-15 10:01 ` Oliver Neukum
2014-12-18 19:31 ` Pavel Machek
2014-12-18 20:10 ` Pavel Machek
2014-12-15 12:10 ` Marcel Holtmann
2014-12-19 9:50 ` Pavel Machek [this message]
2014-12-19 9:58 ` Marcel Holtmann
2014-12-20 15:48 ` Pavel Machek
2014-12-20 23:39 ` Marcel Holtmann
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
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=20141219095000.GA24703@amd \
--to=pavel@ucw.cz \
--cc=aaro.koskinen@iki.fi \
--cc=ivo.g.dimitrov.75@gmail.com \
--cc=khilman@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=pali.rohar@gmail.com \
--cc=sre@debian.org \
--cc=sre@ring0.de \
--cc=tony@atomide.com \
/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).