From patchwork Sat Sep 7 18:45:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13795252 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (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 76BDC487BE; Sat, 7 Sep 2024 18:45:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725734734; cv=none; b=IN2XUSThryofGzZF40ENMHhk6hcmnvGBKZCfs0Q2JRtVna49YIcejhgGoNWU0yx4TbJOrX6mC+3yoz9nuOBLBkW29JCXiYPBpifnUSkuPd770vvYUze95fM717Ns26ecrTNetddOYsfCPk0sc9YcfhG+JHMa3Hqs0rnFJp9HPdI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725734734; c=relaxed/simple; bh=NpicaXjwQ3bJcupzJPtWR9SgNZKmAM3O5dl2leD4RIU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BaftehLHpjcUj8gcAByCI+V+khmOhbgspVinWwpDX/wg2mTx70eCidX8NDr0khLhC9lVBa/NRHP8V1YxygD6PqAtHiRiDZtUTHxmCu9udWturs5IAdfBLI1lJMKmh5ff2o/aSyXPGRi/vY6wMEpCcC7q3xxZeVCeSFBB/Z93dQ0= 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=VKIM2kd1; arc=none smtp.client-ip=209.85.215.172 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="VKIM2kd1" Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-7c3ebba7fbbso2442240a12.1; Sat, 07 Sep 2024 11:45:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725734732; x=1726339532; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FAnImw9Lf58T/UbRYblLAUkOSX/RhrkDeQTKjn5t55s=; b=VKIM2kd1DvMRng8/bDm7WBrq2pBYTcfjVYgr5drLGXPDhvVN+3ojVf0/0d4jBG/O3Z ZRNK3JH9c7msze66yI8zmDkFdF0IrPggF58SoHgmrNJvAd3TOr+k81bAqgGsC/4Mqp61 jSv0DaX0TwlqxicXohdeR3lJRWxTKVIPcVR1rUWenlgrk3ayvOjH8AduqBLEdmCYXv4j eVHb9IRUurpAbP040CSJV2MrVR14nb0p21f40AgYftp2JfdzoudyAyYxCDfoqK4QJdc8 ghvteyl5o4weEF4Fjn0KiGWwRDNJw8isTMbAHx+VS+2YOrAGrdOBmcV4pRb6rSB0t1SJ flDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725734732; x=1726339532; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FAnImw9Lf58T/UbRYblLAUkOSX/RhrkDeQTKjn5t55s=; b=DUgSY6Y/LVgNbR470ZbSVoMbH0DrYpP9OOJzNNEXJXT0V/dQdVcuyqEbLgbDPh5D3J VufNPKhBzscmDWg2nXgDGFD2zXBJlEvCxDgtvzfQT4ouM8NUj6BBUUyFoUSfC9s10nEL zSE2U2PuHbsKRE/nTchJDqGsyUZm6+V6iVLcDXcA6DOrQo8hxdm4e3ltQs+BsSFbYrCn BtmWWbb3F77FszaB+wIq17pCe23l4lcw5Jk2/yiWpQhGNiOPP95bn9IUaXGzU3NgBxWF MG0rEe11LgWRdP5oNN7ZThYKFzK4/kH3yBD/ePrKfNSpA0cP9v56BtwtwqsrbMMTLmcr Cw2A== X-Forwarded-Encrypted: i=1; AJvYcCXKdoc7qdiV2L98JYCwCHQbwXncI6XBBqLi0t4Ze/ZxnslVjmCXZAPHKNGEJ1MI66ryViAjGf+3EQC2Z+4=@vger.kernel.org X-Gm-Message-State: AOJu0Yye6QbuGxRPiWjKWxAB9wNo5ir+445EeU/wozvHrN6OP4K9K35p ZaySVh8KzbdDuO8jf53QEykx0CV0pLn3WIpIQW2mv9H37GHlNE3/1OskzuI8 X-Google-Smtp-Source: AGHT+IHEDA6/zM9y8LcDw/UiUY1hpW8c4bmYXM1K/nUhVhakoGzwR+yQWMhuXBpye5bjbRlvSHmFmQ== X-Received: by 2002:a05:6a21:3a4a:b0:1cf:288f:96de with SMTP id adf61e73a8af0-1cf288f97admr6878541637.14.1725734732546; Sat, 07 Sep 2024 11:45:32 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d825ab18bfsm1111239a12.88.2024.09.07.11.45.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Sep 2024 11:45:32 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCHv4 net-next 1/8] net: ibm: emac: manage emac_irq with devm Date: Sat, 7 Sep 2024 11:45:21 -0700 Message-ID: <20240907184528.8399-2-rosenp@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240907184528.8399-1-rosenp@gmail.com> References: <20240907184528.8399-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org It's the last to go in remove. Safe to let devm handle it. Also move request_irq to probe for clarity. It's removed in _remove not close. Use dev_err_probe instead of printk. Handles EPROBE_DEFER automatically. Signed-off-by: Rosen Penev Reviewed-by: Andrew Lunn --- drivers/net/ethernet/ibm/emac/core.c | 29 +++++++++++----------------- 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index 348702f462bd..895949eee0b0 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -1228,18 +1228,10 @@ static void emac_print_link_status(struct emac_instance *dev) static int emac_open(struct net_device *ndev) { struct emac_instance *dev = netdev_priv(ndev); - int err, i; + int i; DBG(dev, "open" NL); - /* Setup error IRQ handler */ - err = request_irq(dev->emac_irq, emac_irq, 0, "EMAC", dev); - if (err) { - printk(KERN_ERR "%s: failed to request IRQ %d\n", - ndev->name, dev->emac_irq); - return err; - } - /* Allocate RX ring */ for (i = 0; i < NUM_RX_BUFF; ++i) if (emac_alloc_rx_skb(dev, i)) { @@ -1293,8 +1285,6 @@ static int emac_open(struct net_device *ndev) return 0; oom: emac_clean_rx_ring(dev); - free_irq(dev->emac_irq, dev); - return -ENOMEM; } @@ -1408,8 +1398,6 @@ static int emac_close(struct net_device *ndev) emac_clean_tx_ring(dev); emac_clean_rx_ring(dev); - free_irq(dev->emac_irq, dev); - netif_carrier_off(ndev); return 0; @@ -3082,6 +3070,16 @@ static int emac_probe(struct platform_device *ofdev) err = -ENODEV; goto err_gone; } + + /* Setup error IRQ handler */ + err = devm_request_irq(&ofdev->dev, dev->emac_irq, emac_irq, 0, "EMAC", + dev); + if (err) { + dev_err_probe(&ofdev->dev, err, "failed to request IRQ %d", + dev->emac_irq); + goto err_gone; + } + ndev->irq = dev->emac_irq; /* Map EMAC regs */ @@ -3237,8 +3235,6 @@ static int emac_probe(struct platform_device *ofdev) err_irq_unmap: if (dev->wol_irq) irq_dispose_mapping(dev->wol_irq); - if (dev->emac_irq) - irq_dispose_mapping(dev->emac_irq); err_gone: /* if we were on the bootlist, remove us as we won't show up and * wake up all waiters to notify them in case they were waiting @@ -3284,9 +3280,6 @@ static void emac_remove(struct platform_device *ofdev) if (dev->wol_irq) irq_dispose_mapping(dev->wol_irq); - if (dev->emac_irq) - irq_dispose_mapping(dev->emac_irq); - } /* XXX Features in here should be replaced by properties... */ From patchwork Sat Sep 7 18:45:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13795253 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (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 C69A91662EC; Sat, 7 Sep 2024 18:45:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725734736; cv=none; b=hZKacyeHeelWmrYSYcEthJN1wRpXNU8O8kM1BwSejwTsROrNDEEC1CGoYDWkMJWHq0IVrft9Afpiw72tnqC8rImukkkRihUtfbh6WJIO5wkzaeAZm4DsV4ELNOe9CpIGt6Kfk2UFY45lQl3dHWutZhXWWdHVcMR1lK+DP9xjeBY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725734736; c=relaxed/simple; bh=6UHB6oUMvL1d+ctYRTVBIucLnABeJIO/OQSm3S9Ymec=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gm1Ad+mDneBmNQLYPgWXdlYOQr8n6xSLmxUJblQgxx5YDjtgfjYO7WjLTmjfDCPLmOLSStW3LIOruXznWGAnyo0Wzt66qO5uEVLiOsiX3mb/AsrrC2efUoVhKb5k17d/jB/C9WDXrAj8tOir/YW4AX2lNQsEIBCGgCIfvLVSyN4= 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=HjH1YzYm; arc=none smtp.client-ip=209.85.210.181 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="HjH1YzYm" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-718e482930bso363294b3a.2; Sat, 07 Sep 2024 11:45:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725734734; x=1726339534; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=caFpZnX0D2laxG9sbBS2ux7cswRR1JlGkryvwZOpG1s=; b=HjH1YzYmr+SAAZTnTeW/KC2u5cLGK9vae/i+ZxEJXmUXSa+diCG0iLQ+YKehrZdkPT 1TlvejMyW6UkP/FxrO4rFTbB5rVA59H/QKGjEuH470lZXpWEtN7/6TU4U9XxB9blxMAm Wu0NeYRjR8y2JuBeD4MzwwxgdpgRFaNL0iy/u6oQroOhjcjj9bnO3W5mEaBRfz1JDdmy ieikohLWksrtm4OmuZ+i74sHXacWN8FtOQdURnLiMKxb+NriotWxCKt3cUcvkG8vOmVh 0Qmq8/ZFY2mq5bd/qof58bj/4jZmTzbVAGPpLweTMTveXXLaMkaTpMdZxsxva3nBuB8n 9mNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725734734; x=1726339534; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=caFpZnX0D2laxG9sbBS2ux7cswRR1JlGkryvwZOpG1s=; b=HWQJagRwzSgRMHVjhlh18GVULPTuh0u+NVGx8YYpKEYO4B+hthSW1orL9Fxs9bL7i3 Iw7+T/1JJoMg6YZ+6S5ojs0Cep0FQncrhqa2zwF+bjM4XnaKfmubWrQUy/F75d7h55d1 t9qxEqHcVNTI/jOwN7mdv2HJfkvpf4fc/qfINWMgDjjGNlSGybtcgrRA/7RSCQDDrPc7 4n5D16H3oMQLd4N9SjALWyHPIYD/Cf4ROztiMC8M198Rbe99Gaia4IrFXArn2fBpOdU1 iCymz/ZosiHXAsYjzwenLQpSbCChK+mOJF64K3cih2GXScJHJ7VVMftvlK9YnTYySR8M t/gA== X-Forwarded-Encrypted: i=1; AJvYcCWBO2M8pELgCQMY7tJuzbkVhd3JeGkktllJ9B+a8rm2ObCmlYmE0V4Rk2uagO87N+DxlvoYIHgLkNoshbE=@vger.kernel.org X-Gm-Message-State: AOJu0Yxhte49mlStG6OcjYwRHdVFCUarC9jMum9lmm49VBv0xJDaqFVm K6iszYHNHgng9w2f9SbBeu2aoJCdjSpqWmtf6CZOXBt5nQrdjglveiROhKBP X-Google-Smtp-Source: AGHT+IFogc9X5fEtz1AHjsDPBJ7GZUVRzli3sxR7SoXTiWu5ae1V41i/NgRWJ7atX8jVMg6zrDWJ6Q== X-Received: by 2002:a05:6a00:b42:b0:718:9625:cca0 with SMTP id d2e1a72fcca58-718d5e16521mr9117985b3a.7.1725734733855; Sat, 07 Sep 2024 11:45:33 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d825ab18bfsm1111239a12.88.2024.09.07.11.45.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Sep 2024 11:45:33 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCHv4 net-next 2/8] net: ibm: emac: use devm for of_iomap Date: Sat, 7 Sep 2024 11:45:22 -0700 Message-ID: <20240907184528.8399-3-rosenp@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240907184528.8399-1-rosenp@gmail.com> References: <20240907184528.8399-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Allows removing manual iounmap. Signed-off-by: Rosen Penev Reviewed-by: Andrew Lunn --- drivers/net/ethernet/ibm/emac/core.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index 895949eee0b0..e06fcd920f9f 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -3084,9 +3084,9 @@ static int emac_probe(struct platform_device *ofdev) /* Map EMAC regs */ // TODO : platform_get_resource() and devm_ioremap_resource() - dev->emacp = of_iomap(np, 0); - if (dev->emacp == NULL) { - printk(KERN_ERR "%pOF: Can't map device registers!\n", np); + dev->emacp = devm_of_iomap(&ofdev->dev, np, 0, NULL); + if (!dev->emacp) { + dev_err(&ofdev->dev, "can't map device registers"); err = -ENOMEM; goto err_irq_unmap; } @@ -3097,7 +3097,7 @@ static int emac_probe(struct platform_device *ofdev) printk(KERN_ERR "%pOF: Timeout waiting for dependent devices\n", np); /* display more info about what's missing ? */ - goto err_reg_unmap; + goto err_irq_unmap; } dev->mal = platform_get_drvdata(dev->mal_dev); if (dev->mdio_dev != NULL) @@ -3230,8 +3230,6 @@ static int emac_probe(struct platform_device *ofdev) mal_unregister_commac(dev->mal, &dev->commac); err_rel_deps: emac_put_deps(dev); - err_reg_unmap: - iounmap(dev->emacp); err_irq_unmap: if (dev->wol_irq) irq_dispose_mapping(dev->wol_irq); @@ -3276,8 +3274,6 @@ static void emac_remove(struct platform_device *ofdev) mal_unregister_commac(dev->mal, &dev->commac); emac_put_deps(dev); - iounmap(dev->emacp); - if (dev->wol_irq) irq_dispose_mapping(dev->wol_irq); } From patchwork Sat Sep 7 18:45:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13795254 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (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 BD5FC166F36; Sat, 7 Sep 2024 18:45:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725734738; cv=none; b=kzYRdeepR0rWZozVQD2GIMkj/YNQ5fpITKRWlvtueJTQCj2DkAoczG2gzSIMT0H13KHilGBRvtOUtzXjGV4x64YPMOtLJx40QwsIkAKgV1HpBFMlcAm+xm1MA4dqoVCAIhaZX708F6+4gLOBNfz4rd1vRggxlTD/VWqnV4IwT8I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725734738; c=relaxed/simple; bh=J4i+pjvGEr9w8cX9+k5ZAXVoDvumeDRQwkT79rNhoqE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tMq2yXp6wT+g8xY2X8WRCCwwyzBzzos28oY9fVHgT3+0ehL3i0DYxhxzTmrIS6zgSEUexFARD6vp/xZqrhoD7lnLx0RGcoA1UuAIerHtImTy0Azn+ryPsKmZxbWtPgZJbKbfcp9Sif8KdHwJKy+IFqRynC94ZxNKu1CMVxqxQR4= 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=Sypccghm; arc=none smtp.client-ip=209.85.210.171 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="Sypccghm" Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-717911ef035so2410841b3a.3; Sat, 07 Sep 2024 11:45:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725734736; x=1726339536; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CkXxmfOMUnZVegO/6gjb+zCqyFgjDsLsBXpnAHvj2v4=; b=Sypccghm39ZH1kLyz6PseI69CRhBbBnA5i6A/m2wBO5cYVcK/OTjK0BRcsbQEpnh0s 6B0h5nZWNPYqLa/xuJtzS/8Djq/cLuPIl17Su6IaAUeVzRkap9X4WlYApMIEAzg8t5Rc LCGwAZqb+8uxCkTc3l0QmFpST9ADL8ilDOTRaUnABlysXYcgHEy6xMe2DovUbQy5QOSa IV17uEgyjEkVFUOjFbEuoTfuRJaOfUqRhcCuG6xs080h5yp1DhBKNYiKgQ3jiU6h6pBv Bd6cWWsW/DUIa70srkHr3jPzpqHfxlNUS4ehca/vbdh/zqIr+Z7IFRGjB1jIG5fqjo7h /61w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725734736; x=1726339536; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CkXxmfOMUnZVegO/6gjb+zCqyFgjDsLsBXpnAHvj2v4=; b=hd8wnwFP4AtdeBvvPztAV2GemlUOlJsVUhSDf2OEdzQnIG2yRCSqa1V3aCuiixaSGt cq3skd4nvOJjG1OKcTPTjvuvBSUNh/bl9YdFV/pYUQUy7I8hsAS+VjBIFTk0jyxrCQ+w kqLphDb9sk1oPxWiGJYdEs1FyizXFIkBnZBfvos3cj9KtZIRfv3ICvS00SlKAOdsamKx dfCqu4qI4icWgjvI/Nx2Ut6Hx7+DkikZB0GjnxWQhTuz5PzIQJaCf+sJG8QLqJHi9oBR cpyuHnSBcZc63sPyTn4ti0iv0W/Ef6Aap1Stiv+rujIk5dhRB6ZQmfunGATDnOWQBXPO DKGg== X-Forwarded-Encrypted: i=1; AJvYcCVCpIXZGrR2omrYO0P+Ab8KBKbTbloqZqWydehyKjjzB/ZDmGSEpTcSHfrG4sg1SPUs40sBEAv+8W+yi1U=@vger.kernel.org X-Gm-Message-State: AOJu0YxiDF7pfio4liKWMMLloLoKtV96ZzuNWNLx8IjoAhVzd8bYqler exLBa/uJ7Ma6en0oU+bD6G2K2qN2/4A+1cTRHycXkM0hXJcEhRK0XieolKgu X-Google-Smtp-Source: AGHT+IGhbBNFIKylt6fouwp7Q6G6AOkMz2VO1qsgeFpFg3caBTu7MZ9J8Ebhhcaq7kpARbaQ5ZDdZA== X-Received: by 2002:a05:6a00:1746:b0:70e:8e3a:10ee with SMTP id d2e1a72fcca58-718d5ee0415mr7089536b3a.21.1725734735946; Sat, 07 Sep 2024 11:45:35 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d825ab18bfsm1111239a12.88.2024.09.07.11.45.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Sep 2024 11:45:35 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCHv4 net-next 3/8] net: ibm: emac: remove mii_bus with devm Date: Sat, 7 Sep 2024 11:45:23 -0700 Message-ID: <20240907184528.8399-4-rosenp@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240907184528.8399-1-rosenp@gmail.com> References: <20240907184528.8399-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Switching to devm management of mii_bus allows to remove mdiobus_unregister calls and thus avoids needing a mii_bus global struct member. Signed-off-by: Rosen Penev Reviewed-by: Andrew Lunn --- drivers/net/ethernet/ibm/emac/core.c | 32 +++++++++++----------------- drivers/net/ethernet/ibm/emac/core.h | 1 - 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index e06fcd920f9f..837715b52397 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -2581,6 +2581,7 @@ static const struct mii_phy_ops emac_dt_mdio_phy_ops = { static int emac_dt_mdio_probe(struct emac_instance *dev) { struct device_node *mii_np; + struct mii_bus *bus; int res; mii_np = of_get_child_by_name(dev->ofdev->dev.of_node, "mdio"); @@ -2594,23 +2595,23 @@ static int emac_dt_mdio_probe(struct emac_instance *dev) goto put_node; } - dev->mii_bus = devm_mdiobus_alloc(&dev->ofdev->dev); - if (!dev->mii_bus) { + bus = devm_mdiobus_alloc(&dev->ofdev->dev); + if (!bus) { res = -ENOMEM; goto put_node; } - dev->mii_bus->priv = dev->ndev; - dev->mii_bus->parent = dev->ndev->dev.parent; - dev->mii_bus->name = "emac_mdio"; - dev->mii_bus->read = &emac_mii_bus_read; - dev->mii_bus->write = &emac_mii_bus_write; - dev->mii_bus->reset = &emac_mii_bus_reset; - snprintf(dev->mii_bus->id, MII_BUS_ID_SIZE, "%s", dev->ofdev->name); - res = of_mdiobus_register(dev->mii_bus, mii_np); + bus->priv = dev->ndev; + bus->parent = dev->ndev->dev.parent; + bus->name = "emac_mdio"; + bus->read = &emac_mii_bus_read; + bus->write = &emac_mii_bus_write; + bus->reset = &emac_mii_bus_reset; + snprintf(bus->id, MII_BUS_ID_SIZE, "%s", dev->ofdev->name); + res = devm_of_mdiobus_register(&dev->ofdev->dev, bus, mii_np); if (res) { dev_err(&dev->ofdev->dev, "cannot register MDIO bus %s (%d)", - dev->mii_bus->name, res); + bus->name, res); } put_node: @@ -2656,8 +2657,6 @@ static int emac_dt_phy_probe(struct emac_instance *dev) res = emac_dt_mdio_probe(dev); if (!res) { res = emac_dt_phy_connect(dev, phy_handle); - if (res) - mdiobus_unregister(dev->mii_bus); } } @@ -2697,10 +2696,8 @@ static int emac_init_phy(struct emac_instance *dev) res = of_phy_register_fixed_link(np); dev->phy_dev = of_phy_find_device(np); - if (res || !dev->phy_dev) { - mdiobus_unregister(dev->mii_bus); + if (res || !dev->phy_dev) return res ? res : -EINVAL; - } emac_adjust_link(dev->ndev); put_device(&dev->phy_dev->mdio.dev); } @@ -3265,9 +3262,6 @@ static void emac_remove(struct platform_device *ofdev) if (dev->phy_dev) phy_disconnect(dev->phy_dev); - if (dev->mii_bus) - mdiobus_unregister(dev->mii_bus); - busy_phy_map &= ~(1 << dev->phy.address); DBG(dev, "busy_phy_map now %#x" NL, busy_phy_map); diff --git a/drivers/net/ethernet/ibm/emac/core.h b/drivers/net/ethernet/ibm/emac/core.h index 295516b07662..f4bd4cd8ac4a 100644 --- a/drivers/net/ethernet/ibm/emac/core.h +++ b/drivers/net/ethernet/ibm/emac/core.h @@ -189,7 +189,6 @@ struct emac_instance { struct mutex mdio_lock; /* Device-tree based phy configuration */ - struct mii_bus *mii_bus; struct phy_device *phy_dev; /* ZMII infos if any */ From patchwork Sat Sep 7 18:45:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13795255 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (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 D57B9169382; Sat, 7 Sep 2024 18:45:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725734740; cv=none; b=RaDoHGOnulFgbrfXnaVzrQ3140rMdBlAS7nw4zC1Z3zvFphU0fiPBaYQKonSNjKsmkBNiciUfagrGfrqURnp1zkorMj/GomGwZ/qkxUwiVuvNIZ35o+xj6o4subzQ9Id7wHa5j5+NbL/ZYR7Fpv5FElpjJD7PbTLaQhqvNt33ro= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725734740; c=relaxed/simple; bh=UvtVEuLBQwmv16XE+MB2Js1YX95Iw7IOG6LozzpCT+0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mL3ZqHB+6Du+mbP67kUEtnkLZ//fV3Xyqv26MAwBP259KzhrWK9bbanrk180xZRNypm5oEMKf+JdeTR+3LbpwY/LRCnQWPawUAT8gspGahfrRnN7aHJlPr+8jIjgATu0K7AaNhFoakhoDU8/UdbXjgn/NuPcs39GGVkb3aceCoI= 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=WuDoPtqJ; arc=none smtp.client-ip=209.85.210.175 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="WuDoPtqJ" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-717986530ddso2235314b3a.0; Sat, 07 Sep 2024 11:45:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725734738; x=1726339538; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c1VJ/+Zaju1wdDlEMMU2TDwJdzZROyp6uBJLxjIR3Cw=; b=WuDoPtqJR5Xal1e8RfJL+gOQpMH++hnDud3Bs7C0SJw/S3MXerR9CecFDoT5fl6JLt aWEqpyt7JacxvzkXw0jFgfCdDvCL17GyDK4p2SQh0h0Ii0X6oOXURhI7MPIlCb5AOEh+ 5n4NpTwejkp143mzaguJHDB0uwvKoPm8QzKH8EdseL0GtZnQ0oax+SYzqgVxWnzvuVje xFQ3JZ1/20YlKVRzQPnVS1TlXAtkfO7MuI6TyrYGz8dXavSz9kFsZqm/4EIpvCoY/xbe IuIX9TNdhJmC3AMsb13Q5e6N+C7wIvcJ5uYe2j+B6A6ApqJcX9aJPSk1q2b4ad0Aw4i9 m69g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725734738; x=1726339538; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c1VJ/+Zaju1wdDlEMMU2TDwJdzZROyp6uBJLxjIR3Cw=; b=LmM/yIRjA4Wg9Nphf3DB0ZRzn2CCUiU+JMZE7KbGWrndbMyX6CtTgOnvjKjYzMq5kN /A85xT+HtTgqOMZDTHs9jBIGBZHvCq4vtNIqDz6DwVkCv4ta/qUPFV108bQu4NTXy3SG U3DXaCwl7n30Bv2TcrbdJvWzXw77L8et8C6KhVczWu89+ErvXig1qLpYmsVJaf4PnA0H O5lCNh+VT3gpOBlQRXxxHX8KRPO/nkOAd1SaQWSdS2Rk1Yq/mTh3Yq6x8h8szwgmOd62 7rkwS0zExwsD0jJg0kx+liwzkBOKfi/xEiwUqNuzxWFfOd4XEDzW4kzDHnpV7nD4KvGg gZlw== X-Forwarded-Encrypted: i=1; AJvYcCVLQhZaO9Zub+3ssYIjBlHsO4A1Fpmjra2WtmKOECYOAmtvpD267LM8w1BJz6t5y7Esep4qV6u/ygqT9mU=@vger.kernel.org X-Gm-Message-State: AOJu0YySWJO5ZAD+kuFtc6AIBFU+xX0Qh8v06mOufDOJs3d0pseV72WU vbPcOkG1SBK9HBNkL7KOnQiDDoByZdNL5kUY4AifDYevfbaCLP8Z8+Rb/FZE X-Google-Smtp-Source: AGHT+IG16Bb6m4BtsZQWltt5M1ARtLjOV2vjQRnSOhbHGPhTj2P1vAN+lATdA/G7837hdc78HoC1jw== X-Received: by 2002:a05:6a00:21cb:b0:717:8aaf:43be with SMTP id d2e1a72fcca58-718e3108dcamr4859759b3a.0.1725734737947; Sat, 07 Sep 2024 11:45:37 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d825ab18bfsm1111239a12.88.2024.09.07.11.45.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Sep 2024 11:45:37 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCHv4 net-next 4/8] net: ibm: emac: use devm for register_netdev Date: Sat, 7 Sep 2024 11:45:24 -0700 Message-ID: <20240907184528.8399-5-rosenp@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240907184528.8399-1-rosenp@gmail.com> References: <20240907184528.8399-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Cleans it up automatically. No need to handle manually. Signed-off-by: Rosen Penev Reviewed-by: Andrew Lunn --- drivers/net/ethernet/ibm/emac/core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index 837715b52397..71809450b3f3 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -3182,7 +3182,7 @@ static int emac_probe(struct platform_device *ofdev) netif_carrier_off(ndev); - err = register_netdev(ndev); + err = devm_register_netdev(&ofdev->dev, ndev); if (err) { printk(KERN_ERR "%pOF: failed to register net device (%d)!\n", np, err); @@ -3248,8 +3248,6 @@ static void emac_remove(struct platform_device *ofdev) DBG(dev, "remove" NL); - unregister_netdev(dev->ndev); - cancel_work_sync(&dev->reset_work); if (emac_has_feature(dev, EMAC_FTR_HAS_TAH)) From patchwork Sat Sep 7 18:45:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13795256 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (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 0B9BC16B396; Sat, 7 Sep 2024 18:45:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725734742; cv=none; b=pguXusov1tPwCtcGmB5qL7NxcQjgQIBku0qzaAMtUxXBMrzeZBRUSvVRWOlXZAgW+cFe2t0KNQ1EUiB7dOWDkEGZTfVouZWbDN4xRG38QTgRFcgzD9KArUGvNoJLyKdgwv86WD2p5qGcXCGuPrILXp3zy9HsnU4RDMqTJHtb/8I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725734742; c=relaxed/simple; bh=H8SN0p6mNaKXZJ+XbcZbSggjtY2meUxNNeSWEiCPrP4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mY/NtHmVKhsDOt3cYQj9nJQw9x5OoD+u5OXf4TLe9M2eAcAW+cX8+U6HMAY9cpcVYF/NVk06LDP5aOb7v3Jb9S35/WVFJvpGJfvAtDbOqkvd3ta/NHR5lBqGBim4idLka2r0aY6JLQAS31Whi2HHdNQ5cR+KXiV4t2KgRjrtlc4= 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=inPcbIic; arc=none smtp.client-ip=209.85.210.173 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="inPcbIic" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-718e56d7469so399655b3a.0; Sat, 07 Sep 2024 11:45:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725734740; x=1726339540; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bqrZ86leH6CKDA18mB55EYOs04WJksmldMF1y9Gg60g=; b=inPcbIicyhFoZbc80QfRE6WlrNm2z1CEIGo5aFlrzO+bzPKLC/048Od5tqIEOvB9CH a4Q4ZsPn7du0rcNjFwdQmEORnTyGk3wX1xkMkZWXOZqXJYrXLIrtcYxWH1RD815qmEmK GDbSXqc4h+NCdn5s/IqyLxQe6kvXqzDpLXeE1z6cUssbFXokKqRgdoHuLsX3vBOY1i+5 OeGKBtIoMJCwv0nUjt5usPXpl6+3FTiZEdrIQdQjo+hdj7VGRmLlLWQlsK1bWZ9aGgjI 4bgYEuwlxEqKqZBP27XDIsBg7LioUaNh/qqgUeOhyHBjRv8hZHinSd+rZ8QjHH1cAOYz O55g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725734740; x=1726339540; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bqrZ86leH6CKDA18mB55EYOs04WJksmldMF1y9Gg60g=; b=QQNhsgv1bvhOdi01/lGXqmsVmRfZV4p7vnhjcMKEUaTnMvAid4H0NWUPdoyxXGuary jRAoEA4l8gwtQpTMcihIIJrlskCQEJ7j2xQBh2jVUPchDonUwvdylALqKQ3WBmLO/YtC GGMHfzo1gC9klrRuK4NRLG3cdfQVeIqBakCF9tAPJxYUp2em6ghdkKF54G4ycYVd7WhS LI1QC9GUwfYPmNL7RDGcnZr6RfV92pNL+W0UdoPCFM9C+IC12dVqjiTTLstTzl7OUobv 4puonqkbZrnBagjK5lPz2nNs3petP0uQbMbe3qwRbPLepre86hQ6qbJnzQ7SvB6VVzYA BdeQ== X-Forwarded-Encrypted: i=1; AJvYcCUeTmYudThFgl9aP8NWi1Yawj8eaUMb0BoCEceP6y81UkUJzkTnS57iIAkteIzaTanDYky2rH5ohKyz+z4=@vger.kernel.org X-Gm-Message-State: AOJu0Yz1fBcK+8x84IT7XT338+bBd4umUbCX5a8Hzhu/cAtpJ2/JmjKI NurapcPYOsy3+qHeB1dRn7Q5EevkSW8AHw6rzOJUW1djO84XPQhZODsRYLRW X-Google-Smtp-Source: AGHT+IH9aCoYxDsb38F3dT4qPJqTUllT+fIbcC1PFGzwE9jDJZckUt8LtRgyo3TwmbdxAj8xN2bpLQ== X-Received: by 2002:a05:6a00:9444:b0:713:e3f9:b58e with SMTP id d2e1a72fcca58-718d5eefb46mr6451711b3a.17.1725734740040; Sat, 07 Sep 2024 11:45:40 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d825ab18bfsm1111239a12.88.2024.09.07.11.45.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Sep 2024 11:45:39 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCHv4 net-next 5/8] net: ibm: emac: use netdev's phydev directly Date: Sat, 7 Sep 2024 11:45:25 -0700 Message-ID: <20240907184528.8399-6-rosenp@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240907184528.8399-1-rosenp@gmail.com> References: <20240907184528.8399-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Avoids having to use own struct member. Signed-off-by: Rosen Penev Reviewed-by: Andrew Lunn --- drivers/net/ethernet/ibm/emac/core.c | 49 +++++++++++++--------------- drivers/net/ethernet/ibm/emac/core.h | 3 -- 2 files changed, 22 insertions(+), 30 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index 71809450b3f3..3096e4e6b5e5 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -2459,7 +2459,7 @@ static int emac_read_uint_prop(struct device_node *np, const char *name, static void emac_adjust_link(struct net_device *ndev) { struct emac_instance *dev = netdev_priv(ndev); - struct phy_device *phy = dev->phy_dev; + struct phy_device *phy = ndev->phydev; dev->phy.autoneg = phy->autoneg; dev->phy.speed = phy->speed; @@ -2510,22 +2510,20 @@ static int emac_mdio_phy_start_aneg(struct mii_phy *phy, static int emac_mdio_setup_aneg(struct mii_phy *phy, u32 advertise) { struct net_device *ndev = phy->dev; - struct emac_instance *dev = netdev_priv(ndev); phy->autoneg = AUTONEG_ENABLE; phy->advertising = advertise; - return emac_mdio_phy_start_aneg(phy, dev->phy_dev); + return emac_mdio_phy_start_aneg(phy, ndev->phydev); } static int emac_mdio_setup_forced(struct mii_phy *phy, int speed, int fd) { struct net_device *ndev = phy->dev; - struct emac_instance *dev = netdev_priv(ndev); phy->autoneg = AUTONEG_DISABLE; phy->speed = speed; phy->duplex = fd; - return emac_mdio_phy_start_aneg(phy, dev->phy_dev); + return emac_mdio_phy_start_aneg(phy, ndev->phydev); } static int emac_mdio_poll_link(struct mii_phy *phy) @@ -2534,20 +2532,19 @@ static int emac_mdio_poll_link(struct mii_phy *phy) struct emac_instance *dev = netdev_priv(ndev); int res; - res = phy_read_status(dev->phy_dev); + res = phy_read_status(ndev->phydev); if (res) { dev_err(&dev->ofdev->dev, "link update failed (%d).", res); return ethtool_op_get_link(ndev); } - return dev->phy_dev->link; + return ndev->phydev->link; } static int emac_mdio_read_link(struct mii_phy *phy) { struct net_device *ndev = phy->dev; - struct emac_instance *dev = netdev_priv(ndev); - struct phy_device *phy_dev = dev->phy_dev; + struct phy_device *phy_dev = ndev->phydev; int res; res = phy_read_status(phy_dev); @@ -2564,10 +2561,9 @@ static int emac_mdio_read_link(struct mii_phy *phy) static int emac_mdio_init_phy(struct mii_phy *phy) { struct net_device *ndev = phy->dev; - struct emac_instance *dev = netdev_priv(ndev); - phy_start(dev->phy_dev); - return phy_init_hw(dev->phy_dev); + phy_start(ndev->phydev); + return phy_init_hw(ndev->phydev); } static const struct mii_phy_ops emac_dt_mdio_phy_ops = { @@ -2622,26 +2618,28 @@ static int emac_dt_mdio_probe(struct emac_instance *dev) static int emac_dt_phy_connect(struct emac_instance *dev, struct device_node *phy_handle) { + struct phy_device *phy_dev; + dev->phy.def = devm_kzalloc(&dev->ofdev->dev, sizeof(*dev->phy.def), GFP_KERNEL); if (!dev->phy.def) return -ENOMEM; - dev->phy_dev = of_phy_connect(dev->ndev, phy_handle, &emac_adjust_link, - 0, dev->phy_mode); - if (!dev->phy_dev) { + phy_dev = of_phy_connect(dev->ndev, phy_handle, &emac_adjust_link, 0, + dev->phy_mode); + if (!phy_dev) { dev_err(&dev->ofdev->dev, "failed to connect to PHY.\n"); return -ENODEV; } - dev->phy.def->phy_id = dev->phy_dev->drv->phy_id; - dev->phy.def->phy_id_mask = dev->phy_dev->drv->phy_id_mask; - dev->phy.def->name = dev->phy_dev->drv->name; + dev->phy.def->phy_id = phy_dev->drv->phy_id; + dev->phy.def->phy_id_mask = phy_dev->drv->phy_id_mask; + dev->phy.def->name = phy_dev->drv->name; dev->phy.def->ops = &emac_dt_mdio_phy_ops; ethtool_convert_link_mode_to_legacy_u32(&dev->phy.features, - dev->phy_dev->supported); - dev->phy.address = dev->phy_dev->mdio.addr; - dev->phy.mode = dev->phy_dev->interface; + phy_dev->supported); + dev->phy.address = phy_dev->mdio.addr; + dev->phy.mode = phy_dev->interface; return 0; } @@ -2695,11 +2693,11 @@ static int emac_init_phy(struct emac_instance *dev) return res; res = of_phy_register_fixed_link(np); - dev->phy_dev = of_phy_find_device(np); - if (res || !dev->phy_dev) + ndev->phydev = of_phy_find_device(np); + if (res || !ndev->phydev) return res ? res : -EINVAL; emac_adjust_link(dev->ndev); - put_device(&dev->phy_dev->mdio.dev); + put_device(&ndev->phydev->mdio.dev); } return 0; } @@ -3257,9 +3255,6 @@ static void emac_remove(struct platform_device *ofdev) if (emac_has_feature(dev, EMAC_FTR_HAS_ZMII)) zmii_detach(dev->zmii_dev, dev->zmii_port); - if (dev->phy_dev) - phy_disconnect(dev->phy_dev); - busy_phy_map &= ~(1 << dev->phy.address); DBG(dev, "busy_phy_map now %#x" NL, busy_phy_map); diff --git a/drivers/net/ethernet/ibm/emac/core.h b/drivers/net/ethernet/ibm/emac/core.h index f4bd4cd8ac4a..b820a4f6e8c7 100644 --- a/drivers/net/ethernet/ibm/emac/core.h +++ b/drivers/net/ethernet/ibm/emac/core.h @@ -188,9 +188,6 @@ struct emac_instance { struct emac_instance *mdio_instance; struct mutex mdio_lock; - /* Device-tree based phy configuration */ - struct phy_device *phy_dev; - /* ZMII infos if any */ u32 zmii_ph; u32 zmii_port; From patchwork Sat Sep 7 18:45:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13795257 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (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 83A3816191B; Sat, 7 Sep 2024 18:45:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725734743; cv=none; b=EOXlkx0G8z8I7Wq+LiCokJ8JJ0vFpPQ/nCm4epaxwLRMZazti0tC1dazcN/DXtYCIe0jpBkWrfpOq+YZP3Xbzce51X+iP9CLyyKexriCulLp+pP8ppCQ6OszzWtLNcG/o4H5O0LWyqTn2rMqeivN8g2uoqw4Z4IzX13C8beZUPI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725734743; c=relaxed/simple; bh=yE5gCqTODUdT41orFw3/yqcS5Lpn1qY6ldEzgDsuXzI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=u+vVph0KDzYFHeWR8HBGDUCp67jojsGBY3ncj1nzZJiY+eMVAE0qcIbkHHAiT5hzOBj0i7bWZaIEbpMrjSB1TjvQFA8VQYIhj13ymMVQQgpR5/AKGwIoC9uxA3hH07a3W7AZwGUzAwpB1Dgg4pmMneb8ZSr7YYmfFr8vrILlmOg= 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=Y2fov453; arc=none smtp.client-ip=209.85.216.53 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="Y2fov453" Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-2d8818337a5so2985855a91.1; Sat, 07 Sep 2024 11:45:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725734742; x=1726339542; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r6QiWgh/SMR9a3w1u3p0Z64P+ZQ5YDOynV720/su9jY=; b=Y2fov453mJ5JXKUgf5CWkOOB6iRHXPY9oUPOOaOKALr7+QtlhM0RshgxFzEbAJorXw lXsETtNo1nchHxibzo7ARYL3nj5q9VKkmLciT72O0XDsI3fz8wdvZfxzgjDvtA/rtsg2 aHJ2TDNpT4MeK4kF0zpwsLadJmZo2N+P8EZy0yMhm2frkjoVtJgGcpgRXU4yXV0nzFlH gtiGdvgRUOoRSs3GtbbpeZlL3D98uiHCh7gPJGWnNNM6+mRuP1ua99+WzPJVsZjat5Pw OLCbyE1uICBn1eo84Bk1q8RV7q0Y1V/lbEMuI7xgqWsnhaeyhgy2UVBdvZWHrMmK9d6R 1ALQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725734742; x=1726339542; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r6QiWgh/SMR9a3w1u3p0Z64P+ZQ5YDOynV720/su9jY=; b=vzMKMZQ7fxv7ugEgzvId0VnmkMnLkI1L4MfzCDst9Sqa73QTa9S8TRw9ILdVOdm9a+ SHAq6CxTmEoMm1xCpaKDGTX6gH1wGRoDQNu+QOcKYRVBKboN8VZxE8AkU73P/NfmGqnY RkiUNYiTTXxv2Jbi/lnXDAin3SZSgp5XqhN3rp9jh+REbmv5GwX034jdVHOX6qhYce2V VLUmIZSAFRePLFjhWH3HJCslc+AVcFPcqYh/mheoBj638ExcYUBjZmHNzd5AkT/zlcCZ xO8QWiLUxjx2x1ofusMpd5GLk3O4heMIg4x1EUD7oBwzAICD9hJocyu6iREdlWpnIkDh tM7g== X-Forwarded-Encrypted: i=1; AJvYcCUyQCV7yOzI4EOlxwlWO+7/a1ufaqKf0zp1a2JDwdaxxn5IY6ZvfXU95Gi+Pe9tfbTDIZeQWp4MnlE2pUA=@vger.kernel.org X-Gm-Message-State: AOJu0Yw3EYeneXTNmmj61DPHEOOsgd8V7AuJ1Gusics48f6NHOBcXQEM sBLvsy+aUtHFrvMbmDuXSnTm+TDgp6INwuDFsWJLU9+wLtgisNJpI6nTd/MK X-Google-Smtp-Source: AGHT+IFd2iuM7fynExvDtSvwnQLWGlu5LUdxy+EIt3Wz6+YZLcG6Ai57hZIDt3LPQGGCe7ghV2wE8w== X-Received: by 2002:a17:90b:1083:b0:2d8:89c3:1b57 with SMTP id 98e67ed59e1d1-2da8f2f3f81mr20773019a91.15.1725734741523; Sat, 07 Sep 2024 11:45:41 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d825ab18bfsm1111239a12.88.2024.09.07.11.45.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Sep 2024 11:45:41 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCHv4 net-next 6/8] net: ibm: emac: replace of_get_property Date: Sat, 7 Sep 2024 11:45:26 -0700 Message-ID: <20240907184528.8399-7-rosenp@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240907184528.8399-1-rosenp@gmail.com> References: <20240907184528.8399-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org of_property_read_u32 can be used. Signed-off-by: Rosen Penev Reviewed-by: Andrew Lunn --- drivers/net/ethernet/ibm/emac/core.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index 3096e4e6b5e5..7270d7d07350 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -2444,15 +2444,14 @@ static int emac_wait_deps(struct emac_instance *dev) static int emac_read_uint_prop(struct device_node *np, const char *name, u32 *val, int fatal) { - int len; - const u32 *prop = of_get_property(np, name, &len); - if (prop == NULL || len < sizeof(u32)) { + int err; + + err = of_property_read_u32(np, name, val); + if (err) { if (fatal) - printk(KERN_ERR "%pOF: missing %s property\n", - np, name); - return -ENODEV; + pr_err("%pOF: missing %s property", np, name); + return err; } - *val = *prop; return 0; } @@ -3301,16 +3300,15 @@ static void __init emac_make_bootlist(void) /* Collect EMACs */ while((np = of_find_all_nodes(np)) != NULL) { - const u32 *idx; + u32 idx; if (of_match_node(emac_match, np) == NULL) continue; if (of_property_read_bool(np, "unused")) continue; - idx = of_get_property(np, "cell-index", NULL); - if (idx == NULL) + if (of_property_read_u32(np, "cell-index", &idx)) continue; - cell_indices[i] = *idx; + cell_indices[i] = idx; emac_boot_list[i++] = of_node_get(np); if (i >= EMAC_BOOT_LIST_SIZE) { of_node_put(np); From patchwork Sat Sep 7 18:45:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13795258 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 E205116B753; Sat, 7 Sep 2024 18:45:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725734745; cv=none; b=ZpoEvfsstowSL6LPV2e7RSyq339V3nkeFPXEUUdQ6LstLf/NjX0xSTapssX22Z2dLsqaTTMXdn/Y3ThXIcPYc/VHZkijr8W0+q/4Te24uv60/KjEyybwAvdi80JSwDwuHo6pM9qcFGMTRy582TfXe4IkFsJqHOZmX/ujnd8Wd6c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725734745; c=relaxed/simple; bh=htFJczQBC5rEtS7kPHsKmvPAnNb8//6juyMT8SK6VOM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=avB+KJe01/4Ywvv4cm6T9FmVKDi3OIZl5eqrnGXi2qmPDAKsxgTzollzNqZVqyRUcmv4RqpJ9J6NCu0fm9VwtW7YrriHSxv3coIi2xhda9uk7nbdVRZsp/tFADsB4bvDTAQ8yH6X8jhCBg9zlXIM2Q816qjFIKqX6TORkWefCNE= 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=W07b9MvX; arc=none smtp.client-ip=209.85.214.182 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="W07b9MvX" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-20573eb852aso27880865ad.1; Sat, 07 Sep 2024 11:45:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725734743; x=1726339543; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=A5q8e8n9KsYoPsMGj6nbgya2hNhp7CeYD/WbpHI448E=; b=W07b9MvXFn7zm3DoYeRCA0Iyt74C34YHp5F4WsjbUUTkERj0Ml3y5AkZB3EIjpzriO sbX/geSm9MRaaLX0joRN0+/s8LCQTJEbJ/tNcpHB85SRO4iWOLH23bDlxeLbFXBnFWQz U8mP3LMhzOzqAXym8H3e3TWNu7C64pvnErYQKhy9gMV+aeia553VelDx26NfoPy5nn0/ SJNNM8Doknrbs2Kl1DBq8Q+1lLGfGkIBzWYlaXTAutU3mJotqURY/1mNNoKxf49he68h g96RQdyOW8TBnSPMWTmz5Yrk23N+WmZVV2U192lH9ZRPzrbbm+P256yqoXFg2gXB3ISm xPGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725734743; x=1726339543; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A5q8e8n9KsYoPsMGj6nbgya2hNhp7CeYD/WbpHI448E=; b=b+Ip0Cy3ROcEC32+NH6kN8V+neFvA63M6t//MaHWD2iHf2JwjsgZLK0nFKsypgNbvd +XNm9KMZ6wh60cySlYMn6sVoSYu2Isg2INI5qGZ9U8tc13+wqlz/RdZ7EukfE+e8zChB zxXdWwje/hd8yEUFT2p2EXtZwveqPqRAFqRjvBXmAF7Dutt85bRNLhO6oa8NqSwEGt7J 8i05wJ5nWyCcewM2XZ1+ukgTPzau+c2nh1yIL3IF13cKtHT4Z0A2a8me1uFeGEHVu0px JsBRUrwYSrOdyRZi2cBWuWjmN3vabC4fOlkE1+q8EN1gdfjMvZBqAIr0QXoiIPjSQUK+ C6JA== X-Forwarded-Encrypted: i=1; AJvYcCV2QaKKS7u0yE7BYlJYjXOsR7lqF/9UrYL3tFV3TEMgpjr4lvmrhpuAPm8IiEAusGXe9zbVqzYfC3UOq6Y=@vger.kernel.org X-Gm-Message-State: AOJu0YxrXc+iPfEt/bDUMIUDAOD5+UWBJG3W6zvKQffhgKMLmilkv9gd lIIHhRUoGBNKTS2StPcpiNfjfWg+xk6ZKLRW0ghN3Bn9+eGF1G90mgR8wr+I X-Google-Smtp-Source: AGHT+IE6nlPUY/0W+5uQtFTAQLojtcqVvX1Va+CfWhAzdhVlwLn8feN0Olk/Elp8W8UJdTXu2l0aWQ== X-Received: by 2002:a17:903:98b:b0:1fd:8dfd:3553 with SMTP id d9443c01a7336-206b8372f27mr205793085ad.18.1725734743073; Sat, 07 Sep 2024 11:45:43 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d825ab18bfsm1111239a12.88.2024.09.07.11.45.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Sep 2024 11:45:42 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCHv4 net-next 7/8] net: ibm: emac: remove all waiting code Date: Sat, 7 Sep 2024 11:45:27 -0700 Message-ID: <20240907184528.8399-8-rosenp@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240907184528.8399-1-rosenp@gmail.com> References: <20240907184528.8399-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org EPROBE_DEFER, which probably wasn't available when this driver was written, can be used instead of waiting manually. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/core.c | 55 ++++------------------------ 1 file changed, 7 insertions(+), 48 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index 7270d7d07350..57831583ebde 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -96,11 +95,6 @@ MODULE_LICENSE("GPL"); static u32 busy_phy_map; static DEFINE_MUTEX(emac_phy_map_lock); -/* This is the wait queue used to wait on any event related to probe, that - * is discovery of MALs, other EMACs, ZMII/RGMIIs, etc... - */ -static DECLARE_WAIT_QUEUE_HEAD(emac_probe_wait); - /* Having stable interface names is a doomed idea. However, it would be nice * if we didn't have completely random interface names at boot too :-) It's * just a matter of making everybody's life easier. Since we are doing @@ -116,9 +110,6 @@ static DECLARE_WAIT_QUEUE_HEAD(emac_probe_wait); #define EMAC_BOOT_LIST_SIZE 4 static struct device_node *emac_boot_list[EMAC_BOOT_LIST_SIZE]; -/* How long should I wait for dependent devices ? */ -#define EMAC_PROBE_DEP_TIMEOUT (HZ * 5) - /* I don't want to litter system log with timeout errors * when we have brain-damaged PHY. */ @@ -973,8 +964,6 @@ static void __emac_set_multicast_list(struct emac_instance *dev) * we need is just to stop RX channel. This seems to work on all * tested SoCs. --ebs * - * If we need the full reset, we might just trigger the workqueue - * and do it async... a bit nasty but should work --BenH */ dev->mcast_pending = 0; emac_rx_disable(dev); @@ -2378,7 +2367,9 @@ static int emac_check_deps(struct emac_instance *dev, if (deps[i].drvdata != NULL) there++; } - return there == EMAC_DEP_COUNT; + if (there != EMAC_DEP_COUNT) + return -EPROBE_DEFER; + return 0; } static void emac_put_deps(struct emac_instance *dev) @@ -2390,19 +2381,6 @@ static void emac_put_deps(struct emac_instance *dev) platform_device_put(dev->tah_dev); } -static int emac_of_bus_notify(struct notifier_block *nb, unsigned long action, - void *data) -{ - /* We are only intereted in device addition */ - if (action == BUS_NOTIFY_BOUND_DRIVER) - wake_up_all(&emac_probe_wait); - return 0; -} - -static struct notifier_block emac_of_bus_notifier = { - .notifier_call = emac_of_bus_notify -}; - static int emac_wait_deps(struct emac_instance *dev) { struct emac_depentry deps[EMAC_DEP_COUNT]; @@ -2419,18 +2397,13 @@ static int emac_wait_deps(struct emac_instance *dev) deps[EMAC_DEP_MDIO_IDX].phandle = dev->mdio_ph; if (dev->blist && dev->blist > emac_boot_list) deps[EMAC_DEP_PREV_IDX].phandle = 0xffffffffu; - bus_register_notifier(&platform_bus_type, &emac_of_bus_notifier); - wait_event_timeout(emac_probe_wait, - emac_check_deps(dev, deps), - EMAC_PROBE_DEP_TIMEOUT); - bus_unregister_notifier(&platform_bus_type, &emac_of_bus_notifier); - err = emac_check_deps(dev, deps) ? 0 : -ENODEV; + err = emac_check_deps(dev, deps); for (i = 0; i < EMAC_DEP_COUNT; i++) { of_node_put(deps[i].node); if (err) platform_device_put(deps[i].ofdev); } - if (err == 0) { + if (!err) { dev->mal_dev = deps[EMAC_DEP_MAL_IDX].ofdev; dev->zmii_dev = deps[EMAC_DEP_ZMII_IDX].ofdev; dev->rgmii_dev = deps[EMAC_DEP_RGMII_IDX].ofdev; @@ -3087,12 +3060,8 @@ static int emac_probe(struct platform_device *ofdev) /* Wait for dependent devices */ err = emac_wait_deps(dev); - if (err) { - printk(KERN_ERR - "%pOF: Timeout waiting for dependent devices\n", np); - /* display more info about what's missing ? */ + if (err) goto err_irq_unmap; - } dev->mal = platform_get_drvdata(dev->mal_dev); if (dev->mdio_dev != NULL) dev->mdio_instance = platform_get_drvdata(dev->mdio_dev); @@ -3192,10 +3161,6 @@ static int emac_probe(struct platform_device *ofdev) wmb(); platform_set_drvdata(ofdev, dev); - /* There's a new kid in town ! Let's tell everybody */ - wake_up_all(&emac_probe_wait); - - printk(KERN_INFO "%s: EMAC-%d %pOF, MAC %pM\n", ndev->name, dev->cell_index, np, ndev->dev_addr); @@ -3228,14 +3193,8 @@ static int emac_probe(struct platform_device *ofdev) if (dev->wol_irq) irq_dispose_mapping(dev->wol_irq); err_gone: - /* if we were on the bootlist, remove us as we won't show up and - * wake up all waiters to notify them in case they were waiting - * on us - */ - if (blist) { + if (blist) *blist = NULL; - wake_up_all(&emac_probe_wait); - } return err; } From patchwork Sat Sep 7 18:45:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13795259 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-oa1-f54.google.com (mail-oa1-f54.google.com [209.85.160.54]) (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 B8DD716C42C; Sat, 7 Sep 2024 18:45:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725734747; cv=none; b=LEAkk1b9v58ZunEz3tJ+m76q/OAJkeZwKLsuj7l+el+sDpedK9kvvQjX1VugCW7l5hFRNYqTtN3azzWoslRHfiBRah7nbzNmrMBQW7nzmJu3B/q22CftDsO5VzrF3YB3dasn4a4YEQv65EdQJrtNtJ6PItzlAMhZQfubCJeWFdg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725734747; c=relaxed/simple; bh=seVo0Np6PR2inDQXcsvU1y5xTI/3EY+wHEJHZp2a9Bk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rkTnKBWuDv4sF9HkttoZW+XVS7ObrKCJcZsahsShMkvkWB01EDuTgEihnLXITeQFV5oH7fzt8dpC7s03UuGgqckSDYWANcLdr7eZ7k7Sz8Sb8PP6zxK3VlmX0E/+WDNlPV/r1CuYjrOh7GL8Gn61GY5ayhNdPl30nZZnBDiso3A= 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=b5EEl/td; arc=none smtp.client-ip=209.85.160.54 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="b5EEl/td" Received: by mail-oa1-f54.google.com with SMTP id 586e51a60fabf-277e6002b7dso1729459fac.1; Sat, 07 Sep 2024 11:45:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725734744; x=1726339544; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8zDDUM5VV2uKFLT97hFDCWEzUxnP/qoxBNZ9RXNTYNU=; b=b5EEl/tdHbKbR+7nO+0t5iB89ocSZEqyYJMy4iaF8mFNYBNtEHUxWCr0flxmP0Z7qJ FfiYfl+gDrxytC0LgfCPbarqtYsY1GquWe/sHYQa2yDNT9uetCnM0E57ZwX73hAaZXB6 REYz4OsmapGWoCmgc4mpnYbtuKVKv4XKR0hTjE/m3tc1r5VE4Dy2TXydcN4bFL57hl9Z SjxiYaG3u/QAuVYBNF50xXmpcTEcaKM+RUAac9rsXTqWlUAcK719aq702ijPZ15G7jmM 3qxEWHgilWfdkAjwgPOaQ1lAuqP8LjuNqp0rJhlcqbOgeo7vcr4G1+/0PKfp6w6s5tIx fcpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725734744; x=1726339544; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8zDDUM5VV2uKFLT97hFDCWEzUxnP/qoxBNZ9RXNTYNU=; b=VLaIFbC7DHHJV6+fTnnofxJ2FqK/A/0LeQY/zvmELi58pi32cR33rSyzh5WqLhKO79 GX2eQYQ9mA7g8DYaQJxImwR+rnNtQvrHPk2ky0XeZVhMbTb8A2mTdYd6/WpAvG4+Cs7B 89r5B0dN7YP4Fs66KBmmYDY0EQXl4jOCppHFdT+ehaPqj7tkwHxHNposHvlIdU/dKruA hlkasEKOPAszAzLN14bJRCG3uFzv3R+XXqIHCZ2goet0H5LocmLtMTTjeG+RdT05fJLP YKJ9QDgueScZPDo9ufJdQnJTtpgWjBBhXEWq0LfhvHvMxAoLZAZDDqX+G00yJCylRhHJ ffrg== X-Forwarded-Encrypted: i=1; AJvYcCXn49O8SLrIx87Gj7VfRGrcIsjaicPVUunwekHk2bkVwCymfv8+pN2HUPCVY3DVSLerBz2mbvprDAsqgi8=@vger.kernel.org X-Gm-Message-State: AOJu0Yw/Ftgn0ooyZJG6SjxtM5m2TuxvydFAZ3vTBHLC9EZneWvNdRKM jlM++7XBZxCglzvo6bh1XF5ZDISXqkmoiKDdnXcuN/3ho0s8whMAshdBbYmJ X-Google-Smtp-Source: AGHT+IGPPDnc4uAZfONvRq4qAWlN7JqbQTOv39Xx0gKwja5dHtnTqK9lCq6yEYwDAfxKpoiozUZrXw== X-Received: by 2002:a05:6870:a550:b0:261:20f:c297 with SMTP id 586e51a60fabf-27b82e07550mr7244260fac.11.1725734744439; Sat, 07 Sep 2024 11:45:44 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d825ab18bfsm1111239a12.88.2024.09.07.11.45.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Sep 2024 11:45:44 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCHv4 net-next 8/8] net: ibm: emac: get rid of wol_irq Date: Sat, 7 Sep 2024 11:45:28 -0700 Message-ID: <20240907184528.8399-9-rosenp@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240907184528.8399-1-rosenp@gmail.com> References: <20240907184528.8399-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org This is completely unused. Signed-off-by: Rosen Penev Reviewed-by: Andrew Lunn --- drivers/net/ethernet/ibm/emac/core.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index 57831583ebde..a82abf263226 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -3029,9 +3029,8 @@ static int emac_probe(struct platform_device *ofdev) if (err) goto err_gone; - /* Get interrupts. EMAC irq is mandatory, WOL irq is optional */ + /* Get interrupts. EMAC irq is mandatory */ dev->emac_irq = irq_of_parse_and_map(np, 0); - dev->wol_irq = irq_of_parse_and_map(np, 1); if (!dev->emac_irq) { printk(KERN_ERR "%pOF: Can't map main interrupt\n", np); err = -ENODEV; @@ -3055,13 +3054,13 @@ static int emac_probe(struct platform_device *ofdev) if (!dev->emacp) { dev_err(&ofdev->dev, "can't map device registers"); err = -ENOMEM; - goto err_irq_unmap; + goto err_gone; } /* Wait for dependent devices */ err = emac_wait_deps(dev); if (err) - goto err_irq_unmap; + goto err_gone; dev->mal = platform_get_drvdata(dev->mal_dev); if (dev->mdio_dev != NULL) dev->mdio_instance = platform_get_drvdata(dev->mdio_dev); @@ -3189,9 +3188,6 @@ static int emac_probe(struct platform_device *ofdev) mal_unregister_commac(dev->mal, &dev->commac); err_rel_deps: emac_put_deps(dev); - err_irq_unmap: - if (dev->wol_irq) - irq_dispose_mapping(dev->wol_irq); err_gone: if (blist) *blist = NULL; @@ -3218,9 +3214,6 @@ static void emac_remove(struct platform_device *ofdev) mal_unregister_commac(dev->mal, &dev->commac); emac_put_deps(dev); - - if (dev->wol_irq) - irq_dispose_mapping(dev->wol_irq); } /* XXX Features in here should be replaced by properties... */