[PATCH] nouveau,openfirmware: remove useless of_size function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx
Signed-off-by: Laurent Vivier <laurent@xxxxxxxxx>
---
 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

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux