diff options
author | David Herrmann <dh.herrmann@googlemail.com> | 2012-03-09 09:53:42 -0500 |
---|---|---|
committer | Gustavo Padovan <gustavo@padovan.org> | 2012-05-08 23:41:30 -0400 |
commit | 6935e0f5181644201894f0b7fbe3d8910c18af05 (patch) | |
tree | 5420f01c982898aaac0204d9761b23fc39bcc081 | |
parent | bc3dd33cef001e61da0f71b5d8f918b3dbaa4a94 (diff) |
Bluetooth: Remove redundant hdev->parent field
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>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
-rw-r--r-- | drivers/bluetooth/hci_ldisc.c | 2 | ||||
-rw-r--r-- | include/net/bluetooth/hci_core.h | 3 | ||||
-rw-r--r-- | 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 98a8c05d4f23..e564579a6115 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) | |||
388 | hdev->close = hci_uart_close; | 388 | hdev->close = hci_uart_close; |
389 | hdev->flush = hci_uart_flush; | 389 | hdev->flush = hci_uart_flush; |
390 | hdev->send = hci_uart_send_frame; | 390 | hdev->send = hci_uart_send_frame; |
391 | hdev->parent = hu->tty->dev; | 391 | SET_HCIDEV_DEV(hdev, hu->tty->dev); |
392 | 392 | ||
393 | if (test_bit(HCI_UART_RAW_DEVICE, &hu->hdev_flags)) | 393 | if (test_bit(HCI_UART_RAW_DEVICE, &hu->hdev_flags)) |
394 | set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); | 394 | 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 0eec5dbaee0f..c80a9684a144 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -263,7 +263,6 @@ struct hci_dev { | |||
263 | 263 | ||
264 | struct dentry *debugfs; | 264 | struct dentry *debugfs; |
265 | 265 | ||
266 | struct device *parent; | ||
267 | struct device dev; | 266 | struct device dev; |
268 | 267 | ||
269 | struct rfkill *rfkill; | 268 | struct rfkill *rfkill; |
@@ -709,7 +708,7 @@ void hci_conn_init_sysfs(struct hci_conn *conn); | |||
709 | void hci_conn_add_sysfs(struct hci_conn *conn); | 708 | void hci_conn_add_sysfs(struct hci_conn *conn); |
710 | void hci_conn_del_sysfs(struct hci_conn *conn); | 709 | void hci_conn_del_sysfs(struct hci_conn *conn); |
711 | 710 | ||
712 | #define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->parent = (pdev)) | 711 | #define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->dev.parent = (pdev)) |
713 | 712 | ||
714 | /* ----- LMP capabilities ----- */ | 713 | /* ----- LMP capabilities ----- */ |
715 | #define lmp_rswitch_capable(dev) ((dev)->features[0] & LMP_RSWITCH) | 714 | #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 bc154298979a..60b93d8219ef 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) | |||
533 | 533 | ||
534 | BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); | 534 | BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus); |
535 | 535 | ||
536 | dev->parent = hdev->parent; | ||
537 | dev_set_name(dev, "%s", hdev->name); | 536 | dev_set_name(dev, "%s", hdev->name); |
538 | 537 | ||
539 | err = device_add(dev); | 538 | err = device_add(dev); |