* [PATCH] Small kernel-api addition
@ 2001-05-10 17:29 John Levon
2001-05-10 18:05 ` David Woodhouse
0 siblings, 1 reply; 3+ messages in thread
From: John Levon @ 2001-05-10 17:29 UTC (permalink / raw)
To: linux-kernel, alan
Clean against 2.4.4-ac6 and 2.4.4
thanks
john
--- Documentation/DocBook/kernel-api.tmpl.old Thu May 10 18:02:05 2001
+++ Documentation/DocBook/kernel-api.tmpl Thu May 10 18:02:57 2001
@@ -41,8 +41,9 @@
!Iinclude/linux/init.h
</sect1>
- <sect1><title>Atomics</title>
+ <sect1><title>Atomic and pointer manipulation</title>
!Iinclude/asm-i386/atomic.h
+!Iinclude/asm-i386/unaligned.h
</sect1>
<sect1><title>Delaying, scheduling, and timer routines</title>
--- include/asm-i386/unaligned.h.old Thu May 10 17:54:28 2001
+++ include/asm-i386/unaligned.h Thu May 10 18:29:11 2001
@@ -9,8 +9,29 @@
* architectures where unaligned accesses aren't as simple.
*/
+/**
+ * get_unaligned - get value from possibly mis-aligned location
+ * @ptr: pointer to value
+ *
+ * This macro should be used for accessing values larger in size than single
+ * bytes at locations that may be improperly aligned, e.g. retrieving a u16
+ * value from a location not u16-aligned.
+ *
+ * Note that unaligned accesses can be very expensive on some architectures.
+ */
#define get_unaligned(ptr) (*(ptr))
+/**
+ * put_unaligned - put value to a possibly mis-aligned location
+ * @val: value to place
+ * @ptr: pointer to location
+ *
+ * This macro should be used for placing values larger in size than single
+ * bytes at locations that may be improperly aligned, e.g. write a u16
+ * value to a location not u16-aligned.
+ *
+ * Note that unaligned accesses can be very expensive on some architectures.
+ */
#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) ))
#endif
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Small kernel-api addition
2001-05-10 17:29 [PATCH] Small kernel-api addition John Levon
@ 2001-05-10 18:05 ` David Woodhouse
2001-05-10 18:38 ` John Levon
0 siblings, 1 reply; 3+ messages in thread
From: David Woodhouse @ 2001-05-10 18:05 UTC (permalink / raw)
To: John Levon; +Cc: linux-kernel, alan
moz@compsoc.man.ac.uk said:
+ * This macro should be used for accessing values larger in size than single
+ * bytes at locations that may be improperly aligned, e.g. retrieving a u16
+ * value from a location not u16-aligned.
I'd suggest s/that may be/that are expected to be/
If it's _expected_, then by all means use {get,put}_unaligned(). If it's
normally going to be aligned, and it _may_ occasionally be otherwise, let
the common case go fast, and let the fixup handle it otherwise.
--
dwmw2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Small kernel-api addition
2001-05-10 18:05 ` David Woodhouse
@ 2001-05-10 18:38 ` John Levon
0 siblings, 0 replies; 3+ messages in thread
From: John Levon @ 2001-05-10 18:38 UTC (permalink / raw)
To: David Woodhouse; +Cc: linux-kernel, alan
On Thu, 10 May 2001, David Woodhouse wrote:
> I'd suggest s/that may be/that are expected to be/
thanks, how about this :
--- Documentation/DocBook/kernel-api.tmpl.old Thu May 10 18:02:05 2001
+++ Documentation/DocBook/kernel-api.tmpl Thu May 10 18:02:57 2001
@@ -41,8 +41,9 @@
!Iinclude/linux/init.h
</sect1>
- <sect1><title>Atomics</title>
+ <sect1><title>Atomic and pointer manipulation</title>
!Iinclude/asm-i386/atomic.h
+!Iinclude/asm-i386/unaligned.h
</sect1>
<sect1><title>Delaying, scheduling, and timer routines</title>
--- include/asm-i386/unaligned.h.old Thu May 10 17:54:28 2001
+++ include/asm-i386/unaligned.h Thu May 10 19:38:55 2001
@@ -9,8 +9,29 @@
* architectures where unaligned accesses aren't as simple.
*/
+/**
+ * get_unaligned - get value from possibly mis-aligned location
+ * @ptr: pointer to value
+ *
+ * This macro should be used for accessing values larger in size than
+ * single bytes at locations that are expected to be improperly aligned,
+ * e.g. retrieving a u16 value from a location not u16-aligned.
+ *
+ * Note that unaligned accesses can be very expensive on some architectures.
+ */
#define get_unaligned(ptr) (*(ptr))
+/**
+ * put_unaligned - put value to a possibly mis-aligned location
+ * @val: value to place
+ * @ptr: pointer to location
+ *
+ * This macro should be used for placing values larger in size than
+ * single bytes at locations that are expected to be improperly aligned,
+ * e.g. writing a u16 value to a location not u16-aligned.
+ *
+ * Note that unaligned accesses can be very expensive on some architectures.
+ */
#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) ))
#endif
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-05-10 18:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-10 17:29 [PATCH] Small kernel-api addition John Levon
2001-05-10 18:05 ` David Woodhouse
2001-05-10 18:38 ` John Levon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox