nouveau: add support for newer kernel interfaces
v2.
- leave client-provided pointer unmodified on sclass_get() failure
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
diff --git a/nouveau/abi16.c b/nouveau/abi16.c
index 46350b1..ee38c0c 100644
--- a/nouveau/abi16.c
+++ b/nouveau/abi16.c
@@ -244,7 +244,8 @@
/* nouveau_object::length is (ab)used to determine whether the
* object is a legacy object (!=0), or a real NVIF object.
*/
- if ((parent->length != 0 && parent->oclass == NOUVEAU_DEVICE_CLASS)) {
+ if ((parent->length != 0 && parent->oclass == NOUVEAU_DEVICE_CLASS) ||
+ (parent->length == 0 && parent->oclass == NV_DEVICE)) {
if (obj->oclass == NOUVEAU_FIFO_CHANNEL_CLASS) {
struct nouveau_device *dev = (void *)parent;
if (dev->chipset < 0xc0)