fix a vfs api bug in squashfs triggered by zabbix-agent (#4365)
[openwrt/staging/chunkeey.git] / target / linux / ps3 / patches-2.6.28 / 0011-mtd-ps3vram-Use-proper-kernel-types.patch
1 From 993e62e674ba670341f11f60398446bb37a88e8b Mon Sep 17 00:00:00 2001
2 From: Geoff Levand <geoffrey.levand@am.sony.com>
3 Date: Tue, 6 Jan 2009 11:32:28 +0000
4 Subject: [PATCH] mtd/ps3vram: Use proper kernel types
5
6 Replace the use of stdint.h types with kernel types
7 in the ps3vram driver.
8
9 Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
10 Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 ---
12 drivers/mtd/devices/ps3vram.c | 56 ++++++++++++++++++++++-------------------
13 1 files changed, 30 insertions(+), 26 deletions(-)
14
15 diff --git a/drivers/mtd/devices/ps3vram.c b/drivers/mtd/devices/ps3vram.c
16 index f5cc290..91cc2af 100644
17 --- a/drivers/mtd/devices/ps3vram.c
18 +++ b/drivers/mtd/devices/ps3vram.c
19 @@ -65,15 +65,15 @@ struct ps3vram_cache {
20 };
21
22 struct ps3vram_priv {
23 - uint64_t memory_handle;
24 - uint64_t context_handle;
25 - uint8_t *base;
26 - uint32_t *ctrl;
27 - uint32_t *reports;
28 - uint8_t *xdr_buf;
29 + u64 memory_handle;
30 + u64 context_handle;
31 + u32 *ctrl;
32 + u32 *reports;
33 + u8 *base;
34 + u8 *xdr_buf;
35
36 - uint32_t *fifo_base;
37 - uint32_t *fifo_ptr;
38 + u32 *fifo_base;
39 + u32 *fifo_ptr;
40
41 struct device *dev;
42 struct ps3vram_cache cache;
43 @@ -92,7 +92,7 @@ char *size = "256M-";
44 module_param(size, charp, 0);
45 MODULE_PARM_DESC(size, "memory size");
46
47 -static inline uint32_t *ps3vram_get_notifier(uint32_t *reports, int notifier)
48 +static u32 *ps3vram_get_notifier(u32 *reports, int notifier)
49 {
50 return (void *) reports +
51 DMA_NOTIFIER_OFFSET_BASE +
52 @@ -102,8 +102,9 @@ static inline uint32_t *ps3vram_get_notifier(uint32_t *reports, int notifier)
53 static void ps3vram_notifier_reset(struct mtd_info *mtd)
54 {
55 int i;
56 +
57 struct ps3vram_priv *priv = mtd->priv;
58 - uint32_t *notify = ps3vram_get_notifier(priv->reports, NOTIFIER);
59 + u32 *notify = ps3vram_get_notifier(priv->reports, NOTIFIER);
60 for (i = 0; i < 4; i++)
61 notify[i] = 0xffffffff;
62 }
63 @@ -111,7 +112,7 @@ static void ps3vram_notifier_reset(struct mtd_info *mtd)
64 static int ps3vram_notifier_wait(struct mtd_info *mtd, int timeout_ms)
65 {
66 struct ps3vram_priv *priv = mtd->priv;
67 - uint32_t *notify = ps3vram_get_notifier(priv->reports, NOTIFIER);
68 + u32 *notify = ps3vram_get_notifier(priv->reports, NOTIFIER);
69
70 timeout_ms *= 1000;
71
72 @@ -155,13 +156,13 @@ static int ps3vram_wait_ring(struct mtd_info *mtd, int timeout)
73 return 0;
74 }
75
76 -static inline void ps3vram_out_ring(struct ps3vram_priv *priv, uint32_t data)
77 +static void ps3vram_out_ring(struct ps3vram_priv *priv, u32 data)
78 {
79 *(priv->fifo_ptr)++ = data;
80 }
81
82 -static inline void ps3vram_begin_ring(struct ps3vram_priv *priv, uint32_t chan,
83 - uint32_t tag, uint32_t size)
84 +static void ps3vram_begin_ring(struct ps3vram_priv *priv, u32 chan,
85 + u32 tag, u32 size)
86 {
87 ps3vram_out_ring(priv, (size << 18) | (chan << 13) | tag);
88 }
89 @@ -194,7 +195,7 @@ static void ps3vram_fire_ring(struct mtd_info *mtd)
90 mutex_lock(&ps3_gpu_mutex);
91
92 priv->ctrl[CTRL_PUT] = FIFO_BASE + FIFO_OFFSET +
93 - (priv->fifo_ptr - priv->fifo_base) * sizeof(uint32_t);
94 + (priv->fifo_ptr - priv->fifo_base) * sizeof(u32);
95
96 /* asking the HV for a blit will kick the fifo */
97 status = lv1_gpu_context_attribute(priv->context_handle,
98 @@ -204,8 +205,8 @@ static void ps3vram_fire_ring(struct mtd_info *mtd)
99 dev_err(priv->dev, "%s:%d: lv1_gpu_context_attribute failed\n",
100 __func__, __LINE__);
101
102 - if ((priv->fifo_ptr - priv->fifo_base) * sizeof(uint32_t) >
103 - FIFO_SIZE - 1024) {
104 + if ((priv->fifo_ptr - priv->fifo_base) * sizeof(u32) >
105 + FIFO_SIZE - 1024) {
106 dev_dbg(priv->dev, "%s:%d: fifo full, rewinding\n", __func__,
107 __LINE__);
108 ps3vram_wait_ring(mtd, 200);
109 @@ -538,10 +539,13 @@ static int ps3vram_write(struct mtd_info *mtd, loff_t to, size_t len,
110 static int __devinit ps3vram_probe(struct ps3_system_bus_device *dev)
111 {
112 struct ps3vram_priv *priv;
113 - uint64_t status;
114 - uint64_t ddr_lpar, ctrl_lpar, info_lpar, reports_lpar;
115 - int64_t ddr_size;
116 - uint64_t reports_size;
117 + int status;
118 + u64 ddr_lpar;
119 + u64 ctrl_lpar;
120 + u64 info_lpar;
121 + u64 reports_lpar;
122 + u64 ddr_size;
123 + u64 reports_size;
124 int ret = -ENOMEM;
125 char *rest;
126
127 @@ -555,8 +559,8 @@ static int __devinit ps3vram_probe(struct ps3_system_bus_device *dev)
128 priv->dev = &dev->core;
129
130 /* Allocate XDR buffer (1MiB aligned) */
131 - priv->xdr_buf = (uint8_t *) __get_free_pages(GFP_KERNEL,
132 - get_order(XDR_BUF_SIZE));
133 + priv->xdr_buf = (void *)__get_free_pages(GFP_KERNEL,
134 + get_order(XDR_BUF_SIZE));
135 if (priv->xdr_buf == NULL) {
136 dev_dbg(&dev->core, "%s:%d: could not allocate XDR buffer\n",
137 __func__, __LINE__);
138 @@ -565,7 +569,7 @@ static int __devinit ps3vram_probe(struct ps3_system_bus_device *dev)
139 }
140
141 /* Put FIFO at begginning of XDR buffer */
142 - priv->fifo_base = (uint32_t *) (priv->xdr_buf + FIFO_OFFSET);
143 + priv->fifo_base = (u32 *) (priv->xdr_buf + FIFO_OFFSET);
144 priv->fifo_ptr = priv->fifo_base;
145
146 /* XXX: Need to open GPU, in case ps3fb or snd_ps3 aren't loaded */
147 @@ -593,11 +597,11 @@ static int __devinit ps3vram_probe(struct ps3_system_bus_device *dev)
148 status = lv1_gpu_memory_allocate(ddr_size, 0, 0, 0, 0,
149 &priv->memory_handle,
150 &ddr_lpar);
151 - if (status == 0)
152 + if (!status)
153 break;
154 ddr_size -= 1024*1024;
155 }
156 - if (status != 0 || ddr_size <= 0) {
157 + if (status || ddr_size <= 0) {
158 dev_err(&dev->core, "%s:%d: lv1_gpu_memory_allocate failed\n",
159 __func__, __LINE__);
160 ret = -ENOMEM;
161 --
162 1.6.0.4
163