Skip to content

Commit b775e64

Browse files
committed
Merge branch 'devicetree/next-console' into devicetree/next
2 parents 32147e9 + ccdb8ed commit b775e64

17 files changed

Lines changed: 64 additions & 119 deletions

File tree

‎arch/arm/boot/dts/versatile-ab.dts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
i2c0 = &i2c0;
1616
};
1717

18+
chosen {
19+
stdout-path = &uart0;
20+
};
21+
1822
memory {
1923
reg = <0x0 0x08000000>;
2024
};

‎arch/powerpc/platforms/powermac/feature.c‎

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2805,25 +2805,20 @@ set_initial_features(void)
28052805
/* Enable GMAC for now for PCI probing. It will be disabled
28062806
* later on after PCI probe
28072807
*/
2808-
np = of_find_node_by_name(NULL, "ethernet");
2809-
while(np) {
2808+
for_each_node_by_name(np, "ethernet")
28102809
if (of_device_is_compatible(np, "K2-GMAC"))
28112810
g5_gmac_enable(np, 0, 1);
2812-
np = of_find_node_by_name(np, "ethernet");
2813-
}
28142811

28152812
/* Enable FW before PCI probe. Will be disabled later on
28162813
* Note: We should have a batter way to check that we are
28172814
* dealing with uninorth internal cell and not a PCI cell
28182815
* on the external PCI. The code below works though.
28192816
*/
2820-
np = of_find_node_by_name(NULL, "firewire");
2821-
while(np) {
2817+
for_each_node_by_name(np, "firewire") {
28222818
if (of_device_is_compatible(np, "pci106b,5811")) {
28232819
macio_chips[0].flags |= MACIO_FLAG_FW_SUPPORTED;
28242820
g5_fw_enable(np, 0, 1);
28252821
}
2826-
np = of_find_node_by_name(np, "firewire");
28272822
}
28282823
}
28292824
#else /* CONFIG_POWER4 */
@@ -2834,22 +2829,19 @@ set_initial_features(void)
28342829
/* Enable GMAC for now for PCI probing. It will be disabled
28352830
* later on after PCI probe
28362831
*/
2837-
np = of_find_node_by_name(NULL, "ethernet");
2838-
while(np) {
2832+
for_each_node_by_name(np, "ethernet") {
28392833
if (np->parent
28402834
&& of_device_is_compatible(np->parent, "uni-north")
28412835
&& of_device_is_compatible(np, "gmac"))
28422836
core99_gmac_enable(np, 0, 1);
2843-
np = of_find_node_by_name(np, "ethernet");
28442837
}
28452838

28462839
/* Enable FW before PCI probe. Will be disabled later on
28472840
* Note: We should have a batter way to check that we are
28482841
* dealing with uninorth internal cell and not a PCI cell
28492842
* on the external PCI. The code below works though.
28502843
*/
2851-
np = of_find_node_by_name(NULL, "firewire");
2852-
while(np) {
2844+
for_each_node_by_name(np, "firewire") {
28532845
if (np->parent
28542846
&& of_device_is_compatible(np->parent, "uni-north")
28552847
&& (of_device_is_compatible(np, "pci106b,18") ||
@@ -2858,18 +2850,16 @@ set_initial_features(void)
28582850
macio_chips[0].flags |= MACIO_FLAG_FW_SUPPORTED;
28592851
core99_firewire_enable(np, 0, 1);
28602852
}
2861-
np = of_find_node_by_name(np, "firewire");
28622853
}
28632854

28642855
/* Enable ATA-100 before PCI probe. */
28652856
np = of_find_node_by_name(NULL, "ata-6");
2866-
while(np) {
2857+
for_each_node_by_name(np, "ata-6") {
28672858
if (np->parent
28682859
&& of_device_is_compatible(np->parent, "uni-north")
28692860
&& of_device_is_compatible(np, "kauai-ata")) {
28702861
core99_ata100_enable(np, 1);
28712862
}
2872-
np = of_find_node_by_name(np, "ata-6");
28732863
}
28742864

28752865
/* Switch airport off */

‎arch/powerpc/platforms/powermac/pci.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ static void __init fixup_nec_usb2(void)
698698
{
699699
struct device_node *nec;
700700

701-
for (nec = NULL; (nec = of_find_node_by_name(nec, "usb")) != NULL;) {
701+
for_each_node_by_name(nec, "usb") {
702702
struct pci_controller *hose;
703703
u32 data;
704704
const u32 *prop;

‎arch/powerpc/platforms/powermac/smp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ static void __init smp_core99_setup_i2c_hwsync(int ncpus)
577577
int ok;
578578

579579
/* Look for the clock chip */
580-
while ((cc = of_find_node_by_name(cc, "i2c-hwclock")) != NULL) {
580+
for_each_node_by_name(cc, "i2c-hwclock") {
581581
p = of_get_parent(cc);
582582
ok = p && of_device_is_compatible(p, "uni-n-i2c");
583583
of_node_put(p);

‎arch/powerpc/platforms/powermac/udbg_adb.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ int __init udbg_adb_init(int force_btext)
191191
* of type "adb". If not, we return a failure, but we keep the
192192
* bext output set for now
193193
*/
194-
for (np = NULL; (np = of_find_node_by_name(np, "keyboard")) != NULL;) {
194+
for_each_node_by_name(np, "keyboard") {
195195
struct device_node *parent = of_get_parent(np);
196196
int found = (parent && strcmp(parent->type, "adb") == 0);
197197
of_node_put(parent);

‎arch/powerpc/platforms/pseries/setup.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,7 @@ static void __init pseries_discover_pic(void)
232232
struct device_node *np;
233233
const char *typep;
234234

235-
for (np = NULL; (np = of_find_node_by_name(np,
236-
"interrupt-controller"));) {
235+
for_each_node_by_name(np, "interrupt-controller") {
237236
typep = of_get_property(np, "compatible", NULL);
238237
if (strstr(typep, "open-pic")) {
239238
pSeries_mpic_node = of_node_get(np);

‎drivers/cpufreq/pmac64-cpufreq.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,7 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpunode)
499499
}
500500

501501
/* Lookup the i2c hwclock */
502-
for (hwclock = NULL;
503-
(hwclock = of_find_node_by_name(hwclock, "i2c-hwclock")) != NULL;){
502+
for_each_node_by_name(hwclock, "i2c-hwclock") {
504503
const char *loc = of_get_property(hwclock,
505504
"hwctrl-location", NULL);
506505
if (loc == NULL)

‎drivers/edac/cell_edac.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ static void cell_edac_init_csrows(struct mem_ctl_info *mci)
134134
int j;
135135
u32 nr_pages;
136136

137-
for (np = NULL;
138-
(np = of_find_node_by_name(np, "memory")) != NULL;) {
137+
for_each_node_by_name(np, "memory") {
139138
struct resource r;
140139

141140
/* We "know" that the Cell firmware only creates one entry

‎drivers/of/base.c‎

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* as published by the Free Software Foundation; either version
1818
* 2 of the License, or (at your option) any later version.
1919
*/
20+
#include <linux/console.h>
2021
#include <linux/ctype.h>
2122
#include <linux/cpu.h>
2223
#include <linux/module.h>
@@ -35,7 +36,7 @@ struct device_node *of_allnodes;
3536
EXPORT_SYMBOL(of_allnodes);
3637
struct device_node *of_chosen;
3738
struct device_node *of_aliases;
38-
static struct device_node *of_stdout;
39+
struct device_node *of_stdout;
3940

4041
static struct kset *of_kset;
4142

@@ -2062,9 +2063,12 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align))
20622063
of_chosen = of_find_node_by_path("/chosen@0");
20632064

20642065
if (of_chosen) {
2066+
/* linux,stdout-path and /aliases/stdout are for legacy compatibility */
20652067
const char *name = of_get_property(of_chosen, "stdout-path", NULL);
20662068
if (!name)
20672069
name = of_get_property(of_chosen, "linux,stdout-path", NULL);
2070+
if (IS_ENABLED(CONFIG_PPC) && !name)
2071+
name = of_get_property(of_aliases, "stdout", NULL);
20682072
if (name)
20692073
of_stdout = of_find_node_by_path(name);
20702074
}
@@ -2180,20 +2184,22 @@ const char *of_prop_next_string(struct property *prop, const char *cur)
21802184
EXPORT_SYMBOL_GPL(of_prop_next_string);
21812185

21822186
/**
2183-
* of_device_is_stdout_path - check if a device node matches the
2184-
* linux,stdout-path property
2185-
*
2186-
* Check if this device node matches the linux,stdout-path property
2187-
* in the chosen node. return true if yes, false otherwise.
2187+
* of_console_check() - Test and setup console for DT setup
2188+
* @dn - Pointer to device node
2189+
* @name - Name to use for preferred console without index. ex. "ttyS"
2190+
* @index - Index to use for preferred console.
2191+
*
2192+
* Check if the given device node matches the stdout-path property in the
2193+
* /chosen node. If it does then register it as the preferred console and return
2194+
* TRUE. Otherwise return FALSE.
21882195
*/
2189-
int of_device_is_stdout_path(struct device_node *dn)
2196+
bool of_console_check(struct device_node *dn, char *name, int index)
21902197
{
2191-
if (!of_stdout)
2198+
if (!dn || dn != of_stdout || console_set_on_cmdline)
21922199
return false;
2193-
2194-
return of_stdout == dn;
2200+
return add_preferred_console(name, index, NULL);
21952201
}
2196-
EXPORT_SYMBOL_GPL(of_device_is_stdout_path);
2202+
EXPORT_SYMBOL_GPL(of_console_check);
21972203

21982204
/**
21992205
* of_find_next_cache_node - Find a node's subsidiary cache

‎drivers/pci/hotplug/rpaphp_core.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,11 +375,11 @@ static void __exit cleanup_slots(void)
375375

376376
static int __init rpaphp_init(void)
377377
{
378-
struct device_node *dn = NULL;
378+
struct device_node *dn;
379379

380380
info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
381381

382-
while ((dn = of_find_node_by_name(dn, "pci")))
382+
for_each_node_by_name(dn, "pci")
383383
rpaphp_add_slot(dn);
384384

385385
return 0;

0 commit comments

Comments
 (0)