Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'devicetree-for-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux

Pull DeviceTree updates from Rob Herring:

- remove most of_platform_populate() calls in arch code. Now the DT
core code calls it in the default case and platforms only need to
call it if they have special needs

- use pr_fmt on all the DT core print statements

- CoreSight binding doc improvements to block name descriptions

- add dt_to_config script which can parse dts files and list
corresponding kernel config options

- fix memory leak hit with a PowerMac DT

- correct a bunch of STMicro compatible strings to use the correct
vendor prefix

- fix DA9052 PMIC binding doc to match what is actually used in dts
files

* tag 'devicetree-for-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (35 commits)
documentation: da9052: Update regulator bindings names to match DA9052/53 DTS expectations
xtensa: Partially Revert "xtensa: Remove unnecessary of_platform_populate with default match table"
xtensa: Fix build error due to missing include file
MIPS: ath79: Add missing include file
Fix spelling errors in Documentation/devicetree
ARM: dts: fix STMicroelectronics compatible strings
powerpc/dts: fix STMicroelectronics compatible strings
Documentation: dt: i2c: use correct STMicroelectronics vendor prefix
scripts/dtc: dt_to_config - kernel config options for a devicetree
of: fdt: mark unflattened tree as detached
of: overlay: add resolver error prints
coresight: document binding acronyms
Documentation/devicetree: document cavium-pip rx-delay/tx-delay properties
of: use pr_fmt prefix for all console printing
of/irq: Mark initialised interrupt controllers as populated
of: fix memory leak related to safe_name()
Revert "of/platform: export of_default_bus_match_table"
of: unittest: use of_platform_default_populate() to populate default bus
memory: omap-gpmc: use of_platform_default_populate() to populate default bus
bus: uniphier-system-bus: use of_platform_default_populate() to populate default bus
...

