[Nouveau] [PATCH 04/10] drm/nouveau: constify instances of nouveau_bitfield and nouveau_enum structs

Marcin Slusarz marcin.slusarz at gmail.com
Sun Aug 19 13:59:59 PDT 2012


Signed-off-by: Marcin Slusarz <marcin.slusarz at gmail.com>
---
 drivers/gpu/drm/nouveau/core/engine/copy/nva3.c    |    2 +-
 drivers/gpu/drm/nouveau/core/engine/copy/nvc0.c    |    2 +-
 drivers/gpu/drm/nouveau/core/engine/crypt/nv84.c   |    2 +-
 drivers/gpu/drm/nouveau/core/engine/crypt/nv98.c   |    2 +-
 drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c    |   10 +++++-----
 drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c    |   10 +++++-----
 drivers/gpu/drm/nouveau/core/engine/graph/nv04.c   |    6 +++---
 drivers/gpu/drm/nouveau/core/engine/graph/nv10.c   |    4 ++--
 drivers/gpu/drm/nouveau/core/engine/graph/nv50.c   |   16 ++++++++--------
 drivers/gpu/drm/nouveau/core/include/core/enum.h   |    2 +-
 .../gpu/drm/nouveau/core/include/engine/graph.h    |    8 ++++----
 drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c      |   16 ++++++++--------
 12 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/core/engine/copy/nva3.c b/drivers/gpu/drm/nouveau/core/engine/copy/nva3.c
