From: Johan Hedberg <johan.hedberg@gmail.com>
To: Jakub Pawlowski <jpawlowski@google.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH v5 1/3] Bluetooth: Add lock for HCI_OP_SCAN_ENABLE command
Date: Tue, 16 Dec 2014 13:43:30 +0200 [thread overview]
Message-ID: <20141216114330.GA4618@t440s.lan> (raw)
In-Reply-To: <1418293574-25095-1-git-send-email-jpawlowski@google.com>
Hi Jakub,
On Thu, Dec 11, 2014, Jakub Pawlowski wrote:
> This patch introduces new lock, that need to be acquired if you want
> to use HCI_OP_SCAN_ENABLE in a series of request. Next patch introduces
> le restarting that would have race condition without that.
This is not really the way that locks are typically used and will likely
result in bugs in the long run. Each lock should have a well defined
piece of data that it protects and the lock/unlock pair should cover a
clear and contiguous section of code. Neither one of these principles
seems to fulfilled by your design.
As an example, your code would be stuck with the lock if you powered off
the adapter while holding it (since the HCI request callbacks would not
get called). So you'll need to find a different kind of solution here.
It seems to me like you're looking for some sort of state tracking,
which is something locking shouldn't be mixed with.
Johan.
next prev parent reply other threads:[~2014-12-16 11:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-11 10:26 [PATCH v5 1/3] Bluetooth: Add lock for HCI_OP_SCAN_ENABLE command Jakub Pawlowski
2014-12-11 10:26 ` [PATCH v5 2/3] Bluetooth: Add le_scan_restart Jakub Pawlowski
2014-12-11 10:26 ` [PATCH v5 3/3] Bluetooth: Add restarting to service discovery Jakub Pawlowski
2014-12-16 11:43 ` Johan Hedberg [this message]
2014-12-17 14:44 ` [PATCH v5 1/3] Bluetooth: Add lock for HCI_OP_SCAN_ENABLE command Jakub Pawlowski
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=20141216114330.GA4618@t440s.lan \
--to=johan.hedberg@gmail.com \
--cc=jpawlowski@google.com \
--cc=linux-bluetooth@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;
as well as URLs for NNTP newsgroup(s).