+1523 -425
+27 -8
Documentation/devicetree/bindings/arm/coresight.txt
··· 12 12 13 13 * compatible: These have to be supplemented with "arm,primecell" as 14 14 drivers are using the AMBA bus interface. Possible values include: 15 - - "arm,coresight-etb10", "arm,primecell"; 16 - - "arm,coresight-tpiu", "arm,primecell"; 17 - - "arm,coresight-tmc", "arm,primecell"; 18 - - "arm,coresight-funnel", "arm,primecell"; 19 - - "arm,coresight-etm3x", "arm,primecell"; 20 - - "arm,coresight-etm4x", "arm,primecell"; 21 - - "qcom,coresight-replicator1x", "arm,primecell"; 22 - - "arm,coresight-stm", "arm,primecell"; [1] 15 + - Embedded Trace Buffer (version 1.0): 16 + "arm,coresight-etb10", "arm,primecell"; 17 + 18 + - Trace Port Interface Unit: 19 + "arm,coresight-tpiu", "arm,primecell"; 20 + 21 + - Trace Memory Controller, used for Embedded Trace Buffer(ETB), 22 + Embedded Trace FIFO(ETF) and Embedded Trace Router(ETR) 23 + configuration. The configuration mode (ETB, ETF, ETR) is 24 + discovered at boot time when the device is probed. 25 + "arm,coresight-tmc", "arm,primecell"; 26 + 27 + - Trace Funnel: 28 + "arm,coresight-funnel", "arm,primecell"; 29 + 30 + - Embedded Trace Macrocell (version 3.x) and 31 + Program Flow Trace Macrocell: 32 + "arm,coresight-etm3x", "arm,primecell"; 33 + 34 + - Embedded Trace Macrocell (version 4.x): 35 + "arm,coresight-etm4x", "arm,primecell"; 36 + 37 + - Qualcomm Configurable Replicator (version 1.x): 38 + "qcom,coresight-replicator1x", "arm,primecell"; 39 + 40 + - System Trace Macrocell: 41 + "arm,coresight-stm", "arm,primecell"; [1] 23 42 24 43 * reg: physical base address and length of the register 25 44 set(s) of the component.
+2 -2
Documentation/devicetree/bindings/arm/l2c2x0.txt
··· 86 86 firmware) 87 87 - arm,dynamic-clock-gating : L2 dynamic clock gating. Value: <0> (forcibly 88 88 disable), <1> (forcibly enable), property absent (OS specific behavior, 89 - preferrably retain firmware settings) 89 + preferably retain firmware settings) 90 90 - arm,standby-mode: L2 standby mode enable. Value <0> (forcibly disable), 91 91 <1> (forcibly enable), property absent (OS specific behavior, 92 - preferrably retain firmware settings) 92 + preferably retain firmware settings) 93 93 94 94 Example: 95 95
+4 -4
Documentation/devicetree/bindings/i2c/trivial-devices.txt
··· 146 146 sgx,vz89x SGX Sensortech VZ89X Sensors 147 147 sii,s35390a 2-wire CMOS real-time clock 148 148 skyworks,sky81452 Skyworks SKY81452: Six-Channel White LED Driver with Touch Panel Bias Supply 149 - st-micro,24c256 i2c serial eeprom (24cxx) 150 - stm,m41t00 Serial Access TIMEKEEPER 151 - stm,m41t62 Serial real-time clock (RTC) with alarm 152 - stm,m41t80 M41T80 - SERIAL ACCESS RTC WITH ALARMS 149 + st,24c256 i2c serial eeprom (24cxx) 150 + st,m41t00 Serial real-time clock (RTC) 151 + st,m41t62 Serial real-time clock (RTC) with alarm 152 + st,m41t80 M41T80 - SERIAL ACCESS RTC WITH ALARMS 153 153 taos,tsl2550 Ambient Light Sensor with SMBUS/Two Wire Serial Interface 154 154 ti,ads7828 8-Channels, 12-bit ADC 155 155 ti,ads7830 8-Channels, 8-bit ADC
+13 -13
Documentation/devicetree/bindings/mfd/da9052-i2c.txt
··· 8 8 - regulators : Contain the regulator nodes. The DA9052/53 regulators are 9 9 bound using their names as listed below: 10 10 11 - buck0 : regulator BUCK0 12 - buck1 : regulator BUCK1 13 - buck2 : regulator BUCK2 14 - buck3 : regulator BUCK3 11 + buck1 : regulator BUCK CORE 12 + buck2 : regulator BUCK PRO 13 + buck3 : regulator BUCK MEM 14 + buck4 : regulator BUCK PERI 15 + ldo1 : regulator LDO1 16 + ldo2 : regulator LDO2 17 + ldo3 : regulator LDO3 15 18 ldo4 : regulator LDO4 16 19 ldo5 : regulator LDO5 17 20 ldo6 : regulator LDO6 ··· 22 19 ldo8 : regulator LDO8 23 20 ldo9 : regulator LDO9 24 21 ldo10 : regulator LDO10 25 - ldo11 : regulator LDO11 26 - ldo12 : regulator LDO12 27 - ldo13 : regulator LDO13 28 22 29 23 The bindings details of individual regulator device can be found in: 30 24 Documentation/devicetree/bindings/regulator/regulator.txt ··· 36 36 reg = <0x48>; 37 37 38 38 regulators { 39 - buck0 { 40 - regulator-min-microvolt = <500000>; 41 - regulator-max-microvolt = <2075000>; 42 - }; 43 - 44 39 buck1 { 45 40 regulator-min-microvolt = <500000>; 46 41 regulator-max-microvolt = <2075000>; 47 42 }; 48 43 49 44 buck2 { 45 + regulator-min-microvolt = <500000>; 46 + regulator-max-microvolt = <2075000>; 47 + }; 48 + 49 + buck3 { 50 50 regulator-min-microvolt = <925000>; 51 51 regulator-max-microvolt = <2500000>; 52 52 }; 53 53 54 - buck3 { 54 + buck4 { 55 55 regulator-min-microvolt = <925000>; 56 56 regulator-max-microvolt = <2500000>; 57 57 };
+6
Documentation/devicetree/bindings/net/cavium-pip.txt
··· 37 37 38 38 - phy-handle: Optional, see ethernet.txt file in the same directory. 39 39 40 + - rx-delay: Delay value for RGMII receive clock. Optional. Disabled if 0. 41 + Value range is 1-31, and mapping to the actual delay varies depending on HW. 42 + 43 + - tx-delay: Delay value for RGMII transmit clock. Optional. Disabled if 0. 44 + Value range is 1-31, and mapping to the actual delay varies depending on HW. 45 + 40 46 Example: 41 47 42 48 pip@11800a0000000 {
+1 -1
Documentation/devicetree/bindings/net/dsa/dsa.txt
··· 317 317 Note that a port labelled "dsa" will imply checking for the uplink phandle 318 318 described below. 319 319 320 - Optionnal property: 320 + Optional property: 321 321 - link : Should be a list of phandles to another switch's DSA port. 322 322 This property is only used when switches are being 323 323 chained/cascaded together. This port is used as outgoing port
+2 -2
Documentation/devicetree/bindings/powerpc/fsl/fman.txt
··· 35 35 Definition: Specifies the index of the FMan unit. 36 36 37 37 The cell-index value may be used by the SoC, to identify the 38 - FMan unit in the SoC memory map. In the table bellow, 38 + FMan unit in the SoC memory map. In the table below, 39 39 there's a description of the cell-index use in each SoC: 40 40 41 41 - P1023: ··· 247 247 248 248 The cell-index value may be used by the FMan or the SoC, to 249 249 identify the MAC unit in the FMan (or SoC) memory map. 250 - In the tables bellow there's a description of the cell-index 250 + In the tables below there's a description of the cell-index 251 251 use, there are two tables, one describes the use of cell-index 252 252 by the FMan, the second describes the use by the SoC: 253 253
+1 -1
Documentation/devicetree/bindings/regmap/regmap.txt
··· 14 14 be marked that way in the devicetree. 15 15 16 16 On SoCs that can be operated in both big-endian and little-endian 17 - modes, with a single hardware switch controlling both the endianess 17 + modes, with a single hardware switch controlling both the endianness 18 18 of the CPU and a byteswap for MMIO registers (e.g. many Broadcom MIPS 19 19 chips), "native-endian" is used to allow using the same device tree 20 20 blob in both cases.
+2 -2
Documentation/devicetree/bindings/serial/qcom,msm-uartdm.txt
··· 28 28 - dma-names: Should contain "tx" for transmit and "rx" for receive channels 29 29 - qcom,tx-crci: Identificator <u32> for Client Rate Control Interface to be 30 30 used with TX DMA channel. Required when using DMA for transmission 31 - with UARTDM v1.3 and bellow. 31 + with UARTDM v1.3 and below. 32 32 - qcom,rx-crci: Identificator <u32> for Client Rate Control Interface to be 33 33 used with RX DMA channel. Required when using DMA for reception 34 - with UARTDM v1.3 and bellow. 34 + with UARTDM v1.3 and below. 35 35 36 36 Note: Aliases may be defined to ensure the correct ordering of the UARTs. 37 37 The alias serialN will result in the UART being assigned port N. If any
+1 -1
Documentation/devicetree/bindings/sound/simple-card.txt
··· 30 30 sub-nodes. This container may be 31 31 omitted when the card has only one 32 32 DAI link. See the examples and the 33 - section bellow. 33 + section below. 34 34 35 35 Dai-link subnode properties and subnodes: 36 36
+1 -1
Documentation/devicetree/bindings/timer/allwinner,sun5i-a13-hstimer.txt
··· 9 9 one) 10 10 - clocks: phandle to the source clock (usually the AHB clock) 11 11 12 - Optionnal properties: 12 + Optional properties: 13 13 - resets: phandle to a reset controller asserting the timer 14 14 15 15 Example:
-7
arch/arc/kernel/setup.c
··· 15 15 #include <linux/cpu.h> 16 16 #include <linux/of_fdt.h> 17 17 #include <linux/of.h> 18 - #include <linux/of_platform.h> 19 18 #include <linux/cache.h> 20 19 #include <asm/sections.h> 21 20 #include <asm/arcregs.h> ··· 435 436 436 437 static int __init customize_machine(void) 437 438 { 438 - /* 439 - * Traverses flattened DeviceTree - registering platform devices 440 - * (if any) complete with their resources 441 - */ 442 - of_platform_default_populate(NULL, NULL, NULL); 443 - 444 439 if (machine_desc->init_machine) 445 440 machine_desc->init_machine(); 446 441
+1 -1
arch/arm/boot/dts/imx28-m28.dtsi
··· 37 37 status = "okay"; 38 38 39 39 rtc: rtc@68 { 40 - compatible = "stm,m41t62"; 40 + compatible = "st,m41t62"; 41 41 reg = <0x68>; 42 42 }; 43 43 };
+1 -1
arch/arm/boot/dts/imx51-ts4800.dts
··· 102 102 status = "okay"; 103 103 104 104 rtc: m41t00@68 { 105 - compatible = "stm,m41t00"; 105 + compatible = "st,m41t00"; 106 106 reg = <0x68>; 107 107 }; 108 108 };
+1 -1
arch/arm/boot/dts/imx53-m53.dtsi
··· 84 84 }; 85 85 86 86 rtc: rtc@68 { 87 - compatible = "stm,m41t62"; 87 + compatible = "st,m41t62"; 88 88 reg = <0x68>; 89 89 }; 90 90 };
+1 -1
arch/arm/boot/dts/imx6q-dmo-edmqmx6.dts
··· 282 282 }; 283 283 284 284 rtc: m41t62@68 { 285 - compatible = "stm,m41t62"; 285 + compatible = "st,m41t62"; 286 286 reg = <0x68>; 287 287 }; 288 288 };
+1 -1
arch/arm/boot/dts/socfpga_cyclone5_socrates.dts
··· 52 52 status = "okay"; 53 53 54 54 rtc: rtc@68 { 55 - compatible = "stm,m41t82"; 55 + compatible = "st,m41t82"; 56 56 reg = <0x68>; 57 57 }; 58 58 };
+1 -7
arch/arm/kernel/setup.c
··· 19 19 #include <linux/bootmem.h> 20 20 #include <linux/seq_file.h> 21 21 #include <linux/screen_info.h> 22 - #include <linux/of_iommu.h> 23 22 #include <linux/of_platform.h> 24 23 #include <linux/init.h> 25 24 #include <linux/kexec.h> ··· 902 903 * machine from the device tree, if no callback is provided, 903 904 * otherwise we would always need an init_machine callback. 904 905 */ 905 - of_iommu_init(); 906 906 if (machine_desc->init_machine) 907 907 machine_desc->init_machine(); 908 - #ifdef CONFIG_OF 909 - else 910 - of_platform_populate(NULL, of_default_bus_match_table, 911 - NULL, NULL); 912 - #endif 908 + 913 909 return 0; 914 910 } 915 911 arch_initcall(customize_machine);
-3
arch/arm/mach-artpec/board-artpec6.c
··· 13 13 #include <linux/irqchip.h> 14 14 #include <linux/irqchip/arm-gic.h> 15 15 #include <linux/mfd/syscon.h> 16 - #include <linux/of_platform.h> 17 16 #include <linux/of.h> 18 17 #include <linux/of_address.h> 19 18 #include <linux/clk-provider.h> ··· 43 44 regmap_write(regmap, ARTPEC6_DMACFG_REGNUM, 44 45 ARTPEC6_DMACFG_UARTS_BURST); 45 46 }; 46 - 47 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 48 47 } 49 48 50 49 static void artpec6_l2c310_write_sec(unsigned long val, unsigned reg)
+1 -1
arch/arm/mach-at91/at91rm9200.c
··· 30 30 if (soc != NULL) 31 31 soc_dev = soc_device_to_device(soc); 32 32 33 - of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); 33 + of_platform_default_populate(NULL, NULL, soc_dev); 34 34 35 35 at91rm9200_pm_init(); 36 36 }
+1 -1
arch/arm/mach-at91/at91sam9.c
··· 61 61 if (soc != NULL) 62 62 soc_dev = soc_device_to_device(soc); 63 63 64 - of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); 64 + of_platform_default_populate(NULL, NULL, soc_dev); 65 65 } 66 66 67 67 static void __init at91sam9_dt_device_init(void)
+1 -1
arch/arm/mach-at91/sama5.c
··· 68 68 if (soc != NULL) 69 69 soc_dev = soc_device_to_device(soc); 70 70 71 - of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev); 71 + of_platform_default_populate(NULL, NULL, soc_dev); 72 72 sama5_pm_init(); 73 73 } 74 74
-2
arch/arm/mach-bcm/board_bcm21664.c
··· 12 12 */ 13 13 14 14 #include <linux/of_address.h> 15 - #include <linux/of_platform.h> 16 15 #include <linux/io.h> 17 16 18 17 #include <asm/mach/arch.h> ··· 59 60 60 61 static void __init bcm21664_init(void) 61 62 { 62 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 63 63 kona_l2_cache_init(); 64 64 } 65 65
-2
arch/arm/mach-bcm/board_bcm281xx.c
··· 13 13 14 14 #include <linux/clocksource.h> 15 15 #include <linux/of_address.h> 16 - #include <linux/of_platform.h> 17 16 18 17 #include <asm/mach/arch.h> 19 18 ··· 57 58 58 59 static void __init bcm281xx_init(void) 59 60 { 60 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 61 61 kona_l2_cache_init(); 62 62 } 63 63
-10
arch/arm/mach-bcm/board_bcm2835.c
··· 15 15 #include <linux/init.h> 16 16 #include <linux/irqchip.h> 17 17 #include <linux/of_address.h> 18 - #include <linux/of_platform.h> 19 18 #include <linux/clk/bcm2835.h> 20 19 21 20 #include <asm/mach/arch.h> ··· 22 23 23 24 static void __init bcm2835_init(void) 24 25 { 25 - int ret; 26 - 27 26 bcm2835_init_clocks(); 28 - 29 - ret = of_platform_populate(NULL, of_default_bus_match_table, NULL, 30 - NULL); 31 - if (ret) { 32 - pr_err("of_platform_populate failed: %d\n", ret); 33 - BUG(); 34 - } 35 27 } 36 28 37 29 static const char * const bcm2835_compat[] = {
+1 -2
arch/arm/mach-cns3xxx/core.c
··· 395 395 396 396 pm_power_off = cns3xxx_power_off; 397 397 398 - of_platform_populate(NULL, of_default_bus_match_table, 399 - cns3xxx_auxdata, NULL); 398 + of_platform_default_populate(NULL, cns3xxx_auxdata, NULL); 400 399 } 401 400 402 401 static const char *const cns3xxx_dt_compat[] __initconst = {
-3
arch/arm/mach-exynos/exynos.c
··· 14 14 #include <linux/of.h> 15 15 #include <linux/of_address.h> 16 16 #include <linux/of_fdt.h> 17 - #include <linux/of_platform.h> 18 17 #include <linux/platform_device.h> 19 18 #include <linux/irqchip.h> 20 19 #include <linux/soc/samsung/exynos-regs-pmu.h> ··· 216 217 of_machine_is_compatible("samsung,exynos3250") || 217 218 of_machine_is_compatible("samsung,exynos5250")) 218 219 platform_device_register(&exynos_cpuidle); 219 - 220 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 221 220 } 222 221 223 222 static char const *const exynos_dt_compat[] __initconst = {
-3
arch/arm/mach-highbank/highbank.c
··· 23 23 #include <linux/pl320-ipc.h> 24 24 #include <linux/of.h> 25 25 #include <linux/of_irq.h> 26 - #include <linux/of_platform.h> 27 26 #include <linux/of_address.h> 28 27 #include <linux/reboot.h> 29 28 #include <linux/amba/bus.h> ··· 161 162 bus_register_notifier(&amba_bustype, &highbank_amba_nb); 162 163 163 164 pl320_ipc_register_notifier(&hb_keys_nb); 164 - 165 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 166 165 167 166 if (psci_ops.cpu_suspend) 168 167 platform_device_register(&highbank_cpuidle_device);
-2
arch/arm/mach-imx/mach-imx51.c
··· 52 52 { 53 53 imx51_ipu_mipi_setup(); 54 54 imx_src_init(); 55 - 56 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 57 55 } 58 56 59 57 static void __init imx51_init_late(void)
-2
arch/arm/mach-imx/mach-imx53.c
··· 32 32 { 33 33 imx_src_init(); 34 34 35 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 36 - 37 35 imx_aips_allow_unprivileged_access("fsl,imx53-aipstz"); 38 36 } 39 37
+1 -1
arch/arm/mach-imx/mach-imx6q.c
··· 278 278 279 279 imx6q_enet_phy_init(); 280 280 281 - of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); 281 + of_platform_default_populate(NULL, NULL, parent); 282 282 283 283 imx_anatop_init(); 284 284 cpu_is_imx6q() ? imx6q_pm_init() : imx6dl_pm_init();
+1 -1
arch/arm/mach-imx/mach-imx6sl.c
··· 52 52 if (parent == NULL) 53 53 pr_warn("failed to initialize soc device\n"); 54 54 55 - of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); 55 + of_platform_default_populate(NULL, NULL, parent); 56 56 57 57 imx6sl_fec_init(); 58 58 imx_anatop_init();
+1 -1
arch/arm/mach-imx/mach-imx6sx.c
··· 72 72 if (parent == NULL) 73 73 pr_warn("failed to initialize soc device\n"); 74 74 75 - of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); 75 + of_platform_default_populate(NULL, NULL, parent); 76 76 77 77 imx6sx_enet_init(); 78 78 imx_anatop_init();
-1
arch/arm/mach-imx/mach-imx6ul.c
··· 64 64 if (parent == NULL) 65 65 pr_warn("failed to initialize soc device\n"); 66 66 67 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 68 67 imx6ul_enet_init(); 69 68 imx_anatop_init(); 70 69 imx6ul_pm_init();
-1
arch/arm/mach-imx/mach-imx7d.c
··· 93 93 if (parent == NULL) 94 94 pr_warn("failed to initialize soc device\n"); 95 95 96 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 97 96 imx_anatop_init(); 98 97 imx7d_enet_init(); 99 98 }
+1 -2
arch/arm/mach-integrator/integrator_ap.c
··· 240 240 if (!ebi_base) 241 241 return; 242 242 243 - of_platform_populate(NULL, of_default_bus_match_table, 244 - ap_auxdata_lookup, NULL); 243 + of_platform_default_populate(NULL, ap_auxdata_lookup, NULL); 245 244 246 245 sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET); 247 246 for (i = 0; i < 4; i++) {
+1 -2
arch/arm/mach-integrator/integrator_cp.c
··· 231 231 if (!intcp_con_base) 232 232 return; 233 233 234 - of_platform_populate(NULL, of_default_bus_match_table, 235 - intcp_auxdata_lookup, NULL); 234 + of_platform_default_populate(NULL, intcp_auxdata_lookup, NULL); 236 235 } 237 236 238 237 static const char * intcp_dt_board_compat[] = {
-1
arch/arm/mach-keystone/keystone.c
··· 60 60 bus_register_notifier(&platform_bus_type, &platform_nb); 61 61 } 62 62 keystone_pm_runtime_init(); 63 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 64 63 } 65 64 66 65 static long long __init keystone_pv_fixup(void)
+1 -2
arch/arm/mach-lpc32xx/phy3250.c
··· 191 191 LPC32XX_CLKPWR_TESTCLK_TESTCLK2_EN, 192 192 LPC32XX_CLKPWR_TEST_CLK_SEL); 193 193 194 - of_platform_populate(NULL, of_default_bus_match_table, 195 - lpc32xx_auxdata_lookup, NULL); 194 + of_platform_default_populate(NULL, lpc32xx_auxdata_lookup, NULL); 196 195 } 197 196 198 197 static const char *const lpc32xx_dt_compat[] __initconst = {
-3
arch/arm/mach-mvebu/board-v7.c
··· 16 16 #include <linux/init.h> 17 17 #include <linux/of_address.h> 18 18 #include <linux/of_fdt.h> 19 - #include <linux/of_platform.h> 20 19 #include <linux/io.h> 21 20 #include <linux/clocksource.h> 22 21 #include <linux/dma-mapping.h> ··· 143 144 { 144 145 if (of_machine_is_compatible("marvell,armadaxp")) 145 146 i2c_quirk(); 146 - 147 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 148 147 } 149 148 150 149 static const char * const armada_370_xp_dt_compat[] __initconst = {
-2
arch/arm/mach-mvebu/dove.c
··· 11 11 #include <linux/init.h> 12 12 #include <linux/mbus.h> 13 13 #include <linux/of.h> 14 - #include <linux/of_platform.h> 15 14 #include <linux/soc/dove/pmu.h> 16 15 #include <asm/hardware/cache-tauros2.h> 17 16 #include <asm/mach/arch.h> ··· 25 26 #endif 26 27 BUG_ON(mvebu_mbus_dt_init(false)); 27 28 dove_init_pmu(); 28 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 29 29 } 30 30 31 31 static const char * const dove_dt_compat[] __initconst = {
+1 -1
arch/arm/mach-mvebu/kirkwood.c
··· 179 179 kirkwood_pm_init(); 180 180 kirkwood_dt_eth_fixup(); 181 181 182 - of_platform_populate(NULL, of_default_bus_match_table, auxdata, NULL); 182 + of_platform_default_populate(NULL, auxdata, NULL); 183 183 } 184 184 185 185 static const char * const kirkwood_dt_board_compat[] __initconst = {
+1 -2
arch/arm/mach-mxs/mach-mxs.c
··· 498 498 else if (of_machine_is_compatible("msr,m28cu3")) 499 499 m28cu3_init(); 500 500 501 - of_platform_populate(NULL, of_default_bus_match_table, 502 - NULL, parent); 501 + of_platform_default_populate(NULL, NULL, parent); 503 502 504 503 mxs_restart_init(); 505 504
+1 -2
arch/arm/mach-nspire/nspire.c
··· 57 57 58 58 static void __init nspire_init(void) 59 59 { 60 - of_platform_populate(NULL, of_default_bus_match_table, 61 - nspire_auxdata, NULL); 60 + of_platform_default_populate(NULL, nspire_auxdata, NULL); 62 61 } 63 62 64 63 static void nspire_restart(enum reboot_mode mode, const char *cmd)
+1 -2
arch/arm/mach-orion5x/board-dt.c
··· 63 63 if (of_machine_is_compatible("maxtor,shared-storage-2")) 64 64 mss2_init(); 65 65 66 - of_platform_populate(NULL, of_default_bus_match_table, 67 - orion5x_auxdata_lookup, NULL); 66 + of_platform_default_populate(NULL, orion5x_auxdata_lookup, NULL); 68 67 } 69 68 70 69 static const char *orion5x_dt_compat[] = {
-2
arch/arm/mach-picoxcell/common.c
··· 10 10 #include <linux/delay.h> 11 11 #include <linux/of.h> 12 12 #include <linux/of_address.h> 13 - #include <linux/of_platform.h> 14 13 #include <linux/reboot.h> 15 14 16 15 #include <asm/mach/arch.h> ··· 53 54 54 55 static void __init picoxcell_init_machine(void) 55 56 { 56 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 57 57 picoxcell_setup_restart(); 58 58 } 59 59
-1
arch/arm/mach-rockchip/rockchip.c
··· 73 73 static void __init rockchip_dt_init(void) 74 74 { 75 75 rockchip_suspend_init(); 76 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 77 76 } 78 77 79 78 static const char * const rockchip_board_dt_compat[] = {
-2
arch/arm/mach-s3c24xx/mach-s3c2416-dt.c
··· 17 17 18 18 #include <linux/clocksource.h> 19 19 #include <linux/irqchip.h> 20 - #include <linux/of_platform.h> 21 20 #include <linux/serial_s3c.h> 22 21 23 22 #include <asm/mach/arch.h> ··· 34 35 35 36 static void __init s3c2416_dt_machine_init(void) 36 37 { 37 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 38 38 s3c_pm_init(); 39 39 } 40 40
-3
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c
··· 8 8 * published by the Free Software Foundation. 9 9 */ 10 10 11 - #include <linux/of_platform.h> 12 - 13 11 #include <asm/mach/arch.h> 14 12 #include <asm/mach/map.h> 15 13 #include <asm/system_misc.h> ··· 46 48 static void __init s3c64xx_dt_init_machine(void) 47 49 { 48 50 samsung_wdt_reset_of_init(); 49 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 50 51 } 51 52 52 53 static void s3c64xx_dt_restart(enum reboot_mode mode, const char *cmd)
-3
arch/arm/mach-shmobile/setup-r8a7740.c
··· 18 18 #include <linux/io.h> 19 19 #include <linux/irqchip.h> 20 20 #include <linux/irqchip/arm-gic.h> 21 - #include <linux/of_platform.h> 22 21 23 22 #include <asm/mach/map.h> 24 23 #include <asm/mach/arch.h> ··· 76 77 static void __init r8a7740_generic_init(void) 77 78 { 78 79 r8a7740_meram_workaround(); 79 - 80 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 81 80 } 82 81 83 82 static const char *const r8a7740_boards_compat_dt[] __initconst = {
-2
arch/arm/mach-shmobile/setup-sh73a0.c
··· 18 18 #include <linux/init.h> 19 19 #include <linux/interrupt.h> 20 20 #include <linux/irq.h> 21 - #include <linux/of_platform.h> 22 21 #include <linux/delay.h> 23 22 #include <linux/input.h> 24 23 #include <linux/io.h> ··· 54 55 /* Shared attribute override enable, 64K*8way */ 55 56 l2x0_init(IOMEM(0xf0100000), 0x00400000, 0xc20f0fff); 56 57 #endif 57 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 58 58 } 59 59 60 60 static const char *const sh73a0_boards_compat_dt[] __initconst = {
-2
arch/arm/mach-spear/spear1310.c
··· 14 14 #define pr_fmt(fmt) "SPEAr1310: " fmt 15 15 16 16 #include <linux/amba/pl022.h> 17 - #include <linux/of_platform.h> 18 17 #include <linux/pata_arasan_cf_data.h> 19 18 #include <asm/mach/arch.h> 20 19 #include <asm/mach/map.h> ··· 26 27 27 28 static void __init spear1310_dt_init(void) 28 29 { 29 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 30 30 platform_device_register_simple("spear-cpufreq", -1, NULL, 0); 31 31 } 32 32
-1
arch/arm/mach-spear/spear1340.c
··· 19 19 20 20 static void __init spear1340_dt_init(void) 21 21 { 22 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 23 22 platform_device_register_simple("spear-cpufreq", -1, NULL, 0); 24 23 } 25 24
+1 -2
arch/arm/mach-spear/spear300.c
··· 194 194 pl080_plat_data.slave_channels = spear300_dma_info; 195 195 pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear300_dma_info); 196 196 197 - of_platform_populate(NULL, of_default_bus_match_table, 198 - spear300_auxdata_lookup, NULL); 197 + of_platform_default_populate(NULL, spear300_auxdata_lookup, NULL); 199 198 } 200 199 201 200 static const char * const spear300_dt_board_compat[] = {
+1 -2
arch/arm/mach-spear/spear310.c
··· 236 236 pl080_plat_data.slave_channels = spear310_dma_info; 237 237 pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear310_dma_info); 238 238 239 - of_platform_populate(NULL, of_default_bus_match_table, 240 - spear310_auxdata_lookup, NULL); 239 + of_platform_default_populate(NULL, spear310_auxdata_lookup, NULL); 241 240 } 242 241 243 242 static const char * const spear310_dt_board_compat[] = {
+1 -2
arch/arm/mach-spear/spear320.c
··· 240 240 pl080_plat_data.slave_channels = spear320_dma_info; 241 241 pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear320_dma_info); 242 242 243 - of_platform_populate(NULL, of_default_bus_match_table, 244 - spear320_auxdata_lookup, NULL); 243 + of_platform_default_populate(NULL, spear320_auxdata_lookup, NULL); 245 244 } 246 245 247 246 static const char * const spear320_dt_board_compat[] = {
+1 -2
arch/arm/mach-spear/spear6xx.c
··· 411 411 412 412 static void __init spear600_dt_init(void) 413 413 { 414 - of_platform_populate(NULL, of_default_bus_match_table, 415 - spear6xx_auxdata_lookup, NULL); 414 + of_platform_default_populate(NULL, spear6xx_auxdata_lookup, NULL); 416 415 } 417 416 418 417 static const char *spear600_dt_board_compat[] = {
+1 -1
arch/arm/mach-tegra/tegra.c
··· 115 115 * devices 116 116 */ 117 117 out: 118 - of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); 118 + of_platform_default_populate(NULL, NULL, parent); 119 119 } 120 120 121 121 static void __init paz00_init(void)
+1 -2
arch/arm/mach-u300/core.c
··· 391 391 pinctrl_register_mappings(u300_pinmux_map, 392 392 ARRAY_SIZE(u300_pinmux_map)); 393 393 394 - of_platform_populate(NULL, of_default_bus_match_table, 395 - u300_auxdata_lookup, NULL); 394 + of_platform_default_populate(NULL, u300_auxdata_lookup, NULL); 396 395 397 396 /* Enable SEMI self refresh */ 398 397 val = readw(syscon_base + U300_SYSCON_SMCR) |
+1 -2
arch/arm/mach-versatile/versatile_dt.c
··· 344 344 345 345 versatile_dt_pci_init(); 346 346 347 - of_platform_populate(NULL, of_default_bus_match_table, 348 - versatile_auxdata_lookup, NULL); 347 + of_platform_default_populate(NULL, versatile_auxdata_lookup, NULL); 349 348 } 350 349 351 350 static const char *const versatile_dt_match[] __initconst = {
-3
arch/arm/mach-vt8500/vt8500.c
··· 30 30 #include <linux/of.h> 31 31 #include <linux/of_address.h> 32 32 #include <linux/of_irq.h> 33 - #include <linux/of_platform.h> 34 33 35 34 #define LEGACY_GPIO_BASE 0xD8110000 36 35 #define LEGACY_PMC_BASE 0xD8130000 ··· 157 158 pm_power_off = &vt8500_power_off; 158 159 else 159 160 pr_err("%s: PMC Hibernation register could not be remapped, not enabling power off!\n", __func__); 160 - 161 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 162 161 } 163 162 164 163 static const char * const vt8500_dt_compat[] = {
+1 -1
arch/arm/mach-zynq/common.c
··· 141 141 * Finished with the static registrations now; fill in the missing 142 142 * devices 143 143 */ 144 - of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); 144 + of_platform_default_populate(NULL, NULL, parent); 145 145 146 146 platform_device_register(&zynq_cpuidle_device); 147 147 }
-15
arch/arm64/kernel/setup.c
··· 39 39 #include <linux/fs.h> 40 40 #include <linux/proc_fs.h> 41 41 #include <linux/memblock.h> 42 - #include <linux/of_iommu.h> 43 42 #include <linux/of_fdt.h> 44 - #include <linux/of_platform.h> 45 43 #include <linux/efi.h> 46 44 #include <linux/psci.h> 47 45 ··· 300 302 boot_args[1], boot_args[2], boot_args[3]); 301 303 } 302 304 } 303 - 304 - static int __init arm64_device_init(void) 305 - { 306 - if (of_have_populated_dt()) { 307 - of_iommu_init(); 308 - of_platform_populate(NULL, of_default_bus_match_table, 309 - NULL, NULL); 310 - } else if (acpi_disabled) { 311 - pr_crit("Device tree not populated\n"); 312 - } 313 - return 0; 314 - } 315 - arch_initcall_sync(arm64_device_init); 316 305 317 306 static int __init topology_init(void) 318 307 {
+1 -1
arch/c6x/platforms/Makefile
··· 4 4 # Copyright 2010, 2011 Texas Instruments Incorporated 5 5 # 6 6 7 - obj-y = platform.o cache.o megamod-pic.o pll.o plldata.o timer64.o 7 + obj-y = cache.o megamod-pic.o pll.o plldata.o timer64.o 8 8 obj-y += dscr.o 9 9 10 10 # SoC objects
-17
arch/c6x/platforms/platform.c
··· 1 - /* 2 - * Copyright 2011 Texas Instruments Incorporated 3 - * 4 - * This file is licensed under the terms of the GNU General Public License 5 - * version 2. This program is licensed "as is" without any warranty of any 6 - * kind, whether express or implied. 7 - */ 8 - 9 - #include <linux/init.h> 10 - #include <linux/of_platform.h> 11 - 12 - static int __init c6x_device_probe(void) 13 - { 14 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 15 - return 0; 16 - } 17 - core_initcall(c6x_device_probe);
-8
arch/cris/kernel/setup.c
··· 21 21 #include <linux/cpu.h> 22 22 #include <linux/of.h> 23 23 #include <linux/of_fdt.h> 24 - #include <linux/of_platform.h> 25 24 #include <asm/setup.h> 26 25 #include <arch/system.h> 27 26 ··· 211 212 } 212 213 213 214 subsys_initcall(topology_init); 214 - 215 - static int __init cris_of_init(void) 216 - { 217 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 218 - return 0; 219 - } 220 - core_initcall(cris_of_init);
+1 -4
arch/metag/kernel/setup.c
··· 20 20 #include <linux/memblock.h> 21 21 #include <linux/mm.h> 22 22 #include <linux/of_fdt.h> 23 - #include <linux/of_platform.h> 24 23 #include <linux/pfn.h> 25 24 #include <linux/root_dev.h> 26 25 #include <linux/sched.h> ··· 413 414 /* customizes platform devices, or adds new ones */ 414 415 if (machine_desc->init_machine) 415 416 machine_desc->init_machine(); 416 - else 417 - of_platform_populate(NULL, of_default_bus_match_table, NULL, 418 - NULL); 417 + 419 418 return 0; 420 419 } 421 420 arch_initcall(customize_machine);
-2
arch/mips/ath79/setup.c
··· 18 18 #include <linux/err.h> 19 19 #include <linux/clk.h> 20 20 #include <linux/clk-provider.h> 21 - #include <linux/of_platform.h> 22 21 #include <linux/of_fdt.h> 23 22 24 23 #include <asm/bootinfo.h> ··· 284 285 285 286 static int __init ath79_setup(void) 286 287 { 287 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 288 288 if (mips_machtype == ATH79_MACH_GENERIC_OF) 289 289 return 0; 290 290
-8
arch/mips/jz4740/setup.c
··· 20 20 #include <linux/kernel.h> 21 21 #include <linux/libfdt.h> 22 22 #include <linux/of_fdt.h> 23 - #include <linux/of_platform.h> 24 23 25 24 #include <asm/bootinfo.h> 26 25 #include <asm/prom.h> ··· 72 73 73 74 unflatten_and_copy_device_tree(); 74 75 } 75 - 76 - static int __init populate_machine(void) 77 - { 78 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 79 - return 0; 80 - } 81 - arch_initcall(populate_machine); 82 76 83 77 const char *get_system_type(void) 84 78 {
-8
arch/mips/mti-sead3/sead3-setup.c
··· 8 8 */ 9 9 #include <linux/init.h> 10 10 #include <linux/libfdt.h> 11 - #include <linux/of_platform.h> 12 11 #include <linux/of_fdt.h> 13 12 14 13 #include <asm/prom.h> ··· 106 107 107 108 unflatten_and_copy_device_tree(); 108 109 } 109 - 110 - static int __init customize_machine(void) 111 - { 112 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 113 - return 0; 114 - } 115 - arch_initcall(customize_machine);
+1 -2
arch/mips/pic32/pic32mzda/init.c
··· 147 147 panic("Device tree not present"); 148 148 149 149 pic32_of_prepare_platform_data(pic32_auxdata_lookup); 150 - if (of_platform_populate(NULL, of_default_bus_match_table, 151 - pic32_auxdata_lookup, NULL)) 150 + if (of_platform_default_populate(NULL, pic32_auxdata_lookup, NULL)) 152 151 panic("Failed to populate DT"); 153 152 154 153 return 0;
-13
arch/mips/pistachio/init.c
··· 14 14 #include <linux/kernel.h> 15 15 #include <linux/of_address.h> 16 16 #include <linux/of_fdt.h> 17 - #include <linux/of_platform.h> 18 17 19 18 #include <asm/cacheflush.h> 20 19 #include <asm/dma-coherence.h> ··· 158 159 159 160 unflatten_and_copy_device_tree(); 160 161 } 161 - 162 - static int __init plat_of_setup(void) 163 - { 164 - if (!of_have_populated_dt()) 165 - panic("Device tree not present"); 166 - 167 - if (of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL)) 168 - panic("Failed to populate DT"); 169 - 170 - return 0; 171 - } 172 - arch_initcall(plat_of_setup);
-13
arch/mips/xilfpga/init.c
··· 10 10 */ 11 11 12 12 #include <linux/of_fdt.h> 13 - #include <linux/of_platform.h> 14 13 15 14 #include <asm/prom.h> 16 15 ··· 42 43 43 44 unflatten_and_copy_device_tree(); 44 45 } 45 - 46 - static int __init plat_of_setup(void) 47 - { 48 - if (!of_have_populated_dt()) 49 - panic("Device tree not present"); 50 - 51 - if (of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL)) 52 - panic("Failed to populate DT"); 53 - 54 - return 0; 55 - } 56 - arch_initcall(plat_of_setup);
+1 -3
arch/nios2/platform/platform.c
··· 9 9 */ 10 10 11 11 #include <linux/init.h> 12 - #include <linux/of_platform.h> 13 12 #include <linux/of_address.h> 14 13 #include <linux/of_fdt.h> 15 14 #include <linux/err.h> ··· 38 39 } 39 40 } 40 41 41 - return of_platform_populate(NULL, of_default_bus_match_table, 42 - NULL, NULL); 42 + return 0; 43 43 } 44 44 45 45 device_initcall(nios2_soc_device_init);
+1 -1
arch/powerpc/boot/dts/ac14xx.dts
··· 231 231 }; 232 232 233 233 rtc@68 { 234 - compatible = "stm,m41t00"; 234 + compatible = "st,m41t00"; 235 235 reg = <0x68>; 236 236 }; 237 237 };
+1 -1
arch/powerpc/boot/dts/akebono.dts
··· 224 224 #address-cells = <1>; 225 225 #size-cells = <0>; 226 226 rtc@68 { 227 - compatible = "stm,m41t80", "m41st85"; 227 + compatible = "st,m41t80", "m41st85"; 228 228 reg = <0x68>; 229 229 }; 230 230 };
+1 -1
arch/powerpc/boot/dts/bluestone.dts
··· 279 279 #address-cells = <1>; 280 280 #size-cells = <0>; 281 281 rtc@68 { 282 - compatible = "stm,m41t80"; 282 + compatible = "st,m41t80"; 283 283 reg = <0x68>; 284 284 interrupt-parent = <&UIC0>; 285 285 interrupts = <0x9 0x8>;
+1 -1
arch/powerpc/boot/dts/canyonlands.dts
··· 319 319 #address-cells = <1>; 320 320 #size-cells = <0>; 321 321 rtc@68 { 322 - compatible = "stm,m41t80"; 322 + compatible = "st,m41t80"; 323 323 reg = <0x68>; 324 324 interrupt-parent = <&UIC2>; 325 325 interrupts = <0x19 0x8>;
+1 -1
arch/powerpc/boot/dts/currituck.dts
··· 116 116 #address-cells = <1>; 117 117 #size-cells = <0>; 118 118 rtc@68 { 119 - compatible = "stm,m41t80", "m41st85"; 119 + compatible = "st,m41t80", "m41st85"; 120 120 reg = <0x68>; 121 121 }; 122 122 };
+1 -1
arch/powerpc/boot/dts/fsl/mpc8569mds.dts
··· 232 232 mode = "cpu-qe"; 233 233 234 234 serial-flash@0 { 235 - compatible = "stm,m25p40"; 235 + compatible = "st,m25p40"; 236 236 reg = <0>; 237 237 spi-max-frequency = <25000000>; 238 238 };
+1 -1
arch/powerpc/boot/dts/fsl/p1022rdk.dts
··· 57 57 clock-frequency = <12288000>; 58 58 }; 59 59 rtc@68 { 60 - compatible = "stm,m41t62"; 60 + compatible = "st,m41t62"; 61 61 reg = <0x68>; 62 62 }; 63 63 adt7461@4c{
+1 -1
arch/powerpc/boot/dts/glacier.dts
··· 287 287 #address-cells = <1>; 288 288 #size-cells = <0>; 289 289 rtc@68 { 290 - compatible = "stm,m41t80"; 290 + compatible = "st,m41t80"; 291 291 reg = <0x68>; 292 292 interrupt-parent = <&UIC2>; 293 293 interrupts = <0x19 0x8>;
+1 -1
arch/powerpc/boot/dts/icon.dts
··· 256 256 #size-cells = <0>; 257 257 258 258 rtc@68 { 259 - compatible = "stm,m41t00"; 259 + compatible = "st,m41t00"; 260 260 reg = <0x68>; 261 261 }; 262 262 };
+1 -1
arch/powerpc/boot/dts/mpc5121ads.dts
··· 99 99 }; 100 100 101 101 rtc@68 { 102 - compatible = "stm,m41t62"; 102 + compatible = "st,m41t62"; 103 103 reg = <0x68>; 104 104 }; 105 105 };
+1 -1
arch/powerpc/boot/dts/mpc8349emitx.dts
··· 92 92 dfsrr; 93 93 94 94 eeprom: at24@50 { 95 - compatible = "st-micro,24c256"; 95 + compatible = "st,24c256"; 96 96 reg = <0x50>; 97 97 }; 98 98
+1 -1
arch/powerpc/boot/dts/mpc836x_rdk.dts
··· 416 416 gpios = <&qe_pio_e 18 0>; 417 417 418 418 flash { 419 - compatible = "stm,nand512-a"; 419 + compatible = "st,nand512-a"; 420 420 }; 421 421 }; 422 422
+1 -1
arch/powerpc/boot/dts/pdm360ng.dts
··· 103 103 }; 104 104 105 105 rtc@68 { 106 - compatible = "stm,m41t00"; 106 + compatible = "st,m41t00"; 107 107 reg = <0x68>; 108 108 }; 109 109 };
+1 -1
arch/powerpc/boot/dts/sam440ep.dts
··· 196 196 interrupt-parent = <&UIC0>; 197 197 interrupts = <2 4>; 198 198 rtc@68 { 199 - compatible = "stm,m41t80"; 199 + compatible = "st,m41t80"; 200 200 reg = <0x68>; 201 201 }; 202 202 };
+1 -1
arch/powerpc/boot/dts/xcalibur1501.dts
··· 238 238 }; 239 239 240 240 rtc@68 { 241 - compatible = "stm,m41t00", 241 + compatible = "st,m41t00", 242 242 "dallas,ds1338"; 243 243 reg = <0x68>; 244 244 };
+1 -1
arch/powerpc/boot/dts/xpedite5200.dts
··· 130 130 }; 131 131 132 132 rtc@68 { 133 - compatible = "stm,m41t00", 133 + compatible = "st,m41t00", 134 134 "dallas,ds1338"; 135 135 reg = <0x68>; 136 136 };
+1 -1
arch/powerpc/boot/dts/xpedite5200_xmon.dts
··· 134 134 }; 135 135 136 136 rtc@68 { 137 - compatible = "stm,m41t00", 137 + compatible = "st,m41t00", 138 138 "dallas,ds1338"; 139 139 reg = <0x68>; 140 140 };
+1 -1
arch/powerpc/boot/dts/xpedite5301.dts
··· 231 231 }; 232 232 233 233 rtc@68 { 234 - compatible = "stm,m41t00", 234 + compatible = "st,m41t00", 235 235 "dallas,ds1338"; 236 236 reg = <0x68>; 237 237 };
+1 -1
arch/powerpc/boot/dts/xpedite5330.dts
··· 267 267 }; 268 268 269 269 rtc@68 { 270 - compatible = "stm,m41t00", 270 + compatible = "st,m41t00", 271 271 "dallas,ds1338"; 272 272 reg = <0x68>; 273 273 };
+1 -1
arch/powerpc/boot/dts/xpedite5370.dts
··· 229 229 }; 230 230 231 231 rtc@68 { 232 - compatible = "stm,m41t00", 232 + compatible = "st,m41t00", 233 233 "dallas,ds1338"; 234 234 reg = <0x68>; 235 235 };
-16
arch/sh/boards/of-generic.c
··· 9 9 */ 10 10 11 11 #include <linux/of.h> 12 - #include <linux/of_platform.h> 13 12 #include <linux/of_fdt.h> 14 - #include <linux/of_iommu.h> 15 13 #include <linux/clocksource.h> 16 14 #include <linux/irqchip.h> 17 15 #include <linux/clk-provider.h> ··· 178 180 void __init plat_irq_setup(void) 179 181 { 180 182 } 181 - 182 - static int __init sh_of_device_init(void) 183 - { 184 - pr_info("SH generic board support: populating platform devices\n"); 185 - if (of_have_populated_dt()) { 186 - of_iommu_init(); 187 - of_platform_populate(NULL, of_default_bus_match_table, 188 - NULL, NULL); 189 - } else { 190 - pr_crit("Device tree not populated\n"); 191 - } 192 - return 0; 193 - } 194 - arch_initcall_sync(sh_of_device_init);
+1 -2
arch/xtensa/kernel/setup.c
··· 24 24 #include <linux/percpu.h> 25 25 #include <linux/clk-provider.h> 26 26 #include <linux/cpu.h> 27 + #include <linux/of.h> 27 28 #include <linux/of_fdt.h> 28 - #include <linux/of_platform.h> 29 29 30 30 #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) 31 31 # include <linux/console.h> ··· 255 255 static int __init xtensa_device_probe(void) 256 256 { 257 257 of_clk_init(NULL); 258 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 259 258 return 0; 260 259 } 261 260
+2 -3
drivers/bus/imx-weim.c
··· 163 163 } 164 164 165 165 if (have_child) 166 - ret = of_platform_populate(pdev->dev.of_node, 167 - of_default_bus_match_table, 168 - NULL, &pdev->dev); 166 + ret = of_platform_default_populate(pdev->dev.of_node, 167 + NULL, &pdev->dev); 169 168 if (ret) 170 169 dev_err(&pdev->dev, "%s fail to create devices.\n", 171 170 pdev->dev.of_node->full_name);
+1 -2
drivers/bus/uniphier-system-bus.c
··· 257 257 uniphier_system_bus_set_reg(priv); 258 258 259 259 /* Now, the bus is configured. Populate platform_devices below it */ 260 - return of_platform_populate(dev->of_node, of_default_bus_match_table, 261 - NULL, dev); 260 + return of_platform_default_populate(dev->of_node, NULL, dev); 262 261 } 263 262 264 263 static const struct of_device_id uniphier_system_bus_match[] = {
+4 -1
drivers/iommu/of_iommu.c
··· 174 174 return NULL; 175 175 } 176 176 177 - void __init of_iommu_init(void) 177 + static int __init of_iommu_init(void) 178 178 { 179 179 struct device_node *np; 180 180 const struct of_device_id *match, *matches = &__iommu_of_table; ··· 186 186 pr_err("Failed to initialise IOMMU %s\n", 187 187 of_node_full_name(np)); 188 188 } 189 + 190 + return 0; 189 191 } 192 + postcore_initcall_sync(of_iommu_init);
+1 -2
drivers/memory/omap-gpmc.c
··· 2134 2134 /* is child a common bus? */ 2135 2135 if (of_match_node(of_default_bus_match_table, child)) 2136 2136 /* create children and other common bus children */ 2137 - if (of_platform_populate(child, of_default_bus_match_table, 2138 - NULL, &pdev->dev)) 2137 + if (of_platform_default_populate(child, NULL, &pdev->dev)) 2139 2138 goto err_child_fail; 2140 2139 2141 2140 return 0;
+25 -24
drivers/of/address.c
··· 1 1 2 + #define pr_fmt(fmt) "OF: " fmt 3 + 2 4 #include <linux/device.h> 3 5 #include <linux/io.h> 4 6 #include <linux/ioport.h> ··· 26 24 #ifdef DEBUG 27 25 static void of_dump_addr(const char *s, const __be32 *addr, int na) 28 26 { 29 - printk(KERN_DEBUG "%s", s); 27 + pr_debug("%s", s); 30 28 while (na--) 31 - printk(" %08x", be32_to_cpu(*(addr++))); 32 - printk("\n"); 29 + pr_cont(" %08x", be32_to_cpu(*(addr++))); 30 + pr_cont("\n"); 33 31 } 34 32 #else 35 33 static void of_dump_addr(const char *s, const __be32 *addr, int na) { } ··· 70 68 s = of_read_number(range + na + pna, ns); 71 69 da = of_read_number(addr, na); 72 70 73 - pr_debug("OF: default map, cp=%llx, s=%llx, da=%llx\n", 71 + pr_debug("default map, cp=%llx, s=%llx, da=%llx\n", 74 72 (unsigned long long)cp, (unsigned long long)s, 75 73 (unsigned long long)da); 76 74 ··· 158 156 s = of_read_number(range + na + pna, ns); 159 157 da = of_read_number(addr + 1, na - 1); 160 158 161 - pr_debug("OF: PCI map, cp=%llx, s=%llx, da=%llx\n", 159 + pr_debug("PCI map, cp=%llx, s=%llx, da=%llx\n", 162 160 (unsigned long long)cp, (unsigned long long)s, 163 161 (unsigned long long)da); 164 162 ··· 383 381 s = of_read_number(range + na + pna, ns); 384 382 da = of_read_number(addr + 1, na - 1); 385 383 386 - pr_debug("OF: ISA map, cp=%llx, s=%llx, da=%llx\n", 384 + pr_debug("ISA map, cp=%llx, s=%llx, da=%llx\n", 387 385 (unsigned long long)cp, (unsigned long long)s, 388 386 (unsigned long long)da); 389 387 ··· 506 504 */ 507 505 ranges = of_get_property(parent, rprop, &rlen); 508 506 if (ranges == NULL && !of_empty_ranges_quirk(parent)) { 509 - pr_debug("OF: no ranges; cannot translate\n"); 507 + pr_debug("no ranges; cannot translate\n"); 510 508 return 1; 511 509 } 512 510 if (ranges == NULL || rlen == 0) { 513 511 offset = of_read_number(addr, na); 514 512 memset(addr, 0, pna * 4); 515 - pr_debug("OF: empty ranges; 1:1 translation\n"); 513 + pr_debug("empty ranges; 1:1 translation\n"); 516 514 goto finish; 517 515 } 518 516 519 - pr_debug("OF: walking ranges...\n"); 517 + pr_debug("walking ranges...\n"); 520 518 521 519 /* Now walk through the ranges */ 522 520 rlen /= 4; ··· 527 525 break; 528 526 } 529 527 if (offset == OF_BAD_ADDR) { 530 - pr_debug("OF: not found !\n"); 528 + pr_debug("not found !\n"); 531 529 return 1; 532 530 } 533 531 memcpy(addr, ranges + na, 4 * pna); 534 532 535 533 finish: 536 - of_dump_addr("OF: parent translation for:", addr, pna); 537 - pr_debug("OF: with offset: %llx\n", (unsigned long long)offset); 534 + of_dump_addr("parent translation for:", addr, pna); 535 + pr_debug("with offset: %llx\n", (unsigned long long)offset); 538 536 539 537 /* Translate it into parent bus space */ 540 538 return pbus->translate(addr, offset, pna); ··· 559 557 int na, ns, pna, pns; 560 558 u64 result = OF_BAD_ADDR; 561 559 562 - pr_debug("OF: ** translation for device %s **\n", of_node_full_name(dev)); 560 + pr_debug("** translation for device %s **\n", of_node_full_name(dev)); 563 561 564 562 /* Increase refcount at current level */ 565 563 of_node_get(dev); ··· 573 571 /* Count address cells & copy address locally */ 574 572 bus->count_cells(dev, &na, &ns); 575 573 if (!OF_CHECK_COUNTS(na, ns)) { 576 - pr_debug("OF: Bad cell count for %s\n", of_node_full_name(dev)); 574 + pr_debug("Bad cell count for %s\n", of_node_full_name(dev)); 577 575 goto bail; 578 576 } 579 577 memcpy(addr, in_addr, na * 4); 580 578 581 - pr_debug("OF: bus is %s (na=%d, ns=%d) on %s\n", 579 + pr_debug("bus is %s (na=%d, ns=%d) on %s\n", 582 580 bus->name, na, ns, of_node_full_name(parent)); 583 - of_dump_addr("OF: translating address:", addr, na); 581 + of_dump_addr("translating address:", addr, na); 584 582 585 583 /* Translate */ 586 584 for (;;) { ··· 591 589 592 590 /* If root, we have finished */ 593 591 if (parent == NULL) { 594 - pr_debug("OF: reached root node\n"); 592 + pr_debug("reached root node\n"); 595 593 result = of_read_number(addr, na); 596 594 break; 597 595 } ··· 600 598 pbus = of_match_bus(parent); 601 599 pbus->count_cells(dev, &pna, &pns); 602 600 if (!OF_CHECK_COUNTS(pna, pns)) { 603 - pr_err("prom_parse: Bad cell count for %s\n", 601 + pr_err("Bad cell count for %s\n", 604 602 of_node_full_name(dev)); 605 603 break; 606 604 } 607 605 608 - pr_debug("OF: parent bus is %s (na=%d, ns=%d) on %s\n", 606 + pr_debug("parent bus is %s (na=%d, ns=%d) on %s\n", 609 607 pbus->name, pna, pns, of_node_full_name(parent)); 610 608 611 609 /* Apply bus translation */ ··· 617 615 ns = pns; 618 616 bus = pbus; 619 617 620 - of_dump_addr("OF: one level translation:", addr, na); 618 + of_dump_addr("one level translation:", addr, na); 621 619 } 622 620 bail: 623 621 of_node_put(parent); ··· 855 853 } 856 854 857 855 if (!ranges) { 858 - pr_debug("%s: no dma-ranges found for node(%s)\n", 859 - __func__, np->full_name); 856 + pr_debug("no dma-ranges found for node(%s)\n", np->full_name); 860 857 ret = -ENODEV; 861 858 goto out; 862 859 } ··· 872 871 dmaaddr = of_read_number(ranges, naddr); 873 872 *paddr = of_translate_dma_address(np, ranges); 874 873 if (*paddr == OF_BAD_ADDR) { 875 - pr_err("%s: translation of DMA address(%pad) to CPU address failed node(%s)\n", 876 - __func__, dma_addr, np->full_name); 874 + pr_err("translation of DMA address(%pad) to CPU address failed node(%s)\n", 875 + dma_addr, np->full_name); 877 876 ret = -EINVAL; 878 877 goto out; 879 878 }
+28 -13
drivers/of/base.c
··· 17 17 * as published by the Free Software Foundation; either version 18 18 * 2 of the License, or (at your option) any later version. 19 19 */ 20 + 21 + #define pr_fmt(fmt) "OF: " fmt 22 + 20 23 #include <linux/console.h> 21 24 #include <linux/ctype.h> 22 25 #include <linux/cpu.h> ··· 115 112 return memory_read_from_buffer(buf, count, &offset, pp->value, pp->length); 116 113 } 117 114 115 + /* always return newly allocated name, caller must free after use */ 118 116 static const char *safe_name(struct kobject *kobj, const char *orig_name) 119 117 { 120 118 const char *name = orig_name; ··· 130 126 name = kasprintf(GFP_KERNEL, "%s#%i", orig_name, ++i); 131 127 } 132 128 133 - if (name != orig_name) 134 - pr_warn("device-tree: Duplicate name in %s, renamed to \"%s\"\n", 129 + if (name == orig_name) { 130 + name = kstrdup(orig_name, GFP_KERNEL); 131 + } else { 132 + pr_warn("Duplicate name in %s, renamed to \"%s\"\n", 135 133 kobject_name(kobj), name); 134 + } 136 135 return name; 137 136 } 138 137 ··· 166 159 int __of_attach_node_sysfs(struct device_node *np) 167 160 { 168 161 const char *name; 162 + struct kobject *parent; 169 163 struct property *pp; 170 164 int rc; 171 165 ··· 179 171 np->kobj.kset = of_kset; 180 172 if (!np->parent) { 181 173 /* Nodes without parents are new top level trees */ 182 - rc = kobject_add(&np->kobj, NULL, "%s", 183 - safe_name(&of_kset->kobj, "base")); 174 + name = safe_name(&of_kset->kobj, "base"); 175 + parent = NULL; 184 176 } else { 185 177 name = safe_name(&np->parent->kobj, kbasename(np->full_name)); 186 - if (!name || !name[0]) 187 - return -EINVAL; 188 - 189 - rc = kobject_add(&np->kobj, &np->parent->kobj, "%s", name); 178 + parent = &np->parent->kobj; 190 179 } 180 + if (!name) 181 + return -ENOMEM; 182 + rc = kobject_add(&np->kobj, parent, "%s", name); 183 + kfree(name); 191 184 if (rc) 192 185 return rc; 193 186 ··· 207 198 of_kset = kset_create_and_add("devicetree", NULL, firmware_kobj); 208 199 if (!of_kset) { 209 200 mutex_unlock(&of_mutex); 210 - pr_err("devicetree: failed to register existing nodes\n"); 201 + pr_err("failed to register existing nodes\n"); 211 202 return; 212 203 } 213 204 for_each_of_allnodes(np) ··· 1824 1815 return 0; 1825 1816 } 1826 1817 1818 + void __of_sysfs_remove_bin_file(struct device_node *np, struct property *prop) 1819 + { 1820 + sysfs_remove_bin_file(&np->kobj, &prop->attr); 1821 + kfree(prop->attr.attr.name); 1822 + } 1823 + 1827 1824 void __of_remove_property_sysfs(struct device_node *np, struct property *prop) 1828 1825 { 1829 1826 if (!IS_ENABLED(CONFIG_SYSFS)) ··· 1837 1822 1838 1823 /* at early boot, bail here and defer setup to of_init() */ 1839 1824 if (of_kset && of_node_is_attached(np)) 1840 - sysfs_remove_bin_file(&np->kobj, &prop->attr); 1825 + __of_sysfs_remove_bin_file(np, prop); 1841 1826 } 1842 1827 1843 1828 /** ··· 1910 1895 return; 1911 1896 1912 1897 if (oldprop) 1913 - sysfs_remove_bin_file(&np->kobj, &oldprop->attr); 1898 + __of_sysfs_remove_bin_file(np, oldprop); 1914 1899 __of_add_property_sysfs(np, newprop); 1915 1900 } 1916 1901 ··· 2272 2257 of_node_put(node); 2273 2258 2274 2259 if (!port) { 2275 - pr_err("%s(): no port node found in %s\n", 2276 - __func__, parent->full_name); 2260 + pr_err("graph: no port node found in %s\n", 2261 + parent->full_name); 2277 2262 return NULL; 2278 2263 } 2279 2264 } else {
+25 -24
drivers/of/dynamic.c
··· 6 6 * device tree nodes. 7 7 */ 8 8 9 + #define pr_fmt(fmt) "OF: " fmt 10 + 9 11 #include <linux/of.h> 10 12 #include <linux/spinlock.h> 11 13 #include <linux/slab.h> ··· 57 55 /* only remove properties if on sysfs */ 58 56 if (of_node_is_attached(np)) { 59 57 for_each_property_of_node(np, pp) 60 - sysfs_remove_bin_file(&np->kobj, &pp->attr); 58 + __of_sysfs_remove_bin_file(np, pp); 61 59 kobject_del(&np->kobj); 62 60 } 63 61 ··· 98 96 switch (action) { 99 97 case OF_RECONFIG_ATTACH_NODE: 100 98 case OF_RECONFIG_DETACH_NODE: 101 - pr_debug("of/notify %-15s %s\n", action_names[action], 99 + pr_debug("notify %-15s %s\n", action_names[action], 102 100 pr->dn->full_name); 103 101 break; 104 102 case OF_RECONFIG_ADD_PROPERTY: 105 103 case OF_RECONFIG_REMOVE_PROPERTY: 106 104 case OF_RECONFIG_UPDATE_PROPERTY: 107 - pr_debug("of/notify %-15s %s:%s\n", action_names[action], 105 + pr_debug("notify %-15s %s:%s\n", action_names[action], 108 106 pr->dn->full_name, pr->prop->name); 109 107 break; 110 108 ··· 462 460 case OF_RECONFIG_ADD_PROPERTY: 463 461 case OF_RECONFIG_REMOVE_PROPERTY: 464 462 case OF_RECONFIG_UPDATE_PROPERTY: 465 - pr_debug("of/cset<%p> %-15s %s/%s\n", ce, action_names[ce->action], 463 + pr_debug("cset<%p> %-15s %s/%s\n", ce, action_names[ce->action], 466 464 ce->np->full_name, ce->prop->name); 467 465 break; 468 466 case OF_RECONFIG_ATTACH_NODE: 469 467 case OF_RECONFIG_DETACH_NODE: 470 - pr_debug("of/cset<%p> %-15s %s\n", ce, action_names[ce->action], 468 + pr_debug("cset<%p> %-15s %s\n", ce, action_names[ce->action], 471 469 ce->np->full_name); 472 470 break; 473 471 } ··· 533 531 ret = of_property_notify(ce->action, ce->np, ce->prop, ce->old_prop); 534 532 break; 535 533 default: 536 - pr_err("%s: invalid devicetree changeset action: %i\n", __func__, 534 + pr_err("invalid devicetree changeset action: %i\n", 537 535 (int)ce->action); 538 536 return; 539 537 } 540 538 541 539 if (ret) 542 - pr_err("%s: notifier error @%s\n", __func__, ce->np->full_name); 540 + pr_err("changeset notifier error @%s\n", ce->np->full_name); 543 541 } 544 542 545 543 static int __of_changeset_entry_apply(struct of_changeset_entry *ce) ··· 570 568 571 569 ret = __of_add_property(ce->np, ce->prop); 572 570 if (ret) { 573 - pr_err("%s: add_property failed @%s/%s\n", 574 - __func__, ce->np->full_name, 571 + pr_err("changeset: add_property failed @%s/%s\n", 572 + ce->np->full_name, 575 573 ce->prop->name); 576 574 break; 577 575 } ··· 579 577 case OF_RECONFIG_REMOVE_PROPERTY: 580 578 ret = __of_remove_property(ce->np, ce->prop); 581 579 if (ret) { 582 - pr_err("%s: remove_property failed @%s/%s\n", 583 - __func__, ce->np->full_name, 580 + pr_err("changeset: remove_property failed @%s/%s\n", 581 + ce->np->full_name, 584 582 ce->prop->name); 585 583 break; 586 584 } ··· 598 596 599 597 ret = __of_update_property(ce->np, ce->prop, &old_prop); 600 598 if (ret) { 601 - pr_err("%s: update_property failed @%s/%s\n", 602 - __func__, ce->np->full_name, 599 + pr_err("changeset: update_property failed @%s/%s\n", 600 + ce->np->full_name, 603 601 ce->prop->name); 604 602 break; 605 603 } ··· 679 677 int ret; 680 678 681 679 /* perform the rest of the work */ 682 - pr_debug("of_changeset: applying...\n"); 680 + pr_debug("changeset: applying...\n"); 683 681 list_for_each_entry(ce, &ocs->entries, node) { 684 682 ret = __of_changeset_entry_apply(ce); 685 683 if (ret) { 686 - pr_err("%s: Error applying changeset (%d)\n", __func__, ret); 684 + pr_err("Error applying changeset (%d)\n", ret); 687 685 list_for_each_entry_continue_reverse(ce, &ocs->entries, node) 688 686 __of_changeset_entry_revert(ce); 689 687 return ret; 690 688 } 691 689 } 692 - pr_debug("of_changeset: applied, emitting notifiers.\n"); 690 + pr_debug("changeset: applied, emitting notifiers.\n"); 693 691 694 692 /* drop the global lock while emitting notifiers */ 695 693 mutex_unlock(&of_mutex); 696 694 list_for_each_entry(ce, &ocs->entries, node) 697 695 __of_changeset_entry_notify(ce, 0); 698 696 mutex_lock(&of_mutex); 699 - pr_debug("of_changeset: notifiers sent.\n"); 697 + pr_debug("changeset: notifiers sent.\n"); 700 698 701 699 return 0; 702 700 } ··· 730 728 struct of_changeset_entry *ce; 731 729 int ret; 732 730 733 - pr_debug("of_changeset: reverting...\n"); 731 + pr_debug("changeset: reverting...\n"); 734 732 list_for_each_entry_reverse(ce, &ocs->entries, node) { 735 733 ret = __of_changeset_entry_revert(ce); 736 734 if (ret) { 737 - pr_err("%s: Error reverting changeset (%d)\n", __func__, ret); 735 + pr_err("Error reverting changeset (%d)\n", ret); 738 736 list_for_each_entry_continue(ce, &ocs->entries, node) 739 737 __of_changeset_entry_apply(ce); 740 738 return ret; 741 739 } 742 740 } 743 - pr_debug("of_changeset: reverted, emitting notifiers.\n"); 741 + pr_debug("changeset: reverted, emitting notifiers.\n"); 744 742 745 743 /* drop the global lock while emitting notifiers */ 746 744 mutex_unlock(&of_mutex); 747 745 list_for_each_entry_reverse(ce, &ocs->entries, node) 748 746 __of_changeset_entry_notify(ce, 1); 749 747 mutex_lock(&of_mutex); 750 - pr_debug("of_changeset: notifiers sent.\n"); 748 + pr_debug("changeset: notifiers sent.\n"); 751 749 752 750 return 0; 753 751 } ··· 797 795 struct of_changeset_entry *ce; 798 796 799 797 ce = kzalloc(sizeof(*ce), GFP_KERNEL); 800 - if (!ce) { 801 - pr_err("%s: Failed to allocate\n", __func__); 798 + if (!ce) 802 799 return -ENOMEM; 803 - } 800 + 804 801 /* get a reference to the node */ 805 802 ce->action = action; 806 803 ce->np = of_node_get(np);
+16 -9
drivers/of/fdt.c
··· 9 9 * version 2 as published by the Free Software Foundation. 10 10 */ 11 11 12 + #define pr_fmt(fmt) "OF: fdt:" fmt 13 + 12 14 #include <linux/crc32.h> 13 15 #include <linux/kernel.h> 14 16 #include <linux/initrd.h> ··· 184 182 185 183 val = fdt_getprop_by_offset(blob, cur, &pname, &sz); 186 184 if (!val) { 187 - pr_warn("%s: Cannot locate property at 0x%x\n", 188 - __func__, cur); 185 + pr_warn("Cannot locate property at 0x%x\n", cur); 189 186 continue; 190 187 } 191 188 192 189 if (!pname) { 193 - pr_warn("%s: Cannot find property name at 0x%x\n", 194 - __func__, cur); 190 + pr_warn("Cannot find property name at 0x%x\n", cur); 195 191 continue; 196 192 } 197 193 ··· 439 439 } 440 440 441 441 if (offset < 0 && offset != -FDT_ERR_NOTFOUND) { 442 - pr_err("%s: Error %d processing FDT\n", __func__, offset); 442 + pr_err("Error %d processing FDT\n", offset); 443 443 return -EINVAL; 444 444 } 445 445 ··· 472 472 static void *__unflatten_device_tree(const void *blob, 473 473 struct device_node *dad, 474 474 struct device_node **mynodes, 475 - void *(*dt_alloc)(u64 size, u64 align)) 475 + void *(*dt_alloc)(u64 size, u64 align), 476 + bool detached) 476 477 { 477 478 int size; 478 479 void *mem; ··· 517 516 pr_warning("End of tree marker overwritten: %08x\n", 518 517 be32_to_cpup(mem + size)); 519 518 519 + if (detached) { 520 + of_node_set_flag(*mynodes, OF_DETACHED); 521 + pr_debug("unflattened tree is detached\n"); 522 + } 523 + 520 524 pr_debug(" <- unflatten_device_tree()\n"); 521 525 return mem; 522 526 } ··· 554 548 void *mem; 555 549 556 550 mutex_lock(&of_fdt_unflatten_mutex); 557 - mem = __unflatten_device_tree(blob, dad, mynodes, &kernel_tree_alloc); 551 + mem = __unflatten_device_tree(blob, dad, mynodes, &kernel_tree_alloc, 552 + true); 558 553 mutex_unlock(&of_fdt_unflatten_mutex); 559 554 560 555 return mem; ··· 1244 1237 void __init unflatten_device_tree(void) 1245 1238 { 1246 1239 __unflatten_device_tree(initial_boot_params, NULL, &of_root, 1247 - early_init_dt_alloc_memory_arch); 1240 + early_init_dt_alloc_memory_arch, false); 1248 1241 1249 1242 /* Get pointer to "/chosen" and "/aliases" nodes for use everywhere */ 1250 1243 of_alias_scan(early_init_dt_alloc_memory_arch); ··· 1301 1294 1302 1295 if (of_fdt_crc32 != crc32_be(~0, initial_boot_params, 1303 1296 fdt_totalsize(initial_boot_params))) { 1304 - pr_warn("fdt: not creating '/sys/firmware/fdt': CRC check failed\n"); 1297 + pr_warn("not creating '/sys/firmware/fdt': CRC check failed\n"); 1305 1298 return 0; 1306 1299 } 1307 1300 of_fdt_raw_attr.size = fdt_totalsize(initial_boot_params);
+19 -16
drivers/of/fdt_address.c
··· 12 12 * the Free Software Foundation; either version 2, or (at your option) 13 13 * any later version. 14 14 */ 15 + 16 + #define pr_fmt(fmt) "OF: fdt: " fmt 17 + 15 18 #include <linux/kernel.h> 16 19 #include <linux/libfdt.h> 17 20 #include <linux/of.h> ··· 33 30 pr_debug("%s", s); 34 31 while(na--) 35 32 pr_cont(" %08x", *(addr++)); 36 - pr_debug("\n"); 33 + pr_cont("\n"); 37 34 } 38 35 #else 39 36 static void __init of_dump_addr(const char *s, const __be32 *addr, int na) { } ··· 80 77 s = of_read_number(range + na + pna, ns); 81 78 da = of_read_number(addr, na); 82 79 83 - pr_debug("FDT: default map, cp=%llx, s=%llx, da=%llx\n", 80 + pr_debug("default map, cp=%llx, s=%llx, da=%llx\n", 84 81 cp, s, da); 85 82 86 83 if (da < cp || da >= (cp + s)) ··· 126 123 if (rlen == 0) { 127 124 offset = of_read_number(addr, na); 128 125 memset(addr, 0, pna * 4); 129 - pr_debug("FDT: empty ranges, 1:1 translation\n"); 126 + pr_debug("empty ranges, 1:1 translation\n"); 130 127 goto finish; 131 128 } 132 129 133 - pr_debug("FDT: walking ranges...\n"); 130 + pr_debug("walking ranges...\n"); 134 131 135 132 /* Now walk through the ranges */ 136 133 rlen /= 4; ··· 141 138 break; 142 139 } 143 140 if (offset == OF_BAD_ADDR) { 144 - pr_debug("FDT: not found !\n"); 141 + pr_debug("not found !\n"); 145 142 return 1; 146 143 } 147 144 memcpy(addr, ranges + na, 4 * pna); 148 145 149 146 finish: 150 - of_dump_addr("FDT: parent translation for:", addr, pna); 151 - pr_debug("FDT: with offset: %llx\n", offset); 147 + of_dump_addr("parent translation for:", addr, pna); 148 + pr_debug("with offset: %llx\n", offset); 152 149 153 150 /* Translate it into parent bus space */ 154 151 return pbus->translate(addr, offset, pna); ··· 173 170 int na, ns, pna, pns; 174 171 u64 result = OF_BAD_ADDR; 175 172 176 - pr_debug("FDT: ** translation for device %s **\n", 173 + pr_debug("** translation for device %s **\n", 177 174 fdt_get_name(blob, node_offset, NULL)); 178 175 179 176 reg = fdt_getprop(blob, node_offset, "reg", &len); 180 177 if (!reg) { 181 - pr_err("FDT: warning: device tree node '%s' has no address.\n", 178 + pr_err("warning: device tree node '%s' has no address.\n", 182 179 fdt_get_name(blob, node_offset, NULL)); 183 180 goto bail; 184 181 } ··· 192 189 /* Cound address cells & copy address locally */ 193 190 bus->count_cells(blob, parent, &na, &ns); 194 191 if (!OF_CHECK_COUNTS(na, ns)) { 195 - pr_err("FDT: Bad cell count for %s\n", 192 + pr_err("Bad cell count for %s\n", 196 193 fdt_get_name(blob, node_offset, NULL)); 197 194 goto bail; 198 195 } 199 196 memcpy(addr, reg, na * 4); 200 197 201 - pr_debug("FDT: bus (na=%d, ns=%d) on %s\n", 198 + pr_debug("bus (na=%d, ns=%d) on %s\n", 202 199 na, ns, fdt_get_name(blob, parent, NULL)); 203 - of_dump_addr("OF: translating address:", addr, na); 200 + of_dump_addr("translating address:", addr, na); 204 201 205 202 /* Translate */ 206 203 for (;;) { ··· 210 207 211 208 /* If root, we have finished */ 212 209 if (parent < 0) { 213 - pr_debug("FDT: reached root node\n"); 210 + pr_debug("reached root node\n"); 214 211 result = of_read_number(addr, na); 215 212 break; 216 213 } ··· 219 216 pbus = &of_busses[0]; 220 217 pbus->count_cells(blob, parent, &pna, &pns); 221 218 if (!OF_CHECK_COUNTS(pna, pns)) { 222 - pr_err("FDT: Bad cell count for %s\n", 219 + pr_err("Bad cell count for %s\n", 223 220 fdt_get_name(blob, node_offset, NULL)); 224 221 break; 225 222 } 226 223 227 - pr_debug("FDT: parent bus (na=%d, ns=%d) on %s\n", 224 + pr_debug("parent bus (na=%d, ns=%d) on %s\n", 228 225 pna, pns, fdt_get_name(blob, parent, NULL)); 229 226 230 227 /* Apply bus translation */ ··· 237 234 ns = pns; 238 235 bus = pbus; 239 236 240 - of_dump_addr("FDT: one level translation:", addr, na); 237 + of_dump_addr("one level translation:", addr, na); 241 238 } 242 239 bail: 243 240 return result;
+4
drivers/of/irq.c
··· 18 18 * driver. 19 19 */ 20 20 21 + #define pr_fmt(fmt) "OF: " fmt 22 + 21 23 #include <linux/device.h> 22 24 #include <linux/errno.h> 23 25 #include <linux/list.h> ··· 559 557 * its children can get processed in a subsequent pass. 560 558 */ 561 559 list_add_tail(&desc->list, &intc_parent_list); 560 + 561 + of_node_set_flag(desc->dev, OF_POPULATED); 562 562 } 563 563 564 564 /* Get the next pending parent that might have children */
+4 -2
drivers/of/of_pci.c
··· 1 + #define pr_fmt(fmt) "OF: PCI: " fmt 2 + 1 3 #include <linux/kernel.h> 2 4 #include <linux/export.h> 3 5 #include <linux/of.h> ··· 140 138 else 141 139 pci_clear_flags(PCI_PROBE_ONLY); 142 140 143 - pr_info("PCI: PROBE_ONLY %sabled\n", val ? "en" : "dis"); 141 + pr_info("PROBE_ONLY %sabled\n", val ? "en" : "dis"); 144 142 } 145 143 EXPORT_SYMBOL_GPL(of_pci_check_probe_only); 146 144 ··· 183 181 if (!bus_range) 184 182 return -ENOMEM; 185 183 186 - pr_info("PCI host bridge %s ranges:\n", dev->full_name); 184 + pr_info("host bridge %s ranges:\n", dev->full_name); 187 185 188 186 err = of_pci_parse_bus_range(dev, bus_range); 189 187 if (err) {
+3
drivers/of/of_private.h
··· 83 83 extern void __of_detach_node(struct device_node *np); 84 84 extern void __of_detach_node_sysfs(struct device_node *np); 85 85 86 + extern void __of_sysfs_remove_bin_file(struct device_node *np, 87 + struct property *prop); 88 + 86 89 /* iterators for transactions, used for overlays */ 87 90 /* forward iterator */ 88 91 #define for_each_transaction_entry(_oft, _te) \
+11 -11
drivers/of/of_reserved_mem.c
··· 13 13 * License or (at your optional) any later version of the license. 14 14 */ 15 15 16 + #define pr_fmt(fmt) "OF: reserved mem: " fmt 17 + 16 18 #include <linux/err.h> 17 19 #include <linux/of.h> 18 20 #include <linux/of_fdt.h> ··· 78 76 struct reserved_mem *rmem = &reserved_mem[reserved_mem_count]; 79 77 80 78 if (reserved_mem_count == ARRAY_SIZE(reserved_mem)) { 81 - pr_err("Reserved memory: not enough space all defined regions.\n"); 79 + pr_err("not enough space all defined regions.\n"); 82 80 return; 83 81 } 84 82 ··· 111 109 return -EINVAL; 112 110 113 111 if (len != dt_root_size_cells * sizeof(__be32)) { 114 - pr_err("Reserved memory: invalid size property in '%s' node.\n", 115 - uname); 112 + pr_err("invalid size property in '%s' node.\n", uname); 116 113 return -EINVAL; 117 114 } 118 115 size = dt_mem_next_cell(dt_root_size_cells, &prop); ··· 121 120 prop = of_get_flat_dt_prop(node, "alignment", &len); 122 121 if (prop) { 123 122 if (len != dt_root_addr_cells * sizeof(__be32)) { 124 - pr_err("Reserved memory: invalid alignment property in '%s' node.\n", 123 + pr_err("invalid alignment property in '%s' node.\n", 125 124 uname); 126 125 return -EINVAL; 127 126 } ··· 143 142 if (prop) { 144 143 145 144 if (len % t_len != 0) { 146 - pr_err("Reserved memory: invalid alloc-ranges property in '%s', skipping node.\n", 145 + pr_err("invalid alloc-ranges property in '%s', skipping node.\n", 147 146 uname); 148 147 return -EINVAL; 149 148 } ··· 158 157 ret = early_init_dt_alloc_reserved_memory_arch(size, 159 158 align, start, end, nomap, &base); 160 159 if (ret == 0) { 161 - pr_debug("Reserved memory: allocated memory for '%s' node: base %pa, size %ld MiB\n", 160 + pr_debug("allocated memory for '%s' node: base %pa, size %ld MiB\n", 162 161 uname, &base, 163 162 (unsigned long)size / SZ_1M); 164 163 break; ··· 170 169 ret = early_init_dt_alloc_reserved_memory_arch(size, align, 171 170 0, 0, nomap, &base); 172 171 if (ret == 0) 173 - pr_debug("Reserved memory: allocated memory for '%s' node: base %pa, size %ld MiB\n", 172 + pr_debug("allocated memory for '%s' node: base %pa, size %ld MiB\n", 174 173 uname, &base, (unsigned long)size / SZ_1M); 175 174 } 176 175 177 176 if (base == 0) { 178 - pr_info("Reserved memory: failed to allocate memory for node '%s'\n", 179 - uname); 177 + pr_info("failed to allocate memory for node '%s'\n", uname); 180 178 return -ENOMEM; 181 179 } 182 180 ··· 204 204 continue; 205 205 206 206 if (initfn(rmem) == 0) { 207 - pr_info("Reserved memory: initialized node %s, compatible id %s\n", 207 + pr_info("initialized node %s, compatible id %s\n", 208 208 rmem->name, compat); 209 209 return 0; 210 210 } ··· 246 246 247 247 this_end = this->base + this->size; 248 248 next_end = next->base + next->size; 249 - pr_err("Reserved memory: OVERLAP DETECTED!\n%s (%pa--%pa) overlaps with %s (%pa--%pa)\n", 249 + pr_err("OVERLAP DETECTED!\n%s (%pa--%pa) overlaps with %s (%pa--%pa)\n", 250 250 this->name, &this->base, &this_end, 251 251 next->name, &next->base, &next_end); 252 252 }
+16 -27
drivers/of/overlay.c
··· 8 8 * modify it under the terms of the GNU General Public License 9 9 * version 2 as published by the Free Software Foundation. 10 10 */ 11 - #undef DEBUG 11 + 12 + #define pr_fmt(fmt) "OF: overlay: " fmt 13 + 12 14 #include <linux/kernel.h> 13 15 #include <linux/module.h> 14 16 #include <linux/of.h> ··· 139 137 for_each_property_of_node(overlay, prop) { 140 138 ret = of_overlay_apply_single_property(ov, target, prop); 141 139 if (ret) { 142 - pr_err("%s: Failed to apply prop @%s/%s\n", 143 - __func__, target->full_name, prop->name); 140 + pr_err("Failed to apply prop @%s/%s\n", 141 + target->full_name, prop->name); 144 142 return ret; 145 143 } 146 144 } ··· 148 146 for_each_child_of_node(overlay, child) { 149 147 ret = of_overlay_apply_single_device_node(ov, target, child); 150 148 if (ret != 0) { 151 - pr_err("%s: Failed to apply single node @%s/%s\n", 152 - __func__, target->full_name, 153 - child->name); 149 + pr_err("Failed to apply single node @%s/%s\n", 150 + target->full_name, child->name); 154 151 of_node_put(child); 155 152 return ret; 156 153 } ··· 177 176 178 177 err = of_overlay_apply_one(ov, ovinfo->target, ovinfo->overlay); 179 178 if (err != 0) { 180 - pr_err("%s: overlay failed '%s'\n", 181 - __func__, ovinfo->target->full_name); 179 + pr_err("apply failed '%s'\n", ovinfo->target->full_name); 182 180 return err; 183 181 } 184 182 } ··· 208 208 if (ret == 0) 209 209 return of_find_node_by_path(path); 210 210 211 - pr_err("%s: Failed to find target for node %p (%s)\n", __func__, 211 + pr_err("Failed to find target for node %p (%s)\n", 212 212 info_node, info_node->name); 213 213 214 214 return NULL; ··· 355 355 356 356 id = idr_alloc(&ov_idr, ov, 0, 0, GFP_KERNEL); 357 357 if (id < 0) { 358 - pr_err("%s: idr_alloc() failed for tree@%s\n", 359 - __func__, tree->full_name); 360 358 err = id; 361 359 goto err_destroy_trans; 362 360 } ··· 363 365 /* build the overlay info structures */ 364 366 err = of_build_overlay_info(ov, tree); 365 367 if (err) { 366 - pr_err("%s: of_build_overlay_info() failed for tree@%s\n", 367 - __func__, tree->full_name); 368 + pr_err("of_build_overlay_info() failed for tree@%s\n", 369 + tree->full_name); 368 370 goto err_free_idr; 369 371 } 370 372 371 373 /* apply the overlay */ 372 374 err = of_overlay_apply(ov); 373 - if (err) { 374 - pr_err("%s: of_overlay_apply() failed for tree@%s\n", 375 - __func__, tree->full_name); 375 + if (err) 376 376 goto err_abort_trans; 377 - } 378 377 379 378 /* apply the changeset */ 380 379 err = __of_changeset_apply(&ov->cset); 381 - if (err) { 382 - pr_err("%s: __of_changeset_apply() failed for tree@%s\n", 383 - __func__, tree->full_name); 380 + if (err) 384 381 goto err_revert_overlay; 385 - } 382 + 386 383 387 384 /* add to the tail of the overlay list */ 388 385 list_add_tail(&ov->node, &ov_list); ··· 462 469 463 470 list_for_each_entry(ce, &ov->cset.entries, node) { 464 471 if (!overlay_is_topmost(ov, ce->np)) { 465 - pr_err("%s: overlay #%d is not topmost\n", 466 - __func__, ov->id); 472 + pr_err("overlay #%d is not topmost\n", ov->id); 467 473 return 0; 468 474 } 469 475 } ··· 488 496 ov = idr_find(&ov_idr, id); 489 497 if (ov == NULL) { 490 498 err = -ENODEV; 491 - pr_err("%s: Could not find overlay #%d\n", 492 - __func__, id); 499 + pr_err("destroy: Could not find overlay #%d\n", id); 493 500 goto out; 494 501 } 495 502 496 503 /* check whether the overlay is safe to remove */ 497 504 if (!overlay_removal_is_ok(ov)) { 498 505 err = -EBUSY; 499 - pr_err("%s: removal check failed for overlay #%d\n", 500 - __func__, id); 501 506 goto out; 502 507 } 503 508
+27 -10
drivers/of/platform.c
··· 11 11 * 2 of the License, or (at your option) any later version. 12 12 * 13 13 */ 14 + 15 + #define pr_fmt(fmt) "OF: " fmt 16 + 14 17 #include <linux/errno.h> 15 18 #include <linux/module.h> 16 19 #include <linux/amba/bus.h> ··· 34 31 #endif /* CONFIG_ARM_AMBA */ 35 32 {} /* Empty terminated list */ 36 33 }; 37 - EXPORT_SYMBOL(of_default_bus_match_table); 38 34 39 35 static int of_dev_node_match(struct device *dev, void *data) 40 36 { ··· 236 234 return NULL; 237 235 238 236 dev = amba_device_alloc(NULL, 0, 0); 239 - if (!dev) { 240 - pr_err("%s(): amba_device_alloc() failed for %s\n", 241 - __func__, node->full_name); 237 + if (!dev) 242 238 goto err_clear_flag; 243 - } 244 239 245 240 /* setup generic device info */ 246 241 dev->dev.of_node = of_node_get(node); ··· 260 261 261 262 ret = of_address_to_resource(node, 0, &dev->res); 262 263 if (ret) { 263 - pr_err("%s(): of_address_to_resource() failed (%d) for %s\n", 264 - __func__, ret, node->full_name); 264 + pr_err("amba: of_address_to_resource() failed (%d) for %s\n", 265 + ret, node->full_name); 265 266 goto err_free; 266 267 } 267 268 268 269 ret = amba_device_add(dev, &iomem_resource); 269 270 if (ret) { 270 - pr_err("%s(): amba_device_add() failed (%d) for %s\n", 271 - __func__, ret, node->full_name); 271 + pr_err("amba_device_add() failed (%d) for %s\n", 272 + ret, node->full_name); 272 273 goto err_free; 273 274 } 274 275 ··· 362 363 return 0; 363 364 } 364 365 366 + if (of_node_check_flag(bus, OF_POPULATED_BUS)) { 367 + pr_debug("%s() - skipping %s, already populated\n", 368 + __func__, bus->full_name); 369 + return 0; 370 + } 371 + 365 372 auxdata = of_dev_lookup(lookup, bus); 366 373 if (auxdata) { 367 374 bus_id = auxdata->name; ··· 419 414 if (!root) 420 415 return -EINVAL; 421 416 422 - pr_debug("of_platform_bus_probe()\n"); 417 + pr_debug("%s()\n", __func__); 423 418 pr_debug(" starting at: %s\n", root->full_name); 424 419 425 420 /* Do a self check of bus type, if there's a match, create children */ ··· 471 466 if (!root) 472 467 return -EINVAL; 473 468 469 + pr_debug("%s()\n", __func__); 470 + pr_debug(" starting at: %s\n", root->full_name); 471 + 474 472 for_each_child_of_node(root, child) { 475 473 rc = of_platform_bus_create(child, matches, lookup, parent, true); 476 474 if (rc) { ··· 496 488 parent); 497 489 } 498 490 EXPORT_SYMBOL_GPL(of_platform_default_populate); 491 + 492 + static int __init of_platform_default_populate_init(void) 493 + { 494 + if (of_have_populated_dt()) 495 + of_platform_default_populate(NULL, NULL, NULL); 496 + 497 + return 0; 498 + } 499 + arch_initcall_sync(of_platform_default_populate_init); 499 500 500 501 static int of_platform_device_destroy(struct device *dev, void *data) 501 502 {
+8
drivers/of/resolver.c
··· 9 9 * version 2 as published by the Free Software Foundation. 10 10 */ 11 11 12 + #define pr_fmt(fmt) "OF: resolver: " fmt 13 + 12 14 #include <linux/kernel.h> 13 15 #include <linux/module.h> 14 16 #include <linux/of.h> ··· 315 313 phandle phandle, phandle_delta; 316 314 int err; 317 315 316 + if (!resolve) 317 + pr_err("%s: null node\n", __func__); 318 + if (resolve && !of_node_check_flag(resolve, OF_DETACHED)) 319 + pr_err("%s: node %s not detached\n", __func__, 320 + resolve->full_name); 318 321 /* the resolve node must exist, and be detached */ 319 322 if (!resolve || !of_node_check_flag(resolve, OF_DETACHED)) 320 323 return -EINVAL; ··· 376 369 377 370 /* we need to fixup, but no root symbols... */ 378 371 if (!root_sym) { 372 + pr_err("%s: no symbols in root of device tree.\n", __func__); 379 373 err = -EINVAL; 380 374 goto out; 381 375 }
+2 -3
drivers/of/unittest.c
··· 771 771 }; 772 772 773 773 np = of_find_node_by_path("/testcase-data"); 774 - of_platform_populate(np, of_default_bus_match_table, NULL, NULL); 774 + of_platform_default_populate(np, NULL, NULL); 775 775 776 776 /* Test that a missing irq domain returns -EPROBE_DEFER */ 777 777 np = of_find_node_by_path("/testcase-data/testcase-device1"); ··· 1871 1871 goto out; 1872 1872 } 1873 1873 1874 - ret = of_platform_populate(bus_np, of_default_bus_match_table, 1875 - NULL, NULL); 1874 + ret = of_platform_default_populate(bus_np, NULL, NULL); 1876 1875 if (ret != 0) { 1877 1876 unittest(0, "could not populate bus @ \"%s\"\n", bus_path); 1878 1877 goto out;
-2
include/linux/of_iommu.h
··· 11 11 int index, unsigned long *busno, dma_addr_t *addr, 12 12 size_t *size); 13 13 14 - extern void of_iommu_init(void); 15 14 extern const struct iommu_ops *of_iommu_configure(struct device *dev, 16 15 struct device_node *master_np); 17 16 ··· 23 24 return -EINVAL; 24 25 } 25 26 26 - static inline void of_iommu_init(void) { } 27 27 static inline const struct iommu_ops *of_iommu_configure(struct device *dev, 28 28 struct device_node *master_np) 29 29 {
+1213
scripts/dtc/dt_to_config
··· 1 + #!/usr/bin/perl 2 + 3 + # Copyright 2016 by Frank Rowand 4 + # Copyright 2016 by Gaurav Minocha 5 + # 6 + # This file is subject to the terms and conditions of the GNU General Public 7 + # License v2. 8 + 9 + use strict 'refs'; 10 + use strict subs; 11 + 12 + use Getopt::Long; 13 + 14 + $VUFX = "160610a"; 15 + 16 + $script_name = $0; 17 + $script_name =~ s|^.*/||; 18 + 19 + 20 + # ----- constants for print_flags() 21 + 22 + # Position in string $pr_flags. Range of 0..($num_pr_flags - 1). 23 + $pr_flag_pos_mcompatible = 0; 24 + $pr_flag_pos_driver = 1; 25 + $pr_flag_pos_mdriver = 2; 26 + $pr_flag_pos_config = 3; 27 + $pr_flag_pos_mconfig = 4; 28 + $pr_flag_pos_node_not_enabled = 5; 29 + $pr_flag_pos_white_list = 6; 30 + $pr_flag_pos_hard_coded = 7; 31 + $pr_flag_pos_config_hard_coded = 8; 32 + $pr_flag_pos_config_none = 9; 33 + $pr_flag_pos_config_m = 10; 34 + $pr_flag_pos_config_y = 11; 35 + $pr_flag_pos_config_test_fail = 12; 36 + 37 + $num_pr_flags = $pr_flag_pos_config_test_fail + 1; 38 + 39 + # flags in @pr_flag_value must be unique values to allow simple regular 40 + # expessions to work for --include_flags and --exclude_flags. 41 + # Convention: use upper case letters for potential issues or problems. 42 + 43 + @pr_flag_value = ('M', 'd', 'D', 'c', 'C', 'E', 'W', 'H', 'x', 'n', 'm', 'y', 'F'); 44 + 45 + @pr_flag_help = ( 46 + "multiple compatibles found for this node", 47 + "driver found for this compatible", 48 + "multiple drivers found for this compatible", 49 + "kernel config found for this driver", 50 + "multiple config options found for this driver", 51 + "node is not enabled", 52 + "compatible is white listed", 53 + "matching driver and/or kernel config is hard coded", 54 + "kernel config hard coded in Makefile", 55 + "one or more kernel config file options is not set", 56 + "one or more kernel config file options is set to 'm'", 57 + "one or more kernel config file options is set to 'y'", 58 + "one of more kernel config file options fails to have correct value" 59 + ); 60 + 61 + 62 + # ----- 63 + 64 + %driver_config = (); # driver config array, indexed by driver source file 65 + %driver_count = (); # driver_cnt, indexed by compatible 66 + %compat_driver = (); # compatible driver array, indexed by compatible 67 + %existing_config = (); # existing config symbols present in given config file 68 + # expected values are: "y", "m", a decimal number, a 69 + # hex number, or a string 70 + 71 + # ----- magic compatibles, do not have a driver 72 + # 73 + # Will not search for drivers for these compatibles. 74 + 75 + %compat_white_list = ( 76 + 'none' => '1', 77 + 'pci' => '1', 78 + 'simple-bus' => '1', 79 + ); 80 + 81 + # Will not search for drivers for these compatibles. 82 + # 83 + # These compatibles have a very large number of false positives. 84 + # 85 + # 'hardcoded_no_driver' is a magic value. Other code knows this 86 + # magic value. Do not use 'no_driver' here! 87 + # 88 + # Revisit each 'hardcoded_no_driver' to see how the compatible 89 + # is used. Are there drivers that can be provided? 90 + 91 + %driver_hard_code_list = ( 92 + 'cache' => ['hardcoded_no_driver'], 93 + 'eeprom' => ['hardcoded_no_driver'], 94 + 'gpio' => ['hardcoded_no_driver'], 95 + 'gpio-keys' => ['drivers/input/keyboard/gpio_keys.c'], 96 + 'i2c-gpio' => ['drivers/i2c/busses/i2c-gpio.c'], 97 + 'isa' => ['arch/mips/mti-malta/malta-dt.c', 98 + 'arch/x86/kernel/devicetree.c'], 99 + 'led' => ['hardcoded_no_driver'], 100 + 'm25p32' => ['hardcoded_no_driver'], 101 + 'm25p64' => ['hardcoded_no_driver'], 102 + 'm25p80' => ['hardcoded_no_driver'], 103 + 'mtd-ram' => ['drivers/mtd/maps/physmap_of.c'], 104 + 'pwm-backlight' => ['drivers/video/backlight/pwm_bl.c'], 105 + 'spidev' => ['hardcoded_no_driver'], 106 + 'syscon' => ['drivers/mfd/syscon.c'], 107 + 'tlv320aic23' => ['hardcoded_no_driver'], 108 + 'wm8731' => ['hardcoded_no_driver'], 109 + ); 110 + 111 + # Use these config options instead of searching makefiles 112 + 113 + %driver_config_hard_code_list = ( 114 + 115 + # this one needed even if %driver_hard_code_list is empty 116 + 'no_driver' => ['no_config'], 117 + 'hardcoded_no_driver' => ['no_config'], 118 + 119 + # drivers/usb/host/ehci-ppc-of.c 120 + # drivers/usb/host/ehci-xilinx-of.c 121 + # are included from: 122 + # drivers/usb/host/ehci-hcd.c 123 + # thus the search of Makefile for the included .c files is incorrect 124 + # ehci-hcd.c wraps the includes with ifdef CONFIG_USB_EHCI_HCD_..._OF 125 + # 126 + # similar model for ohci-hcd.c (but no ohci-xilinx-of.c) 127 + # 128 + # similarly, uhci-hcd.c includes uhci-platform.c 129 + 130 + 'drivers/usb/host/ehci-ppc-of.c' => ['CONFIG_USB_EHCI_HCD', 131 + 'CONFIG_USB_EHCI_HCD_PPC_OF'], 132 + 'drivers/usb/host/ohci-ppc-of.c' => ['CONFIG_USB_OHCI_HCD', 133 + 'CONFIG_USB_OHCI_HCD_PPC_OF'], 134 + 135 + 'drivers/usb/host/ehci-xilinx-of.c' => ['CONFIG_USB_EHCI_HCD', 136 + 'CONFIG_USB_EHCI_HCD_XILINX'], 137 + 138 + 'drivers/usb/host/uhci-platform.c' => ['CONFIG_USB_UHCI_HCD', 139 + 'CONFIG_USB_UHCI_PLATFORM'], 140 + 141 + # scan_makefile will find only one of these config options: 142 + # ifneq ($(CONFIG_SOC_IMX6)$(CONFIG_SOC_LS1021A),) 143 + 'arch/arm/mach-imx/platsmp.c' => ['CONFIG_SOC_IMX6 && CONFIG_SMP', 144 + 'CONFIG_SOC_LS1021A && CONFIG_SMP'], 145 + ); 146 + 147 + 148 + # 'virt/kvm/arm/.*' are controlled by makefiles in other directories, 149 + # using relative paths, such as 'KVM := ../../../virt/kvm'. Do not 150 + # add complexity to find_kconfig() to deal with this. There is a long 151 + # term intent to change the kvm related makefiles to the normal kernel 152 + # style. After that is done, this entry can be removed from the 153 + # black_list_driver. 154 + 155 + @black_list_driver = ( 156 + # kvm no longer a problem after commit 503a62862e8f in 4.7-rc1 157 + # 'virt/kvm/arm/.*', 158 + ); 159 + 160 + 161 + sub usage() 162 + { 163 + print 164 + " 165 + Usage: $script_name [options] device-tree... 166 + 167 + device_tree is: dts_file | dtb_file | proc_device-tree 168 + 169 + 170 + Valid options: 171 + -c FILE Read kernel config options from FILE 172 + --config FILE synonym for 'c' 173 + --config-format config file friendly output format 174 + --exclude-flag FLAG exclude entries with a matching flag 175 + -h Display this message and exit 176 + --help synonym for 'h' 177 + --black-list-driver use driver black list 178 + --white-list-config use config white list 179 + --white-list-driver use driver white list 180 + --include-flag FLAG include only entries with a matching flag 181 + --include-suspect include only entries with an uppercase flag 182 + --short-name do not show the path portion of the node name 183 + --show-lists report of white and black lists 184 + --version Display program version and exit 185 + 186 + 187 + Report driver source files that match the compatibles in the device 188 + tree file and the kernel config options that enable the driver source 189 + files. 190 + 191 + This program must be run in the root directory of a Linux kernel 192 + source tree. 193 + 194 + The default format is a report that is intended to be easily human 195 + scannable. 196 + 197 + An alternate format can be selected by --config-format. This will 198 + create output that can easily be edited to create a fragment that can 199 + be appended to the existing kernel config file. Each entry consists of 200 + multiple lines. The first line reports flags, the node path, compatible 201 + value, driver file matching the compatible, configuration options, and 202 + current values of the configuration options. For each configuration 203 + option, the following lines report the current value and the value that 204 + is required for the driver file to be included in the kernel. 205 + 206 + If a large number of drivers or config options is listed for a node, 207 + and the '$pr_flag_value[$pr_flag_pos_hard_coded]' flag is set consider using --white-list-config and/or 208 + --white-list-driver. If the white list option suppresses the correct 209 + entry please report that as a bug. 210 + 211 + CAUTION: 212 + This program uses heuristics to guess which driver(s) support each 213 + compatible string and which config option(s) enables the driver(s). 214 + Do not believe that the reported information is fully correct. 215 + This program is intended to aid the process of determining the 216 + proper kernel configuration for a device tree, but this is not 217 + a fully automated process -- human involvement may still be 218 + required! 219 + 220 + The driver match heuristic used is to search for source files 221 + containing the compatible string enclosed in quotes. 222 + 223 + This program might not be able to find all drivers matching a 224 + compatible string. 225 + 226 + Some makefiles are overly clever. This program was not made 227 + complex enough to handle them. If no config option is listed 228 + for a driver, look at the makefile for the driver source file. 229 + Even if a config option is listed for a driver, some other 230 + available config options may not be listed. 231 + 232 + FLAG values: 233 + "; 234 + 235 + for ($k = 0; $k < $num_pr_flags; $k++) { 236 + printf " %s %s\n", $pr_flag_value[$k], $pr_flag_help[$k]; 237 + } 238 + 239 + print 240 + " 241 + Upper case letters indicate potential issues or problems. 242 + 243 + The flag: 244 + 245 + "; 246 + 247 + $k = $pr_flag_pos_hard_coded; 248 + printf " %s %s\n", $pr_flag_value[$k], $pr_flag_help[$k]; 249 + 250 + print 251 + " 252 + will be set if the config or driver is in the white lists, even if 253 + --white-list-config and --white-list-driver are not specified. 254 + This is a hint that 1) many of these reported lines are likely to 255 + be incorrect, and 2) using those options will reduce the number of 256 + drivers and/or config options reported. 257 + 258 + --white-list-config and --white-list-driver may not be accurate if this 259 + program is not well maintained. Use them with appropriate skepticism. 260 + Use the --show-lists option to report the values in the list. 261 + 262 + Return value: 263 + 0 if no error 264 + 1 error processing command line 265 + 2 unable to open or read kernel config file 266 + 3 unable to open or process input device tree file(s) 267 + 268 + EXAMPLES: 269 + 270 + dt_to_config arch/arm/boot/dts/my_dts_file.dts 271 + 272 + Basic report. 273 + 274 + dt_to_config \\ 275 + --config \${KBUILD_OUTPUT}/.config \\ 276 + arch/\${ARCH}/boot/dts/my_dts_file.dts 277 + 278 + Full report, with config file issues noted. 279 + 280 + dt_to_config --include-suspect \\ 281 + --config \${KBUILD_OUTPUT}/.config \\ 282 + arch/\${ARCH}/boot/dts/my_dts_file.dts 283 + 284 + Report of node / compatible string / driver tuples that should 285 + be further investigated. A node may have multiple compatible 286 + strings. A compatible string may be matched by multiple drivers. 287 + A driver may have config file issues noted. The compatible string 288 + and/or driver may be in the white lists. 289 + 290 + dt_to_config --include-suspect --config-format \\ 291 + --config ${KBUILD_OUTPUT}/.config \\ 292 + arch/\${ARCH}/boot/dts/my_dts_file.dts 293 + 294 + Report of node / compatible string / driver tuples that should 295 + be further investigated. The report can be edited to uncomment 296 + the config options to select the desired tuple for a given node. 297 + A node may have multiple compatible strings. A compatible string 298 + may be matched by multiple drivers. A driver may have config file 299 + issues noted. The compatible string and/or driver may be in the 300 + white lists. 301 + 302 + "; 303 + } 304 + 305 + sub set_flag() 306 + { 307 + # pr_flags_ref is a reference to $pr_flags 308 + 309 + my $pr_flags_ref = shift; 310 + my $pos = shift; 311 + 312 + substr $$pr_flags_ref, $pos, 1, $pr_flag_value[$pos]; 313 + 314 + return $pr_flags; 315 + } 316 + 317 + sub print_flags() 318 + { 319 + # return 1 if anything printed, else 0 320 + 321 + # some fields of pn_arg_ref might not be used in this function, but 322 + # extract all of them anyway. 323 + my $pn_arg_ref = shift; 324 + 325 + my $compat = $pn_arg_ref->{compat}; 326 + my $compatible_cnt = $pn_arg_ref->{compatible_cnt}; 327 + my $config = $pn_arg_ref->{config}; 328 + my $config_cnt = $pn_arg_ref->{config_cnt}; 329 + my $driver = $pn_arg_ref->{driver}; 330 + my $driver_cnt = $pn_arg_ref->{driver_cnt}; 331 + my $full_node = $pn_arg_ref->{full_node}; 332 + my $node = $pn_arg_ref->{node}; 333 + my $node_enabled = $pn_arg_ref->{node_enabled}; 334 + my $white_list = $pn_arg_ref->{white_list}; 335 + 336 + my $pr_flags = '-' x $num_pr_flags; 337 + 338 + 339 + # ----- set flags in $pr_flags 340 + 341 + if ($compatible_cnt > 1) { 342 + &set_flag(\$pr_flags, $pr_flag_pos_mcompatible); 343 + } 344 + 345 + if ($config_cnt > 1) { 346 + &set_flag(\$pr_flags, $pr_flag_pos_mconfig); 347 + } 348 + 349 + if ($driver_cnt >= 1) { 350 + &set_flag(\$pr_flags, $pr_flag_pos_driver); 351 + } 352 + 353 + if ($driver_cnt > 1) { 354 + &set_flag(\$pr_flags, $pr_flag_pos_mdriver); 355 + } 356 + 357 + # These strings are the same way the linux kernel tests. 358 + # The ePapr lists of values is slightly different. 359 + if (!( 360 + ($node_enabled eq "") || 361 + ($node_enabled eq "ok") || 362 + ($node_enabled eq "okay") 363 + )) { 364 + &set_flag(\$pr_flags, $pr_flag_pos_node_not_enabled); 365 + } 366 + 367 + if ($white_list) { 368 + &set_flag(\$pr_flags, $pr_flag_pos_white_list); 369 + } 370 + 371 + if (exists($driver_hard_code_list{$compat}) || 372 + (exists($driver_config_hard_code_list{$driver}) && 373 + ($driver ne "no_driver"))) { 374 + &set_flag(\$pr_flags, $pr_flag_pos_hard_coded); 375 + } 376 + 377 + my @configs = split(' && ', $config); 378 + for $configs (@configs) { 379 + $not = $configs =~ /^!/; 380 + $configs =~ s/^!//; 381 + 382 + if (($configs ne "no_config") && ($configs ne "no_makefile")) { 383 + &set_flag(\$pr_flags, $pr_flag_pos_config); 384 + } 385 + 386 + if (($config_cnt >= 1) && 387 + ($configs !~ /CONFIG_/) && 388 + (($configs ne "no_config") && ($configs ne "no_makefile"))) { 389 + &set_flag(\$pr_flags, $pr_flag_pos_config_hard_coded); 390 + } 391 + 392 + my $existing_config = $existing_config{$configs}; 393 + if ($existing_config eq "m") { 394 + &set_flag(\$pr_flags, $pr_flag_pos_config_m); 395 + # Possible fail, depends on whether built in or 396 + # module is desired. 397 + &set_flag(\$pr_flags, $pr_flag_pos_config_test_fail); 398 + } elsif ($existing_config eq "y") { 399 + &set_flag(\$pr_flags, $pr_flag_pos_config_y); 400 + if ($not) { 401 + &set_flag(\$pr_flags, $pr_flag_pos_config_test_fail); 402 + } 403 + } elsif (($config_file) && ($configs =~ /CONFIG_/)) { 404 + &set_flag(\$pr_flags, $pr_flag_pos_config_none); 405 + if (!$not) { 406 + &set_flag(\$pr_flags, $pr_flag_pos_config_test_fail); 407 + } 408 + } 409 + } 410 + 411 + # ----- include / exclude filters 412 + 413 + if ($include_flag_pattern && ($pr_flags !~ m/$include_flag_pattern/)) { 414 + return 0; 415 + } 416 + 417 + if ($exclude_flag_pattern && ($pr_flags =~ m/$exclude_flag_pattern/)) { 418 + return 0; 419 + } 420 + 421 + if ($config_format) { 422 + print "# "; 423 + } 424 + print "$pr_flags : "; 425 + 426 + return 1; 427 + } 428 + 429 + 430 + sub print_node() 431 + { 432 + # return number of lines printed 433 + 434 + # some fields of pn_arg_ref might not be used in this function, but 435 + # extract all of them anyway. 436 + my $pn_arg_ref = shift; 437 + 438 + my $compat = $pn_arg_ref->{compat}; 439 + my $compatible_cnt = $pn_arg_ref->{compatible_cnt}; 440 + my $config = $pn_arg_ref->{config}; 441 + my $config_cnt = $pn_arg_ref->{config_cnt}; 442 + my $driver = $pn_arg_ref->{driver}; 443 + my $driver_cnt = $pn_arg_ref->{driver_cnt}; 444 + my $full_node = $pn_arg_ref->{full_node}; 445 + my $node = $pn_arg_ref->{node}; 446 + my $node_enabled = $pn_arg_ref->{node_enabled}; 447 + my $white_list = $pn_arg_ref->{white_list}; 448 + 449 + my $separator; 450 + 451 + if (! &print_flags($pn_arg_ref)) { 452 + return 0; 453 + } 454 + 455 + 456 + if ($short_name) { 457 + print "$node"; 458 + } else { 459 + print "$full_node"; 460 + } 461 + print " : $compat : $driver : $config : "; 462 + 463 + my @configs = split(' && ', $config); 464 + 465 + if ($config_file) { 466 + for $configs (@configs) { 467 + $configs =~ s/^!//; 468 + my $existing_config = $existing_config{$configs}; 469 + if (!$existing_config) { 470 + # check for /-m/, /-y/, or /-objs/ 471 + if ($configs !~ /CONFIG_/) { 472 + $existing_config = "x"; 473 + }; 474 + }; 475 + if ($existing_config) { 476 + print "$separator", "$existing_config"; 477 + $separator = ", "; 478 + } else { 479 + print "$separator", "n"; 480 + $separator = ", "; 481 + } 482 + } 483 + } else { 484 + print "none"; 485 + } 486 + 487 + print "\n"; 488 + 489 + if ($config_format) { 490 + for $configs (@configs) { 491 + $not = $configs =~ /^!/; 492 + $configs =~ s/^!//; 493 + my $existing_config = $existing_config{$configs}; 494 + 495 + if ($not) { 496 + if ($configs !~ /CONFIG_/) { 497 + print "# $configs\n"; 498 + } elsif ($existing_config eq "m") { 499 + print "# $configs is m\n"; 500 + print "# $configs=n\n"; 501 + } elsif ($existing_config eq "y") { 502 + print "# $configs is set\n"; 503 + print "# $configs=n\n"; 504 + } else { 505 + print "# $configs is not set\n"; 506 + print "# $configs=n\n"; 507 + } 508 + 509 + } else { 510 + if ($configs !~ /CONFIG_/) { 511 + print "# $configs\n"; 512 + } elsif ($existing_config eq "m") { 513 + print "# $configs is m\n"; 514 + print "# $configs=y\n"; 515 + } elsif ($existing_config eq "y") { 516 + print "# $configs is set\n"; 517 + print "# $configs=y\n"; 518 + } else { 519 + print "# $configs is not set\n"; 520 + print "# $configs=y\n"; 521 + } 522 + } 523 + } 524 + } 525 + 526 + return 1; 527 + } 528 + 529 + 530 + sub scan_makefile 531 + { 532 + my $pn_arg_ref = shift; 533 + my $driver = shift; 534 + 535 + # ----- Find Kconfig symbols that enable driver 536 + 537 + my ($dir, $base) = $driver =~ m{(.*)/(.*).c}; 538 + 539 + my $makefile = $dir . "/Makefile"; 540 + if (! -r $makefile) { 541 + $makefile = $dir . "/Kbuild"; 542 + } 543 + if (! -r $makefile) { 544 + my $config; 545 + 546 + $config = 'no_makefile'; 547 + push @{ $driver_config{$driver} }, $config; 548 + return; 549 + } 550 + 551 + if (!open(MAKEFILE_FILE, "<", "$makefile")) { 552 + return; 553 + } 554 + 555 + my $line; 556 + my @config; 557 + my @if_config; 558 + my @make_var; 559 + 560 + NEXT_LINE: 561 + while ($next_line = <MAKEFILE_FILE>) { 562 + my $config; 563 + my $if_config; 564 + my $ifdef; 565 + my $ifeq; 566 + my $ifndef; 567 + my $ifneq; 568 + my $ifdef_config; 569 + my $ifeq_config; 570 + my $ifndef_config; 571 + my $ifneq_config; 572 + 573 + chomp($next_line); 574 + $line = $line . $next_line; 575 + if ($next_line =~ /\\$/) { 576 + $line =~ s/\\$/ /; 577 + next NEXT_LINE; 578 + } 579 + if ($line =~ /^\s*#/) { 580 + $line = ""; 581 + next NEXT_LINE; 582 + } 583 + 584 + # ----- condition ... else ... endif 585 + 586 + if ($line =~ /^([ ]\s*|)else\b/) { 587 + $if_config = "!" . pop @if_config; 588 + $if_config =~ s/^!!//; 589 + push @if_config, $if_config; 590 + $line =~ s/^([ ]\s*|)else\b//; 591 + } 592 + 593 + ($null, $ifeq_config, $ifeq_config_val ) = $line =~ /^([ ]\s*|)ifeq\b.*\b(CONFIG_[A-Za-z0-9_]*)(.*)/; 594 + ($null, $ifneq_config, $ifneq_config_val) = $line =~ /^([ ]\s*|)ifneq\b.*\b(CONFIG_[A-Za-z0-9_]*)(.*)/; 595 + ($null, $ifdef_config) = $line =~ /^([ ]\s*|)ifdef\b.*\b(CONFIG_[A-Za-z0-9_]*)/; 596 + ($null, $ifndef_config) = $line =~ /^([ ]\s*|)ifndef\b.*\b(CONFIG_[A-Za-z0-9_]*)/; 597 + 598 + ($null, $ifeq) = $line =~ /^([ ]\s*|)ifeq\b\s*(.*)/; 599 + ($null, $ifneq) = $line =~ /^([ ]\s*|)ifneq\b\s*(.*)/; 600 + ($null, $ifdef) = $line =~ /^([ ]\s*|)ifdef\b\s*(.*)/; 601 + ($null, $ifndef) = $line =~ /^([ ]\s*|)ifndef\b\s*(.*)/; 602 + 603 + # Order of tests is important. Prefer "CONFIG_*" regex match over 604 + # less specific regex match. 605 + if ($ifdef_config) { 606 + $if_config = $ifdef_config; 607 + } elsif ($ifeq_config) { 608 + if ($ifeq_config_val =~ /y/) { 609 + $if_config = $ifeq_config; 610 + } else { 611 + $if_config = "!" . $ifeq_config; 612 + } 613 + } elsif ($ifndef_config) { 614 + $if_config = "!" . $ifndef_config; 615 + } elsif ($ifneq_config) { 616 + if ($ifneq_config_val =~ /y/) { 617 + $if_config = "!" . $ifneq_config; 618 + } else { 619 + $if_config = $ifneq_config; 620 + } 621 + } elsif ($ifdef) { 622 + $if_config = $ifdef; 623 + } elsif ($ifeq) { 624 + $if_config = $ifeq; 625 + } elsif ($ifndef) { 626 + $if_config = "!" . $ifndef; 627 + } elsif ($ifneq) { 628 + $if_config = "!" . $ifneq; 629 + } else { 630 + $if_config = ""; 631 + } 632 + $if_config =~ s/^!!//; 633 + 634 + if ($if_config) { 635 + push @if_config, $if_config; 636 + $line = ""; 637 + next NEXT_LINE; 638 + } 639 + 640 + if ($line =~ /^([ ]\s*|)endif\b/) { 641 + pop @if_config; 642 + $line = ""; 643 + next NEXT_LINE; 644 + } 645 + 646 + # ----- simple CONFIG_* = *.[co] or xxx [+:?]*= *.[co] 647 + # Most makefiles select on *.o, but 648 + # arch/powerpc/boot/Makefile selects on *.c 649 + 650 + ($config) = $line =~ /(CONFIG_[A-Za-z0-9_]+).*\b$base.[co]\b/; 651 + 652 + # ----- match a make variable instead of *.[co] 653 + # Recursively expanded variables are not handled. 654 + 655 + if (!$config) { 656 + my $make_var; 657 + ($make_var) = $line =~ /\s*(\S+?)\s*[+:\?]*=.*\b$base.[co]\b/; 658 + if ($make_var) { 659 + if ($make_var =~ /[a-zA-Z0-9]+-[ym]/) { 660 + $config = $make_var; 661 + } elsif ($make_var =~ /[a-zA-Z0-9]+-objs/) { 662 + $config = $make_var; 663 + } else { 664 + push @make_var, $make_var; 665 + } 666 + } 667 + } 668 + 669 + if (!$config) { 670 + for $make_var (@make_var) { 671 + ($config) = $line =~ /(CONFIG_[A-Za-z0-9_]+).*\b$make_var\b/; 672 + last if ($config); 673 + } 674 + } 675 + 676 + if (!$config) { 677 + for $make_var (@make_var) { 678 + ($config) = $line =~ /\s*(\S+?)\s*[+:\?]*=.*\b$make_var\b/; 679 + last if ($config); 680 + } 681 + } 682 + 683 + # ----- next if no config found 684 + 685 + if (!$config) { 686 + $line = ""; 687 + next NEXT_LINE; 688 + } 689 + 690 + for $if_config (@if_config) { 691 + $config = $if_config . " && " . $config; 692 + } 693 + 694 + push @{ $driver_config{$driver} }, $config; 695 + 696 + $line = ""; 697 + } 698 + 699 + close(MAKEFILE_FILE); 700 + 701 + } 702 + 703 + 704 + sub find_kconfig 705 + { 706 + my $pn_arg_ref = shift; 707 + my $driver = shift; 708 + 709 + my $lines_printed = 0; 710 + my @configs; 711 + 712 + if (!@{ $driver_config{$driver} }) { 713 + &scan_makefile($pn_arg_ref, $driver); 714 + if (!@{ $driver_config{$driver} }) { 715 + push @{ $driver_config{$driver} }, "no_config"; 716 + } 717 + } 718 + 719 + @configs = @{ $driver_config{$driver} }; 720 + 721 + $$pn_arg_ref{config_cnt} = $#configs + 1; 722 + for my $config (@configs) { 723 + $$pn_arg_ref{config} = $config; 724 + $lines_printed += &print_node($pn_arg_ref); 725 + } 726 + 727 + return $lines_printed; 728 + } 729 + 730 + 731 + sub handle_compatible() 732 + { 733 + my $full_node = shift; 734 + my $node = shift; 735 + my $compatible = shift; 736 + my $node_enabled = shift; 737 + 738 + my $compat; 739 + my $lines_printed = 0; 740 + my %pn_arg = (); 741 + 742 + return if (!$node or !$compatible); 743 + 744 + # Do not process compatible property of root node, 745 + # it is used to match board, not to bind a driver. 746 + return if ($node eq "/"); 747 + 748 + $pn_arg{full_node} = $full_node; 749 + $pn_arg{node} = $node; 750 + $pn_arg{node_enabled} = $node_enabled; 751 + 752 + my @compatibles = split('", "', $compatible); 753 + 754 + $compatibles[0] =~ s/^"//; 755 + $compatibles[$#compatibles] =~ s/"$//; 756 + 757 + $pn_arg{compatible_cnt} = $#compatibles + 1; 758 + 759 + COMPAT: 760 + for $compat (@compatibles) { 761 + 762 + $pn_arg{compat} = $compat; 763 + $pn_arg{driver_cnt} = 0; 764 + $pn_arg{white_list} = 0; 765 + 766 + if (exists($compat_white_list{$compat})) { 767 + $pn_arg{white_list} = 1; 768 + $pn_arg{driver} = "no_driver"; 769 + $pn_arg{config_cnt} = 1; 770 + $pn_arg{config} = "no_config"; 771 + $lines_printed += &print_node(\%pn_arg); 772 + next COMPAT; 773 + } 774 + 775 + # ----- if compat previously seen, use cached info 776 + 777 + if (exists($compat_driver{$compat})) { 778 + for my $driver (@{ $compat_driver{$compat} }) { 779 + $pn_arg{driver} = $driver; 780 + $pn_arg{driver_cnt} = $driver_count{$compat}; 781 + $pn_arg{config_cnt} = $#{ $driver_config{$driver}} + 1; 782 + 783 + for my $config (@{ $driver_config{$driver} }) { 784 + $pn_arg{config} = $config; 785 + $lines_printed += &print_node(\%pn_arg); 786 + } 787 + 788 + if (!@{ $driver_config{$driver} }) { 789 + # no config cached yet 790 + # $driver in %driver_hard_code_list 791 + # but not %driver_config_hard_code_list 792 + $lines_printed += &find_kconfig(\%pn_arg, $driver); 793 + } 794 + } 795 + next COMPAT; 796 + } 797 + 798 + 799 + # ----- Find drivers (source files that contain compatible) 800 + 801 + # this will miss arch/sparc/include/asm/parport.h 802 + # It is better to move the compatible out of the .h 803 + # than to add *.h. to the files list, because *.h generates 804 + # a lot of false negatives. 805 + my $files = '"*.c"'; 806 + my $drivers = `git grep -l '"$compat"' -- $files`; 807 + chomp($drivers); 808 + if ($drivers eq "") { 809 + $pn_arg{driver} = "no_driver"; 810 + $pn_arg{config_cnt} = 1; 811 + $pn_arg{config} = "no_config"; 812 + push @{ $compat_driver{$compat} }, "no_driver"; 813 + $lines_printed += &print_node(\%pn_arg); 814 + next COMPAT; 815 + } 816 + 817 + my @drivers = split("\n", $drivers); 818 + $driver_count{$compat} = $#drivers + 1; 819 + $pn_arg{driver_cnt} = $#drivers + 1; 820 + 821 + DRIVER: 822 + for my $driver (@drivers) { 823 + push @{ $compat_driver{$compat} }, $driver; 824 + $pn_arg{driver} = $driver; 825 + 826 + # ----- if driver previously seen, use cached info 827 + 828 + $pn_arg{config_cnt} = $#{ $driver_config{$driver} } + 1; 829 + for my $config (@{ $driver_config{$driver} }) { 830 + $pn_arg{config} = $config; 831 + $lines_printed += &print_node(\%pn_arg); 832 + } 833 + if (@{ $driver_config{$driver} }) { 834 + next DRIVER; 835 + } 836 + 837 + if ($black_list_driver) { 838 + for $black (@black_list_driver) { 839 + next DRIVER if ($driver =~ /^$black$/); 840 + } 841 + } 842 + 843 + 844 + # ----- Find Kconfig symbols that enable driver 845 + 846 + $lines_printed += &find_kconfig(\%pn_arg, $driver); 847 + 848 + } 849 + } 850 + 851 + # White space (line) between nodes for readability. 852 + # Each node may report several compatibles. 853 + # For each compatible, multiple drivers may be reported. 854 + # For each driver, multiple CONFIG_ options may be reported. 855 + if ($lines_printed) { 856 + print "\n"; 857 + } 858 + } 859 + 860 + sub read_dts() 861 + { 862 + my $file = shift; 863 + 864 + my $compatible = ""; 865 + my $line; 866 + my $node = ""; 867 + my $node_enabled = ""; 868 + 869 + if (! -r $file) { 870 + print STDERR "file '$file' is not readable or does not exist\n"; 871 + exit 3; 872 + } 873 + 874 + if (!open(DT_FILE, "-|", "$dtx_diff $file")) { 875 + print STDERR "\n"; 876 + print STDERR "shell command failed:\n"; 877 + print STDERR " $dtx_diff $file\n"; 878 + print STDERR "\n"; 879 + exit 3; 880 + } 881 + 882 + FILE: 883 + while ($line = <DT_FILE>) { 884 + chomp($line); 885 + 886 + if ($line =~ /{/) { 887 + 888 + &handle_compatible($full_node, $node, $compatible, 889 + $node_enabled); 890 + 891 + while ($end_node_count-- > 0) { 892 + pop @full_node; 893 + }; 894 + $end_node_count = 0; 895 + $full_node = @full_node[-1]; 896 + 897 + $node = $line; 898 + $node =~ s/^\s*(.*)\s+\{.*/$1/; 899 + $node =~ s/.*: //; 900 + if ($node eq '/' ) { 901 + $full_node = '/'; 902 + } elsif ($full_node ne '/') { 903 + $full_node = $full_node . '/' . $node; 904 + } else { 905 + $full_node = '/' . $node; 906 + } 907 + push @full_node, $full_node; 908 + 909 + $compatible = ""; 910 + $node_enabled = ""; 911 + next FILE; 912 + } 913 + 914 + if ($line =~ /}/) { 915 + $end_node_count++; 916 + } 917 + 918 + if ($line =~ /(\s+|^)status =/) { 919 + $node_enabled = $line; 920 + $node_enabled =~ s/^\t*//; 921 + $node_enabled =~ s/^status = "//; 922 + $node_enabled =~ s/";$//; 923 + next FILE; 924 + } 925 + 926 + if ($line =~ /(\s+|^)compatible =/) { 927 + # Extract all compatible entries for this device 928 + # White space matching here and in handle_compatible() is 929 + # precise, because input format is the output of dtc, 930 + # which is invoked by dtx_diff. 931 + $compatible = $line; 932 + $compatible =~ s/^\t*//; 933 + $compatible =~ s/^compatible = //; 934 + $compatible =~ s/;$//; 935 + } 936 + } 937 + 938 + &handle_compatible($full_node, $node, $compatible, $node_enabled); 939 + 940 + close(DT_FILE); 941 + } 942 + 943 + 944 + sub read_config_file() 945 + { 946 + if (! -r $config_file) { 947 + print STDERR "file '$config_file' is not readable or does not exist\n"; 948 + exit 2; 949 + } 950 + 951 + if (!open(CONFIG_FILE, "<", "$config_file")) { 952 + print STDERR "open $config_file failed\n"; 953 + exit 2; 954 + } 955 + 956 + my @line; 957 + 958 + LINE: 959 + while ($line = <CONFIG_FILE>) { 960 + chomp($line); 961 + next LINE if ($line =~ /^\s*#/); 962 + next LINE if ($line =~ /^\s*$/); 963 + @line = split /=/, $line; 964 + $existing_config{@line[0]} = @line[1]; 965 + } 966 + 967 + close(CONFIG_FILE); 968 + } 969 + 970 + 971 + sub cmd_line_err() 972 + { 973 + my $msg = shift; 974 + 975 + print STDERR "\n"; 976 + print STDERR " ERROR processing command line options\n"; 977 + print STDERR " $msg\n" if ($msg ne ""); 978 + print STDERR "\n"; 979 + print STDERR " For help, type '$script_name --help'\n"; 980 + print STDERR "\n"; 981 + } 982 + 983 + 984 + # ----------------------------------------------------------------------------- 985 + # program entry point 986 + 987 + Getopt::Long::Configure("no_ignore_case", "bundling"); 988 + 989 + if (!GetOptions( 990 + "c=s" => \$config_file, 991 + "config=s" => \$config_file, 992 + "config-format" => \$config_format, 993 + "exclude-flag=s" => \@exclude_flag, 994 + "h" => \$help, 995 + "help" => \$help, 996 + "black-list-driver" => \$black_list_driver, 997 + "white-list-config" => \$white_list_config, 998 + "white-list-driver" => \$white_list_driver, 999 + "include-flag=s" => \@include_flag, 1000 + "include-suspect" => \$include_suspect, 1001 + "short-name" => \$short_name, 1002 + "show-lists" => \$show_lists, 1003 + "version" => \$version, 1004 + )) { 1005 + 1006 + &cmd_line_err(); 1007 + 1008 + exit 1; 1009 + } 1010 + 1011 + 1012 + my $exit_after_messages = 0; 1013 + 1014 + if ($version) { 1015 + print STDERR "\n$script_name $VUFX\n\n"; 1016 + $exit_after_messages = 1; 1017 + } 1018 + 1019 + 1020 + if ($help) { 1021 + &usage; 1022 + $exit_after_messages = 1; 1023 + } 1024 + 1025 + 1026 + if ($show_lists) { 1027 + 1028 + print "\n"; 1029 + print "These compatibles are hard coded to have no driver.\n"; 1030 + print "\n"; 1031 + for my $compat (sort keys %compat_white_list) { 1032 + print " $compat\n"; 1033 + } 1034 + 1035 + 1036 + print "\n\n"; 1037 + print "The driver for these compatibles is hard coded (white list).\n"; 1038 + print "\n"; 1039 + my $max_compat_len = 0; 1040 + for my $compat (sort keys %driver_hard_code_list) { 1041 + if (length $compat > $max_compat_len) { 1042 + $max_compat_len = length $compat; 1043 + } 1044 + } 1045 + for my $compat (sort keys %driver_hard_code_list) { 1046 + if (($driver ne "hardcoded_no_driver") && ($driver ne "no_driver")) { 1047 + my $first = 1; 1048 + for my $driver (@{ $driver_hard_code_list{$compat} }) { 1049 + if ($first) { 1050 + print " $compat"; 1051 + print " " x ($max_compat_len - length $compat); 1052 + $first = 0; 1053 + } else { 1054 + print " ", " " x $max_compat_len; 1055 + } 1056 + print " $driver\n"; 1057 + } 1058 + } 1059 + } 1060 + 1061 + 1062 + print "\n\n"; 1063 + print "The configuration option for these drivers is hard coded (white list).\n"; 1064 + print "\n"; 1065 + my $max_driver_len = 0; 1066 + for my $driver (sort keys %driver_config_hard_code_list) { 1067 + if (length $driver > $max_driver_len) { 1068 + $max_driver_len = length $driver; 1069 + } 1070 + } 1071 + for my $driver (sort keys %driver_config_hard_code_list) { 1072 + if (($driver ne "hardcoded_no_driver") && ($driver ne "no_driver")) { 1073 + my $first = 1; 1074 + for my $config (@{ $driver_config_hard_code_list{$driver} }) { 1075 + if ($first) { 1076 + print " $driver"; 1077 + print " " x ($max_driver_len - length $driver); 1078 + $first = 0; 1079 + } else { 1080 + print " ", " " x $max_driver_len; 1081 + } 1082 + print " $config\n"; 1083 + } 1084 + } 1085 + } 1086 + 1087 + 1088 + print "\n\n"; 1089 + print "These drivers are black listed.\n"; 1090 + print "\n"; 1091 + for my $driver (@black_list_driver) { 1092 + print " $driver\n"; 1093 + } 1094 + 1095 + print "\n"; 1096 + 1097 + $exit_after_messages = 1; 1098 + } 1099 + 1100 + 1101 + if ($exit_after_messages) { 1102 + exit 0; 1103 + } 1104 + 1105 + 1106 + $exclude_flag_pattern = "["; 1107 + for my $exclude_flag (@exclude_flag) { 1108 + $exclude_flag_pattern = $exclude_flag_pattern . $exclude_flag; 1109 + } 1110 + $exclude_flag_pattern = $exclude_flag_pattern . "]"; 1111 + # clean up if empty 1112 + $exclude_flag_pattern =~ s/^\[\]$//; 1113 + 1114 + 1115 + $include_flag_pattern = "["; 1116 + for my $include_flag (@include_flag) { 1117 + $include_flag_pattern = $include_flag_pattern . $include_flag; 1118 + } 1119 + $include_flag_pattern = $include_flag_pattern . "]"; 1120 + # clean up if empty 1121 + $include_flag_pattern =~ s/^\[\]$//; 1122 + 1123 + 1124 + if ($exclude_flag_pattern) { 1125 + my $found = 0; 1126 + for $pr_flag_value (@pr_flag_value) { 1127 + if ($exclude_flag_pattern =~ m/$pr_flag_value/) { 1128 + $found = 1; 1129 + } 1130 + } 1131 + if (!$found) { 1132 + &cmd_line_err("invalid value for FLAG in --exclude-flag\n"); 1133 + exit 1 1134 + } 1135 + } 1136 + 1137 + if ($include_flag_pattern) { 1138 + my $found = 0; 1139 + for $pr_flag_value (@pr_flag_value) { 1140 + if ($include_flag_pattern =~ m/$pr_flag_value/) { 1141 + $found = 1; 1142 + } 1143 + } 1144 + if (!$found) { 1145 + &cmd_line_err("invalid value for FLAG in --include-flag\n"); 1146 + exit 1 1147 + } 1148 + } 1149 + 1150 + if ($include_suspect) { 1151 + $include_flag_pattern =~ s/\[//; 1152 + $include_flag_pattern =~ s/\]//; 1153 + $include_flag_pattern = "[" . $include_flag_pattern . "A-Z]"; 1154 + } 1155 + 1156 + if ($exclude_flag_pattern =~ m/$include_flag_pattern/) { 1157 + &cmd_line_err("the same flag appears in both --exclude-flag and --include-flag or --include-suspect\n"); 1158 + exit 1 1159 + } 1160 + 1161 + 1162 + # ($#ARGV < 0) is valid for --help, --version 1163 + if ($#ARGV < 0) { 1164 + &cmd_line_err("device-tree... is required"); 1165 + exit 1 1166 + } 1167 + 1168 + 1169 + if ($config_file) { 1170 + &read_config_file(); 1171 + } 1172 + 1173 + 1174 + # avoid pushing duplicates for this value 1175 + $driver = "hardcoded_no_driver"; 1176 + for $config ( @{ $driver_config_hard_code_list{$driver} } ) { 1177 + push @{ $driver_config{$driver} }, $config; 1178 + } 1179 + 1180 + if ($white_list_driver) { 1181 + for my $compat (keys %driver_hard_code_list) { 1182 + for my $driver (@{ $driver_hard_code_list{$compat} }) { 1183 + push @{ $compat_driver{$compat} }, $driver; 1184 + if ($driver ne "hardcoded_no_driver") { 1185 + $driver_count{$compat} = scalar @{ $compat_driver{$compat} }; 1186 + } 1187 + } 1188 + } 1189 + } 1190 + 1191 + if ($white_list_config) { 1192 + for my $driver (keys %driver_config_hard_code_list) { 1193 + if ($driver ne "hardcoded_no_driver") { 1194 + for $config ( @{ $driver_config_hard_code_list{$driver} } ) { 1195 + push @{ $driver_config{$driver} }, $config; 1196 + } 1197 + } 1198 + } 1199 + } 1200 + 1201 + if (-x "scripts/dtc/dtx_diff") { 1202 + $dtx_diff = "scripts/dtc/dtx_diff"; 1203 + } else { 1204 + 1205 + print STDERR "\n"; 1206 + print STDERR "$script_name must be run from the root directory of a Linux kernel tree\n"; 1207 + print STDERR "\n"; 1208 + exit 3; 1209 + } 1210 + 1211 + for $file (@ARGV) { 1212 + &read_dts($file); 1213 + }
+1 -1
scripts/dtc/dtx_diff
··· 266 266 267 267 if [ ! -x ${DTC} ] ; then 268 268 __DTC="dtc" 269 - if grep -q "^CONFIG_DTC=y" ${__KBUILD_OUTPUT}/.config ; then 269 + if grep -q "^CONFIG_DTC=y" ${__KBUILD_OUTPUT}/.config 2>/dev/null; then 270 270 make_command=' 271 271 make scripts' 272 272 else