Return-Path: MIME-Version: 1.0 In-Reply-To: <20140312114203.GD7489@localhost.P-661HNU-F1> References: <1394406363-6751-1-git-send-email-lukasz.rymanowski@tieto.com> <1394406363-6751-5-git-send-email-lukasz.rymanowski@tieto.com> <20140312114203.GD7489@localhost.P-661HNU-F1> Date: Fri, 14 Mar 2014 16:57:24 +0100 Message-ID: Subject: Re: [PATCH v2 04/10] emulator: Add handling inquiry number of responses From: Lukasz Rymanowski To: Lukasz Rymanowski , "linux-bluetooth@vger.kernel.org" Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-bluetooth-owner@vger.kernel.org List-ID: Hi Johan, On 12 March 2014 12:42, Johan Hedberg wrote: > Hi Lukasz, > > On Mon, Mar 10, 2014, Lukasz Rymanowski wrote: >> @@ -769,17 +772,22 @@ static bool inquiry_callback(void *user_data) >> } >> } >> >> - if (i == MAX_BTDEV_ENTRIES) { >> - struct bt_hci_evt_inquiry_complete ic; >> - >> - ic.status = BT_HCI_ERR_SUCCESS; >> - send_event(btdev, BT_HCI_EVT_INQUIRY_COMPLETE, &ic, sizeof(ic)); >> + /* Check if we sent already required amount of responses*/ >> + if (data->num_resp && data->sent_count == data->num_resp) >> + goto finish; >> >> - btdev->inquiry_id = 0; >> - return false; >> - } >> + if (i == MAX_BTDEV_ENTRIES) >> + goto finish; >> >> return true; >> + >> +finish: >> + /* Note that destroy will be called */ >> + ic.status = BT_HCI_ERR_SUCCESS; >> + send_event(btdev, BT_HCI_EVT_INQUIRY_COMPLETE, &ic, sizeof(ic)); >> + >> + btdev->inquiry_id = 0; >> + return false; >> } > > I know you're just moving it around from the first patch but isn't the > btdev->inquiry_id = unnecessary here since you're doing the same in the > destroy function which gets called as soon as you return false? > Good catch, will remove it. > Johan Lukasz