[Prism54-devel] [PATCH] reduce macros in prism54_process_trap_helper
Jens Maurer
Jens.Maurer@gmx.net
Sun, 28 Dec 2003 23:31:19 +0100
This is a multi-part message in MIME format.
--------------000209070203010706050800
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Hello!
The attached patch replaces the SEND_*_EVENT macros in
isl_ioctl.c by proper functions. This redundancy elimination
saves slightly less than 8KB in the resulting prism54.o module
object file.
It also allows for kmalloc() to return NULL, and gracefully
ignores the trap in that case. (As a side note, I don't
think we need GFP_ATOMIC here.)
NOTE: I don't have a WLAN card yet, so I can't test it at
the moment.
Jens Maurer
--------------000209070203010706050800
Content-Type: text/plain;
name="ioctl-send-event.patch"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="ioctl-send-event.patch"
LS0tIGlzbF9pb2N0bC5jLm9sZAlTdW4gRGVjIDI4IDIxOjU2OjEwIDIwMDMKKysrIGlzbF9p
b2N0bC5jCVN1biBEZWMgMjggMjM6MjY6NDQgMjAwMwpAQCAtMjA0NCw1NCArMjA0NCw1MCBA
QAogCiAvKiBUcmFuc2xhdGUgYSBUUkFQIG9pZCBpbnRvIGEgd2lyZWxlc3MgZXZlbnQuIENh
bGxlZCBpbiBpc2xwY2lfbWd0X3JlY2VpdmUuICovCiAKLSNkZWZpbmUgU1RSX0FERChkZXN0
LHNyYyxsZW5ndGgpZG8geyBcCi0JQlVHX09OKChsZW5ndGgpICsgc2l6ZW9mKChzcmMpKS0x
ID4gSVdfQ1VTVE9NX01BWCk7CVwKLQltZW1jcHkoJihkZXN0KVsobGVuZ3RoKV0sIChzcmMp
LCBzaXplb2YoKHNyYykpLTEpO1wKLQkobGVuZ3RoKSArPSBzaXplb2YoKHNyYykpLTE7XAot
CX0gd2hpbGUgKDApCi0KLSNkZWZpbmUgU1RSX0FERF9BRERSRVNTKGRlc3QsYWRkcixsZW5n
dGgpZG8geyBcCi0JaW50IF9pOwlcCi0JQlVHX09OKChsZW5ndGgpICsgMTcg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