index fd4ea19..22e99e4 100644
--- a/drivers/gpu/drm/nouveau/core/engine/copy/nva3.c
+++ b/drivers/gpu/drm/nouveau/core/engine/copy/nva3.c
@@ -93,7 +93,7 @@ nva3_copy_cclass = {
  * PCOPY engine/subdev functions
  ******************************************************************************/
 
-static struct nouveau_enum nva3_copy_isr_error_name[] = {
+static const struct nouveau_enum nva3_copy_isr_error_name[] = {
 	{ 0x0001, "ILLEGAL_MTHD" },
 	{ 0x0002, "INVALID_ENUM" },
 	{ 0x0003, "INVALID_BITFIELD" },
diff --git a/drivers/gpu/drm/nouveau/core/engine/copy/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/copy/nvc0.c
index 6835d7d..69ae2d7 100644
--- a/drivers/gpu/drm/nouveau/core/engine/copy/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/copy/nvc0.c
@@ -104,7 +104,7 @@ nvc0_copy1_cclass = {
  * PCOPY engine/subdev functions
  ******************************************************************************/
 
-static struct nouveau_enum nvc0_copy_isr_error_name[] = {
+static const struct nouveau_enum nvc0_copy_isr_error_name[] = {
 	{ 0x0001, "ILLEGAL_MTHD" },
 	{ 0x0002, "INVALID_ENUM" },
 	{ 0x0003, "INVALID_BITFIELD" },
diff --git a/drivers/gpu/drm/nouveau/core/engine/crypt/nv84.c b/drivers/gpu/drm/nouveau/core/engine/crypt/nv84.c
index 67622aa..b0c7d68 100644
--- a/drivers/gpu/drm/nouveau/core/engine/crypt/nv84.c
+++ b/drivers/gpu/drm/nouveau/core/engine/crypt/nv84.c
@@ -122,7 +122,7 @@ nv84_crypt_cclass = {
  * PCRYPT engine/subdev functions
  ******************************************************************************/
 
-static struct nouveau_bitfield nv84_crypt_intr_mask[] = {
+static const struct nouveau_bitfield nv84_crypt_intr_mask[] = {
 	{ 0x00000001, "INVALID_STATE" },
 	{ 0x00000002, "ILLEGAL_MTHD" },
 	{ 0x00000004, "ILLEGAL_CLASS" },
diff --git a/drivers/gpu/drm/nouveau/core/engine/crypt/nv98.c b/drivers/gpu/drm/nouveau/core/engine/crypt/nv98.c
index 9a589d3..a2e7c0c 100644
--- a/drivers/gpu/drm/nouveau/core/engine/crypt/nv98.c
+++ b/drivers/gpu/drm/nouveau/core/engine/crypt/nv98.c
@@ -92,7 +92,7 @@ nv98_crypt_cclass = {
  * PCRYPT engine/subdev functions
  ******************************************************************************/
 
-static struct nouveau_enum nv98_crypt_isr_error_name[] = {
+static const struct nouveau_enum nv98_crypt_isr_error_name[] = {
 	{ 0x0000, "ILLEGAL_MTHD" },
 	{ 0x0001, "INVALID_BITFIELD" },
 	{ 0x0002, "INVALID_ENUM" },
diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c
index 31f5a96..0da6643 100644
--- a/drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/fifo/nvc0.c
@@ -324,7 +324,7 @@ nvc0_fifo_cclass = {
  * PFIFO engine
  ******************************************************************************/
 
-struct nouveau_enum nvc0_fifo_fault_unit[] = {
+static const struct nouveau_enum nvc0_fifo_fault_unit[] = {
 	{ 0x00, "PGRAPH" },
 	{ 0x03, "PEEPHOLE" },
 	{ 0x04, "BAR1" },
@@ -340,7 +340,7 @@ struct nouveau_enum nvc0_fifo_fault_unit[] = {
 	{}
 };
 
-struct nouveau_enum nvc0_fifo_fault_reason[] = {
+static const struct nouveau_enum nvc0_fifo_fault_reason[] = {
 	{ 0x00, "PT_NOT_PRESENT" },
 	{ 0x01, "PT_TOO_SHORT" },
 	{ 0x02, "PAGE_NOT_PRESENT" },
@@ -353,7 +353,7 @@ struct nouveau_enum nvc0_fifo_fault_reason[] = {
 	{}
 };
 
-struct nouveau_enum nvc0_fifo_fault_hubclient[] = {
+static const struct nouveau_enum nvc0_fifo_fault_hubclient[] = {
 	{ 0x01, "PCOPY0" },
 	{ 0x02, "PCOPY1" },
 	{ 0x04, "DISPATCH" },
@@ -371,7 +371,7 @@ struct nouveau_enum nvc0_fifo_fault_hubclient[] = {
 	{}
 };
 
-struct nouveau_enum nvc0_fifo_fault_gpcclient[] = {
+static const struct nouveau_enum nvc0_fifo_fault_gpcclient[] = {
 	{ 0x01, "TEX" },
 	{ 0x0c, "ESETUP" },
 	{ 0x0e, "CTXCTL" },
@@ -379,7 +379,7 @@ struct nouveau_enum nvc0_fifo_fault_gpcclient[] = {
 	{}
 };
 
-struct nouveau_bitfield nvc0_fifo_subfifo_intr[] = {
+static const struct nouveau_bitfield nvc0_fifo_subfifo_intr[] = {
 /*	{ 0x00008000, "" }	seen with null ib push */
 	{ 0x00200000, "ILLEGAL_MTHD" },
 	{ 0x00800000, "EMPTY_SUBC" },
diff --git a/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c b/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c
index b2612b0..04b65ae 100644
--- a/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/fifo/nve0.c
@@ -368,11 +368,11 @@ nve0_fifo_cclass = {
  * PFIFO engine
  ******************************************************************************/
 
-struct nouveau_enum nve0_fifo_fault_unit[] = {
+static const struct nouveau_enum nve0_fifo_fault_unit[] = {
 	{}
 };
 
-struct nouveau_enum nve0_fifo_fault_reason[] = {
+static const struct nouveau_enum nve0_fifo_fault_reason[] = {
 	{ 0x00, "PT_NOT_PRESENT" },
 	{ 0x01, "PT_TOO_SHORT" },
 	{ 0x02, "PAGE_NOT_PRESENT" },
@@ -385,15 +385,15 @@ struct nouveau_enum nve0_fifo_fault_reason[] = {
 	{}
 };
 
-struct nouveau_enum nve0_fifo_fault_hubclient[] = {
+static const struct nouveau_enum nve0_fifo_fault_hubclient[] = {
 	{}
 };
 
-struct nouveau_enum nve0_fifo_fault_gpcclient[] = {
+static const struct nouveau_enum nve0_fifo_fault_gpcclient[] = {
 	{}
 };
 
-struct nouveau_bitfield nve0_fifo_subfifo_intr[] = {
+static const struct nouveau_bitfield nve0_fifo_subfifo_intr[] = {
 	{ 0x00200000, "ILLEGAL_MTHD" },
 	{ 0x00800000, "EMPTY_SUBC" },
 	{}
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nv04.c b/drivers/gpu/drm/nouveau/core/engine/graph/nv04.c
index 267ac60..e41411e 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nv04.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nv04.c
@@ -1213,13 +1213,13 @@ nv04_graph_idle(void *obj)
 	return true;
 }
 
-static struct nouveau_bitfield
+static const struct nouveau_bitfield
 nv04_graph_intr_name[] = {
 	{ NV_PGRAPH_INTR_NOTIFY, "NOTIFY" },
 	{}
 };
 
-static struct nouveau_bitfield
+static const struct nouveau_bitfield
 nv04_graph_nstatus[] = {
 	{ NV04_PGRAPH_NSTATUS_STATE_IN_USE,       "STATE_IN_USE" },
 	{ NV04_PGRAPH_NSTATUS_INVALID_STATE,      "INVALID_STATE" },
@@ -1228,7 +1228,7 @@ nv04_graph_nstatus[] = {
 	{}
 };
 
-struct nouveau_bitfield
+const struct nouveau_bitfield
 nv04_graph_nsource[] = {
 	{ NV03_PGRAPH_NSOURCE_NOTIFICATION,       "NOTIFICATION" },
 	{ NV03_PGRAPH_NSOURCE_DATA_ERROR,         "DATA_ERROR" },
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nv10.c b/drivers/gpu/drm/nouveau/core/engine/graph/nv10.c
index 35c4d71..d3289ef 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nv10.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nv10.c
@@ -1135,13 +1135,13 @@ nv10_graph_tile_prog(struct nouveau_engine *engine, int i)
 	pfifo->start(pfifo, &flags);
 }
 
-struct nouveau_bitfield nv10_graph_intr_name[] = {
+const struct nouveau_bitfield nv10_graph_intr_name[] = {
 	{ NV_PGRAPH_INTR_NOTIFY, "NOTIFY" },
 	{ NV_PGRAPH_INTR_ERROR,  "ERROR"  },
 	{}
 };
 
-struct nouveau_bitfield nv10_graph_nstatus[] = {
+const struct nouveau_bitfield nv10_graph_nstatus[] = {
 	{ NV10_PGRAPH_NSTATUS_STATE_IN_USE,       "STATE_IN_USE" },
 	{ NV10_PGRAPH_NSTATUS_INVALID_STATE,      "INVALID_STATE" },
 	{ NV10_PGRAPH_NSTATUS_BAD_ARGUMENT,       "BAD_ARGUMENT" },
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c b/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c
index 6859514..d425db7 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c
@@ -184,7 +184,7 @@ nv50_graph_tlb_flush(struct nouveau_engine *engine)
 	return 0;
 }
 
-static struct nouveau_bitfield nv50_pgraph_status[] = {
+static const struct nouveau_bitfield nv50_pgraph_status[] = {
 	{ 1<<0, "BUSY" }, /* set when any bit is set */
 	{ 1<<1, "DISPATCH" },
 	{ 1<<2, "UNK2" },
@@ -302,7 +302,7 @@ nv84_graph_tlb_flush(struct nouveau_engine *engine)
 	return timeout ? -EBUSY : 0;
 }
 
-static struct nouveau_enum nv50_mp_exec_error_names[] = {
+static const struct nouveau_enum nv50_mp_exec_error_names[] = {
 	{ 3, "STACK_UNDERFLOW", NULL },
 	{ 4, "QUADON_ACTIVE", NULL },
 	{ 8, "TIMEOUT", NULL },
@@ -311,30 +311,30 @@ static struct nouveau_enum nv50_mp_exec_error_names[] = {
 	{}
 };
 
-static struct nouveau_bitfield nv50_graph_trap_m2mf[] = {
+static const struct nouveau_bitfield nv50_graph_trap_m2mf[] = {
 	{ 0x00000001, "NOTIFY" },
 	{ 0x00000002, "IN" },
 	{ 0x00000004, "OUT" },
 	{}
 };
 
-static struct nouveau_bitfield nv50_graph_trap_vfetch[] = {
+static const struct nouveau_bitfield nv50_graph_trap_vfetch[] = {
 	{ 0x00000001, "FAULT" },
 	{}
 };
 
-static struct nouveau_bitfield nv50_graph_trap_strmout[] = {
+static const struct nouveau_bitfield nv50_graph_trap_strmout[] = {
 	{ 0x00000001, "FAULT" },
 	{}
 };
 
-static struct nouveau_bitfield nv50_graph_trap_ccache[] = {
+static const struct nouveau_bitfield nv50_graph_trap_ccache[] = {
 	{ 0x00000001, "FAULT" },
 	{}
 };
 
 /* There must be a *lot* of these. Will take some time to gather them up. */
-struct nouveau_enum nv50_data_error_names[] = {
+const struct nouveau_enum nv50_data_error_names[] = {
 	{ 0x00000003, "INVALID_OPERATION", NULL },
 	{ 0x00000004, "INVALID_VALUE", NULL },
 	{ 0x00000005, "INVALID_ENUM", NULL },
@@ -380,7 +380,7 @@ struct nouveau_enum nv50_data_error_names[] = {
 	{}
 };
 
-static struct nouveau_bitfield nv50_graph_intr_name[] = {
+static const struct nouveau_bitfield nv50_graph_intr_name[] = {
 	{ 0x00000001, "NOTIFY" },
 	{ 0x00000002, "COMPUTE_QUERY" },
 	{ 0x00000010, "ILLEGAL_MTHD" },
diff --git a/drivers/gpu/drm/nouveau/core/include/core/enum.h b/drivers/gpu/drm/nouveau/core/include/core/enum.h
index 62ec041..e7b1e18 100644
--- a/drivers/gpu/drm/nouveau/core/include/core/enum.h
+++ b/drivers/gpu/drm/nouveau/core/include/core/enum.h
@@ -4,7 +4,7 @@
 struct nouveau_enum {
 	u32 value;
 	const char *name;
-	void *data;
+	const void *data;
 };
 
 const struct nouveau_enum *
diff --git a/drivers/gpu/drm/nouveau/core/include/engine/graph.h b/drivers/gpu/drm/nouveau/core/include/engine/graph.h
index 388cfcf..6943b40 100644
--- a/drivers/gpu/drm/nouveau/core/include/engine/graph.h
+++ b/drivers/gpu/drm/nouveau/core/include/engine/graph.h
@@ -60,13 +60,13 @@ extern struct nouveau_oclass nv50_graph_oclass;
 extern struct nouveau_oclass nvc0_graph_oclass;
 extern struct nouveau_oclass nve0_graph_oclass;
 
-extern struct nouveau_bitfield nv04_graph_nsource[];
+extern const struct nouveau_bitfield nv04_graph_nsource[];
 extern struct nouveau_ofuncs nv04_graph_ofuncs;
 bool nv04_graph_idle(void *obj);
 
-extern struct nouveau_bitfield nv10_graph_intr_name[];
-extern struct nouveau_bitfield nv10_graph_nstatus[];
+extern const struct nouveau_bitfield nv10_graph_intr_name[];
+extern const struct nouveau_bitfield nv10_graph_nstatus[];
 
-extern struct nouveau_enum nv50_data_error_names[];
+extern const struct nouveau_enum nv50_data_error_names[];
 
 #endif
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c
index a36d190..767d9c4 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c
@@ -331,7 +331,7 @@ nv50_fb_oclass = {
 	},
 };
 
-static struct nouveau_enum vm_dispatch_subclients[] = {
+static const struct nouveau_enum vm_dispatch_subclients[] = {
 	{ 0x00000000, "GRCTX", NULL },
 	{ 0x00000001, "NOTIFY", NULL },
 	{ 0x00000002, "QUERY", NULL },
@@ -342,14 +342,14 @@ static struct nouveau_enum vm_dispatch_subclients[] = {
 	{}
 };
 
-static struct nouveau_enum vm_ccache_subclients[] = {
+static const struct nouveau_enum vm_ccache_subclients[] = {
 	{ 0x00000000, "CB", NULL },
 	{ 0x00000001, "TIC", NULL },
 	{ 0x00000002, "TSC", NULL },
 	{}
 };
 
-static struct nouveau_enum vm_prop_subclients[] = {
+static const struct nouveau_enum vm_prop_subclients[] = {
 	{ 0x00000000, "RT0", NULL },
 	{ 0x00000001, "RT1", NULL },
 	{ 0x00000002, "RT2", NULL },
@@ -366,19 +366,19 @@ static struct nouveau_enum vm_prop_subclients[] = {
 	{}
 };
 
-static struct nouveau_enum vm_pfifo_subclients[] = {
+static const struct nouveau_enum vm_pfifo_subclients[] = {
 	{ 0x00000000, "PUSHBUF", NULL },
 	{ 0x00000001, "SEMAPHORE", NULL },
 	{}
 };
 
-static struct nouveau_enum vm_bar_subclients[] = {
+static const struct nouveau_enum vm_bar_subclients[] = {
 	{ 0x00000000, "FB", NULL },
 	{ 0x00000001, "IN", NULL },
 	{}
 };
 
-static struct nouveau_enum vm_client[] = {
+static const struct nouveau_enum vm_client[] = {
 	{ 0x00000000, "STRMOUT", NULL },
 	{ 0x00000003, "DISPATCH", vm_dispatch_subclients },
 	{ 0x00000004, "PFIFO_WRITE", NULL },
@@ -397,7 +397,7 @@ static struct nouveau_enum vm_client[] = {
 	{}
 };
 
-static struct nouveau_enum vm_engine[] = {
+static const struct nouveau_enum vm_engine[] = {
 	{ 0x00000000, "PGRAPH", NULL },
 	{ 0x00000001, "PVP", NULL },
 	{ 0x00000004, "PEEPHOLE", NULL },
@@ -413,7 +413,7 @@ static struct nouveau_enum vm_engine[] = {
 	{}
 };
 
-static struct nouveau_enum vm_fault[] = {
+static const struct nouveau_enum vm_fault[] = {
 	{ 0x00000000, "PT_NOT_PRESENT", NULL },
 	{ 0x00000001, "PT_TOO_SHORT", NULL },
 	{ 0x00000002, "PAGE_NOT_PRESENT", NULL },
-- 
1.7.8.6



More information about the Nouveau mailing list