Skip to contentSkip to conversation

Add "const" attribute to kfifo input buffer pointers

PATCH Superseded David VomLehn 2 participants 2 messages Aug 14, 2009 Kfifo

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 Add "const" attribute to kfifo input buffer pointers

Change the input buffer arguments for kfifo_put() and __kfifo_put() to have the "const" attribute.

Signed-off-by David VomLehn
include/linux/kfifo.h +3 -2
index 29f62e1..38d4578 100644
@@ -38,7 +38,7 @@ extern struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask,
 				 spinlock_t *lock);
 extern void kfifo_free(struct kfifo *fifo);
 extern unsigned int __kfifo_put(struct kfifo *fifo,
-				unsigned char *buffer, unsigned int len);
+				const unsigned char *buffer, unsigned int len);
 extern unsigned int __kfifo_get(struct kfifo *fifo,
 				unsigned char *buffer, unsigned int len);
 
@@ -77,7 +77,8 @@ static inline void kfifo_reset(struct kfifo *fifo)
  * bytes copied.
  */
 static inline unsigned int kfifo_put(struct kfifo *fifo,
-				     unsigned char *buffer, unsigned int len)
+				     const unsigned char *buffer,
+				     unsigned int len)
 {
 	unsigned long flags;
 	unsigned int ret;
kernel/kfifo.c +1 -1
index 26539e3..1082952 100644
@@ -117,7 +117,7 @@ EXPORT_SYMBOL(kfifo_free);
  * writer, you don't need extra locking to use these functions.
  */
 unsigned int __kfifo_put(struct kfifo *fifo,
-			 unsigned char *buffer, unsigned int len)
+			 const unsigned char *buffer, unsigned int len)
 {
 	unsigned int l;
 
#1 lore raw

Re: kfifo: Add "const" attribute to kfifo input buffer pointers

Quoted 3 lines · David VomLehn

Change the input buffer arguments for kfifo_put() and __kfifo_put() to have the "const" attribute.

Alan Cox already beat you to this one, I have a patch in my tree from him that does this.

thanks,

greg k-h