public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: David Herrmann <dh.herrmann@googlemail.com>
To: linux-bluetooth@vger.kernel.org
Cc: marcel@holtmann.org, padovan@profusion.mobi,
	David Herrmann <dh.herrmann@googlemail.com>
Subject: [PATCH 3/3] Bluetooth: Remove unneeded initialization in hci_alloc_dev()
Date: Sun, 22 Apr 2012 14:39:59 +0200	[thread overview]
Message-ID: <1335098400-24571-3-git-send-email-dh.herrmann@googlemail.com> (raw)
In-Reply-To: <1335098400-24571-1-git-send-email-dh.herrmann@googlemail.com>

We allocate memory with kzalloc() so there is no need to call
memset(..., 0, ...) or similar.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
---
For the curious reader: ATOMIC_INIT(x) is defined to { (x) } for every
architecture so we can safely remove it, too.

 net/bluetooth/hci_core.c |   10 ----------
 1 file changed, 10 deletions(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 1df4b6d..3b97ad3 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1714,20 +1714,16 @@ int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window,
 struct hci_dev *hci_alloc_dev(void)
 {
 	struct hci_dev *hdev;
-	int i;
 
 	hdev = kzalloc(sizeof(struct hci_dev), GFP_KERNEL);
 	if (!hdev)
 		return NULL;
 
-	hdev->flags = 0;
-	hdev->dev_flags = 0;
 	hdev->pkt_type  = (HCI_DM1 | HCI_DH1 | HCI_HV1);
 	hdev->esco_type = (ESCO_HV1);
 	hdev->link_mode = (HCI_LM_ACCEPT);
 	hdev->io_capability = 0x03; /* No Input No Output */
 
-	hdev->idle_timeout = 0;
 	hdev->sniff_max_interval = 800;
 	hdev->sniff_min_interval = 80;
 
@@ -1762,12 +1758,6 @@ struct hci_dev *hci_alloc_dev(void)
 
 	setup_timer(&hdev->cmd_timer, hci_cmd_timer, (unsigned long) hdev);
 
-	memset(&hdev->stat, 0, sizeof(struct hci_dev_stats));
-	atomic_set(&hdev->promisc, 0);
-
-	for (i = 0; i < NUM_REASSEMBLY; i++)
-		hdev->reassembly[i] = NULL;
-
 	hci_init_sysfs(hdev);
 	discovery_init(hdev);
 	hci_conn_hash_init(hdev);
-- 
1.7.10

      parent reply	other threads:[~2012-04-22 12:39 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
2012-04-22 12:39 ` David Herrmann [this message]

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=1335098400-24571-3-git-send-email-dh.herrmann@googlemail.com \
    --to=dh.herrmann@googlemail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.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