drm/nv50/kms: use sclass() instead of trial-and-error
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
036a12b681
commit
6af5289e85
1 changed files with 20 additions and 6 deletions
|
@ -66,15 +66,29 @@ static int
|
||||||
nv50_chan_create(struct nvif_object *disp, const u32 *oclass, u8 head,
|
nv50_chan_create(struct nvif_object *disp, const u32 *oclass, u8 head,
|
||||||
void *data, u32 size, struct nv50_chan *chan)
|
void *data, u32 size, struct nv50_chan *chan)
|
||||||
{
|
{
|
||||||
|
const u32 handle = (oclass[0] << 16) | head;
|
||||||
|
u32 sclass[8];
|
||||||
|
int ret, i;
|
||||||
|
|
||||||
|
ret = nvif_object_sclass(disp, sclass, ARRAY_SIZE(sclass));
|
||||||
|
WARN_ON(ret > ARRAY_SIZE(sclass));
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
while (oclass[0]) {
|
while (oclass[0]) {
|
||||||
int ret = nvif_object_init(disp, NULL, (oclass[0] << 16) | head,
|
for (i = 0; i < ARRAY_SIZE(sclass); i++) {
|
||||||
oclass[0], data, size,
|
if (sclass[i] == oclass[0]) {
|
||||||
&chan->user);
|
ret = nvif_object_init(disp, NULL, handle,
|
||||||
if (oclass++, ret == 0) {
|
oclass[0], data, size,
|
||||||
nvif_object_map(&chan->user);
|
&chan->user);
|
||||||
return ret;
|
if (ret == 0)
|
||||||
|
nvif_object_map(&chan->user);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
oclass++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue