public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: David Herrmann <dh.herrmann@googlemail.com>
Cc: linux-bluetooth@vger.kernel.org, padovan@profusion.mobi
Subject: Re: [PATCH 2/3] Bluetooth: Move device initialization to hci_alloc_dev()
Date: Sun, 22 Apr 2012 15:47:55 +0200	[thread overview]
Message-ID: <1335102475.16897.351.camel@aeonflux> (raw)
In-Reply-To: <1335098400-24571-2-git-send-email-dh.herrmann@googlemail.com>

Hi David,

> We currently initialize locks, lists, works, etc. in hci_register_dev()
> (hci_alloc_dev() was added later) which is bogus because an hdev is in an
> invalid state if it is not registered.
> This patch moves all memory initialization to hci_alloc_dev(). Device
> registering and registration of sub-modules is still left in
> hci_register_dev() as it belongs there.
> 
> The benefit is (despite cleaning up the code-base) we can now always be
> sure that an hdev is a valid object and can be locked and worked on even
> though it may not be registered.
> 
> This patch also reorders the initialization to be easier to understand.
> First the memory is initialized, then all generic structures and as last
> step the sub-init functions are called. This guarantees that all
> dependencies are initialized in the right order and makes it also easier
> to find a specific line. We previously initialized it in the same order as
> the "struct hci_dev" is declared which seems pretty random.
> 
> Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
> ---
> Sorry for reordering the calls, it makes reviewing very hard. However, I think
> it improves readability a _lot_. I can resend without reordering if you want.

I am fine with this. And I could not spot any issue here. So I went
ahead and applied all 3 patches to bluetooth-next tree.

Regards

Marcel



  reply	other threads:[~2012-04-22 13:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-22 12:39 [PATCH 1/3] Bluetooth: Move hci_alloc/free_dev close to hci_register/unregister_dev David Herrmann
2012-04-22 12:39 ` [PATCH 2/3] Bluetooth: Move device initialization to hci_alloc_dev() David Herrmann
2012-04-22 13:47   ` Marcel Holtmann [this message]
2012-04-22 12:39 ` [PATCH 3/3] Bluetooth: Remove unneeded initialization in hci_alloc_dev() David Herrmann

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=1335102475.16897.351.camel@aeonflux \
    --to=marcel@holtmann.org \
    --cc=dh.herrmann@googlemail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=padovan@profusion.mobi \
    /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