mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:24:47 +01:00
ata: ahci-dwc: Simplify with scoped for each OF child loop
Use scoped for-each loop when iterating over device nodes and switch to iterating already over available nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
This commit is contained in:
parent
2dc8a3295b
commit
602f661282
1 changed files with 2 additions and 8 deletions
|
|
@ -260,7 +260,6 @@ static void ahci_dwc_init_timer(struct ahci_host_priv *hpriv)
|
|||
static int ahci_dwc_init_dmacr(struct ahci_host_priv *hpriv)
|
||||
{
|
||||
struct ahci_dwc_host_priv *dpriv = hpriv->plat_data;
|
||||
struct device_node *child;
|
||||
void __iomem *port_mmio;
|
||||
u32 port, dmacr, ts;
|
||||
|
||||
|
|
@ -271,14 +270,9 @@ static int ahci_dwc_init_dmacr(struct ahci_host_priv *hpriv)
|
|||
* the HBA global reset so we can freely initialize it once until the
|
||||
* next system reset.
|
||||
*/
|
||||
for_each_child_of_node(dpriv->pdev->dev.of_node, child) {
|
||||
if (!of_device_is_available(child))
|
||||
continue;
|
||||
|
||||
if (of_property_read_u32(child, "reg", &port)) {
|
||||
of_node_put(child);
|
||||
for_each_available_child_of_node_scoped(dpriv->pdev->dev.of_node, child) {
|
||||
if (of_property_read_u32(child, "reg", &port))
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
port_mmio = __ahci_port_base(hpriv, port);
|
||||
dmacr = readl(port_mmio + AHCI_DWC_PORT_DMACR);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue