Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f02c636 authored by Andre Eisenbach's avatar Andre Eisenbach Committed by Android Partner Code Review
Browse files

Merge "Remove ACL connection reference counting" into m-wireless-dev

parents 546bd393 1b198927
Loading
Loading
Loading
Loading
+11 −12
Original line number Original line Diff line number Diff line
@@ -501,18 +501,9 @@ void btm_acl_update_busy_level (tBTM_BLI_EVENT event)
    {
    {
        case BTM_BLI_ACL_UP_EVT:
        case BTM_BLI_ACL_UP_EVT:
            BTM_TRACE_DEBUG ("BTM_BLI_ACL_UP_EVT");
            BTM_TRACE_DEBUG ("BTM_BLI_ACL_UP_EVT");
            btm_cb.num_acl++;
            break;
            break;
        case BTM_BLI_ACL_DOWN_EVT:
        case BTM_BLI_ACL_DOWN_EVT:
            if (btm_cb.num_acl)
            BTM_TRACE_DEBUG ("BTM_BLI_ACL_DOWN_EVT");
            {
                btm_cb.num_acl--;
                BTM_TRACE_DEBUG ("BTM_BLI_ACL_DOWN_EVT", btm_cb.num_acl);
            }
            else
            {
                BTM_TRACE_ERROR ("BTM_BLI_ACL_DOWN_EVT issued, but num_acl already zero !!!");
            }
            break;
            break;
        case BTM_BLI_PAGE_EVT:
        case BTM_BLI_PAGE_EVT:
            BTM_TRACE_DEBUG ("BTM_BLI_PAGE_EVT");
            BTM_TRACE_DEBUG ("BTM_BLI_PAGE_EVT");
@@ -544,7 +535,7 @@ void btm_acl_update_busy_level (tBTM_BLI_EVENT event)
    if (btm_cb.is_paging || btm_cb.is_inquiry)
    if (btm_cb.is_paging || btm_cb.is_inquiry)
        busy_level = 10;
        busy_level = 10;
    else
    else
        busy_level = (UINT8)btm_cb.num_acl;
        busy_level = BTM_GetNumAclLinks();


    if ((busy_level != btm_cb.busy_level) ||(old_inquiry_state != btm_cb.is_inquiry))
    if ((busy_level != btm_cb.busy_level) ||(old_inquiry_state != btm_cb.is_inquiry))
    {
    {
@@ -1416,7 +1407,15 @@ BOOLEAN BTM_IsAclConnectionUp (BD_ADDR remote_bda, tBT_TRANSPORT transport)
*******************************************************************************/
*******************************************************************************/
UINT16 BTM_GetNumAclLinks (void)
UINT16 BTM_GetNumAclLinks (void)
{
{
    return(UINT16)btm_cb.num_acl;
    uint16_t num_acl = 0;

    for (uint16_t i = 0; i < MAX_L2CAP_LINKS; ++i)
    {
        if (btm_cb.acl_db[i].in_use)
            ++num_acl;
    }

    return num_acl;
}
}


/*******************************************************************************
/*******************************************************************************
+0 −1
Original line number Original line Diff line number Diff line
@@ -836,7 +836,6 @@ typedef struct


    UINT8                   acl_disc_reason;
    UINT8                   acl_disc_reason;
    UINT8                   trace_level;
    UINT8                   trace_level;
    UINT8                   num_acl;    /* num of active ACL links */
    UINT8                   busy_level; /* the current busy level */
    UINT8                   busy_level; /* the current busy level */
    BOOLEAN                 is_paging;  /* TRUE, if paging is in progess */
    BOOLEAN                 is_paging;  /* TRUE, if paging is in progess */
    BOOLEAN                 is_inquiry; /* TRUE, if inquiry is in progess */
    BOOLEAN                 is_inquiry; /* TRUE, if inquiry is in progess */
+3 −4
Original line number Original line Diff line number Diff line
@@ -927,9 +927,9 @@ BOOLEAN btm_pm_device_in_active_or_sniff_mode(void)
    /* The active state is the highest state-includes connected device and sniff mode*/
    /* The active state is the highest state-includes connected device and sniff mode*/


    /* Covers active and sniff modes */
    /* Covers active and sniff modes */
    if (btm_cb.num_acl > 0)
    if (BTM_GetNumAclLinks() > 0)
    {
    {
        BTM_TRACE_DEBUG("btm_pm_device_in_active_or_sniff_mode-acl:%d", btm_cb.num_acl);
        BTM_TRACE_DEBUG("%s - ACL links: %d", __func__, BTM_GetNumAclLinks());
        return TRUE;
        return TRUE;
    }
    }


@@ -937,8 +937,7 @@ BOOLEAN btm_pm_device_in_active_or_sniff_mode(void)
    /* Check BLE states */
    /* Check BLE states */
    if (btm_ble_get_conn_st() != BLE_CONN_IDLE)
    if (btm_ble_get_conn_st() != BLE_CONN_IDLE)
    {
    {
        BTM_TRACE_DEBUG("btm_pm_device_in_active_or_sniff_mode- BLE state: %x",
        BTM_TRACE_DEBUG("%s - BLE state: %x", __func__, btm_ble_get_conn_st());
                        btm_ble_get_conn_st());
        return TRUE;
        return TRUE;
    }
    }
#endif
#endif