Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
6448c097
Commit
6448c097
authored
Oct 03, 2017
by
Rob Herring
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dt-printf-v2' into HEAD
parents
0c37c56d
a7e4cfb0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
77 deletions
+18
-77
arch/powerpc/platforms/pseries/dlpar.c
arch/powerpc/platforms/pseries/dlpar.c
+6
-18
arch/powerpc/platforms/pseries/reconfig.c
arch/powerpc/platforms/pseries/reconfig.c
+1
-1
drivers/of/fdt.c
drivers/of/fdt.c
+11
-58
No files found.
arch/powerpc/platforms/pseries/dlpar.c
View file @
6448c097
...
...
@@ -75,24 +75,17 @@ static struct property *dlpar_parse_cc_property(struct cc_workarea *ccwa)
return
prop
;
}
static
struct
device_node
*
dlpar_parse_cc_node
(
struct
cc_workarea
*
ccwa
,
const
char
*
path
)
static
struct
device_node
*
dlpar_parse_cc_node
(
struct
cc_workarea
*
ccwa
)
{
struct
device_node
*
dn
;
char
*
name
;
/* If parent node path is "/" advance path to NULL terminator to
* prevent double leading slashs in full_name.
*/
if
(
!
path
[
1
])
path
++
;
const
char
*
name
;
dn
=
kzalloc
(
sizeof
(
*
dn
),
GFP_KERNEL
);
if
(
!
dn
)
return
NULL
;
name
=
(
char
*
)
ccwa
+
be32_to_cpu
(
ccwa
->
name_offset
);
dn
->
full_name
=
k
asprintf
(
GFP_KERNEL
,
"%s/%s"
,
path
,
name
);
name
=
(
c
onst
c
har
*
)
ccwa
+
be32_to_cpu
(
ccwa
->
name_offset
);
dn
->
full_name
=
k
strdup
(
name
,
GFP_KERNEL
);
if
(
!
dn
->
full_name
)
{
kfree
(
dn
);
return
NULL
;
...
...
@@ -148,7 +141,6 @@ struct device_node *dlpar_configure_connector(__be32 drc_index,
struct
property
*
last_property
=
NULL
;
struct
cc_workarea
*
ccwa
;
char
*
data_buf
;
const
char
*
parent_path
=
parent
->
full_name
;
int
cc_token
;
int
rc
=
-
1
;
...
...
@@ -182,7 +174,7 @@ struct device_node *dlpar_configure_connector(__be32 drc_index,
break
;
case
NEXT_SIBLING
:
dn
=
dlpar_parse_cc_node
(
ccwa
,
parent_path
);
dn
=
dlpar_parse_cc_node
(
ccwa
);
if
(
!
dn
)
goto
cc_error
;
...
...
@@ -192,10 +184,7 @@ struct device_node *dlpar_configure_connector(__be32 drc_index,
break
;
case
NEXT_CHILD
:
if
(
first_dn
)
parent_path
=
last_dn
->
full_name
;
dn
=
dlpar_parse_cc_node
(
ccwa
,
parent_path
);
dn
=
dlpar_parse_cc_node
(
ccwa
);
if
(
!
dn
)
goto
cc_error
;
...
...
@@ -226,7 +215,6 @@ struct device_node *dlpar_configure_connector(__be32 drc_index,
case
PREV_PARENT
:
last_dn
=
last_dn
->
parent
;
parent_path
=
last_dn
->
parent
->
full_name
;
break
;
case
CALL_AGAIN
:
...
...
arch/powerpc/platforms/pseries/reconfig.c
View file @
6448c097
...
...
@@ -33,7 +33,7 @@ static int pSeries_reconfig_add_node(const char *path, struct property *proplist
if
(
!
np
)
goto
out_err
;
np
->
full_name
=
kstrdup
(
path
,
GFP_KERNEL
);
np
->
full_name
=
kstrdup
(
kbasename
(
path
)
,
GFP_KERNEL
);
if
(
!
np
->
full_name
)
goto
out_err
;
...
...
drivers/of/fdt.c
View file @
6448c097
...
...
@@ -266,74 +266,32 @@ static void populate_properties(const void *blob,
*
pprev
=
NULL
;
}
static
unsigned
int
populate_node
(
const
void
*
blob
,
int
offset
,
void
**
mem
,
struct
device_node
*
dad
,
unsigned
int
fpsize
,
struct
device_node
**
pnp
,
bool
dryrun
)
static
bool
populate_node
(
const
void
*
blob
,
int
offset
,
void
**
mem
,
struct
device_node
*
dad
,
struct
device_node
**
pnp
,
bool
dryrun
)
{
struct
device_node
*
np
;
const
char
*
pathp
;
unsigned
int
l
,
allocl
;
int
new_format
=
0
;
pathp
=
fdt_get_name
(
blob
,
offset
,
&
l
);
if
(
!
pathp
)
{
*
pnp
=
NULL
;
return
0
;
return
false
;
}
allocl
=
++
l
;
/* version 0x10 has a more compact unit name here instead of the full
* path. we accumulate the full path size using "fpsize", we'll rebuild
* it later. We detect this because the first character of the name is
* not '/'.
*/
if
((
*
pathp
)
!=
'/'
)
{
new_format
=
1
;
if
(
fpsize
==
0
)
{
/* root node: special case. fpsize accounts for path
* plus terminating zero. root node only has '/', so
* fpsize should be 2, but we want to avoid the first
* level nodes to have two '/' so we use fpsize 1 here
*/
fpsize
=
1
;
allocl
=
2
;
l
=
1
;
pathp
=
""
;
}
else
{
/* account for '/' and path size minus terminal 0
* already in 'l'
*/
fpsize
+=
l
;
allocl
=
fpsize
;
}
}
np
=
unflatten_dt_alloc
(
mem
,
sizeof
(
struct
device_node
)
+
allocl
,
__alignof__
(
struct
device_node
));
if
(
!
dryrun
)
{
char
*
fn
;
of_node_init
(
np
);
np
->
full_name
=
fn
=
((
char
*
)
np
)
+
sizeof
(
*
np
);
if
(
new_format
)
{
/* rebuild full path for new format */
if
(
dad
&&
dad
->
parent
)
{
strcpy
(
fn
,
dad
->
full_name
);
#ifdef DEBUG
if
((
strlen
(
fn
)
+
l
+
1
)
!=
allocl
)
{
pr_debug
(
"%s: p: %d, l: %d, a: %d
\n
"
,
pathp
,
(
int
)
strlen
(
fn
),
l
,
allocl
);
}
#endif
fn
+=
strlen
(
fn
);
}
*
(
fn
++
)
=
'/'
;
}
memcpy
(
fn
,
pathp
,
l
);
if
(
dad
!=
NULL
)
{
...
...
@@ -355,7 +313,7 @@ static unsigned int populate_node(const void *blob,
}
*
pnp
=
np
;
return
fpsiz
e
;
return
tru
e
;
}
static
void
reverse_nodes
(
struct
device_node
*
parent
)
...
...
@@ -399,7 +357,6 @@ static int unflatten_dt_nodes(const void *blob,
struct
device_node
*
root
;
int
offset
=
0
,
depth
=
0
,
initial_depth
=
0
;
#define FDT_MAX_DEPTH 64
unsigned
int
fpsizes
[
FDT_MAX_DEPTH
];
struct
device_node
*
nps
[
FDT_MAX_DEPTH
];
void
*
base
=
mem
;
bool
dryrun
=
!
base
;
...
...
@@ -418,7 +375,6 @@ static int unflatten_dt_nodes(const void *blob,
depth
=
initial_depth
=
1
;
root
=
dad
;
fpsizes
[
depth
]
=
dad
?
strlen
(
of_node_full_name
(
dad
))
:
0
;
nps
[
depth
]
=
dad
;
for
(
offset
=
0
;
...
...
@@ -427,11 +383,8 @@ static int unflatten_dt_nodes(const void *blob,
if
(
WARN_ON_ONCE
(
depth
>=
FDT_MAX_DEPTH
))
continue
;
fpsizes
[
depth
+
1
]
=
populate_node
(
blob
,
offset
,
&
mem
,
nps
[
depth
],
fpsizes
[
depth
],
&
nps
[
depth
+
1
],
dryrun
);
if
(
!
fpsizes
[
depth
+
1
])
if
(
!
populate_node
(
blob
,
offset
,
&
mem
,
nps
[
depth
],
&
nps
[
depth
+
1
],
dryrun
))
return
mem
-
base
;
if
(
!
dryrun
&&
nodepp
&&
!*
nodepp
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment