mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
fdt_support: make fdt_fixup_mtdparts() prototype more specific
The second argument of fdt_fixup_mtdparts() is an opaque pointer, 'void *node_info', hence callers can pass any pointer. Obviously, fdt_fixup_mtdparts() expects 'struct node_info *' otherwise, it crashes run-time. Change the prototype so that it is compile-time checked. Also, add 'const' qualifier to it so that callers can constify the struct node_info arrays. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
4a610fada1
commit
5f4e32d058
2 changed files with 15 additions and 9 deletions
|
@ -893,9 +893,9 @@ err_prop:
|
||||||
*
|
*
|
||||||
* fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
|
* fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
|
||||||
*/
|
*/
|
||||||
void fdt_fixup_mtdparts(void *blob, void *node_info, int node_info_size)
|
void fdt_fixup_mtdparts(void *blob, const struct node_info *node_info,
|
||||||
|
int node_info_size)
|
||||||
{
|
{
|
||||||
struct node_info *ni = node_info;
|
|
||||||
struct mtd_device *dev;
|
struct mtd_device *dev;
|
||||||
int i, idx;
|
int i, idx;
|
||||||
int noff;
|
int noff;
|
||||||
|
@ -905,12 +905,13 @@ void fdt_fixup_mtdparts(void *blob, void *node_info, int node_info_size)
|
||||||
|
|
||||||
for (i = 0; i < node_info_size; i++) {
|
for (i = 0; i < node_info_size; i++) {
|
||||||
idx = 0;
|
idx = 0;
|
||||||
noff = fdt_node_offset_by_compatible(blob, -1, ni[i].compat);
|
noff = fdt_node_offset_by_compatible(blob, -1,
|
||||||
|
node_info[i].compat);
|
||||||
while (noff != -FDT_ERR_NOTFOUND) {
|
while (noff != -FDT_ERR_NOTFOUND) {
|
||||||
debug("%s: %s, mtd dev type %d\n",
|
debug("%s: %s, mtd dev type %d\n",
|
||||||
fdt_get_name(blob, noff, 0),
|
fdt_get_name(blob, noff, 0),
|
||||||
ni[i].compat, ni[i].type);
|
node_info[i].compat, node_info[i].type);
|
||||||
dev = device_find(ni[i].type, idx++);
|
dev = device_find(node_info[i].type, idx++);
|
||||||
if (dev) {
|
if (dev) {
|
||||||
if (fdt_node_set_part_info(blob, noff, dev))
|
if (fdt_node_set_part_info(blob, noff, dev))
|
||||||
return; /* return on error */
|
return; /* return on error */
|
||||||
|
@ -918,7 +919,7 @@ void fdt_fixup_mtdparts(void *blob, void *node_info, int node_info_size)
|
||||||
|
|
||||||
/* Jump to next flash node */
|
/* Jump to next flash node */
|
||||||
noff = fdt_node_offset_by_compatible(blob, noff,
|
noff = fdt_node_offset_by_compatible(blob, noff,
|
||||||
ni[i].compat);
|
node_info[i].compat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,11 +205,16 @@ int fdt_increase_size(void *fdt, int add_len);
|
||||||
|
|
||||||
int fdt_fixup_nor_flash_size(void *blob);
|
int fdt_fixup_nor_flash_size(void *blob);
|
||||||
|
|
||||||
|
struct node_info;
|
||||||
#if defined(CONFIG_FDT_FIXUP_PARTITIONS)
|
#if defined(CONFIG_FDT_FIXUP_PARTITIONS)
|
||||||
void fdt_fixup_mtdparts(void *fdt, void *node_info, int node_info_size);
|
void fdt_fixup_mtdparts(void *fdt, const struct node_info *node_info,
|
||||||
|
int node_info_size);
|
||||||
#else
|
#else
|
||||||
static inline void fdt_fixup_mtdparts(void *fdt, void *node_info,
|
static inline void fdt_fixup_mtdparts(void *fdt,
|
||||||
int node_info_size) {}
|
const struct node_info *node_info,
|
||||||
|
int node_info_size)
|
||||||
|
{
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void fdt_del_node_and_alias(void *blob, const char *alias);
|
void fdt_del_node_and_alias(void *blob, const char *alias);
|
||||||
|
|
Loading…
Reference in a new issue