[ltp] [PATCH] {RFC} iwlagn: make 'broken' powersaving a module parameter for 3945/4965

Robert Tomsick linux-thinkpad@linux-thinkpad.org
Thu, 25 Mar 2010 22:55:22 +0000


--=-GtHdVzGg3+Spfg42ozsg
Content-Type: multipart/mixed; boundary="=-wNd8ZteXo0vo7XszdVpT"


--=-wNd8ZteXo0vo7XszdVpT
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Hi,

A while back Tino Keitel posted a patch which could re-enable the
powersaving features of the Intel WiFi 4965 cards.  As some of you may
know, the driver's powersaving code was found to be buggy and was
disabled in one of the recent 2.6.3x kernels (I forget which one).  As
it turns out it's not too bad -- IIRC it doesn't handle suspend/resume
properly, but works fine otherwise.

I recently got a chance to do some hacking and have come up with a patch
that adds a new parameter 'allow_broken_ps' to the iwlagn driver.  If
set to '1' this will allow power management to be enabled (same as
Tino's patch), but by default will preserve the (safer) upstream
behavior (i.e. don't allow power management for the 3945/4965.)

I figured that for users who rarely suspend (such as myself) this allows
for a nice way to allow intentional use of the flakier code to save
power, whilst still falling back to the safer behavior by default for
users who wish to use suspend, etc.

I've tested it on my ThinkPad X61s (with a 4965) and have found no
issues, but would appreciate any comments.  It's a pretty small patch,
but I'm still quite new to kernel hacking, so any feedback is
appreciated.

Thanks!
-Rob


--=-wNd8ZteXo0vo7XszdVpT
Content-Disposition: attachment; filename=iwlwifi-add-allow_broken_ps-module-parameter.patch
Content-Type: text/x-patch; name=iwlwifi-add-allow_broken_ps-module-parameter.patch;
	charset=UTF-8
Content-Transfer-Encoding: base64

ZGlmZiAtcnVQTiBsaW51eC0yLjYuMzMtcnRoaW5rL2RyaXZlcnMvbmV0L3dpcmVsZXNzL2l3bHdp
ZmkvaXdsMzk0NS1iYXNlLmMgbGludXgtMi42LjMzLXJ0aGluay1zdGFnaW5nL2RyaXZlcnMvbmV0
L3dpcmVsZXNzL2l3bHdpZmkvaXdsMzk0NS1iYXNlLmMNCi0tLSBsaW51eC0yLjYuMzMtcnRoaW5r
L2RyaX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zGg3+Spfg42ozsg
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEABECAAYFAkur6doACgkQd6gWl6secBIIuQCfargQNGDa9WQcux4YEXPJ2zYm
lGoAnjGhan83qFX3QbUoavLP7eMWFi02
=4TU7
-----END PGP SIGNATURE-----

--=-GtHdVzGg3+Spfg42ozsg--