Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1439835 > unrolled thread

[PATCH v3 2/7] drm/nouveau/core: make use of new strlcpytolower() function

Started byMarkus Mayer <mmayer@broadcom.com>
First post2016-07-09 00:50 +0200
Last post2016-07-09 00:50 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v3 2/7] drm/nouveau/core: make use of new strlcpytolower() function Markus Mayer <mmayer@broadcom.com> - 2016-07-09 00:50 +0200

#1439835 — [PATCH v3 2/7] drm/nouveau/core: make use of new strlcpytolower() function

FromMarkus Mayer <mmayer@broadcom.com>
Date2016-07-09 00:50 +0200
Subject[PATCH v3 2/7] drm/nouveau/core: make use of new strlcpytolower() function
Message-ID<rSMKR-2Eu-7@gated-at.bofh.it>
Call strlcpytolower() rather than copying the string explicitly and
then walking it to convert it to lowercase.

Signed-off-by: Markus Mayer <mmayer@broadcom.com>
---

The semantics of the new function has changed, so this patch has been
updated since v2 to match the new strlcpy() semantics (no explicit NULL
terminating is required).

See https://patchwork.kernel.org/patch/9215207/ for the previous version.


 drivers/gpu/drm/nouveau/nvkm/core/firmware.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/core/firmware.c b/drivers/gpu/drm/nouveau/nvkm/core/firmware.c
index 34ecd4a..982601e 100644
--- a/drivers/gpu/drm/nouveau/nvkm/core/firmware.c
+++ b/drivers/gpu/drm/nouveau/nvkm/core/firmware.c
@@ -36,16 +36,9 @@ 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));
-	cname[sizeof(cname) - 1] = '\0';
-	i = strlen(cname);
-	while (i) {
-		--i;
-		cname[i] = tolower(cname[i]);
-	}
+	strlcpytolower(cname, device->chip->name, sizeof(cname));
 
 	snprintf(f, sizeof(f), "nvidia/%s/%s.bin", cname, fwname);
 	return request_firmware(fw, f, device->dev);
-- 
2.7.4

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web