Hi Jakub, On Sat, Nov 22, 2014, Jakub Pawlowski wrote: > This commit extract generic_start_discovery and generic_stop_discovery > in preparation for start and stop service discovery. The reason behind > that is that both functions will share big part of code, and it would > be much easier to maintain just one generic method. > > Signed-off-by: Jakub Pawlowski <jpawlowski@xxxxxxxxxx> > --- > net/bluetooth/mgmt.c | 89 +++++++++++++++++++++++++++++++++------------------- > 1 file changed, 56 insertions(+), 33 deletions(-) People's dislike of these generic* functions was previously pointed out but no good options were proposed, so let me give a try: Considering that we don't allow multiple concurrent stop or start discovery operations (the mgmt commands will return "busy" errors), couldn't we simply look up whatever pending start/discovery command there is and then use that to derive our response? I.e. instead of a single mgmt_pending_find (which we anyway need to do) there'd potentially be two such calls. Regarding Stop Service Discovery, I'm starting to doubt whether the whole thing is needed at all. It's exactly the same as Stop Discovery and you don't even attempt to check that the Stop Discovery/Stop Service Discovery matches the actual ongoing discovery type (i.e. your code would allow stopping a normal discovery with Stop Service Discovery and vice versa). So I'd propose to just drop the new method and reuse the existing Stop Discovery to stop either one of these two types. Johan -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html