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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'driver-core-7.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core

Pull driver core fixes from Danilo Krummrich:

- Do not register imx_clk_scu_driver in imx8qxp_clk_probe(); besides
fixing two other issues, this avoids a deadlock in combination with
commit dc23806a7c47 ("driver core: enforce device_lock for
driver_match_device()")

- Move secondary node lookup from device_get_next_child_node() to
fwnode_get_next_child_node(); this avoids issues when users switch
from the device API to the fwnode API

- Export io_define_{read,write}!() to avoid unused import warnings when
CONFIG_PCI=n

* tag 'driver-core-7.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core:
clk: scu/imx8qxp: do not register driver in probe()
rust: io: macro_export io_define_read!() and io_define_write!()
device property: Allow secondary lookup in fwnode_get_next_child_node()

+150 -70
+13 -14
drivers/base/property.c
··· 797 797 fwnode_get_next_child_node(const struct fwnode_handle *fwnode, 798 798 struct fwnode_handle *child) 799 799 { 800 - return fwnode_call_ptr_op(fwnode, get_next_child_node, child); 800 + struct fwnode_handle *next; 801 + 802 + if (IS_ERR_OR_NULL(fwnode)) 803 + return NULL; 804 + 805 + /* Try to find a child in primary fwnode */ 806 + next = fwnode_call_ptr_op(fwnode, get_next_child_node, child); 807 + if (next) 808 + return next; 809 + 810 + /* When no more children in primary, continue with secondary */ 811 + return fwnode_call_ptr_op(fwnode->secondary, get_next_child_node, child); 801 812 } 802 813 EXPORT_SYMBOL_GPL(fwnode_get_next_child_node); 803 814 ··· 852 841 struct fwnode_handle *device_get_next_child_node(const struct device *dev, 853 842 struct fwnode_handle *child) 854 843 { 855 - const struct fwnode_handle *fwnode = dev_fwnode(dev); 856 - struct fwnode_handle *next; 857 - 858 - if (IS_ERR_OR_NULL(fwnode)) 859 - return NULL; 860 - 861 - /* Try to find a child in primary fwnode */ 862 - next = fwnode_get_next_child_node(fwnode, child); 863 - if (next) 864 - return next; 865 - 866 - /* When no more children in primary, continue with secondary */ 867 - return fwnode_get_next_child_node(fwnode->secondary, child); 844 + return fwnode_get_next_child_node(dev_fwnode(dev), child); 868 845 } 869 846 EXPORT_SYMBOL_GPL(device_get_next_child_node); 870 847
+23 -1
drivers/clk/imx/clk-imx8qxp.c
··· 346 346 }, 347 347 .probe = imx8qxp_clk_probe, 348 348 }; 349 - module_platform_driver(imx8qxp_clk_driver); 349 + 350 + static int __init imx8qxp_clk_init(void) 351 + { 352 + int ret; 353 + 354 + ret = platform_driver_register(&imx8qxp_clk_driver); 355 + if (ret) 356 + return ret; 357 + 358 + ret = imx_clk_scu_module_init(); 359 + if (ret) 360 + platform_driver_unregister(&imx8qxp_clk_driver); 361 + 362 + return ret; 363 + } 364 + module_init(imx8qxp_clk_init); 365 + 366 + static void __exit imx8qxp_clk_exit(void) 367 + { 368 + imx_clk_scu_module_exit(); 369 + platform_driver_unregister(&imx8qxp_clk_driver); 370 + } 371 + module_exit(imx8qxp_clk_exit); 350 372 351 373 MODULE_AUTHOR("Aisheng Dong <aisheng.dong@nxp.com>"); 352 374 MODULE_DESCRIPTION("NXP i.MX8QXP clock driver");
+11 -1
drivers/clk/imx/clk-scu.c
··· 191 191 return p != NULL; 192 192 } 193 193 194 + int __init imx_clk_scu_module_init(void) 195 + { 196 + return platform_driver_register(&imx_clk_scu_driver); 197 + } 198 + 199 + void __exit imx_clk_scu_module_exit(void) 200 + { 201 + return platform_driver_unregister(&imx_clk_scu_driver); 202 + } 203 + 194 204 int imx_clk_scu_init(struct device_node *np, 195 205 const struct imx_clk_scu_rsrc_table *data) 196 206 { ··· 225 215 rsrc_table = data; 226 216 } 227 217 228 - return platform_driver_register(&imx_clk_scu_driver); 218 + return 0; 229 219 } 230 220 231 221 /*
+2
drivers/clk/imx/clk-scu.h
··· 25 25 extern const struct imx_clk_scu_rsrc_table imx_clk_scu_rsrc_imx8qxp; 26 26 extern const struct imx_clk_scu_rsrc_table imx_clk_scu_rsrc_imx8qm; 27 27 28 + int __init imx_clk_scu_module_init(void); 29 + void __exit imx_clk_scu_module_exit(void); 28 30 int imx_clk_scu_init(struct device_node *np, 29 31 const struct imx_clk_scu_rsrc_table *data); 30 32 struct clk_hw *imx_scu_of_clk_src_get(struct of_phandle_args *clkspec,
+89 -42
rust/kernel/io.rs
··· 139 139 140 140 /// Internal helper macros used to invoke C MMIO read functions. 141 141 /// 142 - /// This macro is intended to be used by higher-level MMIO access macros (define_read) and provides 143 - /// a unified expansion for infallible vs. fallible read semantics. It emits a direct call into the 144 - /// corresponding C helper and performs the required cast to the Rust return type. 142 + /// This macro is intended to be used by higher-level MMIO access macros (io_define_read) and 143 + /// provides a unified expansion for infallible vs. fallible read semantics. It emits a direct call 144 + /// into the corresponding C helper and performs the required cast to the Rust return type. 145 145 /// 146 146 /// # Parameters 147 147 /// ··· 166 166 167 167 /// Internal helper macros used to invoke C MMIO write functions. 168 168 /// 169 - /// This macro is intended to be used by higher-level MMIO access macros (define_write) and provides 170 - /// a unified expansion for infallible vs. fallible write semantics. It emits a direct call into the 171 - /// corresponding C helper and performs the required cast to the Rust return type. 169 + /// This macro is intended to be used by higher-level MMIO access macros (io_define_write) and 170 + /// provides a unified expansion for infallible vs. fallible write semantics. It emits a direct call 171 + /// into the corresponding C helper and performs the required cast to the Rust return type. 172 172 /// 173 173 /// # Parameters 174 174 /// ··· 193 193 }}; 194 194 } 195 195 196 - macro_rules! define_read { 196 + /// Generates an accessor method for reading from an I/O backend. 197 + /// 198 + /// This macro reduces boilerplate by automatically generating either compile-time bounds-checked 199 + /// (infallible) or runtime bounds-checked (fallible) read methods. It abstracts the address 200 + /// calculation and bounds checking, and delegates the actual I/O read operation to a specified 201 + /// helper macro, making it generic over different I/O backends. 202 + /// 203 + /// # Parameters 204 + /// 205 + /// * `infallible` / `fallible` - Determines the bounds-checking strategy. `infallible` relies on 206 + /// `IoKnownSize` for compile-time checks and returns the value directly. `fallible` performs 207 + /// runtime checks against `maxsize()` and returns a `Result<T>`. 208 + /// * `$(#[$attr:meta])*` - Optional attributes to apply to the generated method (e.g., 209 + /// `#[cfg(CONFIG_64BIT)]` or inline directives). 210 + /// * `$vis:vis` - The visibility of the generated method (e.g., `pub`). 211 + /// * `$name:ident` / `$try_name:ident` - The name of the generated method (e.g., `read32`, 212 + /// `try_read8`). 213 + /// * `$call_macro:ident` - The backend-specific helper macro used to emit the actual I/O call 214 + /// (e.g., `call_mmio_read`). 215 + /// * `$c_fn:ident` - The backend-specific C function or identifier to be passed into the 216 + /// `$call_macro`. 217 + /// * `$type_name:ty` - The Rust type of the value being read (e.g., `u8`, `u32`). 218 + #[macro_export] 219 + macro_rules! io_define_read { 197 220 (infallible, $(#[$attr:meta])* $vis:vis $name:ident, $call_macro:ident($c_fn:ident) -> 198 221 $type_name:ty) => { 199 222 /// Read IO data from a given offset known at compile time. ··· 249 226 } 250 227 }; 251 228 } 252 - pub(crate) use define_read; 229 + pub use io_define_read; 253 230 254 - macro_rules! define_write { 231 + /// Generates an accessor method for writing to an I/O backend. 232 + /// 233 + /// This macro reduces boilerplate by automatically generating either compile-time bounds-checked 234 + /// (infallible) or runtime bounds-checked (fallible) write methods. It abstracts the address 235 + /// calculation and bounds checking, and delegates the actual I/O write operation to a specified 236 + /// helper macro, making it generic over different I/O backends. 237 + /// 238 + /// # Parameters 239 + /// 240 + /// * `infallible` / `fallible` - Determines the bounds-checking strategy. `infallible` relies on 241 + /// `IoKnownSize` for compile-time checks and returns `()`. `fallible` performs runtime checks 242 + /// against `maxsize()` and returns a `Result`. 243 + /// * `$(#[$attr:meta])*` - Optional attributes to apply to the generated method (e.g., 244 + /// `#[cfg(CONFIG_64BIT)]` or inline directives). 245 + /// * `$vis:vis` - The visibility of the generated method (e.g., `pub`). 246 + /// * `$name:ident` / `$try_name:ident` - The name of the generated method (e.g., `write32`, 247 + /// `try_write8`). 248 + /// * `$call_macro:ident` - The backend-specific helper macro used to emit the actual I/O call 249 + /// (e.g., `call_mmio_write`). 250 + /// * `$c_fn:ident` - The backend-specific C function or identifier to be passed into the 251 + /// `$call_macro`. 252 + /// * `$type_name:ty` - The Rust type of the value being written (e.g., `u8`, `u32`). Note the use 253 + /// of `<-` before the type to denote a write operation. 254 + #[macro_export] 255 + macro_rules! io_define_write { 255 256 (infallible, $(#[$attr:meta])* $vis:vis $name:ident, $call_macro:ident($c_fn:ident) <- 256 257 $type_name:ty) => { 257 258 /// Write IO data from a given offset known at compile time. ··· 306 259 } 307 260 }; 308 261 } 309 - pub(crate) use define_write; 262 + pub use io_define_write; 310 263 311 264 /// Checks whether an access of type `U` at the given `offset` 312 265 /// is valid within this region. ··· 556 509 self.0.maxsize() 557 510 } 558 511 559 - define_read!(fallible, try_read8, call_mmio_read(readb) -> u8); 560 - define_read!(fallible, try_read16, call_mmio_read(readw) -> u16); 561 - define_read!(fallible, try_read32, call_mmio_read(readl) -> u32); 562 - define_read!( 512 + io_define_read!(fallible, try_read8, call_mmio_read(readb) -> u8); 513 + io_define_read!(fallible, try_read16, call_mmio_read(readw) -> u16); 514 + io_define_read!(fallible, try_read32, call_mmio_read(readl) -> u32); 515 + io_define_read!( 563 516 fallible, 564 517 #[cfg(CONFIG_64BIT)] 565 518 try_read64, 566 519 call_mmio_read(readq) -> u64 567 520 ); 568 521 569 - define_write!(fallible, try_write8, call_mmio_write(writeb) <- u8); 570 - define_write!(fallible, try_write16, call_mmio_write(writew) <- u16); 571 - define_write!(fallible, try_write32, call_mmio_write(writel) <- u32); 572 - define_write!( 522 + io_define_write!(fallible, try_write8, call_mmio_write(writeb) <- u8); 523 + io_define_write!(fallible, try_write16, call_mmio_write(writew) <- u16); 524 + io_define_write!(fallible, try_write32, call_mmio_write(writel) <- u32); 525 + io_define_write!( 573 526 fallible, 574 527 #[cfg(CONFIG_64BIT)] 575 528 try_write64, 576 529 call_mmio_write(writeq) <- u64 577 530 ); 578 531 579 - define_read!(infallible, read8, call_mmio_read(readb) -> u8); 580 - define_read!(infallible, read16, call_mmio_read(readw) -> u16); 581 - define_read!(infallible, read32, call_mmio_read(readl) -> u32); 582 - define_read!( 532 + io_define_read!(infallible, read8, call_mmio_read(readb) -> u8); 533 + io_define_read!(infallible, read16, call_mmio_read(readw) -> u16); 534 + io_define_read!(infallible, read32, call_mmio_read(readl) -> u32); 535 + io_define_read!( 583 536 infallible, 584 537 #[cfg(CONFIG_64BIT)] 585 538 read64, 586 539 call_mmio_read(readq) -> u64 587 540 ); 588 541 589 - define_write!(infallible, write8, call_mmio_write(writeb) <- u8); 590 - define_write!(infallible, write16, call_mmio_write(writew) <- u16); 591 - define_write!(infallible, write32, call_mmio_write(writel) <- u32); 592 - define_write!( 542 + io_define_write!(infallible, write8, call_mmio_write(writeb) <- u8); 543 + io_define_write!(infallible, write16, call_mmio_write(writew) <- u16); 544 + io_define_write!(infallible, write32, call_mmio_write(writel) <- u32); 545 + io_define_write!( 593 546 infallible, 594 547 #[cfg(CONFIG_64BIT)] 595 548 write64, ··· 613 566 unsafe { &*core::ptr::from_ref(raw).cast() } 614 567 } 615 568 616 - define_read!(infallible, pub read8_relaxed, call_mmio_read(readb_relaxed) -> u8); 617 - define_read!(infallible, pub read16_relaxed, call_mmio_read(readw_relaxed) -> u16); 618 - define_read!(infallible, pub read32_relaxed, call_mmio_read(readl_relaxed) -> u32); 619 - define_read!( 569 + io_define_read!(infallible, pub read8_relaxed, call_mmio_read(readb_relaxed) -> u8); 570 + io_define_read!(infallible, pub read16_relaxed, call_mmio_read(readw_relaxed) -> u16); 571 + io_define_read!(infallible, pub read32_relaxed, call_mmio_read(readl_relaxed) -> u32); 572 + io_define_read!( 620 573 infallible, 621 574 #[cfg(CONFIG_64BIT)] 622 575 pub read64_relaxed, 623 576 call_mmio_read(readq_relaxed) -> u64 624 577 ); 625 578 626 - define_read!(fallible, pub try_read8_relaxed, call_mmio_read(readb_relaxed) -> u8); 627 - define_read!(fallible, pub try_read16_relaxed, call_mmio_read(readw_relaxed) -> u16); 628 - define_read!(fallible, pub try_read32_relaxed, call_mmio_read(readl_relaxed) -> u32); 629 - define_read!( 579 + io_define_read!(fallible, pub try_read8_relaxed, call_mmio_read(readb_relaxed) -> u8); 580 + io_define_read!(fallible, pub try_read16_relaxed, call_mmio_read(readw_relaxed) -> u16); 581 + io_define_read!(fallible, pub try_read32_relaxed, call_mmio_read(readl_relaxed) -> u32); 582 + io_define_read!( 630 583 fallible, 631 584 #[cfg(CONFIG_64BIT)] 632 585 pub try_read64_relaxed, 633 586 call_mmio_read(readq_relaxed) -> u64 634 587 ); 635 588 636 - define_write!(infallible, pub write8_relaxed, call_mmio_write(writeb_relaxed) <- u8); 637 - define_write!(infallible, pub write16_relaxed, call_mmio_write(writew_relaxed) <- u16); 638 - define_write!(infallible, pub write32_relaxed, call_mmio_write(writel_relaxed) <- u32); 639 - define_write!( 589 + io_define_write!(infallible, pub write8_relaxed, call_mmio_write(writeb_relaxed) <- u8); 590 + io_define_write!(infallible, pub write16_relaxed, call_mmio_write(writew_relaxed) <- u16); 591 + io_define_write!(infallible, pub write32_relaxed, call_mmio_write(writel_relaxed) <- u32); 592 + io_define_write!( 640 593 infallible, 641 594 #[cfg(CONFIG_64BIT)] 642 595 pub write64_relaxed, 643 596 call_mmio_write(writeq_relaxed) <- u64 644 597 ); 645 598 646 - define_write!(fallible, pub try_write8_relaxed, call_mmio_write(writeb_relaxed) <- u8); 647 - define_write!(fallible, pub try_write16_relaxed, call_mmio_write(writew_relaxed) <- u16); 648 - define_write!(fallible, pub try_write32_relaxed, call_mmio_write(writel_relaxed) <- u32); 649 - define_write!( 599 + io_define_write!(fallible, pub try_write8_relaxed, call_mmio_write(writeb_relaxed) <- u8); 600 + io_define_write!(fallible, pub try_write16_relaxed, call_mmio_write(writew_relaxed) <- u16); 601 + io_define_write!(fallible, pub try_write32_relaxed, call_mmio_write(writel_relaxed) <- u32); 602 + io_define_write!( 650 603 fallible, 651 604 #[cfg(CONFIG_64BIT)] 652 605 pub try_write64_relaxed,
+12 -12
rust/kernel/pci/io.rs
··· 8 8 device, 9 9 devres::Devres, 10 10 io::{ 11 - define_read, 12 - define_write, 11 + io_define_read, 12 + io_define_write, 13 13 Io, 14 14 IoCapable, 15 15 IoKnownSize, ··· 88 88 /// Internal helper macros used to invoke C PCI configuration space read functions. 89 89 /// 90 90 /// This macro is intended to be used by higher-level PCI configuration space access macros 91 - /// (define_read) and provides a unified expansion for infallible vs. fallible read semantics. It 91 + /// (io_define_read) and provides a unified expansion for infallible vs. fallible read semantics. It 92 92 /// emits a direct call into the corresponding C helper and performs the required cast to the Rust 93 93 /// return type. 94 94 /// ··· 117 117 /// Internal helper macros used to invoke C PCI configuration space write functions. 118 118 /// 119 119 /// This macro is intended to be used by higher-level PCI configuration space access macros 120 - /// (define_write) and provides a unified expansion for infallible vs. fallible read semantics. It 121 - /// emits a direct call into the corresponding C helper and performs the required cast to the Rust 122 - /// return type. 120 + /// (io_define_write) and provides a unified expansion for infallible vs. fallible read semantics. 121 + /// It emits a direct call into the corresponding C helper and performs the required cast to the 122 + /// Rust return type. 123 123 /// 124 124 /// # Parameters 125 125 /// ··· 163 163 // PCI configuration space does not support fallible operations. 164 164 // The default implementations from the Io trait are not used. 165 165 166 - define_read!(infallible, read8, call_config_read(pci_read_config_byte) -> u8); 167 - define_read!(infallible, read16, call_config_read(pci_read_config_word) -> u16); 168 - define_read!(infallible, read32, call_config_read(pci_read_config_dword) -> u32); 166 + io_define_read!(infallible, read8, call_config_read(pci_read_config_byte) -> u8); 167 + io_define_read!(infallible, read16, call_config_read(pci_read_config_word) -> u16); 168 + io_define_read!(infallible, read32, call_config_read(pci_read_config_dword) -> u32); 169 169 170 - define_write!(infallible, write8, call_config_write(pci_write_config_byte) <- u8); 171 - define_write!(infallible, write16, call_config_write(pci_write_config_word) <- u16); 172 - define_write!(infallible, write32, call_config_write(pci_write_config_dword) <- u32); 170 + io_define_write!(infallible, write8, call_config_write(pci_write_config_byte) <- u8); 171 + io_define_write!(infallible, write16, call_config_write(pci_write_config_word) <- u16); 172 + io_define_write!(infallible, write32, call_config_write(pci_write_config_dword) <- u32); 173 173 } 174 174 175 175 impl<'a, S: ConfigSpaceKind> IoKnownSize for ConfigSpace<'a, S> {