Skip to content

Commit 602f661

Browse files
krzkdamien-lemoal
authored andcommitted
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>
1 parent 2dc8a32 commit 602f661

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

drivers/ata/ahci_dwc.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ static void ahci_dwc_init_timer(struct ahci_host_priv *hpriv)
260260
static int ahci_dwc_init_dmacr(struct ahci_host_priv *hpriv)
261261
{
262262
struct ahci_dwc_host_priv *dpriv = hpriv->plat_data;
263-
struct device_node *child;
264263
void __iomem *port_mmio;
265264
u32 port, dmacr, ts;
266265

@@ -271,14 +270,9 @@ static int ahci_dwc_init_dmacr(struct ahci_host_priv *hpriv)
271270
* the HBA global reset so we can freely initialize it once until the
272271
* next system reset.
273272
*/
274-
for_each_child_of_node(dpriv->pdev->dev.of_node, child) {
275-
if (!of_device_is_available(child))
276-
continue;
277-
278-
if (of_property_read_u32(child, "reg", &port)) {
279-
of_node_put(child);
273+
for_each_available_child_of_node_scoped(dpriv->pdev->dev.of_node, child) {
274+
if (of_property_read_u32(child, "reg", &port))
280275
return -EINVAL;
281-
}
282276

283277
port_mmio = __ahci_port_base(hpriv, port);
284278
dmacr = readl(port_mmio + AHCI_DWC_PORT_DMACR);

0 commit comments

Comments
 (0)