Staging: comedi: Replace kref_put with kref_sub in function
PATCH 1/1 Staging: comedi: Replace kref_put with kref_sub in function
Since, kref_put calls kref_sub and its return value is not used by calls to comedi_buf_map_put, it can be replaced here with kref_sub.
Signed-off-by Vatika Harlalka <[email protected]>
--- drivers/staging/comedi/comedi_buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/comedi_buf.c +1 -1
@@ -157,7 +157,7 @@ void comedi_buf_map_get(struct comedi_buf_map *bm)int comedi_buf_map_put (struct comedi_buf_map *bm) {if (bm) -return kref_put (&bm->refcount, comedi_buf_map_kref_release); +return kref_sub (&bm->refcount,1 , comedi_buf_map_kref_release);return 1 ; }
Signature · 1 line
1.9.1
drivers/staging/comedi/comedi_buf.c void comedi_buf_map_get(struct comedi_buf_map *bm) · line 163
Quoted 11 lines · On Monday 02 March 2015 17:36:55 Vatika Harlalka wrote:
drivers/staging/comedi/comedi_buf.c +1
-1@@ -157,7 +157,7 @@ void comedi_buf_map_get(struct comedi_buf_map *bm)int comedi_buf_map_put (struct comedi_buf_map *bm) {if (bm) -return kref_put (&bm->refcount, comedi_buf_map_kref_release); +return kref_sub (&bm->refcount,1 , comedi_buf_map_kref_release);return 1 ; }
I don't think this is a helpful change: you should only use kref_sub if you subtract more than 1 from the reference, otherwise the kref_put is the right interface already.
Arnd
Alright, thanks :)