From: Brian Rogers <brian@xyzw.org>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: linux-bluetooth@vger.kernel.org,
Kay Sievers <kay.sievers@vrfy.org>,
David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH] Wait for child devices to go away before deleting a connection
Date: Wed, 29 Jul 2009 22:24:18 -0700 [thread overview]
Message-ID: <4A712E82.40303@xyzw.org> (raw)
In-Reply-To: <1248925752.28545.260.camel@violet>
Marcel Holtmann wrote:
> Hi Brian,
>
>
>>>>>>> Kay, David, wouldn't be pinning of the parent device here be enough to
>>>>>>> get this done in a clean way?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> If there's a way that the connection can be pinned until the child
>>>>>> devices go away, that definitely sounds cleaner to me.
>>>>>>
>>>>>>
>>>>>>
>>>>> so I pushed some patches to bluetooth-testing tree that should fix this
>>>>> problem. They are not fully tested by me. Please test and report back
>>>>> the results.
>>>>>
>>>>>
>>>>>
>>>> Fails to compile if CONFIG_USB_HIDDEV=y :
>>>>
>>>> ERROR: "hiddev_disconnect" [net/bluetooth/hidp/hidp.ko] undefined!
>>>>
>>>> Ironically, the reference to hiddev_disconnect is fine if hiddev isn't
>>>> enabled because then hiddev.h supplies an empty static inline function.
>>>>
>>>> I'm going to test with a kernel without hiddev for now.
>>>>
>>>>
>>> just take that piece out of the patch. It is not important. I just wanna
>>> now if the uevents are now coming in order.
>>>
>>>
>> I just tried it without hiddev and observed that the input devices go
>> away, but the connection never gets deleted. Then when I turn my mouse
>> back on, bad stuff happens:
>>
>
> I do have a typo here :(
>
> void hci_conn_hold_device(struct hci_conn *conn)
> {
> hci_conn_hold(conn);
>
> atomic_inc(&conn->devref);
> }
> EXPORT_SYMBOL(hci_conn_hold_device);
>
> void hci_conn_put_device(struct hci_conn *conn)
> {
> if (atomic_dec_and_test(&conn->refcnt))
> hci_conn_del_sysfs(conn);
>
> hci_conn_put(conn);
> }
> EXPORT_SYMBOL(hci_conn_put_device);
>
> The atomic_dec_and_test() should operate on conn->devref. Can you change
> that and try again.
>
That got it to work once, but it was apparently a fluke because my the
next two times I tried shutting off my mouse, it caused a complete
system freeze where Alt-SysRq B didn't work.
> Also if that doesn't help, remove the hci_conn_hold() and hci_conn_put()
> from the two functions above and try again.
>
That did the trick. Now I see correct device removal order and I haven't
observed any problems with switching my mouse on and off.
prev parent reply other threads:[~2009-07-30 5:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-20 8:03 [PATCH] Wait for child devices to go away before deleting a connection Brian Rogers
2009-07-20 8:10 ` Marcel Holtmann
2009-07-23 13:25 ` Brian Rogers
2009-07-29 21:12 ` Marcel Holtmann
2009-07-29 22:37 ` Brian Rogers
2009-07-30 2:33 ` Marcel Holtmann
2009-07-30 3:25 ` Brian Rogers
2009-07-30 3:49 ` Marcel Holtmann
2009-07-30 5:24 ` Brian Rogers [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A712E82.40303@xyzw.org \
--to=brian@xyzw.org \
--cc=dwmw2@infradead.org \
--cc=kay.sievers@vrfy.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=marcel@holtmann.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox