Deal with varying return type for kref_put in newer kernels.
authorFrank Mori Hess <fmhess@speakeasy.net>
Wed, 23 Nov 2005 12:59:44 +0000 (12:59 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Wed, 23 Nov 2005 12:59:44 +0000 (12:59 +0000)
include/linux/kref.h

index f7a511214939e044abf8934e6903ac90dbedaae0..20d4aa38ac7d8686a5134e9799c7f8ed4db24f5c 100644 (file)
@@ -98,7 +98,16 @@ static inline void KREF_INIT(struct kref *kref, void (*release) (struct kref *kr
 
 static inline int KREF_PUT(struct kref *kref, void (*release) (struct kref *kref))
 {
-       return kref_put(kref, release);
+       int retval;
+       if(atomic_read(&kref->refcount) == 1)
+       {
+               retval = 1;
+       }else
+       {
+               retval = 0;
+       }
+       kref_put(kref, release);
+       return retval;
 }
 
 #endif // LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)