diff options
author | Olof Johansson <olof@lixom.net> | 2013-08-20 14:07:53 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2013-08-21 07:28:08 -0400 |
commit | a246968edcfcfe0503fa9bcd5a444e7a5b9986dc (patch) | |
tree | 0e14f939ec5e826260c32fc47ee556b976bd5d95 | |
parent | f5e4626097f865783177f265d7793995bd8a2a76 (diff) |
hwrng: omap - reorder OMAP TRNG driver code
The newly added omap4 support in the driver was added without
consideration for building older configs. When building omap1_defconfig,
it resulted in:
drivers/char/hw_random/omap-rng.c:190:12: warning: 'omap4_rng_init' defined but not used [-Wunused-function]
drivers/char/hw_random/omap-rng.c:215:13: warning: 'omap4_rng_cleanup' defined but not used [-Wunused-function]
drivers/char/hw_random/omap-rng.c:251:20: warning: 'omap4_rng_irq' defined but not used [-Wunused-function]
Move the code around so it is grouped with its operations struct, which
for the omap4 case means also under the #ifdef CONFIG_OF, where it needs
to be.
Signed-off-by: Olof Johansson <olof@lixom.net>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | drivers/char/hw_random/omap-rng.c | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c index f3f71425e7e2..9b89ff4881de 100644 --- a/drivers/char/hw_random/omap-rng.c +++ b/drivers/char/hw_random/omap-rng.c | |||
@@ -140,16 +140,6 @@ static inline void omap_rng_write(struct omap_rng_dev *priv, u16 reg, | |||
140 | __raw_writel(val, priv->base + priv->pdata->regs[reg]); | 140 | __raw_writel(val, priv->base + priv->pdata->regs[reg]); |
141 | } | 141 | } |
142 | 142 | ||
143 | static inline u32 omap2_rng_data_present(struct omap_rng_dev *priv) | ||
144 | { | ||
145 | return omap_rng_read(priv, RNG_STATUS_REG) ? 0 : 1; | ||
146 | } | ||
147 | |||
148 | static inline u32 omap4_rng_data_present(struct omap_rng_dev *priv) | ||
149 | { | ||
150 | return omap_rng_read(priv, RNG_STATUS_REG) & RNG_REG_STATUS_RDY; | ||
151 | } | ||
152 | |||
153 | static int omap_rng_data_present(struct hwrng *rng, int wait) | 143 | static int omap_rng_data_present(struct hwrng *rng, int wait) |
154 | { | 144 | { |
155 | struct omap_rng_dev *priv; | 145 | struct omap_rng_dev *priv; |
@@ -187,6 +177,60 @@ static int omap_rng_data_read(struct hwrng *rng, u32 *data) | |||
187 | return data_size; | 177 | return data_size; |
188 | } | 178 | } |
189 | 179 | ||
180 | static int omap_rng_init(struct hwrng *rng) | ||
181 | { | ||
182 | struct omap_rng_dev *priv; | ||
183 | |||
184 | priv = (struct omap_rng_dev *)rng->priv; | ||
185 | return priv->pdata->init(priv); | ||
186 | } | ||
187 | |||
188 | static void omap_rng_cleanup(struct hwrng *rng) | ||
189 | { | ||
190 | struct omap_rng_dev *priv; | ||
191 | |||
192 | priv = (struct omap_rng_dev *)rng->priv; | ||
193 | priv->pdata->cleanup(priv); | ||
194 | } | ||
195 | |||
196 | static struct hwrng omap_rng_ops = { | ||
197 | .name = "omap", | ||
198 | .data_present = omap_rng_data_present, | ||
199 | .data_read = omap_rng_data_read, | ||
200 | .init = omap_rng_init, | ||
201 | .cleanup = omap_rng_cleanup, | ||
202 | }; | ||
203 | |||
204 | static inline u32 omap2_rng_data_present(struct omap_rng_dev *priv) | ||
205 | { | ||
206 | return omap_rng_read(priv, RNG_STATUS_REG) ? 0 : 1; | ||
207 | } | ||
208 | |||
209 | static int omap2_rng_init(struct omap_rng_dev *priv) | ||
210 | { | ||
211 | omap_rng_write(priv, RNG_SYSCONFIG_REG, 0x1); | ||
212 | return 0; | ||
213 | } | ||
214 | |||
215 | static void omap2_rng_cleanup(struct omap_rng_dev *priv) | ||
216 | { | ||
217 | omap_rng_write(priv, RNG_SYSCONFIG_REG, 0x0); | ||
218 | } | ||
219 | |||
220 | static struct omap_rng_pdata omap2_rng_pdata = { | ||
221 | .regs = (u16 *)reg_map_omap2, | ||
222 | .data_size = OMAP2_RNG_OUTPUT_SIZE, | ||
223 | .data_present = omap2_rng_data_present, | ||
224 | .init = omap2_rng_init, | ||
225 | .cleanup = omap2_rng_cleanup, | ||
226 | }; | ||
227 | |||
228 | #if defined(CONFIG_OF) | ||
229 | static inline u32 omap4_rng_data_present(struct omap_rng_dev *priv) | ||
230 | { | ||
231 | return omap_rng_read(priv, RNG_STATUS_REG) & RNG_REG_STATUS_RDY; | ||
232 | } | ||
233 | |||
190 | static int omap4_rng_init(struct omap_rng_dev *priv) | 234 | static int omap4_rng_init(struct omap_rng_dev *priv) |
191 | { | 235 | { |
192 | u32 val; | 236 | u32 val; |
@@ -221,33 +265,6 @@ static void omap4_rng_cleanup(struct omap_rng_dev *priv) | |||
221 | omap_rng_write(priv, RNG_CONFIG_REG, val); | 265 | omap_rng_write(priv, RNG_CONFIG_REG, val); |
222 | } | 266 | } |
223 | 267 | ||
224 | static int omap2_rng_init(struct omap_rng_dev *priv) | ||
225 | { | ||
226 | omap_rng_write(priv, RNG_SYSCONFIG_REG, 0x1); | ||
227 | return 0; | ||
228 | } | ||
229 | |||
230 | static void omap2_rng_cleanup(struct omap_rng_dev *priv) | ||
231 | { | ||
232 | omap_rng_write(priv, RNG_SYSCONFIG_REG, 0x0); | ||
233 | } | ||
234 | |||
235 | static int omap_rng_init(struct hwrng *rng) | ||
236 | { | ||
237 | struct omap_rng_dev *priv; | ||
238 | |||
239 | priv = (struct omap_rng_dev *)rng->priv; | ||
240 | return priv->pdata->init(priv); | ||
241 | } | ||
242 | |||
243 | static void omap_rng_cleanup(struct hwrng *rng) | ||
244 | { | ||
245 | struct omap_rng_dev *priv; | ||
246 | |||
247 | priv = (struct omap_rng_dev *)rng->priv; | ||
248 | priv->pdata->cleanup(priv); | ||
249 | } | ||
250 | |||
251 | static irqreturn_t omap4_rng_irq(int irq, void *dev_id) | 268 | static irqreturn_t omap4_rng_irq(int irq, void *dev_id) |
252 | { | 269 | { |
253 | struct omap_rng_dev *priv = dev_id; | 270 | struct omap_rng_dev *priv = dev_id; |
@@ -275,23 +292,6 @@ static irqreturn_t omap4_rng_irq(int irq, void *dev_id) | |||
275 | return IRQ_HANDLED; | 292 | return IRQ_HANDLED; |
276 | } | 293 | } |
277 | 294 | ||
278 | static struct hwrng omap_rng_ops = { | ||
279 | .name = "omap", | ||
280 | .data_present = omap_rng_data_present, | ||
281 | .data_read = omap_rng_data_read, | ||
282 | .init = omap_rng_init, | ||
283 | .cleanup = omap_rng_cleanup, | ||
284 | }; | ||
285 | |||
286 | static struct omap_rng_pdata omap2_rng_pdata = { | ||
287 | .regs = (u16 *)reg_map_omap2, | ||
288 | .data_size = OMAP2_RNG_OUTPUT_SIZE, | ||
289 | .data_present = omap2_rng_data_present, | ||
290 | .init = omap2_rng_init, | ||
291 | .cleanup = omap2_rng_cleanup, | ||
292 | }; | ||
293 | |||
294 | #if defined(CONFIG_OF) | ||
295 | static struct omap_rng_pdata omap4_rng_pdata = { | 295 | static struct omap_rng_pdata omap4_rng_pdata = { |
296 | .regs = (u16 *)reg_map_omap4, | 296 | .regs = (u16 *)reg_map_omap4, |
297 | .data_size = OMAP4_RNG_OUTPUT_SIZE, | 297 | .data_size = OMAP4_RNG_OUTPUT_SIZE, |