* [PATCH] Bluetooth: Remove redundant hdev->parent field
@ 2012-03-09 14:53 David Herrmann
2012-03-09 17:12 ` Marcel Holtmann
2012-03-16 15:26 ` Johan Hedberg
0 siblings, 2 replies; 3+ messages in thread
From: David Herrmann @ 2012-03-09 14:53 UTC (permalink / raw)
To: linux-bluetooth; +Cc: marcel, padovan, David Herrmann
We initialize the "struct device" in hci_alloc_dev() for a long time now
so we can access hdev->dev.parent directly. Hence, we can drop the
temporary field hdev->parent which is used in no other place than
hci_add_sysfs().
SET_HCIDEV_DEV() is never called after registering a device by the drivers
so we do not overwrite internal device-state. Furthermore, hdev->dev is
initialized to 0 by kzalloc() inside hci_alloc_dev() so the default
behavior with dev.parent = NULL is kept.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
---
drivers/bluetooth/hci_ldisc.c | 2 +-
include/net/bluetooth/hci_core.h | 3 +--
net/bluetooth/hci_sysfs.c | 1 -
3 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index fd5adb4..2f57b05 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -388,7 +388,7 @@ static int hci_uart_register_dev(struct hci_uart *hu)
hdev->close = hci_uart_close;
hdev->flush = hci_uart_flush;
hdev->send = hci_uart_send_frame;
- hdev->parent = hu->tty->dev;
+ SET_HCIDEV_DEV(hdev, hu->tty->dev);
if (test_bit(HCI_UART_RAW_DEVICE, &hu->hdev_flags))
set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks);
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index daefaac..edf2fd7 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -263,7 +263,6 @@ struct hci_dev {
struct dentry *debugfs;
- struct device *parent;
struct device dev;
struct rfkill *rfkill;
@@ -708,7 +707,7 @@ void hci_conn_init_sysfs(struct hci_conn *conn);
void hci_conn_add_sysfs(struct hci_conn *conn);
void hci_conn_del_sysfs(struct hci_conn *conn);
-#define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->parent = (pdev))
+#define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->dev.parent = (pdev))
/* ----- LMP capabilities ----- */
#define lmp_rswitch_capable(dev) ((dev)->features[0] & LMP_RSWITCH)
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index bc15429..60b93d8 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -533,7 +533,6 @@ int hci_add_sysfs(struct hci_dev *hdev)
BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus);
- dev->parent = hdev->parent;
dev_set_name(dev, "%s", hdev->name);
err = device_add(dev);
--
1.7.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: Remove redundant hdev->parent field
2012-03-09 14:53 [PATCH] Bluetooth: Remove redundant hdev->parent field David Herrmann
@ 2012-03-09 17:12 ` Marcel Holtmann
2012-03-16 15:26 ` Johan Hedberg
1 sibling, 0 replies; 3+ messages in thread
From: Marcel Holtmann @ 2012-03-09 17:12 UTC (permalink / raw)
To: David Herrmann; +Cc: linux-bluetooth, padovan
Hi David,
> We initialize the "struct device" in hci_alloc_dev() for a long time now
> so we can access hdev->dev.parent directly. Hence, we can drop the
> temporary field hdev->parent which is used in no other place than
> hci_add_sysfs().
>
> SET_HCIDEV_DEV() is never called after registering a device by the drivers
> so we do not overwrite internal device-state. Furthermore, hdev->dev is
> initialized to 0 by kzalloc() inside hci_alloc_dev() so the default
> behavior with dev.parent = NULL is kept.
>
> Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
> ---
> drivers/bluetooth/hci_ldisc.c | 2 +-
> include/net/bluetooth/hci_core.h | 3 +--
> net/bluetooth/hci_sysfs.c | 1 -
> 3 files changed, 2 insertions(+), 4 deletions(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: Remove redundant hdev->parent field
2012-03-09 14:53 [PATCH] Bluetooth: Remove redundant hdev->parent field David Herrmann
2012-03-09 17:12 ` Marcel Holtmann
@ 2012-03-16 15:26 ` Johan Hedberg
1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2012-03-16 15:26 UTC (permalink / raw)
To: David Herrmann; +Cc: linux-bluetooth, marcel, padovan
Hi David,
On Fri, Mar 09, 2012, David Herrmann wrote:
> We initialize the "struct device" in hci_alloc_dev() for a long time now
> so we can access hdev->dev.parent directly. Hence, we can drop the
> temporary field hdev->parent which is used in no other place than
> hci_add_sysfs().
>
> SET_HCIDEV_DEV() is never called after registering a device by the drivers
> so we do not overwrite internal device-state. Furthermore, hdev->dev is
> initialized to 0 by kzalloc() inside hci_alloc_dev() so the default
> behavior with dev.parent = NULL is kept.
>
> Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
> ---
> drivers/bluetooth/hci_ldisc.c | 2 +-
> include/net/bluetooth/hci_core.h | 3 +--
> net/bluetooth/hci_sysfs.c | 1 -
> 3 files changed, 2 insertions(+), 4 deletions(-)
Applied to my bluetooth-next tree. Thanks.
Johan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-16 15:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-09 14:53 [PATCH] Bluetooth: Remove redundant hdev->parent field David Herrmann
2012-03-09 17:12 ` Marcel Holtmann
2012-03-16 15:26 ` Johan Hedberg
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).