@@ -58,23 +58,22 @@ EXPORT_SYMBOL(lockref_get);
58
58
* @lockref: pointer to lockref structure
59
59
* Return: 1 if count updated successfully or 0 if count was zero
60
60
*/
61
- int lockref_get_not_zero (struct lockref * lockref )
61
+ bool lockref_get_not_zero (struct lockref * lockref )
62
62
{
63
- int retval ;
63
+ bool retval = false ;
64
64
65
65
CMPXCHG_LOOP (
66
66
new .count ++ ;
67
67
if (old .count <= 0 )
68
- return 0 ;
68
+ return false ;
69
69
,
70
- return 1 ;
70
+ return true ;
71
71
);
72
72
73
73
spin_lock (& lockref -> lock );
74
- retval = 0 ;
75
74
if (lockref -> count > 0 ) {
76
75
lockref -> count ++ ;
77
- retval = 1 ;
76
+ retval = true ;
78
77
}
79
78
spin_unlock (& lockref -> lock );
80
79
return retval ;
@@ -106,22 +105,22 @@ EXPORT_SYMBOL(lockref_put_return);
106
105
* @lockref: pointer to lockref structure
107
106
* Return: 1 if count updated successfully or 0 if count <= 1 and lock taken
108
107
*/
109
- int lockref_put_or_lock (struct lockref * lockref )
108
+ bool lockref_put_or_lock (struct lockref * lockref )
110
109
{
111
110
CMPXCHG_LOOP (
112
111
new .count -- ;
113
112
if (old .count <= 1 )
114
113
break ;
115
114
,
116
- return 1 ;
115
+ return true ;
117
116
);
118
117
119
118
spin_lock (& lockref -> lock );
120
119
if (lockref -> count <= 1 )
121
- return 0 ;
120
+ return false ;
122
121
lockref -> count -- ;
123
122
spin_unlock (& lockref -> lock );
124
- return 1 ;
123
+ return true ;
125
124
}
126
125
EXPORT_SYMBOL (lockref_put_or_lock );
127
126
@@ -141,23 +140,22 @@ EXPORT_SYMBOL(lockref_mark_dead);
141
140
* @lockref: pointer to lockref structure
142
141
* Return: 1 if count updated successfully or 0 if lockref was dead
143
142
*/
144
- int lockref_get_not_dead (struct lockref * lockref )
143
+ bool lockref_get_not_dead (struct lockref * lockref )
145
144
{
146
- int retval ;
145
+ bool retval = false ;
147
146
148
147
CMPXCHG_LOOP (
149
148
new .count ++ ;
150
149
if (old .count < 0 )
151
- return 0 ;
150
+ return false ;
152
151
,
153
- return 1 ;
152
+ return true ;
154
153
);
155
154
156
155
spin_lock (& lockref -> lock );
157
- retval = 0 ;
158
156
if (lockref -> count >= 0 ) {
159
157
lockref -> count ++ ;
160
- retval = 1 ;
158
+ retval = true ;
161
159
}
162
160
spin_unlock (& lockref -> lock );
163
161
return retval ;
0 commit comments