From nobody Sat Jul 25 20:46:46 2026 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 6E96835BDDB for ; Mon, 13 Jul 2026 23:13:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783984388; cv=none; b=l83bYuBaQsx5hJC95CDWJ4UYNGZHtPPEV8epmN9vx6Qnlo5Ohl9bx0FCynjMd3CXt4EQbj7/LX1tot6NZUeJKgeR2idUU7MsSdlfP9op+bAB39k2wJWVK0WUg6zP8s0Kvb4jkAyHMwSK28RJwfU7LnXHF7JCLcBQ6EkaUAPkBYU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783984388; c=relaxed/simple; bh=D+9DxGA9152fq3R64B5ifYMqljUSrXKhB8lJk19OIbk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=S/R3jKUYGKWY5iaxWrx1L/aOI5ktziDaQBklueGFYVFwSM3CCNv9Bwx5nLlGy56aqqbuazH0a0PEk3kIT2LwemveigAxs1CcPoy5pRfZo0be+FOCYVp5uEHTOi+eXxvvTg9V2tybKNlyn7MAx4lV7V16IdZLmzEDltbw1KT3tsw= 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=og4tZ1u6; arc=none smtp.client-ip=209.85.214.170 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="og4tZ1u6" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-2cedda2ce6fso8430655ad.1 for ; Mon, 13 Jul 2026 16:13:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783984385; x=1784589185; 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=u4frmzDud/t/Oc/bcsYFoHimfeTx60ofYbikyBifGLs=; b=og4tZ1u6Bt5gd9k/ZFZCNS4WYtPxf6PnClrg6/KkczbAl0qeMjT9nfGjYOzoDlBLoD vhGdgADvJ2jyrXj3Vg0bCe23ZbTOoxfR9IyLHxWZWifp1tjT/59CAKF1wh5GVRQNfNuU x572hiIIacBJrL+tPutPYowBUAyNtPOvGldMLCaBUe97lYcJvf0u6iV/OnBoB6sVUBio 6Q+YenJyyiFX4EPOHRK6lq9zUQNZ4ZueB13eJOdHGctqwWVAR8X3EIna3Up1ZLeS6Cq5 nisxmR+y8u58nzeOM51TXp+U+IOlE+fKZrHtIQjVnBxovS6vbOvb8+j089Ixr/4jsqQK xN6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783984385; x=1784589185; 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=u4frmzDud/t/Oc/bcsYFoHimfeTx60ofYbikyBifGLs=; b=HPQv6wx60B+82lW/GAp4jKbhr6vDR6HplOi8ECdWlQ5DLpjvwj0GHGWGHIFUTUl0ng lalCUGsfQFK77Z2pdMsGX3Cs0jszrArbuG1db/H4HL2dFh/OQAf8ekamAVFfLUlmPwED akmMP0zNCkR9Yfuc2F4WINuF6LAF/yHUpDz43LO/pDkEAoO9vYU5AkT3WijADI16XK8D 8o+h+25KxSzXbFa1U1qduSIKDk70OQqeVw3USNggsHBEenqPTRCy6tt4qx/pLJgEXS0W 2Eu4TuigX67T8iXUjPIx6p23Qa7kGGHoUJWchDfCdEKBTmvANzJaCNzyDFPlHNUMQT1a 9KSA== X-Forwarded-Encrypted: i=1; AHgh+RpjmK1mDVdT+omR3qj31b6GL2Ax2QFx20KduWzkCwVJBBAp0vmAiDHnN65/XIs1MXT1Wpd7RW+GkJaixfM=@vger.kernel.org X-Gm-Message-State: AOJu0YypIFCpfxj0T5syG+EpuI8zIKFiiTkfMjgxDrQL8IYXMVjv7SUk 2ynkGFEUjNAwDGdMw4nac+4G5CRhuEKxAgTJcrD3N2Emx7bRz9Ussks3idLw/w== X-Gm-Gg: AfdE7clP2a4V9qawzslNnPkQELyffsQfamcgdbTOMuau1o9ZRYH7tvBPjlMJBaBAKZY 6Etg+fuQZZFMOA0G6ZmSnRvoefmgDVswVWccu/Z2A6xROXIjJ2UmzAEB67Xo6MAwu7MDqKZePbw 7Wsg/+rxi7Po2vEXqKPiF5h6iXPBj4MLidcEgvF19vwXnZ9rVpLGp5Zr/2Or2KRShRwzrRkGQze BLf0lUpbCVlMfO/wfXt3AhRv0mH5xomky8DvMGlK446vj4k2jGS4tAPpLnp8g/iHMiSau7CbpNw 1rDMLvxxeRuhgzsn+RhE07gv0OIKqfPjDSHHKIA7oVJLYU4yHY4CZY8NS/paQ8gyeHBfnJUAazw 5VKRhcyt5GuGjb49rrny+14OZJ9xECjMFOi5TK95kpTswWedGmeUS7ZH9qeE7aFnQBfOd2RHp2k 5J6dC/kXxjqOR8W1E5rU8x4QzRk7evVtiMFB4GpKNesfV/M58lgn9SI5yFOlBMDq4NQ/aMVdv7L f+sA0mGjZcgneDBkqAOxVy6ie2decFOkLfFHEw9O6jPzJICchxhFRfDkHiL882Kng== X-Received: by 2002:a17:902:d98b:b0:2ca:75b1:e1e5 with SMTP id d9443c01a7336-2ce9e79f444mr103871895ad.4.1783984384697; Mon, 13 Jul 2026 16:13:04 -0700 (PDT) Received: from ryzen.lan ([2601:644:8000:7a86::e35]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ccc9bdb73asm106234995ad.17.2026.07.13.16.13.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2026 16:13:04 -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: ehci-ppc-of: use platform for irq and ioremap Date: Mon, 13 Jul 2026 16:13:02 -0700 Message-ID: <20260713231302.1076740-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, assign the mapped address to hcd->regs, and use a separate on-stack resource (ohci_res) for the unrelated ibm,usb-ohci-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 ehci_hcd_ppc_of_remove()) and the now-unused of_irq.h and of_platform.h includes, 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_EHCI_HCD_PPC_OF) with LLVM=3D1; drivers/usb/host/ehci-hcd.o (which includes ehci-ppc-of.c) compiles cleanly. Assisted-by: opencode:hy3-free Signed-off-by: Rosen Penev --- drivers/usb/host/ehci-ppc-of.c | 47 ++++++++++++---------------------- 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c index 8063b9d3aebd..457d15da40a3 100644 --- a/drivers/usb/host/ehci-ppc-of.c +++ b/drivers/usb/host/ehci-ppc-of.c @@ -18,8 +18,6 @@ =20 #include #include -#include -#include =20 =20 static const struct hc_driver ehci_ppc_of_hc_driver =3D { @@ -96,7 +94,9 @@ static int ehci_hcd_ppc_of_probe(struct platform_device *= op) struct device_node *dn =3D op->dev.of_node; struct usb_hcd *hcd; struct ehci_hcd *ehci =3D NULL; - struct resource res; + struct resource *res; + struct resource ohci_res; + void __iomem *regs; int irq; int rv; =20 @@ -107,39 +107,30 @@ static int ehci_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(&ehci_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); - - 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_irq; - } - - hcd->regs =3D devm_ioremap_resource(&op->dev, &res); - if (IS_ERR(hcd->regs)) { - rv =3D PTR_ERR(hcd->regs); - goto err_ioremap; - } + hcd->regs =3D regs; + hcd->rsrc_start =3D res->start; + hcd->rsrc_len =3D resource_size(res); =20 ehci =3D hcd_to_ehci(hcd); np =3D of_find_compatible_node(NULL, NULL, "ibm,usb-ohci-440epx"); if (np !=3D NULL) { /* claim we really affected by usb23 erratum */ - if (!of_address_to_resource(np, 0, &res)) + if (!of_address_to_resource(np, 0, &ohci_res)) ehci->ohci_hcctrl_reg =3D devm_ioremap(&op->dev, - res.start + OHCI_HCCTRL_OFFSET, + ohci_res.start + OHCI_HCCTRL_OFFSET, OHCI_HCCTRL_LEN); else pr_debug("%s: no ohci offset in fdt\n", __FILE__); @@ -170,14 +161,12 @@ static int ehci_hcd_ppc_of_probe(struct platform_devi= ce *op) =20 rv =3D usb_add_hcd(hcd, irq, 0); if (rv) - goto err_ioremap; + goto err; =20 device_wakeup_enable(hcd->self.controller); return 0; =20 -err_ioremap: - irq_dispose_mapping(irq); -err_irq: +err: usb_put_hcd(hcd); =20 return rv; @@ -196,8 +185,6 @@ static void ehci_hcd_ppc_of_remove(struct platform_devi= ce *op) =20 usb_remove_hcd(hcd); =20 - irq_dispose_mapping(hcd->irq); - /* use request_mem_region to test if the ohci driver is loaded. if so * ensure the ohci core is operational. */ --=20 2.55.0