diff options
| -rw-r--r-- | include/net/bluetooth/hci_core.h | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 5b924423cf20..3779ea362257 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
| @@ -513,11 +513,15 @@ static inline void __hci_dev_put(struct hci_dev *d) | |||
| 513 | d->destruct(d); | 513 | d->destruct(d); |
| 514 | } | 514 | } |
| 515 | 515 | ||
| 516 | static inline void hci_dev_put(struct hci_dev *d) | 516 | /* |
| 517 | { | 517 | * hci_dev_put and hci_dev_hold are macros to avoid dragging all the |
| 518 | __hci_dev_put(d); | 518 | * overhead of all the modular infrastructure into this header. |
| 519 | module_put(d->owner); | 519 | */ |
| 520 | } | 520 | #define hci_dev_put(d) \ |
| 521 | do { \ | ||
| 522 | __hci_dev_put(d); \ | ||
| 523 | module_put(d->owner); \ | ||
| 524 | } while (0) | ||
| 521 | 525 | ||
| 522 | static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d) | 526 | static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d) |
| 523 | { | 527 | { |
| @@ -525,12 +529,10 @@ static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d) | |||
| 525 | return d; | 529 | return d; |
| 526 | } | 530 | } |
| 527 | 531 | ||
| 528 | static inline struct hci_dev *hci_dev_hold(struct hci_dev *d) | 532 | #define hci_dev_hold(d) \ |
| 529 | { | 533 | ({ \ |
| 530 | if (try_module_get(d->owner)) | 534 | try_module_get(d->owner) ? __hci_dev_hold(d) : NULL; \ |
| 531 | return __hci_dev_hold(d); | 535 | }) |
| 532 | return NULL; | ||
| 533 | } | ||
| 534 | 536 | ||
| 535 | #define hci_dev_lock(d) spin_lock(&d->lock) | 537 | #define hci_dev_lock(d) spin_lock(&d->lock) |
| 536 | #define hci_dev_unlock(d) spin_unlock(&d->lock) | 538 | #define hci_dev_unlock(d) spin_unlock(&d->lock) |
