From nobody Sat Jul 25 20:46:46 2026 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFC8A3D1CB0 for ; Mon, 13 Jul 2026 23:16:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783984571; cv=none; b=ZTaWO82hcIq/KR6v75LuhfIBaVvyN551cXgsLOBgLYDDaOGgeBfGOeYRh3E8ChRgQUskRddIHLz+kTw0UvNkofkhehYyxfieAGGmRpJ/SQHmhBy+nmU15JKIJxciwO5iJYj6kE0O2GxvSOqDb0xwEGPLjE3sJezc1i0yIkrCbCc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783984571; c=relaxed/simple; bh=xi4XLb5qBsbOyGboUbhPURXcEV7axu9PupvEt5dLKSg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=mAvcoG+rq64eL3zJPvwy+EH5sgAPK8l4HTvhErbbuGJAiy6SvXjoIx2biBHzzAa8c8T3YgXtxeDNkA1jEIqH5CBXM0QJyWgoO8C6l/vXtP9DdBo0BBf/DYMQtEp8wDq/T1jyK6U8Zocks1SRDfO7FGzYytTS+dwQGlbAwkwVmcA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nWgBV4qg; arc=none smtp.client-ip=209.85.214.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nWgBV4qg" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-2ce9e39fccbso3227865ad.1 for ; Mon, 13 Jul 2026 16:16:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783984567; x=1784589367; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=hW14DA5ad6cBBgJfRTqHvDQ+60aG/svK+L09SG/oC1w=; b=nWgBV4qgJM2RR2jIvToxutesvc0lOiJwNj8okjlgdZc52393iHteMriOqjLWBPA+kv GkwHmd39B5M8BRsXI7jCzXUlidK3XJYIAsIjdmV5OerIlUsj/Ah+csWpYjwHt2iagjkW PzEUMVBMNiDTx2aq1IZhWIIxVRN1W6NGI7ruhrITvXaGk4dPgFshEq5d/Cxg+CRmcUb6 s5ZcxVWHs4deKdBvV20L2Fsp0ONuBIdBMUtxXcyZs7QX7HX7k9bBJIv1xmK6aqdHHX6W KQIsjvvexi5Bj25Go005+HDxftmupNbb6YldUu251dckKebMnAVy1Ze1TFTFXPov50sy 2+Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783984567; x=1784589367; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=hW14DA5ad6cBBgJfRTqHvDQ+60aG/svK+L09SG/oC1w=; b=onjk1NkXeyokL0em3fPUSovyihGYBntCnH19eE7zKIebzeN+LNOaZciJgbjMOwrKsY OS09HNtxtquTk1Isp9hp6cIPkf9IQRDxVcVLGtwULoGv019HHmBue2oCiwNfoOsBQwLq po+JupjiJN+G2/goiU3cbBnCOcKVNexayG4/UPbF+eU2b8rKZH/czsLNY8TVhSINPY4a lbbeLBqdUEXznsnsnbYAAv8AMUlIBiAX94lQNZDEWLgsmtvC4zIWM2KJkl/PKoYgEFh/ oXfH8b9YbF0JXXRwvJIL5USItzw2riboqbYG6G9ue9UJwJIARE+Bb0NTo+V2n9yL97kn GI4Q== X-Forwarded-Encrypted: i=1; AHgh+Rq1jLWKH7dfZHdHo+kTVpuDgwVr/1F/+HbnBns8tIRB8V6dtiuvE6/P/zfS+yr/8L6Aprw9fEA6RT3T7NQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yw6df7GFfYbwZXFH/m9zn5I4dBGZCasRuhvUko7M/Ffy6kZuCdU o97FPEI5eb2NGJbyV6IG7pDBM1JkVj/QxsFN7GXy6Dae5gtYkQTvOfih X-Gm-Gg: AfdE7cl68joU6jBG3V7osK0vCi7DYzuOGAlS2iOt+XtnguSHmxB7RNwFY4n+Gs5d758 hGwtbhnAmhBIbXJ/OwJ0YUsN0rZu3+N0NMYn3h6Vu327UjOp6KGU1RfbW8WNXk9Sl61dZpONZ6t adu0F3/PZPCW/dJJwFrgpWR/EhLtX7m9L2TBWYIGz82AsvtUGM0SDFsjdJEPGe3sz8gKvz0lzOE pfGFxDpQRK7y2+FM4nGGKoFuNhTTOXsRZ+e6hjLZBbtLyrRUgfpfIgk8GMsY8chEVfbdASH+yUs 3vT8iZ17LCSBiO4mNhmUtH5HNPAIJgTualgN0aegCw06DYRhCQs5o+pKlVbARIWdvdAV6xohjgi 0WFVzj+gpor0SDrPChMwee4P46s/uyZozJm97dFB6I5x8unBpoOB1NpIOq9PwSeN1jT0bkwb8L3 EsRtbb6v0srxiZdkrUn7hbpq4//1G6ZK4/tzmxGUmHUFU1S4ifgntpZBT2q5jjX3w04g/VnhXF9 tIl23NznonUwyeo2oVZU/dSNPCXkWkpDW8c1qwBh6SXdhkZGGaBTxO8rvTVCe9sRSUmJ02690R7 X-Received: by 2002:a05:6a21:2d44:b0:39b:bc11:9ec5 with SMTP id adf61e73a8af0-3c0f093fbc7mr16423792637.13.1783984566492; Mon, 13 Jul 2026 16:16:06 -0700 (PDT) Received: from ryzen.lan ([2601:644:8000:7a86::e35]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-ca5b3162a49sm8888835a12.15.2026.07.13.16.16.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2026 16:16:05 -0700 (PDT) From: Rosen Penev To: linux-usb@vger.kernel.org Cc: Alan Stern , Greg Kroah-Hartman , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , linux-kernel@vger.kernel.org (open list), llvm@lists.linux.dev (open list:CLANG/LLVM BUILD SUPPORT:Keyword:\b(?i:clang|llvm)\b) Subject: [PATCH] usb: ohci-ppc-of: use platform for irq and ioremap Date: Mon, 13 Jul 2026 16:16:04 -0700 Message-ID: <20260713231604.1090044-1-rosenp@gmail.com> X-Mailer: git-send-email 2.55.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace the open-coded of_address_to_resource() plus devm_ioremap_resource() sequence with devm_platform_get_and_ioremap_resource(), which looks up the resource and maps it in one call. The helper returns a pointer to the resource, so update rsrc_start / rsrc_len to dereference it and assign the mapped address to hcd->regs. Use a separate on-stack resource (ehci_res) for the unrelated ibm,usb-ehci-440epx erratum lookup rather than aliasing the returned resource pointer. Switch IRQ acquisition from irq_of_parse_and_map() to platform_get_irq(), which only retrieves the interrupt the OF/platform core has already set up rather than transferring mapping ownership to the driver. Drop the now unneeded irq_dispose_mapping() calls (probe error path and ohci_hcd_ppc_of_remove()) and the now-unused of_irq.h include, keeping linux/of_address.h for the erratum block's of_address_to_resource(). Behaviorally equivalent with respect to region reservation: the prior code used devm_ioremap_resource(), which already reserved the region. Built for PowerPC (ppc44x_defconfig + CONFIG_USB_OHCI_HCD_PPC_OF) with LLVM=3D1; drivers/usb/host/ohci-hcd.o (which includes ohci-ppc-of.c) compiles cleanly. Assisted-by: opencode:hy3-free Signed-off-by: Rosen Penev --- drivers/usb/host/ohci-ppc-of.c | 44 +++++++++++++--------------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c index acd0a0e398a4..3a965b9c04fa 100644 --- a/drivers/usb/host/ohci-ppc-of.c +++ b/drivers/usb/host/ohci-ppc-of.c @@ -17,7 +17,6 @@ #include #include #include -#include #include =20 static int @@ -87,7 +86,9 @@ static int ohci_hcd_ppc_of_probe(struct platform_device *= op) struct device_node *dn =3D op->dev.of_node; struct usb_hcd *hcd; struct ohci_hcd *ohci; - struct resource res; + struct resource *res; + struct resource ehci_res; + void __iomem *regs; int irq; =20 int rv; @@ -103,30 +104,21 @@ static int ohci_hcd_ppc_of_probe(struct platform_devi= ce *op) =20 dev_dbg(&op->dev, "initializing PPC-OF USB Controller\n"); =20 - rv =3D of_address_to_resource(dn, 0, &res); - if (rv) - return rv; + regs =3D devm_platform_get_and_ioremap_resource(op, 0, &res); + if (IS_ERR(regs)) + return PTR_ERR(regs); + + irq =3D platform_get_irq(op, 0); + if (irq < 0) + return irq; =20 hcd =3D usb_create_hcd(&ohci_ppc_of_hc_driver, &op->dev, "PPC-OF USB"); if (!hcd) return -ENOMEM; =20 - hcd->rsrc_start =3D res.start; - hcd->rsrc_len =3D resource_size(&res); - - hcd->regs =3D devm_ioremap_resource(&op->dev, &res); - if (IS_ERR(hcd->regs)) { - rv =3D PTR_ERR(hcd->regs); - goto err_rmr; - } - - irq =3D irq_of_parse_and_map(dn, 0); - if (!irq) { - dev_err(&op->dev, "%s: irq_of_parse_and_map failed\n", - __FILE__); - rv =3D -EBUSY; - goto err_rmr; - } + hcd->rsrc_start =3D res->start; + hcd->rsrc_len =3D resource_size(res); + hcd->regs =3D regs; =20 ohci =3D hcd_to_ohci(hcd); if (is_bigendian) { @@ -158,20 +150,18 @@ static int ohci_hcd_ppc_of_probe(struct platform_devi= ce *op) * the ehci driver is loaded. */ if (np !=3D NULL) { - if (!of_address_to_resource(np, 0, &res)) { - if (!request_mem_region(res.start, 0x4, hcd_name)) { + if (!of_address_to_resource(np, 0, &ehci_res)) { + if (!request_mem_region(ehci_res.start, 0x4, hcd_name)) { writel_be((readl_be(&ohci->regs->control) | OHCI_USB_SUSPEND), &ohci->regs->control); (void) readl_be(&ohci->regs->control); } else - release_mem_region(res.start, 0x4); + release_mem_region(ehci_res.start, 0x4); } else pr_debug("%s: cannot get ehci offset from fdt\n", __FILE__); of_node_put(np); } =20 - irq_dispose_mapping(irq); -err_rmr: usb_put_hcd(hcd); =20 return rv; @@ -185,8 +175,6 @@ static void ohci_hcd_ppc_of_remove(struct platform_devi= ce *op) =20 usb_remove_hcd(hcd); =20 - irq_dispose_mapping(hcd->irq); - usb_put_hcd(hcd); } =20 --=20 2.55.0