linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Remove unneeded zero init
@ 2012-08-30  9:04 Andrei Emeltchenko
  2012-08-30 15:06 ` Marcel Holtmann
  0 siblings, 1 reply; 5+ messages in thread
From: Andrei Emeltchenko @ 2012-08-30  9:04 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

hdev is allocated with kzalloc so zero initialization is not needed.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 include/net/bluetooth/hci_core.h |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 36720f0..05bcea6 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -443,10 +443,8 @@ static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
 static inline void hci_conn_hash_init(struct hci_dev *hdev)
 {
 	struct hci_conn_hash *h = &hdev->conn_hash;
+
 	INIT_LIST_HEAD(&h->list);
-	h->acl_num = 0;
-	h->sco_num = 0;
-	h->le_num = 0;
 }
 
 static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Bluetooth: Remove unneeded zero init
  2012-08-30  9:04 [PATCH] Bluetooth: Remove unneeded zero init Andrei Emeltchenko
@ 2012-08-30 15:06 ` Marcel Holtmann
  2012-08-31 13:39   ` [PATCHv2] " Andrei Emeltchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2012-08-30 15:06 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

Hi Andrei,

> hdev is allocated with kzalloc so zero initialization is not needed.
> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
>  include/net/bluetooth/hci_core.h |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> index 36720f0..05bcea6 100644
> --- a/include/net/bluetooth/hci_core.h
> +++ b/include/net/bluetooth/hci_core.h
> @@ -443,10 +443,8 @@ static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
>  static inline void hci_conn_hash_init(struct hci_dev *hdev)
>  {
>  	struct hci_conn_hash *h = &hdev->conn_hash;
> +
>  	INIT_LIST_HEAD(&h->list);
> -	h->acl_num = 0;
> -	h->sco_num = 0;
> -	h->le_num = 0;
>  }

since there is only one user of hci_conn_hash_init, we should just
replace that call with a direct INIT_LIST_HEAD.

Regards

Marcel



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCHv2] Bluetooth: Remove unneeded zero init
  2012-08-30 15:06 ` Marcel Holtmann
@ 2012-08-31 13:39   ` Andrei Emeltchenko
  2012-08-31 16:20     ` Marcel Holtmann
  2012-08-31 17:55     ` Gustavo Padovan
  0 siblings, 2 replies; 5+ messages in thread
From: Andrei Emeltchenko @ 2012-08-31 13:39 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

hdev is allocated with kzalloc so zero initialization is not needed.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 include/net/bluetooth/hci_core.h |    9 ---------
 net/bluetooth/hci_core.c         |    2 +-
 2 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 7542af4..4704ca4 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -428,15 +428,6 @@ static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
 	       test_bit(HCI_CONN_SSP_ENABLED, &conn->flags);
 }
 
-static inline void hci_conn_hash_init(struct hci_dev *hdev)
-{
-	struct hci_conn_hash *h = &hdev->conn_hash;
-	INIT_LIST_HEAD(&h->list);
-	h->acl_num = 0;
-	h->sco_num = 0;
-	h->le_num = 0;
-}
-
 static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c)
 {
 	struct hci_conn_hash *h = &hdev->conn_hash;
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 28bab9d..8dbbc01 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1652,6 +1652,7 @@ struct hci_dev *hci_alloc_dev(void)
 	INIT_LIST_HEAD(&hdev->link_keys);
 	INIT_LIST_HEAD(&hdev->long_term_keys);
 	INIT_LIST_HEAD(&hdev->remote_oob_data);
+	INIT_LIST_HEAD(&hdev->conn_hash.list);
 
 	INIT_WORK(&hdev->rx_work, hci_rx_work);
 	INIT_WORK(&hdev->cmd_work, hci_cmd_work);
@@ -1674,7 +1675,6 @@ struct hci_dev *hci_alloc_dev(void)
 
 	hci_init_sysfs(hdev);
 	discovery_init(hdev);
-	hci_conn_hash_init(hdev);
 
 	return hdev;
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCHv2] Bluetooth: Remove unneeded zero init
  2012-08-31 13:39   ` [PATCHv2] " Andrei Emeltchenko
@ 2012-08-31 16:20     ` Marcel Holtmann
  2012-08-31 17:55     ` Gustavo Padovan
  1 sibling, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2012-08-31 16:20 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

Hi Andrei,

> hdev is allocated with kzalloc so zero initialization is not needed.
> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
>  include/net/bluetooth/hci_core.h |    9 ---------
>  net/bluetooth/hci_core.c         |    2 +-
>  2 files changed, 1 insertion(+), 10 deletions(-)

Acked-by: Marcel Holtmann <marcel@holtmann.org>

Regards

Marcel



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCHv2] Bluetooth: Remove unneeded zero init
  2012-08-31 13:39   ` [PATCHv2] " Andrei Emeltchenko
  2012-08-31 16:20     ` Marcel Holtmann
@ 2012-08-31 17:55     ` Gustavo Padovan
  1 sibling, 0 replies; 5+ messages in thread
From: Gustavo Padovan @ 2012-08-31 17:55 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

Hi Andrei,

* Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com> [2012-08-31 16:39:28 +0300]:

> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> 
> hdev is allocated with kzalloc so zero initialization is not needed.
> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
>  include/net/bluetooth/hci_core.h |    9 ---------
>  net/bluetooth/hci_core.c         |    2 +-
>  2 files changed, 1 insertion(+), 10 deletions(-)

Patch has been applied to bluetooth-next. Thanks.

	Gustavo

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-08-31 17:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-30  9:04 [PATCH] Bluetooth: Remove unneeded zero init Andrei Emeltchenko
2012-08-30 15:06 ` Marcel Holtmann
2012-08-31 13:39   ` [PATCHv2] " Andrei Emeltchenko
2012-08-31 16:20     ` Marcel Holtmann
2012-08-31 17:55     ` Gustavo Padovan

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).