Commit 33bcb4c3 authored by Alexandre Courbot's avatar Alexandre Courbot Committed by Ben Skeggs

drm/nouveau/gr/gf100: use the nvkm_firmware functions

Use the nvkm_firmware_* functions when loading external firmware to
avoid duplicate code.
Signed-off-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 046fdb2a
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <core/client.h> #include <core/client.h>
#include <core/option.h> #include <core/option.h>
#include <core/firmware.h>
#include <subdev/fb.h> #include <subdev/fb.h>
#include <subdev/mc.h> #include <subdev/mc.h>
#include <subdev/pmu.h> #include <subdev/pmu.h>
...@@ -1720,22 +1721,9 @@ gf100_gr_ctor_fw(struct gf100_gr *gr, const char *fwname, ...@@ -1720,22 +1721,9 @@ gf100_gr_ctor_fw(struct gf100_gr *gr, const char *fwname,
struct nvkm_subdev *subdev = &gr->base.engine.subdev; struct nvkm_subdev *subdev = &gr->base.engine.subdev;
struct nvkm_device *device = subdev->device; struct nvkm_device *device = subdev->device;
const struct firmware *fw; const struct firmware *fw;
char f[64];
char cname[16];
int ret; int ret;
int i;
/* Convert device name to lowercase */
strncpy(cname, device->chip->name, sizeof(cname));
cname[sizeof(cname) - 1] = '\0';
i = strlen(cname);
while (i) {
--i;
cname[i] = tolower(cname[i]);
}
snprintf(f, sizeof(f), "nvidia/%s/%s.bin", cname, fwname); ret = nvkm_firmware_get(device, fwname, &fw);
ret = request_firmware(&fw, f, device->dev);
if (ret) { if (ret) {
nvkm_error(subdev, "failed to load %s\n", fwname); nvkm_error(subdev, "failed to load %s\n", fwname);
return ret; return ret;
...@@ -1743,7 +1731,7 @@ gf100_gr_ctor_fw(struct gf100_gr *gr, const char *fwname, ...@@ -1743,7 +1731,7 @@ gf100_gr_ctor_fw(struct gf100_gr *gr, const char *fwname,
fuc->size = fw->size; fuc->size = fw->size;
fuc->data = kmemdup(fw->data, fuc->size, GFP_KERNEL); fuc->data = kmemdup(fw->data, fuc->size, GFP_KERNEL);
release_firmware(fw); nvkm_firmware_put(fw);
return (fuc->data != NULL) ? 0 : -ENOMEM; return (fuc->data != NULL) ? 0 : -ENOMEM;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment