Bug 33759 - 49bluetooth hook needs to wait for btusb module to get unused
Summary: 49bluetooth hook needs to wait for btusb module to get unused
Status: RESOLVED WONTFIX
Alias: None
Product: pm-utils
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Richard Hughes
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-31 06:12 UTC by Martin Pitt
Modified: 2018-06-29 19:57 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
patch against git head (1.47 KB, patch)
2011-01-31 06:33 UTC, Martin Pitt
Details | Splinter Review

Description Martin Pitt 2011-01-31 06:12:10 UTC
(Original bug at https://launchpad.net/bugs/698331)

The 49bluetooth hook disables /proc/acpi/ibm/bluetooth but this isn't synchronous, i. e. it doesn't wait until the module usage count actually drops to 0. Due to that, it's impossible to add btusb to SUSPEND_MODULES (on some models/older kernels you need to do that to fix suspend problems), as at that point the module is still in use. To demonstrate that, I added some logging to the hook:

==== before: =====
--- /proc/acpi/ibm/bluetooth ----
status:		enabled
commands:	enable, disable
--- rfkill list ---
0: tpacpi_bluetooth_sw: Bluetooth
	Soft blocked: no
	Hard blocked: no
1: tpacpi_wwan_sw: Wireless WAN
	Soft blocked: no
	Hard blocked: no
2: phy0: Wireless LAN
	Soft blocked: no
	Hard blocked: no
10: hci0: Bluetooth
	Soft blocked: no
	Hard blocked: no
--- lsmod ---
btusb                  18600  2 

=== after writing /proc/acpi/ibm/bluetooth ====
--- /proc/acpi/ibm/bluetooth ----
status:		disabled
commands:	enable, disable
--- rfkill list ---
0: tpacpi_bluetooth_sw: Bluetooth
	Soft blocked: yes
	Hard blocked: no
1: tpacpi_wwan_sw: Wireless WAN
	Soft blocked: no
	Hard blocked: no
2: phy0: Wireless LAN
	Soft blocked: no
	Hard blocked: no
10: hci0: Bluetooth
	Soft blocked: no
	Hard blocked: no
--- lsmod ---
btusb                  18600  2 

As we can see, /proc/acpi/ibm/bluetooth got updated, but both rfkill as well as the module usage count are still active.

=== after sleep 0.5 ====
--- /proc/acpi/ibm/bluetooth ----
status:		disabled
commands:	enable, disable
--- rfkill ---
0: tpacpi_bluetooth_sw: Bluetooth
	Soft blocked: yes
	Hard blocked: no
1: tpacpi_wwan_sw: Wireless WAN
	Soft blocked: no
	Hard blocked: no
2: phy0: Wireless LAN
	Soft blocked: no
	Hard blocked: no
--- lsmod ---
btusb                  18600  0 

Now it disappeared from rfkill and the module usage count dropped to 0.

I'll write a better hook which waits for the module to get unused.
Comment 1 Martin Pitt 2011-01-31 06:33:16 UTC
Created attachment 42750 [details] [review]
patch against git head

What do you think about this?
Comment 2 Adam Jackson 2018-06-29 19:57:20 UTC
pm-utils hasn't been touched in eight years, none of this is likely to get addressed. Closing bugs and disabling the bz product.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.