lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1444906224-3582-1-git-send-email-laurent@vivier.eu>
Date:	Thu, 15 Oct 2015 12:50:24 +0200
From:	Laurent Vivier <laurent@...ier.eu>
To:	airlied@...hat.com
Cc:	bskeggs@...hat.com, dri-devel@...ts.freedesktop.org,
	linux-kernel@...r.kernel.org, Laurent Vivier <laurent@...ier.eu>,
	imirkin@...m.mit.edu
Subject: [PATCH] nouveau,openfirmware: remove useless of_size function

On of_init(), we store the size given by the openfirmware in bios->size,
this allows to remove of_size that is only used by openfirmware interface.
As bios->size is the size of available data in bios->data, we must
copy all data to bios->data.

Tested on PowerMac G5 with 64bit kernel and a NV43 card (GeForce 6600 LE).

CC: imirkin@...m.mit.edu
Signed-off-by: Laurent Vivier <laurent@...ier.eu>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/bios/priv.h     |  1 -
 drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c   |  2 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c | 16 ++++++----------
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/priv.h b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/priv.h
index 212800e..7b026ce 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/priv.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/priv.h
@@ -8,7 +8,6 @@ struct nvbios_source {
 	void *(*init)(struct nvkm_bios *, const char *);
 	void  (*fini)(void *);
 	u32   (*read)(void *, u32 offset, u32 length, struct nvkm_bios *);
-	u32   (*size)(void *);
 	bool rw;
 	bool ignore_checksum;
 	bool no_pcir;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c
index b2557e8..44e8525 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c
@@ -58,7 +58,7 @@ shadow_image(struct nvkm_bios *bios, int idx, u32 offset, struct shadow *mthd)
 	if (mthd->func->no_pcir) {
 		image.base = 0;
 		image.type = 0;
-		image.size = mthd->func->size(mthd->data);
+		image.size = bios->size;
 		image.last = 1;
 	} else {
 		if (!shadow_fetch(bios, mthd, offset + 0x1000)) {
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c
index 4bf486b..6e4a863 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c
@@ -36,19 +36,11 @@ of_read(void *data, u32 offset, u32 length, struct nvkm_bios *bios)
 	struct priv *priv = data;
 	if (offset < priv->size) {
 		length = min_t(u32, length, priv->size - offset);
-		memcpy_fromio(bios->data + offset, priv->data + offset, length);
 		return length;
 	}
 	return 0;
 }
 
-static u32
-of_size(void *data)
-{
-	struct priv *priv = data;
-	return priv->size;
-}
-
 static void *
 of_init(struct nvkm_bios *bios, const char *name)
 {
@@ -60,8 +52,13 @@ of_init(struct nvkm_bios *bios, const char *name)
 		return ERR_PTR(-ENODEV);
 	if (!(priv = kzalloc(sizeof(*priv), GFP_KERNEL)))
 		return ERR_PTR(-ENOMEM);
-	if ((priv->data = of_get_property(dn, "NVDA,BMP", &priv->size)))
+	priv->data = of_get_property(dn, "NVDA,BMP", &priv->size);
+	if (priv->data) {
+		bios->size = priv->size;
+		bios->data = kzalloc(bios->size, GFP_KERNEL);
+		memcpy(bios->data, priv->data, bios->size);
 		return priv;
+	}
 	kfree(priv);
 	return ERR_PTR(-EINVAL);
 }
@@ -72,7 +69,6 @@ nvbios_of = {
 	.init = of_init,
 	.fini = (void(*)(void *))kfree,
 	.read = of_read,
-	.size = of_size,
 	.rw = false,
 	.ignore_checksum = true,
 	.no_pcir = true,
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