[PATCH v2 2/7] drm/nouveau/core: make use of new strncpytolower() function
Markus Mayer
mmayer at broadcom.com
Tue Jul 5 20:47:06 UTC 2016
Call strncpytolower() rather than copying the string explicitly and
then walking it to convert it to lowercase.
Signed-off-by: Markus Mayer <mmayer at broadcom.com>
---
drivers/gpu/drm/nouveau/nvkm/core/firmware.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/firmware.c b/drivers/gpu/drm/nouveau/nvkm/core/firmware.c
index 34ecd4a..6f3314f 100644
--- a/drivers/gpu/drm/nouveau/nvkm/core/firmware.c
+++ b/drivers/gpu/drm/nouveau/nvkm/core/firmware.c
@@ -36,16 +36,10 @@ nvkm_firmware_get(struct nvkm_device *device, const char *fwname,
{
char f[64];
char cname[16];
- int i;
/* Convert device name to lowercase */
- strncpy(cname, device->chip->name, sizeof(cname));
+ strncpytolower(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);
return request_firmware(fw, f, device->dev);
--
2.7.4
More information about the dri-devel
mailing list