tools, slub: Fix off-by-one buffer corruption after readlink() call
[linux-2.6/linux-mips.git] / arch / arm / plat-mxc / devices / platform-mxc_rnga.c
blobb4b7612b6e172c2dad8fccc81ab06f2585a73403
1 /*
2 * Copyright (C) 2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9 #include <mach/hardware.h>
10 #include <mach/devices-common.h>
12 struct imx_mxc_rnga_data {
13 resource_size_t iobase;
16 #define imx_mxc_rnga_data_entry_single(soc) \
17 { \
18 .iobase = soc ## _RNGA_BASE_ADDR, \
21 #ifdef CONFIG_SOC_IMX31
22 static const struct imx_mxc_rnga_data imx31_mxc_rnga_data __initconst =
23 imx_mxc_rnga_data_entry_single(MX31);
24 #endif /* ifdef CONFIG_SOC_IMX31 */
26 static struct platform_device *__init imx_add_mxc_rnga(
27 const struct imx_mxc_rnga_data *data)
29 struct resource res[] = {
31 .start = data->iobase,
32 .end = data->iobase + SZ_16K - 1,
33 .flags = IORESOURCE_MEM,
36 return imx_add_platform_device("mxc_rnga", -1,
37 res, ARRAY_SIZE(res), NULL, 0);
40 static int __init imxXX_add_mxc_rnga(void)
42 struct platform_device *ret;
44 #if defined(CONFIG_SOC_IMX31)
45 if (cpu_is_mx31())
46 ret = imx_add_mxc_rnga(&imx31_mxc_rnga_data);
47 else
48 #endif /* if defined(CONFIG_SOC_IMX31) */
49 ret = ERR_PTR(-ENODEV);
51 if (IS_ERR(ret))
52 return PTR_ERR(ret);
54 return 0;
56 arch_initcall(imxXX_add_mxc_rnga);