drm/nouveau: replace ffsll with __ffs64
authorIlia Mirkin <imirkin@alum.mit.edu>
Sun, 9 Feb 2014 20:51:24 +0000 (15:51 -0500)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 26 Mar 2014 03:59:31 +0000 (13:59 +1000)
The ffsll function is a lot slower than the __ffs64 built-in which
compiles to a single instruction on 64-bit. It's also nice to avoid
custom versions of standard functions. Note that __ffs == ffs - 1.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/core/parent.c
drivers/gpu/drm/nouveau/nouveau_abi16.c

index 313380ce632df1b9f1b9eef0915ef14deade0162..dee5d1235e9bb6701e0b5214da3482d5d334fbfb 100644 (file)
@@ -49,7 +49,7 @@ nouveau_parent_sclass(struct nouveau_object *parent, u16 handle,
 
        mask = nv_parent(parent)->engine;
        while (mask) {
-               int i = ffsll(mask) - 1;
+               int i = __ffs64(mask);
 
                if (nv_iclass(parent, NV_CLIENT_CLASS))
                        engine = nv_engine(nv_client(parent)->device);
index 900fae01793e7884ee8033a11d6c247cbeb36678..b70111711be3b30100e4c25385abfacc9b0a9cff 100644 (file)
@@ -270,8 +270,8 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS)
                return nouveau_abi16_put(abi16, -EINVAL);
 
        /* allocate "abi16 channel" data and make up a handle for it */
-       init->channel = ffsll(~abi16->handles);
-       if (!init->channel--)
+       init->channel = __ffs64(~abi16->handles);
+       if (~abi16->handles == 0)
                return nouveau_abi16_put(abi16, -ENOSPC);
 
        chan = kzalloc(sizeof(*chan), GFP_KERNEL);