* [PATCH v1] Bluetooth: hci_sync: Remove redundant func definition
@ 2022-07-14 4:54 Zijun Hu
2022-07-14 20:52 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 5+ messages in thread
From: Zijun Hu @ 2022-07-14 4:54 UTC (permalink / raw)
To: marcel, johan.hedberg, luiz.dentz, davem, edumazet, kuba, pabeni,
luiz.von.dentz, quic_zijuhu
Cc: linux-kernel, linux-bluetooth, linux-arm-msm, netdev
both hci_request.c and hci_sync.c have the same definition
for disconnected_accept_list_entries(), so remove a redundant
copy.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
net/bluetooth/hci_request.c | 2 +-
net/bluetooth/hci_request.h | 2 ++
net/bluetooth/hci_sync.c | 18 ------------------
3 files changed, 3 insertions(+), 19 deletions(-)
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index 635cc5fb451e..38e6c66a3327 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -1784,7 +1784,7 @@ int hci_update_random_address(struct hci_request *req, bool require_privacy,
return 0;
}
-static bool disconnected_accept_list_entries(struct hci_dev *hdev)
+bool disconnected_accept_list_entries(struct hci_dev *hdev)
{
struct bdaddr_list *b;
diff --git a/net/bluetooth/hci_request.h b/net/bluetooth/hci_request.h
index 7f8df258e295..e80b500878d9 100644
--- a/net/bluetooth/hci_request.h
+++ b/net/bluetooth/hci_request.h
@@ -120,6 +120,8 @@ void __hci_req_update_scan(struct hci_request *req);
int hci_update_random_address(struct hci_request *req, bool require_privacy,
bool use_rpa, u8 *own_addr_type);
+bool disconnected_accept_list_entries(struct hci_dev *hdev);
+
int hci_abort_conn(struct hci_conn *conn, u8 reason);
void __hci_abort_conn(struct hci_request *req, struct hci_conn *conn,
u8 reason);
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 212b0cdb25f5..99ffac6c5e8c 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -2419,24 +2419,6 @@ int hci_write_fast_connectable_sync(struct hci_dev *hdev, bool enable)
return err;
}
-static bool disconnected_accept_list_entries(struct hci_dev *hdev)
-{
- struct bdaddr_list *b;
-
- list_for_each_entry(b, &hdev->accept_list, list) {
- struct hci_conn *conn;
-
- conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &b->bdaddr);
- if (!conn)
- return true;
-
- if (conn->state != BT_CONNECTED && conn->state != BT_CONFIG)
- return true;
- }
-
- return false;
-}
-
static int hci_write_scan_enable_sync(struct hci_dev *hdev, u8 val)
{
return __hci_cmd_sync_status(hdev, HCI_OP_WRITE_SCAN_ENABLE,
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1] Bluetooth: hci_sync: Remove redundant func definition
2022-07-14 4:54 [PATCH v1] Bluetooth: hci_sync: Remove redundant func definition Zijun Hu
@ 2022-07-14 20:52 ` Luiz Augusto von Dentz
2022-07-15 2:12 ` quic_zijuhu
0 siblings, 1 reply; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2022-07-14 20:52 UTC (permalink / raw)
To: Zijun Hu
Cc: Marcel Holtmann, Johan Hedberg, David Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Luiz Augusto Von Dentz,
Linux Kernel Mailing List, linux-bluetooth, linux-arm-msm,
open list:NETWORKING [GENERAL]
Hi Zijun,
On Wed, Jul 13, 2022 at 9:54 PM Zijun Hu <quic_zijuhu@quicinc.com> wrote:
>
> both hci_request.c and hci_sync.c have the same definition
> for disconnected_accept_list_entries(), so remove a redundant
> copy.
>
> Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
> ---
> net/bluetooth/hci_request.c | 2 +-
> net/bluetooth/hci_request.h | 2 ++
> net/bluetooth/hci_sync.c | 18 ------------------
> 3 files changed, 3 insertions(+), 19 deletions(-)
We are actually deprecating hci_request functions in favor of hci_sync
ones so this is going in the opposite direction.
> diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
> index 635cc5fb451e..38e6c66a3327 100644
> --- a/net/bluetooth/hci_request.c
> +++ b/net/bluetooth/hci_request.c
> @@ -1784,7 +1784,7 @@ int hci_update_random_address(struct hci_request *req, bool require_privacy,
> return 0;
> }
>
> -static bool disconnected_accept_list_entries(struct hci_dev *hdev)
> +bool disconnected_accept_list_entries(struct hci_dev *hdev)
> {
> struct bdaddr_list *b;
>
> diff --git a/net/bluetooth/hci_request.h b/net/bluetooth/hci_request.h
> index 7f8df258e295..e80b500878d9 100644
> --- a/net/bluetooth/hci_request.h
> +++ b/net/bluetooth/hci_request.h
> @@ -120,6 +120,8 @@ void __hci_req_update_scan(struct hci_request *req);
> int hci_update_random_address(struct hci_request *req, bool require_privacy,
> bool use_rpa, u8 *own_addr_type);
>
> +bool disconnected_accept_list_entries(struct hci_dev *hdev);
> +
> int hci_abort_conn(struct hci_conn *conn, u8 reason);
> void __hci_abort_conn(struct hci_request *req, struct hci_conn *conn,
> u8 reason);
> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
> index 212b0cdb25f5..99ffac6c5e8c 100644
> --- a/net/bluetooth/hci_sync.c
> +++ b/net/bluetooth/hci_sync.c
> @@ -2419,24 +2419,6 @@ int hci_write_fast_connectable_sync(struct hci_dev *hdev, bool enable)
> return err;
> }
>
> -static bool disconnected_accept_list_entries(struct hci_dev *hdev)
> -{
> - struct bdaddr_list *b;
> -
> - list_for_each_entry(b, &hdev->accept_list, list) {
> - struct hci_conn *conn;
> -
> - conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &b->bdaddr);
> - if (!conn)
> - return true;
> -
> - if (conn->state != BT_CONNECTED && conn->state != BT_CONFIG)
> - return true;
> - }
> -
> - return false;
> -}
> -
> static int hci_write_scan_enable_sync(struct hci_dev *hdev, u8 val)
> {
> return __hci_cmd_sync_status(hdev, HCI_OP_WRITE_SCAN_ENABLE,
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
>
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] Bluetooth: hci_sync: Remove redundant func definition
2022-07-14 20:52 ` Luiz Augusto von Dentz
@ 2022-07-15 2:12 ` quic_zijuhu
2022-07-15 4:03 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 5+ messages in thread
From: quic_zijuhu @ 2022-07-15 2:12 UTC (permalink / raw)
To: Luiz Augusto von Dentz
Cc: Marcel Holtmann, Johan Hedberg, David Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Luiz Augusto Von Dentz,
Linux Kernel Mailing List, linux-bluetooth, linux-arm-msm,
open list:NETWORKING [GENERAL]
On 7/15/2022 4:52 AM, Luiz Augusto von Dentz wrote:
> Hi Zijun,
>
> On Wed, Jul 13, 2022 at 9:54 PM Zijun Hu <quic_zijuhu@quicinc.com> wrote:
>>
>> both hci_request.c and hci_sync.c have the same definition
>> for disconnected_accept_list_entries(), so remove a redundant
>> copy.
>>
>> Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
>> ---
>> net/bluetooth/hci_request.c | 2 +-
>> net/bluetooth/hci_request.h | 2 ++
>> net/bluetooth/hci_sync.c | 18 ------------------
>> 3 files changed, 3 insertions(+), 19 deletions(-)
>
> We are actually deprecating hci_request functions in favor of hci_sync
> ones so this is going in the opposite direction.
>
should remove disconnected_accept_list_entries() definition within hci_request.c instead of
hci_sync.c, right?
>> diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
>> index 635cc5fb451e..38e6c66a3327 100644
>> --- a/net/bluetooth/hci_request.c
>> +++ b/net/bluetooth/hci_request.c
>> @@ -1784,7 +1784,7 @@ int hci_update_random_address(struct hci_request *req, bool require_privacy,
>> return 0;
>> }
>>
>> -static bool disconnected_accept_list_entries(struct hci_dev *hdev)
>> +bool disconnected_accept_list_entries(struct hci_dev *hdev)
>> {
>> struct bdaddr_list *b;
>>
>> diff --git a/net/bluetooth/hci_request.h b/net/bluetooth/hci_request.h
>> index 7f8df258e295..e80b500878d9 100644
>> --- a/net/bluetooth/hci_request.h
>> +++ b/net/bluetooth/hci_request.h
>> @@ -120,6 +120,8 @@ void __hci_req_update_scan(struct hci_request *req);
>> int hci_update_random_address(struct hci_request *req, bool require_privacy,
>> bool use_rpa, u8 *own_addr_type);
>>
>> +bool disconnected_accept_list_entries(struct hci_dev *hdev);
>> +
>> int hci_abort_conn(struct hci_conn *conn, u8 reason);
>> void __hci_abort_conn(struct hci_request *req, struct hci_conn *conn,
>> u8 reason);
>> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
>> index 212b0cdb25f5..99ffac6c5e8c 100644
>> --- a/net/bluetooth/hci_sync.c
>> +++ b/net/bluetooth/hci_sync.c
>> @@ -2419,24 +2419,6 @@ int hci_write_fast_connectable_sync(struct hci_dev *hdev, bool enable)
>> return err;
>> }
>>
>> -static bool disconnected_accept_list_entries(struct hci_dev *hdev)
>> -{
>> - struct bdaddr_list *b;
>> -
>> - list_for_each_entry(b, &hdev->accept_list, list) {
>> - struct hci_conn *conn;
>> -
>> - conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &b->bdaddr);
>> - if (!conn)
>> - return true;
>> -
>> - if (conn->state != BT_CONNECTED && conn->state != BT_CONFIG)
>> - return true;
>> - }
>> -
>> - return false;
>> -}
>> -
>> static int hci_write_scan_enable_sync(struct hci_dev *hdev, u8 val)
>> {
>> return __hci_cmd_sync_status(hdev, HCI_OP_WRITE_SCAN_ENABLE,
>> --
>> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
>>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] Bluetooth: hci_sync: Remove redundant func definition
2022-07-15 2:12 ` quic_zijuhu
@ 2022-07-15 4:03 ` Luiz Augusto von Dentz
2022-07-15 7:49 ` quic_zijuhu
0 siblings, 1 reply; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2022-07-15 4:03 UTC (permalink / raw)
To: quic_zijuhu
Cc: Marcel Holtmann, Johan Hedberg, David Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Luiz Augusto Von Dentz,
Linux Kernel Mailing List, linux-bluetooth, linux-arm-msm,
open list:NETWORKING [GENERAL]
Hi Quic_zijuhu,
On Thu, Jul 14, 2022 at 7:12 PM quic_zijuhu <quic_zijuhu@quicinc.com> wrote:
>
> On 7/15/2022 4:52 AM, Luiz Augusto von Dentz wrote:
> > Hi Zijun,
> >
> > On Wed, Jul 13, 2022 at 9:54 PM Zijun Hu <quic_zijuhu@quicinc.com> wrote:
> >>
> >> both hci_request.c and hci_sync.c have the same definition
> >> for disconnected_accept_list_entries(), so remove a redundant
> >> copy.
> >>
> >> Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
> >> ---
> >> net/bluetooth/hci_request.c | 2 +-
> >> net/bluetooth/hci_request.h | 2 ++
> >> net/bluetooth/hci_sync.c | 18 ------------------
> >> 3 files changed, 3 insertions(+), 19 deletions(-)
> >
> > We are actually deprecating hci_request functions in favor of hci_sync
> > ones so this is going in the opposite direction.
> >
> should remove disconnected_accept_list_entries() definition within hci_request.c instead of
> hci_sync.c, right?
Correct
> >> diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
> >> index 635cc5fb451e..38e6c66a3327 100644
> >> --- a/net/bluetooth/hci_request.c
> >> +++ b/net/bluetooth/hci_request.c
> >> @@ -1784,7 +1784,7 @@ int hci_update_random_address(struct hci_request *req, bool require_privacy,
> >> return 0;
> >> }
> >>
> >> -static bool disconnected_accept_list_entries(struct hci_dev *hdev)
> >> +bool disconnected_accept_list_entries(struct hci_dev *hdev)
> >> {
> >> struct bdaddr_list *b;
> >>
> >> diff --git a/net/bluetooth/hci_request.h b/net/bluetooth/hci_request.h
> >> index 7f8df258e295..e80b500878d9 100644
> >> --- a/net/bluetooth/hci_request.h
> >> +++ b/net/bluetooth/hci_request.h
> >> @@ -120,6 +120,8 @@ void __hci_req_update_scan(struct hci_request *req);
> >> int hci_update_random_address(struct hci_request *req, bool require_privacy,
> >> bool use_rpa, u8 *own_addr_type);
> >>
> >> +bool disconnected_accept_list_entries(struct hci_dev *hdev);
> >> +
> >> int hci_abort_conn(struct hci_conn *conn, u8 reason);
> >> void __hci_abort_conn(struct hci_request *req, struct hci_conn *conn,
> >> u8 reason);
> >> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
> >> index 212b0cdb25f5..99ffac6c5e8c 100644
> >> --- a/net/bluetooth/hci_sync.c
> >> +++ b/net/bluetooth/hci_sync.c
> >> @@ -2419,24 +2419,6 @@ int hci_write_fast_connectable_sync(struct hci_dev *hdev, bool enable)
> >> return err;
> >> }
> >>
> >> -static bool disconnected_accept_list_entries(struct hci_dev *hdev)
> >> -{
> >> - struct bdaddr_list *b;
> >> -
> >> - list_for_each_entry(b, &hdev->accept_list, list) {
> >> - struct hci_conn *conn;
> >> -
> >> - conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &b->bdaddr);
> >> - if (!conn)
> >> - return true;
> >> -
> >> - if (conn->state != BT_CONNECTED && conn->state != BT_CONFIG)
> >> - return true;
> >> - }
> >> -
> >> - return false;
> >> -}
> >> -
> >> static int hci_write_scan_enable_sync(struct hci_dev *hdev, u8 val)
> >> {
> >> return __hci_cmd_sync_status(hdev, HCI_OP_WRITE_SCAN_ENABLE,
> >> --
> >> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
> >>
> >
> >
>
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] Bluetooth: hci_sync: Remove redundant func definition
2022-07-15 4:03 ` Luiz Augusto von Dentz
@ 2022-07-15 7:49 ` quic_zijuhu
0 siblings, 0 replies; 5+ messages in thread
From: quic_zijuhu @ 2022-07-15 7:49 UTC (permalink / raw)
To: Luiz Augusto von Dentz
Cc: Marcel Holtmann, Johan Hedberg, David Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Luiz Augusto Von Dentz,
Linux Kernel Mailing List, linux-bluetooth, linux-arm-msm,
open list:NETWORKING [GENERAL]
On 7/15/2022 12:03 PM, Luiz Augusto von Dentz wrote:
> Hi Quic_zijuhu,
>
> On Thu, Jul 14, 2022 at 7:12 PM quic_zijuhu <quic_zijuhu@quicinc.com> wrote:
>>
>> On 7/15/2022 4:52 AM, Luiz Augusto von Dentz wrote:
>>> Hi Zijun,
>>>
>>> On Wed, Jul 13, 2022 at 9:54 PM Zijun Hu <quic_zijuhu@quicinc.com> wrote:
>>>>
>>>> both hci_request.c and hci_sync.c have the same definition
>>>> for disconnected_accept_list_entries(), so remove a redundant
>>>> copy.
>>>>
>>>> Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
>>>> ---
>>>> net/bluetooth/hci_request.c | 2 +-
>>>> net/bluetooth/hci_request.h | 2 ++
>>>> net/bluetooth/hci_sync.c | 18 ------------------
>>>> 3 files changed, 3 insertions(+), 19 deletions(-)
>>>
>>> We are actually deprecating hci_request functions in favor of hci_sync
>>> ones so this is going in the opposite direction.
>>>
>> should remove disconnected_accept_list_entries() definition within hci_request.c instead of
>> hci_sync.c, right?
>
> Correct
>
thank you for your suggestion, correct within v4 sent, could you have a code review again?
>>>> diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
>>>> index 635cc5fb451e..38e6c66a3327 100644
>>>> --- a/net/bluetooth/hci_request.c
>>>> +++ b/net/bluetooth/hci_request.c
>>>> @@ -1784,7 +1784,7 @@ int hci_update_random_address(struct hci_request *req, bool require_privacy,
>>>> return 0;
>>>> }
>>>>
>>>> -static bool disconnected_accept_list_entries(struct hci_dev *hdev)
>>>> +bool disconnected_accept_list_entries(struct hci_dev *hdev)
>>>> {
>>>> struct bdaddr_list *b;
>>>>
>>>> diff --git a/net/bluetooth/hci_request.h b/net/bluetooth/hci_request.h
>>>> index 7f8df258e295..e80b500878d9 100644
>>>> --- a/net/bluetooth/hci_request.h
>>>> +++ b/net/bluetooth/hci_request.h
>>>> @@ -120,6 +120,8 @@ void __hci_req_update_scan(struct hci_request *req);
>>>> int hci_update_random_address(struct hci_request *req, bool require_privacy,
>>>> bool use_rpa, u8 *own_addr_type);
>>>>
>>>> +bool disconnected_accept_list_entries(struct hci_dev *hdev);
>>>> +
>>>> int hci_abort_conn(struct hci_conn *conn, u8 reason);
>>>> void __hci_abort_conn(struct hci_request *req, struct hci_conn *conn,
>>>> u8 reason);
>>>> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
>>>> index 212b0cdb25f5..99ffac6c5e8c 100644
>>>> --- a/net/bluetooth/hci_sync.c
>>>> +++ b/net/bluetooth/hci_sync.c
>>>> @@ -2419,24 +2419,6 @@ int hci_write_fast_connectable_sync(struct hci_dev *hdev, bool enable)
>>>> return err;
>>>> }
>>>>
>>>> -static bool disconnected_accept_list_entries(struct hci_dev *hdev)
>>>> -{
>>>> - struct bdaddr_list *b;
>>>> -
>>>> - list_for_each_entry(b, &hdev->accept_list, list) {
>>>> - struct hci_conn *conn;
>>>> -
>>>> - conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &b->bdaddr);
>>>> - if (!conn)
>>>> - return true;
>>>> -
>>>> - if (conn->state != BT_CONNECTED && conn->state != BT_CONFIG)
>>>> - return true;
>>>> - }
>>>> -
>>>> - return false;
>>>> -}
>>>> -
>>>> static int hci_write_scan_enable_sync(struct hci_dev *hdev, u8 val)
>>>> {
>>>> return __hci_cmd_sync_status(hdev, HCI_OP_WRITE_SCAN_ENABLE,
>>>> --
>>>> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
>>>>
>>>
>>>
>>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-07-15 7:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-14 4:54 [PATCH v1] Bluetooth: hci_sync: Remove redundant func definition Zijun Hu
2022-07-14 20:52 ` Luiz Augusto von Dentz
2022-07-15 2:12 ` quic_zijuhu
2022-07-15 4:03 ` Luiz Augusto von Dentz
2022-07-15 7:49 ` quic_zijuhu
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).