From nobody Thu Nov 28 10:42:16 2024 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.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 8CA741CDA17; Tue, 1 Oct 2024 20:58:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816331; cv=none; b=tpK7SsEW6is+rYBdj6Ehp9SF/HOTljzUAME498dhnKP+PyxJFbG+d4KhHRtU88IV3XOjuf/h21nj61n6zbn+qbtqB2hM/RZ41h3xqHBNnsckduZqx2Axj/ru+eLnENajdqClgbFBpOUSh3W7LtVFY+Dac/GVxGgae27xZEifimk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816331; c=relaxed/simple; bh=VLHNOJVF2xYI9xFz0sdYpst/JrodikRXh5fZnHMPKUw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Qvz+6kCWdv7hVhzlzx9Oo56KbQDB0B2DDeYUN+MjZILfuLuw6BptLqFWoQUWwNqNVQbzIX6rN6Vk4OOqo+JWl07ONiAhSmOAbnOXL1+OeB+p9H7dnv9ZyUKkjr0imixxLWxMRblHLRU+wauNp/m60r9Uu371h8th1qoCNe85h+U= 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=Htf40M8o; arc=none smtp.client-ip=209.85.215.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="Htf40M8o" Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-7e6afa8baeaso5116593a12.3; Tue, 01 Oct 2024 13:58:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727816328; x=1728421128; 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=nTFOaXTef0G9oTg4z249QNFPMYARm/rD0bt+cP8X3Pw=; b=Htf40M8oGFAo+qIegeI+okWYMtnoukUH64XqE58bODv4s0iGBJ+p1qk4P8iws5aGF7 gMOTDL17dQ3Nc1IDavXR09sq7tGViKfzmTGCDbaDNfviWiJwlNvk9wBXAIx7saxXghR2 amhzW6o7+CafeDiJXK2CHoexoQXYqqAHYnwkuj7gnSyxQblgmmk0KUxru9J3yK9XGKF1 YAAK/nIXLrjnN1PqYMKh7FMc3WL52niXhd4sCjvxg9NKugUkWhDJeV4B8j1VQXwKHbxe ZXj3fjqJLItErCJJ7YAaTsbm/QPSr1AN5fPrWcYleJrJcLVCtcO/d5Xz7ZkXBXut7hl1 W8BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727816328; x=1728421128; 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=nTFOaXTef0G9oTg4z249QNFPMYARm/rD0bt+cP8X3Pw=; b=Sr1ZV+K6jIe4/vPa1DKU+mzghKVuyUgne17hPDDkW1bflDaEnJFks4xocU6kVvTcDx 20TCKGtEmy0WzX5F+SwzXVh4hboI8auhtBiVWa0beTD3pAF5+3hMPUHlZd4W2wSBklHt sB2CC9DLMvzUrEopczCuzwGRe4nNRNmp74EjS15rWXOIW+UQ839tMYv5L96DOZPUCiYN EG/ioOe7rez0jjb9XSTvrAgkeuuUqNwV5CDAlNKkDxP5zbjN6FSsPa0lETLJdhgY32OW pGPJ6wzZ+pCnFyhuxFXUTZesTKcPd1dJj8a/7B9tctDkonL6DSC5vg+0W16WRRm5cKH3 /1FA== X-Forwarded-Encrypted: i=1; AJvYcCUFuhciMUSj+tH7V2b87B8U36a+DmqDkrpNSOFaezp2g4rRhiYkIPiNPHmnc4wQmrITpoFMwuCWhHy2eiA=@vger.kernel.org X-Gm-Message-State: AOJu0YxEaaBGX3Wn9g/EuAk8OkYAiN3CeTzdyg6LgPb+VpYLeCEGYlnC IpA3NUBe6xIYeYsxLFZuTV9y67K3TOclnqqtI70DCxrxvKikC+RoeaBvjNvD X-Google-Smtp-Source: AGHT+IHfGLsPXHiXEbaLpfGnepkMDG1K7qrayUW9CTQPxL4iXoGX/OBLXciDiH3g+6tERdVhWPHRMw== X-Received: by 2002:a05:6a21:1693:b0:1d3:e4e:ff55 with SMTP id adf61e73a8af0-1d5db101999mr1440585637.7.1727816328375; Tue, 01 Oct 2024 13:58:48 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26518a2asm8545765b3a.107.2024.10.01.13.58.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 13:58:48 -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: [PATCHv2 net-next 01/18] net: ibm: emac: use netif_receive_skb_list Date: Tue, 1 Oct 2024 13:58:27 -0700 Message-ID: <20241001205844.306821-2-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241001205844.306821-1-rosenp@gmail.com> References: <20241001205844.306821-1-rosenp@gmail.com> 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" Small rx improvement. Would use napi_gro_receive instead but that's a lot more involved than netif_receive_skb_list because of how the function is implemented. Before: > iperf -c 192.168.1.1 ------------------------------------------------------------ Client connecting to 192.168.1.1, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 1] local 192.168.1.101 port 51556 connected with 192.168.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 1] 0.00-10.04 sec 559 MBytes 467 Mbits/sec > iperf -c 192.168.1.1 ------------------------------------------------------------ Client connecting to 192.168.1.1, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 1] local 192.168.1.101 port 48228 connected with 192.168.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 1] 0.00-10.03 sec 558 MBytes 467 Mbits/sec > iperf -c 192.168.1.1 ------------------------------------------------------------ Client connecting to 192.168.1.1, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 1] local 192.168.1.101 port 47600 connected with 192.168.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 1] 0.00-10.04 sec 557 MBytes 466 Mbits/sec > iperf -c 192.168.1.1 ------------------------------------------------------------ Client connecting to 192.168.1.1, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 1] local 192.168.1.101 port 37252 connected with 192.168.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 1] 0.00-10.05 sec 559 MBytes 467 Mbits/sec After: > iperf -c 192.168.1.1 ------------------------------------------------------------ Client connecting to 192.168.1.1, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 1] local 192.168.1.101 port 40786 connected with 192.168.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 1] 0.00-10.05 sec 572 MBytes 478 Mbits/sec > iperf -c 192.168.1.1 ------------------------------------------------------------ Client connecting to 192.168.1.1, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 1] local 192.168.1.101 port 52482 connected with 192.168.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 1] 0.00-10.04 sec 571 MBytes 477 Mbits/sec > iperf -c 192.168.1.1 ------------------------------------------------------------ Client connecting to 192.168.1.1, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 1] local 192.168.1.101 port 48370 connected with 192.168.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 1] 0.00-10.04 sec 572 MBytes 478 Mbits/sec > iperf -c 192.168.1.1 ------------------------------------------------------------ Client connecting to 192.168.1.1, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 1] local 192.168.1.101 port 46086 connected with 192.168.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 1] 0.00-10.05 sec 571 MBytes 476 Mbits/sec > iperf -c 192.168.1.1 ------------------------------------------------------------ Client connecting to 192.168.1.1, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 1] local 192.168.1.101 port 46062 connected with 192.168.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 1] 0.00-10.04 sec 572 MBytes 478 Mbits/sec Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ib= m/emac/core.c index dac570f3c110..d476844bae3e 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -1727,6 +1727,7 @@ static inline int emac_rx_sg_append(struct emac_insta= nce *dev, int slot) /* NAPI poll context */ static int emac_poll_rx(void *param, int budget) { + LIST_HEAD(rx_list); struct emac_instance *dev =3D param; int slot =3D dev->rx_slot, received =3D 0; =20 @@ -1783,8 +1784,7 @@ static int emac_poll_rx(void *param, int budget) skb->protocol =3D eth_type_trans(skb, dev->ndev); emac_rx_csum(dev, skb, ctrl); =20 - if (unlikely(netif_receive_skb(skb) =3D=3D NET_RX_DROP)) - ++dev->estats.rx_dropped_stack; + list_add_tail(&skb->list, &rx_list); next: ++dev->stats.rx_packets; skip: @@ -1828,6 +1828,8 @@ static int emac_poll_rx(void *param, int budget) goto next; } =20 + netif_receive_skb_list(&rx_list); + if (received) { DBG2(dev, "rx %d BDs" NL, received); dev->rx_slot =3D slot; --=20 2.46.2 From nobody Thu Nov 28 10:42:16 2024 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.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 BD9931CEAB7; Tue, 1 Oct 2024 20:58:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816332; cv=none; b=X+09fTahWcHevkgIMJjMuLmWAVaGDFFCr9puKi06AKI99Uik9c3HoWeAxghlmKzNpIz9gYvwzXRo9iyryZWVnpLXr6yIUDw0s890/3iEnwnSIia7zSuAhP+s0LAVH4WwnJWWte1mVXCaG3wNRwJEJuUnOKK1KWNo1q+XNz+NZWM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816332; c=relaxed/simple; bh=A+1j/Ugq/kUN7xpD6mKc0h/usxX2L7w7reuIgtpSPxc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oLEN7nzh459LOHX7PncjY+q0mnLie2l1pPdDZF+nb05xGkLlukIILoioWHQW5ce/kwOuXMZ8Rj2VeF1exNWli4pckud2mpnovSPbUfd2AQrsNbbzBi0J5VvYwR9J5HGoiS2oX7GNDm8YrZyrAo/qR2n9s9tSCBP7ICp3eMPQbQM= 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=eGVUmoat; arc=none smtp.client-ip=209.85.214.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="eGVUmoat" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-20b6458ee37so41997325ad.1; Tue, 01 Oct 2024 13:58:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727816330; x=1728421130; 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=qIAV5bXXJI/k1ElcEpFKyJcx4VyhECZfs9bbGfC3jN4=; b=eGVUmoatpEdfBsIXIFRlrHP1R1KUdRoBcSrW9E6sxQ/qXO1YO3tEuCANA8fF/1zKDS 4pr7pZNg/K9oaQ+J7Irs48zSVGzMBf8IJJS4peQ3OoYSRUvPkAI6w7jOhzYhiICQfooE 3KWMpl7mdg+HNCUVKDTlXUaewrrTbhV2xiYyp//MljrbLfVRZiTbeiYfTjRSB+pe1UK8 R0Pqh8NG6nhbLGvDGOXJ68R7k2fRn+FtZqWdqwxpTCsTfXQNLQsO1U5vcgsQPJ/T3g4I oSPLMLeBLRvyU1sYc7J7HuddBmV0bILn40dyuoPhMp5qgZcgE+8f8kqj8mOSkM6AvSqZ cTAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727816330; x=1728421130; 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=qIAV5bXXJI/k1ElcEpFKyJcx4VyhECZfs9bbGfC3jN4=; b=SEh/BFIzSrEcq/GBoyVOQwb2L22g0B+zbdg65W524h/7e02hRzn0uTYBiLaKets3E3 W3Ywe+mvjx+z/E2SFrcMlkljqhLQldqLD3OqzXgdpDoJqHdWlg341RS4xS6iuaHQk/iO 0M8VSyGM6jeb+4L6Z0/fNjhmJPzPVe0abPdFPPFyKaGzq4+5lyw7aQoBiixRztB2k/Li JE9eb0Lnj67rbRcpGeT8+tJt8m9mMNRZEAiybGXErtLKHUNHKcMD9kMdTCLskcKR3Yoy ilFGWtQ4qWSIen/DTKMlTapJkJPScpdy9d6TQDw4weW7Ov2p2BPgJuJ4TSUNWi+AjChO zxgw== X-Forwarded-Encrypted: i=1; AJvYcCUuczmaavfjhWrjPGq64b/s+BzjEZHPiVZ2ittXkP1FPBywXa64KGVvzQAS/DpGnvwQY5n6BGuVnwlVdBI=@vger.kernel.org X-Gm-Message-State: AOJu0Yw1u2C8ut3nG9NfQguP/L/jLbUiynofyG2sOvt4I7IOPftMLHKD P7sA7WNFznoVRgVM4E0XMiG+TE1940RPSz27Liuqj1//n2jzgfmYKqvbOFc7 X-Google-Smtp-Source: AGHT+IHE1+VXwxYDEtoSaaRpy5X0sJ3H8mwx9vxyCYdC1AeW8zrrppOQOLx3EnsCTwKIQlPN1ZsnaA== X-Received: by 2002:a05:6a20:c996:b0:1d3:293a:47d0 with SMTP id adf61e73a8af0-1d5db1a4430mr1232825637.7.1727816329745; Tue, 01 Oct 2024 13:58:49 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26518a2asm8545765b3a.107.2024.10.01.13.58.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 13:58:49 -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: [PATCHv2 net-next 02/18] net: ibm: emac: remove custom init/exit functions Date: Tue, 1 Oct 2024 13:58:28 -0700 Message-ID: <20241001205844.306821-3-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241001205844.306821-1-rosenp@gmail.com> References: <20241001205844.306821-1-rosenp@gmail.com> 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" Now that we're using EPROBE_DEFER, we don't have to do custom initialization and we can let the core handle this for us. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/core.c | 39 +-------------------------- drivers/net/ethernet/ibm/emac/mal.h | 4 --- drivers/net/ethernet/ibm/emac/rgmii.h | 4 --- drivers/net/ethernet/ibm/emac/tah.h | 4 --- drivers/net/ethernet/ibm/emac/zmii.h | 4 --- 5 files changed, 1 insertion(+), 54 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ib= m/emac/core.c index d476844bae3e..97ae0b7ccb0d 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -3283,42 +3283,10 @@ static void __init emac_make_bootlist(void) =20 static int __init emac_init(void) { - int rc; - - printk(KERN_INFO DRV_DESC ", version " DRV_VERSION "\n"); - /* Build EMAC boot list */ emac_make_bootlist(); =20 - /* Init submodules */ - rc =3D mal_init(); - if (rc) - goto err; - rc =3D zmii_init(); - if (rc) - goto err_mal; - rc =3D rgmii_init(); - if (rc) - goto err_zmii; - rc =3D tah_init(); - if (rc) - goto err_rgmii; - rc =3D platform_driver_register(&emac_driver); - if (rc) - goto err_tah; - - return 0; - - err_tah: - tah_exit(); - err_rgmii: - rgmii_exit(); - err_zmii: - zmii_exit(); - err_mal: - mal_exit(); - err: - return rc; + return platform_driver_register(&emac_driver); } =20 static void __exit emac_exit(void) @@ -3327,11 +3295,6 @@ static void __exit emac_exit(void) =20 platform_driver_unregister(&emac_driver); =20 - tah_exit(); - rgmii_exit(); - zmii_exit(); - mal_exit(); - /* Destroy EMAC boot list */ for (i =3D 0; i < EMAC_BOOT_LIST_SIZE; i++) of_node_put(emac_boot_list[i]); diff --git a/drivers/net/ethernet/ibm/emac/mal.h b/drivers/net/ethernet/ibm= /emac/mal.h index e0ddc41186a2..2963b36be6f5 100644 --- a/drivers/net/ethernet/ibm/emac/mal.h +++ b/drivers/net/ethernet/ibm/emac/mal.h @@ -252,10 +252,6 @@ static inline int mal_has_feature(struct mal_instance = *dev, (MAL_FTRS_POSSIBLE & dev->features & feature); } =20 -/* Register MAL devices */ -int mal_init(void); -void mal_exit(void); - int mal_register_commac(struct mal_instance *mal, struct mal_commac *commac); void mal_unregister_commac(struct mal_instance *mal, diff --git a/drivers/net/ethernet/ibm/emac/rgmii.h b/drivers/net/ethernet/i= bm/emac/rgmii.h index 8e4e36eed172..170bcd35039b 100644 --- a/drivers/net/ethernet/ibm/emac/rgmii.h +++ b/drivers/net/ethernet/ibm/emac/rgmii.h @@ -52,8 +52,6 @@ struct rgmii_instance { =20 #ifdef CONFIG_IBM_EMAC_RGMII =20 -int rgmii_init(void); -void rgmii_exit(void); int rgmii_attach(struct platform_device *ofdev, int input, int mode); void rgmii_detach(struct platform_device *ofdev, int input); void rgmii_get_mdio(struct platform_device *ofdev, int input); @@ -64,8 +62,6 @@ void *rgmii_dump_regs(struct platform_device *ofdev, void= *buf); =20 #else =20 -# define rgmii_init() 0 -# define rgmii_exit() do { } while(0) # define rgmii_attach(x,y,z) (-ENXIO) # define rgmii_detach(x,y) do { } while(0) # define rgmii_get_mdio(o,i) do { } while (0) diff --git a/drivers/net/ethernet/ibm/emac/tah.h b/drivers/net/ethernet/ibm= /emac/tah.h index 86c2b6b9d460..60c16cf7a41a 100644 --- a/drivers/net/ethernet/ibm/emac/tah.h +++ b/drivers/net/ethernet/ibm/emac/tah.h @@ -68,8 +68,6 @@ struct tah_instance { =20 #ifdef CONFIG_IBM_EMAC_TAH =20 -int tah_init(void); -void tah_exit(void); int tah_attach(struct platform_device *ofdev, int channel); void tah_detach(struct platform_device *ofdev, int channel); void tah_reset(struct platform_device *ofdev); @@ -78,8 +76,6 @@ void *tah_dump_regs(struct platform_device *ofdev, void *= buf); =20 #else =20 -# define tah_init() 0 -# define tah_exit() do { } while(0) # define tah_attach(x,y) (-ENXIO) # define tah_detach(x,y) do { } while(0) # define tah_reset(x) do { } while(0) diff --git a/drivers/net/ethernet/ibm/emac/zmii.h b/drivers/net/ethernet/ib= m/emac/zmii.h index 65daedc78594..213de06d8ea2 100644 --- a/drivers/net/ethernet/ibm/emac/zmii.h +++ b/drivers/net/ethernet/ibm/emac/zmii.h @@ -48,8 +48,6 @@ struct zmii_instance { =20 #ifdef CONFIG_IBM_EMAC_ZMII =20 -int zmii_init(void); -void zmii_exit(void); int zmii_attach(struct platform_device *ofdev, int input, phy_interface_t *mode); void zmii_detach(struct platform_device *ofdev, int input); @@ -60,8 +58,6 @@ int zmii_get_regs_len(struct platform_device *ocpdev); void *zmii_dump_regs(struct platform_device *ofdev, void *buf); =20 #else -# define zmii_init() 0 -# define zmii_exit() do { } while(0) # define zmii_attach(x,y,z) (-ENXIO) # define zmii_detach(x,y) do { } while(0) # define zmii_get_mdio(x,y) do { } while(0) --=20 2.46.2 From nobody Thu Nov 28 10:42:16 2024 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (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 2E5CF1CEE85; Tue, 1 Oct 2024 20:58:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816333; cv=none; b=iZ0G5gV/aArY79ytR0792c1QbTlb0m0PjqV5Lfrn7IIKNAg9JtCtpy1kAXKfb2DyV2rU3AA7N4mBU5YSuBwhjxzCqAwViS8ZasapnMfYy5u9j94sN4TutMmyzf2Ovd24yLPbz410Z9Q1eCsw3tKISa5b2JbDPrH/aLEQ7ZXYmTE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816333; c=relaxed/simple; bh=E2lpnkQkB6alWziSY4dY/baMJyxnTAm4Bw4gm3jpZVg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IShKZE2lGIJgwRR9stxcMDb8Q2CSqiVni4sk55TAj3DzlvH+PmarUAmX8QBgioDoe4gUWzeHImKQnaet1fp+hVWyE/xcjXLJJAv3KxkGFMCSrCeMil868vxz4cfLMwUTcPuisrsX6XJwm2PQ5tRKu3MzKDBCMxeuavRh3RdHwgw= 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=LaUhoYsH; arc=none smtp.client-ip=209.85.210.169 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="LaUhoYsH" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-71dc4451fffso582057b3a.2; Tue, 01 Oct 2024 13:58:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727816331; x=1728421131; 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=8u5EqNnoRftoG2NG+EU6QGUJmaRNtnq9ufFREhiUF4c=; b=LaUhoYsHT18kaD4q/NeD2KUlVNz4W5fk4/J4LzLMZx+S0zEyoVZWaVUiBTGnA2sUbu G4+aNnqpRzIxr5OIokz57hp1LF4mvUzcpXgBd5BDquYmSqd1OjkRNasIDwoAhbY+1q8u nEHK1HmRUB7zOsjovyGYFbV6GAFHE7MQJPuJ+018HYsj23h6jnObf5FmrZ2AH/ktE02x iT3aXTjyQFf+YgPU7MwdiH8fwfHNocYTRsaoXRcJ/Q6fBGf+8J2AfG5FWYYeC0X2bXm0 FRI4ksAhMNaKwXXgkZKYjeoPrzlOt2udPjnsL5eSRxGYNVzo6UHC4icrMy4brs6mF4Zn MbHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727816331; x=1728421131; 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=8u5EqNnoRftoG2NG+EU6QGUJmaRNtnq9ufFREhiUF4c=; b=VsJ3VFEo24r1o9NgjXMzbbgW2H36wViE/7nmI5QsDaZj9jZ1aikGha26prTtcHyQe0 DiQUOzT43DoRTUCWVLnnsIPsdVN2/deasG8iUgDquqRg/iim9pEmmQXoZma1DDF6nIid 3zOiKiQZ2AmRNXTbSGfO53dr4alPJVs5E+Xevyw6ETM7Oz+NGMduNBMm11nWEtCaLS9W idlM0vAetJMp43BKJHNr7PRyvoog+1YW7+BUbOxcLBh0R0h2W8fn+UM5GADEYEX/4sPQ r0NFXjLUQS70LDqiRD+OhjwKbBmOqtUuPjIFGvLOMkCKTkhY9S5FY82lsUNekdAlr0R5 4VYw== X-Forwarded-Encrypted: i=1; AJvYcCXqkV2jOXgFQrBbe4MovB018T9Z/2W70cie9inPqeySgsmG4j0YunaeWODmAtS5JVBUO+/Mm4xWC82vMKo=@vger.kernel.org X-Gm-Message-State: AOJu0YzBrLHJJWnsOG7qNDBGC8a7X+i/97zIdBX3ZuqjVK1xii8J9MOY 5/iNDHPijmVdbP0SFnzrYtsNMwbk4/G5Tr1euF+4o9Z+TqillNRsEZD/6xx+ X-Google-Smtp-Source: AGHT+IGIBz+BCy19vbRJIQndwYAXWyaXZpjiAqVPJhueT2p/meXUdb003OCEsDyZ0pbVsutbLFpeUA== X-Received: by 2002:a05:6a00:889:b0:714:2198:26bd with SMTP id d2e1a72fcca58-71dc5c67060mr1684347b3a.11.1727816331154; Tue, 01 Oct 2024 13:58:51 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26518a2asm8545765b3a.107.2024.10.01.13.58.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 13:58:50 -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: [PATCHv2 net-next 03/18] net: ibm: emac: use module_platform_driver for modules Date: Tue, 1 Oct 2024 13:58:29 -0700 Message-ID: <20241001205844.306821-4-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241001205844.306821-1-rosenp@gmail.com> References: <20241001205844.306821-1-rosenp@gmail.com> 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" These init and exit functions don't do anything special. Just macro it away. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/mal.c | 10 +--------- drivers/net/ethernet/ibm/emac/rgmii.c | 10 +--------- drivers/net/ethernet/ibm/emac/tah.c | 10 +--------- drivers/net/ethernet/ibm/emac/zmii.c | 10 +--------- 4 files changed, 4 insertions(+), 36 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm= /emac/mal.c index d92dd9c83031..a632d3a207d3 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c @@ -779,12 +779,4 @@ static struct platform_driver mal_of_driver =3D { .remove_new =3D mal_remove, }; =20 -int __init mal_init(void) -{ - return platform_driver_register(&mal_of_driver); -} - -void mal_exit(void) -{ - platform_driver_unregister(&mal_of_driver); -} +module_platform_driver(mal_of_driver); diff --git a/drivers/net/ethernet/ibm/emac/rgmii.c b/drivers/net/ethernet/i= bm/emac/rgmii.c index e1712fdc3c31..52f080661f87 100644 --- a/drivers/net/ethernet/ibm/emac/rgmii.c +++ b/drivers/net/ethernet/ibm/emac/rgmii.c @@ -303,12 +303,4 @@ static struct platform_driver rgmii_driver =3D { .remove_new =3D rgmii_remove, }; =20 -int __init rgmii_init(void) -{ - return platform_driver_register(&rgmii_driver); -} - -void rgmii_exit(void) -{ - platform_driver_unregister(&rgmii_driver); -} +module_platform_driver(rgmii_driver); diff --git a/drivers/net/ethernet/ibm/emac/tah.c b/drivers/net/ethernet/ibm= /emac/tah.c index fa3488258ca2..8407ff83b1d3 100644 --- a/drivers/net/ethernet/ibm/emac/tah.c +++ b/drivers/net/ethernet/ibm/emac/tah.c @@ -161,12 +161,4 @@ static struct platform_driver tah_driver =3D { .remove_new =3D tah_remove, }; =20 -int __init tah_init(void) -{ - return platform_driver_register(&tah_driver); -} - -void tah_exit(void) -{ - platform_driver_unregister(&tah_driver); -} +module_platform_driver(tah_driver); diff --git a/drivers/net/ethernet/ibm/emac/zmii.c b/drivers/net/ethernet/ib= m/emac/zmii.c index 26e86cdee2f6..97cea64abe55 100644 --- a/drivers/net/ethernet/ibm/emac/zmii.c +++ b/drivers/net/ethernet/ibm/emac/zmii.c @@ -309,12 +309,4 @@ static struct platform_driver zmii_driver =3D { .remove_new =3D zmii_remove, }; =20 -int __init zmii_init(void) -{ - return platform_driver_register(&zmii_driver); -} - -void zmii_exit(void) -{ - platform_driver_unregister(&zmii_driver); -} +module_platform_driver(zmii_driver); --=20 2.46.2 From nobody Thu Nov 28 10:42:16 2024 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.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 348271CEEA6; Tue, 1 Oct 2024 20:58:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816334; cv=none; b=lAs+Mq5j2FrA9FKqTLOXWy4utoGbvM40oVozlF2PIYXJHul3QqTCJHfwwIJ4qnQW2TkAQ58Cpr8jPtMAvPZlKDNkvD1JK5ntsK7SQQ5XyNuA1KdBqf+K3FAbwmDKjtpfauOTKUB6Ds3WOLuU50ZdSmUWTuiDqZDKSce36ZbpI8Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816334; c=relaxed/simple; bh=kk6BZgx6e1aK6qkYUJ4gDXK7X1PwsJgqDQzdqq529+8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qRsWvpws01FMuKmqApFhuu4tHpUfB4q9I3ELau6QUWybOJH+PWzthWCxgpR4raoiMzmocjBYPbswHNP3rsXHVxKR2W9OiI6IoE6xPJ9gzuOxPhhWdQtPxU4YHTBaj8GznXMrcNR4WBbI2ayFpw4aRzwO7pa4reJgfH412OYQ5ZE= 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=mStwiViK; arc=none smtp.client-ip=209.85.215.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="mStwiViK" Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-7db1f13b14aso5008910a12.1; Tue, 01 Oct 2024 13:58:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727816332; x=1728421132; 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=FTdchS1usQhL1WtM0gjI76UYTIDbC6vW1SK3n+i286A=; b=mStwiViK4NgVRIvRn0MCTkpY/hlfrU6Bq0MVi6t+Eic7ZPxsy17r4FQtOH20WuyK4B InMiJQ7XfRs8D7JsZnqR/5hvZ4+3WobiQbmUBaYHBhZaQhLC7SpmqcefLAWUMG+SG+LE QGfuopDCg+cddGS6cTruEHeeddu5ekRdK2EX/ZAH+lgk9ER4Mj/WS0K/f+Grb++DEDDv jCz5/4VVKfHm59aI9ucQq/nLSWefDXPQgjAcBKTxRigbjRtq26pjTbAgQoFn3nrY6ZNr elrHTMOv5K0jyWcCql4Fl4LwY6dVzr4WrIHUKSD2i15k2/f5yK36ip0bAjUtP2PHvZfg Q2Vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727816332; x=1728421132; 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=FTdchS1usQhL1WtM0gjI76UYTIDbC6vW1SK3n+i286A=; b=tZ8uabg2+IfD7HqeS4FvBscM1FBPD/qINNbUl0xggMMw3xfQCIUVNTIU84uQkatW7v bcgL6NIyEuNK3o5WsUMdyvfl2tu93CfHqTLHtS8iaT7UvTw+KHVklU04h6+EZKVBOwlX lJEFe5JeTedRLThoOZw6I5fXxxcUj8GwAUEJ4s+dRnrtLjcMGLeKrw/bNH8Y4SuvPHeH 8CCcJ9cnaNqJRH+1ByUzZD8wuGt5t5cCifGN5JFPY2Axk0ei2WQLrq/87kXqSBYYoYTW SrSspfglJao2Va64sGoaGj2xR5IRBjILnA3egcowYdxJmUBzvTnO8O9GDe7X9brhfV/U jC/w== X-Forwarded-Encrypted: i=1; AJvYcCW0/O9ahxFwkmFRP9CK+0FrsFCYoqdhyml1hXkd7boIlqEX5jar9nBIFj+LS5By1mvtaH73u7i1SceEmAw=@vger.kernel.org X-Gm-Message-State: AOJu0YzR4pv0RVZD9iN7u8sY20SjF4E9BkZ3OO+4HVg6BZdV/7la7usy he2c8XwwQzwImSH36kZ8EidBDfF1yxO7sxHdlwdtZJae0QFJ0I8ErTxPvUsQ X-Google-Smtp-Source: AGHT+IFt99AVWEMVsaluLCwiowNU97XyBm5lyHuDwidt8U1ogI3RBbW/yAvgKBrDKJh3++UVAxhGPQ== X-Received: by 2002:a05:6a20:d494:b0:1d2:eaca:34d4 with SMTP id adf61e73a8af0-1d5db1a35acmr1533558637.4.1727816332467; Tue, 01 Oct 2024 13:58:52 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26518a2asm8545765b3a.107.2024.10.01.13.58.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 13:58:52 -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: [PATCHv2 net-next 04/18] net: ibm: emac: use devm_platform_ioremap_resource Date: Tue, 1 Oct 2024 13:58:30 -0700 Message-ID: <20241001205844.306821-5-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241001205844.306821-1-rosenp@gmail.com> References: <20241001205844.306821-1-rosenp@gmail.com> 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" No need to have a struct resource. Gets rid of the TODO. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/core.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ib= m/emac/core.c index 97ae0b7ccb0d..205ba7aa02d4 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -3050,12 +3050,10 @@ static int emac_probe(struct platform_device *ofdev) =20 ndev->irq =3D dev->emac_irq; =20 - /* Map EMAC regs */ - // TODO : platform_get_resource() and devm_ioremap_resource() - dev->emacp =3D devm_of_iomap(&ofdev->dev, np, 0, NULL); - if (!dev->emacp) { + dev->emacp =3D devm_platform_ioremap_resource(ofdev, 0); + if (IS_ERR(dev->emacp)) { dev_err(&ofdev->dev, "can't map device registers"); - err =3D -ENOMEM; + err =3D PTR_ERR(dev->emacp); goto err_gone; } =20 --=20 2.46.2 From nobody Thu Nov 28 10:42:16 2024 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (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 B888D1CF2A2; Tue, 1 Oct 2024 20:58:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816336; cv=none; b=DHTOsKlGdOIeG+cGnHKVDsb9tQIiDZZunqOSceD1ZGSqeOBpUg3N3DwqdNCVfRBZ3ueAW32WMEGWFLSdjTWFI+IDtz/07Wk2/G8nIy5sD5CudPth08fbJVCfAqujcHmK4J6HKYd+EA5qtjX9p8SIgDgmAObFfdDeF8oUwQeH4tQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816336; c=relaxed/simple; bh=k+hWWt4RJCuaq34feyjRdwmdzmEmgz88H7zHH0eqdeo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H4lBb3vH17mub9aFnp+lYby8q+EGI8lEk/jvzuARxXSb/PUXnoVo0ZAIxHCVugf6NzHxPrnNal2HsZHMdWqZ5j0FcZFFQQbAr6+IeHy4NbSFCYsH4wzJlxKIdGdDiCqwRNb1rVAAb1ah5lIXeg34UChkl7FqMdLHNnPDmst6F9Y= 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=WdbwdcBo; arc=none smtp.client-ip=209.85.210.177 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="WdbwdcBo" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-71b0722f221so4633289b3a.3; Tue, 01 Oct 2024 13:58:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727816334; x=1728421134; 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=qFaFgc9POesph+LsrZhmZjoY7P5q5F3QfbVs+MT0fXs=; b=WdbwdcBoCdVKEH0AyhKLz3yLBaMYQ/wNrIwwtmnLwDtCrfy/0HWt2vz8jrbo8s8HXp aw01L7dDWdxF+HQ/G4/CY3/W55mb9/qO0Ky6BwVe+Ek7g0ayKPcObtm8C4FdWD/Zc+VH tDD2pi1Pz1pJJGTWgG+noOpP4X3EI5xttxOx9+ZJmWXr9vRweBUURTORXOsZPxoDpWkY 79pqW8w//B51POMP1OBac4Z/5uTcLpHrwo9ham3+Ykzv2wHKaeKYDFuc7M4o06kcE80Q 8GQde+s0IadKyDj6KEHxFZwHAiwODJpvivRAmwo4nxiPFuatTczt9/8DQGG9FNsSoGP3 ppeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727816334; x=1728421134; 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=qFaFgc9POesph+LsrZhmZjoY7P5q5F3QfbVs+MT0fXs=; b=YajdRA2WlqdNJkoxAFrZqzf3kEPueGcglhKnfgQNreHBivMnCRxsOZ+Dnd86C+pjLY XdE+jtveseMvIVFlE+JwpPnFnyuaB3SipSgByvKG8rSytNalLuML4yYC7Pf22XN8g+mm SuE/WGGb/Rsz+pWPXwyhxuVSTM27ZUDacaOtwYlLctIkSIJHT75eRDOxX0UJ0GlGn5qk u1asKAuODIvU/HJD+T7T42K8aeL5d+aq+5K7bYVYS+Yj4Y0X/vGZR1mfQtjfiShzTgTJ 6lY9QRg3ZizxIkEKQOJPmi0rJuNDD5Ew7jngKhl3OEmgCeS8quLJlP00qIeCeH8QCxuP kTBg== X-Forwarded-Encrypted: i=1; AJvYcCVV/HSDlYH8thRmPuIwRcIiSHQH2viAU8y9cU08G5TCmxEIta9IqLKIR/gUx6KNidESwm3h6oGtBaGAf2k=@vger.kernel.org X-Gm-Message-State: AOJu0YyocwaGaHnsvlDvNIt7LtA+0QAg1IG7grNBD3Jl6oOr0qHl+ew+ va9rb0hTBjDWg5v8gYb5EWelpKlM3K5j7SpCpdhhMW6GZFdQ+Nd9kdpRMbV8 X-Google-Smtp-Source: AGHT+IGE5uk8JS4v9klDh6dqy3EEdN/CIxhx8jOqp+96IFnDKyRW0HzOE5M2uFwmadrHfky3BvFG3A== X-Received: by 2002:a05:6a00:1490:b0:714:1e28:da95 with SMTP id d2e1a72fcca58-71dc5c7847emr1528000b3a.7.1727816333774; Tue, 01 Oct 2024 13:58:53 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26518a2asm8545765b3a.107.2024.10.01.13.58.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 13:58:53 -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: [PATCHv2 net-next 05/18] net: ibm: emac: use platform_get_irq Date: Tue, 1 Oct 2024 13:58:31 -0700 Message-ID: <20241001205844.306821-6-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241001205844.306821-1-rosenp@gmail.com> References: <20241001205844.306821-1-rosenp@gmail.com> 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" No need for irq_of_parse_and_map since we have platform_device. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/core.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ib= m/emac/core.c index 205ba7aa02d4..a55e84eb1d4d 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -3031,15 +3031,8 @@ static int emac_probe(struct platform_device *ofdev) if (err) goto err_gone; =20 - /* Get interrupts. EMAC irq is mandatory */ - dev->emac_irq =3D irq_of_parse_and_map(np, 0); - if (!dev->emac_irq) { - printk(KERN_ERR "%pOF: Can't map main interrupt\n", np); - err =3D -ENODEV; - goto err_gone; - } - /* Setup error IRQ handler */ + dev->emac_irq =3D platform_get_irq(ofdev, 0); err =3D devm_request_irq(&ofdev->dev, dev->emac_irq, emac_irq, 0, "EMAC", dev); if (err) { --=20 2.46.2 From nobody Thu Nov 28 10:42:16 2024 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.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 04EEE1CF5D8; Tue, 1 Oct 2024 20:58:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816337; cv=none; b=d4lVhBbFktjarW1mzb+iSRCHmHe80kpATKQdtE8LZd0JJ22YlB9RRFqJguTGs/hGPW5URaP1CZ8GDCfv811MWk1mzhV9M7xg1xkEsmtoABFmhLMzwImPvozJAKtn+AXJETXugxZppRSt01DiugAxkZF3BiSgRxQMaqb2etA0VAs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816337; c=relaxed/simple; bh=8lBOVvzvGRf+RpMwtTpzh+BQKToFBXpodpfesW9+iz8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tHFjknaeUwrncM7BllfiCAFuDcTiYfc5Yb3BGoA9DLRt6Ib2ZjKmF2Wr6WwWbUJ2GdnS3zM7x1WgyFkI+DZzSK3veAgtW6DvzPMhSgRA40p7IT5tYAWj0XH48MMem6Bbt2qhX0rqFCm4OMnuUXrOQD9Nw+tJIDv/sPTmsipsyRI= 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=CjnLrBlE; arc=none smtp.client-ip=209.85.210.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="CjnLrBlE" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-7198de684a7so4220062b3a.2; Tue, 01 Oct 2024 13:58:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727816335; x=1728421135; 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=YXiaXkjRmxS0jNHUrwUuLitPui/qQi7NdietjnRpv7U=; b=CjnLrBlEi1Y0CXWudvWHehfJQw78rbp6bctY+i/AcbyfaULV8qEyX8sx4Zn36kjEVd rwRo4svb/WqYvM7tJ/zdrIfn8uCEZs7ycDO1VjFV1T14O/93LSrMt0Ebmf8XWqmOteLm zUmd5IQ5rvVeNSGStfoGCOB/6WjyrWqg8l55UnVRF5LkmyuWBdPQyHcdkv33UFPecF5b cr50zaN3iABFmKbHbbs/OSahgrhfj/FeSI2kcuv3p/LjLkB7+XaNMKbXSRERWRje/z7J z15vrUwfz0QPC/sfN+N4ObZVn7Sl3bXeOKc58AklHErZP/Cd07IdxIr9IZUffwjGazdT aPkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727816335; x=1728421135; 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=YXiaXkjRmxS0jNHUrwUuLitPui/qQi7NdietjnRpv7U=; b=F2ZoeMGh1bVCsVoU68aY7YtFOWT++q1PfFjo1AXPk2O+8lQi1VPmE3xgdpw4t+AEkU ZZse6HUrZTFRUnlMspvgFpFIguRlO6AcIld8et7ML7old33pwNYzwXnqKpydHtyi5zZm 2mdRIc1POcameKJn444J0Y1NZ504WeOE1l5esXxuAgCxrxiqS/Gbp5EWFScCpThF++qM mwZMUtRuSYIw6UB7fUos5BetFAEEkmv6bR9W2j3LG/+lwZCmJa1fGM+6gTlQcPaqedq3 m4GkR2uvz6lgU0Elzxt5j+WeL7ZT3ZIPtmqNH+fPO3pxp2Vk9dbt/vEB2dV93yIaQ7E6 DlRw== X-Forwarded-Encrypted: i=1; AJvYcCX36dcPsfwOS7thXzVTfC85coZ3Xtfnpwtt7M1pWuOQRd2g9n7jkL+5U9KZK/WoYLMVUQNq1BW6t07xBag=@vger.kernel.org X-Gm-Message-State: AOJu0YzXix1i/oHFWSfyVZ6743LhPITxxIF3D5su0iqCe1f1UCg/zd/i XiB/VwPj8aRzGVX7PID8neFv8S+L3ARZs21vcEKtiWWjYQWDJFwAOaF8Y4/p X-Google-Smtp-Source: AGHT+IHw1Dz6EJChxmKwmosEiggoeMOWXKv3rXqOM8l95wzH+XBEQeYHac1io9tfpWa5jz5lVs+ydg== X-Received: by 2002:a05:6a00:b8d:b0:70d:1b48:e362 with SMTP id d2e1a72fcca58-71dc5d6adcemr1218182b3a.26.1727816335164; Tue, 01 Oct 2024 13:58:55 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26518a2asm8545765b3a.107.2024.10.01.13.58.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 13:58:54 -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: [PATCHv2 net-next 06/18] net: ibm: emac: remove bootlist support Date: Tue, 1 Oct 2024 13:58:32 -0700 Message-ID: <20241001205844.306821-7-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241001205844.306821-1-rosenp@gmail.com> References: <20241001205844.306821-1-rosenp@gmail.com> 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" This seems to be mainly used for deterministic interfaces. systemd already does this in userspace. Allows simplifying the driver with a single module_platform_driver. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/core.c | 117 +++------------------------ 1 file changed, 9 insertions(+), 108 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ib= m/emac/core.c index a55e84eb1d4d..a4701e2f9f73 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c @@ -95,21 +95,6 @@ MODULE_LICENSE("GPL"); static u32 busy_phy_map; static DEFINE_MUTEX(emac_phy_map_lock); =20 -/* Having stable interface names is a doomed idea. However, it would be ni= ce - * 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 - * threaded probing, it's a bit harder though. The base idea here is that - * we make up a list of all emacs in the device-tree before we register the - * driver. Every emac will then wait for the previous one in the list to - * initialize before itself. We should also keep that list ordered by - * cell_index. - * That list is only 4 entries long, meaning that additional EMACs don't - * get ordering guarantees unless EMAC_BOOT_LIST_SIZE is increased. - */ - -#define EMAC_BOOT_LIST_SIZE 4 -static struct device_node *emac_boot_list[EMAC_BOOT_LIST_SIZE]; - /* I don't want to litter system log with timeout errors * when we have brain-damaged PHY. */ @@ -2330,14 +2315,12 @@ struct emac_depentry { #define EMAC_DEP_RGMII_IDX 2 #define EMAC_DEP_TAH_IDX 3 #define EMAC_DEP_MDIO_IDX 4 -#define EMAC_DEP_PREV_IDX 5 -#define EMAC_DEP_COUNT 6 +#define EMAC_DEP_COUNT 5 =20 static int emac_check_deps(struct emac_instance *dev, struct emac_depentry *deps) { int i, there =3D 0; - struct device_node *np; =20 for (i =3D 0; i < EMAC_DEP_COUNT; i++) { /* no dependency on that item, allright */ @@ -2345,17 +2328,6 @@ static int emac_check_deps(struct emac_instance *dev, there++; continue; } - /* special case for blist as the dependency might go away */ - if (i =3D=3D EMAC_DEP_PREV_IDX) { - np =3D *(dev->blist - 1); - if (np =3D=3D NULL) { - deps[i].phandle =3D 0; - there++; - continue; - } - if (deps[i].node =3D=3D NULL) - deps[i].node =3D of_node_get(np); - } if (deps[i].node =3D=3D NULL) deps[i].node =3D of_find_node_by_phandle(deps[i].phandle); if (deps[i].node =3D=3D NULL) @@ -2397,8 +2369,6 @@ static int emac_wait_deps(struct emac_instance *dev) deps[EMAC_DEP_TAH_IDX].phandle =3D dev->tah_ph; if (dev->mdio_ph) deps[EMAC_DEP_MDIO_IDX].phandle =3D dev->mdio_ph; - if (dev->blist && dev->blist > emac_boot_list) - deps[EMAC_DEP_PREV_IDX].phandle =3D 0xffffffffu; err =3D emac_check_deps(dev, deps); for (i =3D 0; i < EMAC_DEP_COUNT; i++) { of_node_put(deps[i].node); @@ -2412,7 +2382,6 @@ static int emac_wait_deps(struct emac_instance *dev) dev->tah_dev =3D deps[EMAC_DEP_TAH_IDX].ofdev; dev->mdio_dev =3D deps[EMAC_DEP_MDIO_IDX].ofdev; } - platform_device_put(deps[EMAC_DEP_PREV_IDX].ofdev); return err; } =20 @@ -2993,8 +2962,7 @@ static int emac_probe(struct platform_device *ofdev) struct net_device *ndev; struct emac_instance *dev; struct device_node *np =3D ofdev->dev.of_node; - struct device_node **blist =3D NULL; - int err, i; + int err; =20 /* Skip unused/unwired EMACS. We leave the check for an unused * property here for now, but new flat device trees should set a @@ -3003,21 +2971,14 @@ static int emac_probe(struct platform_device *ofdev) if (of_property_read_bool(np, "unused") || !of_device_is_available(np)) return -ENODEV; =20 - /* Find ourselves in the bootlist if we are there */ - for (i =3D 0; i < EMAC_BOOT_LIST_SIZE; i++) - if (emac_boot_list[i] =3D=3D np) - blist =3D &emac_boot_list[i]; - /* Allocate our net_device structure */ - err =3D -ENOMEM; ndev =3D devm_alloc_etherdev(&ofdev->dev, sizeof(struct emac_instance)); if (!ndev) - goto err_gone; + return -ENOMEM; =20 dev =3D netdev_priv(ndev); dev->ndev =3D ndev; dev->ofdev =3D ofdev; - dev->blist =3D blist; SET_NETDEV_DEV(ndev, &ofdev->dev); =20 /* Initialize some embedded data structures */ @@ -3029,16 +2990,15 @@ static int emac_probe(struct platform_device *ofdev) /* Init various config data based on device-tree */ err =3D emac_init_config(dev); if (err) - goto err_gone; + return err; =20 /* Setup error IRQ handler */ dev->emac_irq =3D platform_get_irq(ofdev, 0); err =3D 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; + return dev_err_probe(&ofdev->dev, err, + "failed to request IRQ %d", dev->emac_irq); } =20 ndev->irq =3D dev->emac_irq; @@ -3046,14 +3006,13 @@ static int emac_probe(struct platform_device *ofdev) dev->emacp =3D devm_platform_ioremap_resource(ofdev, 0); if (IS_ERR(dev->emacp)) { dev_err(&ofdev->dev, "can't map device registers"); - err =3D PTR_ERR(dev->emacp); - goto err_gone; + return PTR_ERR(dev->emacp); } =20 /* Wait for dependent devices */ err =3D emac_wait_deps(dev); if (err) - goto err_gone; + return err; dev->mal =3D platform_get_drvdata(dev->mal_dev); if (dev->mdio_dev !=3D NULL) dev->mdio_instance =3D platform_get_drvdata(dev->mdio_dev); @@ -3181,9 +3140,6 @@ static int emac_probe(struct platform_device *ofdev) mal_unregister_commac(dev->mal, &dev->commac); err_rel_deps: emac_put_deps(dev); - err_gone: - if (blist) - *blist =3D NULL; return err; } =20 @@ -3237,59 +3193,4 @@ static struct platform_driver emac_driver =3D { .remove_new =3D emac_remove, }; =20 -static void __init emac_make_bootlist(void) -{ - struct device_node *np =3D NULL; - int j, max, i =3D 0; - int cell_indices[EMAC_BOOT_LIST_SIZE]; - - /* Collect EMACs */ - while((np =3D of_find_all_nodes(np)) !=3D NULL) { - u32 idx; - - if (of_match_node(emac_match, np) =3D=3D NULL) - continue; - if (of_property_read_bool(np, "unused")) - continue; - if (of_property_read_u32(np, "cell-index", &idx)) - continue; - cell_indices[i] =3D idx; - emac_boot_list[i++] =3D of_node_get(np); - if (i >=3D EMAC_BOOT_LIST_SIZE) { - of_node_put(np); - break; - } - } - max =3D i; - - /* Bubble sort them (doh, what a creative algorithm :-) */ - for (i =3D 0; max > 1 && (i < (max - 1)); i++) - for (j =3D i; j < max; j++) { - if (cell_indices[i] > cell_indices[j]) { - swap(emac_boot_list[i], emac_boot_list[j]); - swap(cell_indices[i], cell_indices[j]); - } - } -} - -static int __init emac_init(void) -{ - /* Build EMAC boot list */ - emac_make_bootlist(); - - return platform_driver_register(&emac_driver); -} - -static void __exit emac_exit(void) -{ - int i; - - platform_driver_unregister(&emac_driver); - - /* Destroy EMAC boot list */ - for (i =3D 0; i < EMAC_BOOT_LIST_SIZE; i++) - of_node_put(emac_boot_list[i]); -} - -module_init(emac_init); -module_exit(emac_exit); +module_platform_driver(emac_driver); --=20 2.46.2 From nobody Thu Nov 28 10:42:16 2024 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.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 BA22A1CF7BD; Tue, 1 Oct 2024 20:58:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816339; cv=none; b=Bvg70LKGj3BBGqgXGHsfERaCsRrPg0/fT85AQzclVqTXHKbIMLob2zKKxQGJshqjxcSBSQ53LSkme71gg4qNAmp7NzZKnrWtnkGdBI8tBnFQNfAD3EaXf+CYAII4KjnV1NIg+m9RIJPWtcz8un8bHPVI44jVGWNlEPSpuFg9ozE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816339; c=relaxed/simple; bh=R3/zEAcwhIv1vvXu5eqLy8v9T/QO1blsvg8rxiWDF6o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rhBEYMFzFybx8stilWSmKPH+pQWONIFG8A3urve5044/1BIrwVtRVj4ZuFBxRi9ZFpN5kAhb+uJVJnsQ4Sngy3OfJi/2Cbs9xfI0CM/tVfaHhwLq3Who9Ov1uwZ69Q/0P6GhN+hkh1boZcUpdYidAm5/93fuUyHnRVlUI4VMlGg= 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=HQ1WVtUr; arc=none smtp.client-ip=209.85.210.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="HQ1WVtUr" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-71798a15ce5so169626b3a.0; Tue, 01 Oct 2024 13:58:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727816337; x=1728421137; 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=DoSnKsCafEyqo0X8z8XwraZSkcHXlpNQF2EXgefwFyU=; b=HQ1WVtUrQ722GAWlMtLRLVJM1b56TfLV9+A/0EOARvJ1aGCol14LrSr0jZmchghoV5 zD2y1ACb14tGubKFZVvVZ+N9l2xcMOXRzC0X9Et2q8WKqGtWxQ2ZVs8vYhyX//UblK3N IW5KbIBzZklgeVO8C512fPOO9rXdluOZFMKU9JLXy/Rm8VxMcs54PmkZA3EsaES2FP7m 6am25P+Ton68do5SCXyzysoaHWfzAhWPtfLBzFcwv+XrZAhLksrRbmfxHsjSzLCJAXdL bwnhn+Df7PEXS/plsz6ufF7JF7uZjWo6JsHi/XjDS1CZtorp87jfdsrD6EivachsyD9j GrkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727816337; x=1728421137; 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=DoSnKsCafEyqo0X8z8XwraZSkcHXlpNQF2EXgefwFyU=; b=fIfxkqpyvFloEa4K0OT5vgGSLBByU+k0JZ7B6/O7ISEwxMuaPdvOzdXWuGihP7ab8m 4V/jUIdI6KToGpGzOaXj0MjXkrKcKZsvNRKADGkBr9nTb6zFE89YiKUigmLKBDJwxTow wO7EuC0tG1tocSgS+PZyWnZjioJnU91bcJeOEobVb0TN4vh92Vro18Djr8CFzl/MWSx3 cnzG+l2fcDfhqsjtlqkiO9siqQ0bI4JWqL5zkRKYC1QVDwzbw7Bg542/PyknUbPt09r8 +R9BSTdWps7hmRFRC64X8s32i3lfeUukammR77/SaSAvNa3HZvED53Ozfrk9oA9ka5FX BrAg== X-Forwarded-Encrypted: i=1; AJvYcCVGH1QMaJZoPzranKBtfkhkZclj6SpERQqiLdrtWtCxoIjaZ4g6XuXTG6R2B55pPub8w75JK9J+invZWfI=@vger.kernel.org X-Gm-Message-State: AOJu0YxYEQAcjljubIK4PhZ4r4tDHaIk+L7xWmfq2e9LEZofEVz6fOat QtmZoc09Jzv3NNpGv4iue4lOlzNWL2GaCOnzQs0uKmHnqcpwDQopC7JrSzlr X-Google-Smtp-Source: AGHT+IEICARG8cGqNN3HJIvgRnic4YE+VxZn1idnnY403ZTunAJB3pdd6mecAa1Sm8o9KZO9Gx7wvQ== X-Received: by 2002:a05:6a20:43a8:b0:1d5:118a:b53a with SMTP id adf61e73a8af0-1d637725a12mr1432978637.21.1727816337032; Tue, 01 Oct 2024 13:58:57 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26518a2asm8545765b3a.107.2024.10.01.13.58.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 13:58:56 -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: [PATCHv2 net-next 07/18] net: ibm: emac: tah: use devm for kzalloc Date: Tue, 1 Oct 2024 13:58:33 -0700 Message-ID: <20241001205844.306821-8-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241001205844.306821-1-rosenp@gmail.com> References: <20241001205844.306821-1-rosenp@gmail.com> 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" Simplifies the probe function by removing gotos. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/tah.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/tah.c b/drivers/net/ethernet/ibm= /emac/tah.c index 8407ff83b1d3..03e0a4445569 100644 --- a/drivers/net/ethernet/ibm/emac/tah.c +++ b/drivers/net/ethernet/ibm/emac/tah.c @@ -90,28 +90,25 @@ static int tah_probe(struct platform_device *ofdev) struct device_node *np =3D ofdev->dev.of_node; struct tah_instance *dev; struct resource regs; - int rc; =20 - rc =3D -ENOMEM; - dev =3D kzalloc(sizeof(struct tah_instance), GFP_KERNEL); - if (dev =3D=3D NULL) - goto err_gone; + dev =3D devm_kzalloc(&ofdev->dev, sizeof(struct tah_instance), + GFP_KERNEL); + if (!dev) + return -ENOMEM; =20 mutex_init(&dev->lock); dev->ofdev =3D ofdev; =20 - rc =3D -ENXIO; if (of_address_to_resource(np, 0, ®s)) { printk(KERN_ERR "%pOF: Can't get registers address\n", np); - goto err_free; + return -ENXIO; } =20 - rc =3D -ENOMEM; dev->base =3D (struct tah_regs __iomem *)ioremap(regs.start, sizeof(struct tah_regs)); if (dev->base =3D=3D NULL) { printk(KERN_ERR "%pOF: Can't map device registers!\n", np); - goto err_free; + return -ENOMEM; } =20 platform_set_drvdata(ofdev, dev); @@ -123,11 +120,6 @@ static int tah_probe(struct platform_device *ofdev) wmb(); =20 return 0; - - err_free: - kfree(dev); - err_gone: - return rc; } =20 static void tah_remove(struct platform_device *ofdev) @@ -137,7 +129,6 @@ static void tah_remove(struct platform_device *ofdev) WARN_ON(dev->users !=3D 0); =20 iounmap(dev->base); - kfree(dev); } =20 static const struct of_device_id tah_match[] =3D --=20 2.46.2 From nobody Thu Nov 28 10:42:16 2024 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.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 3F0DD1CF7DD; Tue, 1 Oct 2024 20:58:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816340; cv=none; b=p7zjX/nfrhCSZIGvSNYqEi8hI5ow+z/Jhqh2JLG+IHDPbK2+fkGZF6KduPYJ/dyheL9AAfvOyTFr71WG/5cMOpjFLYIk5yk1E3Wo04ATLIM8+PmlOBSnNX0cYBzc9Ev94x5Q5AHPBzFMTfy2XZqxkIsZCDO+dH8lXSdD9mMorK8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816340; c=relaxed/simple; bh=2IYzVGZB/me91vV9GKAMx/UOKfRS26DvtY0el6//X54=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gzWAqsaPanXivmvwpwGIsdZ680DVaI1b6hWm3kMM36REbvGlsjcCwgylQCcJFTSxro96ijzlZlpZmJ9HxgxNUkKT4dNpvyWCEeE5DfgxcsKVow46RLRy7erx6bHjTExPXNYYmeuhMZYnrzyldY9kdMRbRMoHcBGnGqu97pFYVTU= 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=c5GvuRtp; arc=none smtp.client-ip=209.85.210.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="c5GvuRtp" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-71afb729f24so4547962b3a.0; Tue, 01 Oct 2024 13:58:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727816338; x=1728421138; 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=sGWXvjbdkPp+9wytWEPAL2W2KtxouZqemO4TuRcnCl0=; b=c5GvuRtpRry3VayfA8BnHa/hxPvStslylhKTJjo18Ngb7mbyzfqJSC9WMDZJabYoqh +Be2ee4QfxSzozYtC9qemZOIC9811YhBI7D9LARcF8xZH01NEJ5X7SbQLB/FB/9kVWoj UR32CGQxQZ7BaaQyd+Q+8bk8l74GlxeBnTfU5NeucCw/FqICeW6mxTdSXEYlz/tdwnw3 /o/lZmkGPcwm8S7FhB6Jo1UQfaOsHX9+uELbWyY0OjCOSLG+z5e7LQOD749KS+oe63Rw 06wFVGxyBLI366BUTMmnlbZxUZeyJnzBDqPveTho3yE0gupwcyc247tAI7gLXshl1RWn Wteg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727816338; x=1728421138; 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=sGWXvjbdkPp+9wytWEPAL2W2KtxouZqemO4TuRcnCl0=; b=D/kOYs8OPat18a4qq+7FIDIS+JoT4c0yB+kDPGbgsQry0ln6FLBHTlodN6FWroUAU+ DY7h0qsSbH6gEt0vsF1oQEcDH6xFUXuPyfOkxnrpyzjKK9dQ2M/jvyT95C/Vc4d1u3VD UQQ6J0Qlaevwa6/2h7qubtDUu6IhdAyhS4CwEW1VtbDoOv7n/Yn7zG6AoZXRdhPYNLod YE93qf/tV9NFy5tkZAT7AJ8MZJP6WqGWXbViIm/Qu6BqKL9ARd6c2OqN0YvAQYcaKSAo vNXZuLFLU5u6y78IemXtbLqFRW2YI3gfCpZR4hkv1+XMDOLejaOihhJsDUaI21sZ+NQf JnRA== X-Forwarded-Encrypted: i=1; AJvYcCVLqmN1yoExvgbno/CSCQAnuFiGOQpH9YhJ3n4NMwdgBQVVhcReCDvEOfxaw2X54qVPBlKvLhbQCqJ9OfU=@vger.kernel.org X-Gm-Message-State: AOJu0YyeLaqsWVaR8CBnmWVZ98qyB2OebWvLt74UsJA5u7sShJEVnoW9 YPUo3u08E261B03jCj4SDZXeIZM1Yl/9GYIQhzlWmeQ/ipN0r5cfDr8GDeh2 X-Google-Smtp-Source: AGHT+IHJ5wb7WXFugRxlHlytowNGbzU87hF3FsPvGSL+Jk8nuv9NtGAtGlKQ8cP9CvB1ssiLsVg8cg== X-Received: by 2002:a05:6a00:391b:b0:714:3acb:9d4b with SMTP id d2e1a72fcca58-71dc5d53786mr1102373b3a.18.1727816338362; Tue, 01 Oct 2024 13:58:58 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26518a2asm8545765b3a.107.2024.10.01.13.58.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 13:58:58 -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: [PATCHv2 net-next 08/18] net: ibm: emac: tah: devm_platform_get_resources Date: Tue, 1 Oct 2024 13:58:34 -0700 Message-ID: <20241001205844.306821-9-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241001205844.306821-1-rosenp@gmail.com> References: <20241001205844.306821-1-rosenp@gmail.com> 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" Simplifies the probe function by a bit and allows removing the _remove function such that devm now handles all cleanup. printk gets converted to dev_err as np is now gone. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/tah.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/tah.c b/drivers/net/ethernet/ibm= /emac/tah.c index 03e0a4445569..27c1b3f77125 100644 --- a/drivers/net/ethernet/ibm/emac/tah.c +++ b/drivers/net/ethernet/ibm/emac/tah.c @@ -87,9 +87,7 @@ void *tah_dump_regs(struct platform_device *ofdev, void *= buf) =20 static int tah_probe(struct platform_device *ofdev) { - struct device_node *np =3D ofdev->dev.of_node; struct tah_instance *dev; - struct resource regs; =20 dev =3D devm_kzalloc(&ofdev->dev, sizeof(struct tah_instance), GFP_KERNEL); @@ -99,16 +97,10 @@ static int tah_probe(struct platform_device *ofdev) mutex_init(&dev->lock); dev->ofdev =3D ofdev; =20 - if (of_address_to_resource(np, 0, ®s)) { - printk(KERN_ERR "%pOF: Can't get registers address\n", np); - return -ENXIO; - } - - dev->base =3D (struct tah_regs __iomem *)ioremap(regs.start, - sizeof(struct tah_regs)); - if (dev->base =3D=3D NULL) { - printk(KERN_ERR "%pOF: Can't map device registers!\n", np); - return -ENOMEM; + dev->base =3D devm_platform_ioremap_resource(ofdev, 0); + if (IS_ERR(dev->base)) { + dev_err(&ofdev->dev, "can't map device registers"); + return PTR_ERR(dev->base); } =20 platform_set_drvdata(ofdev, dev); @@ -122,15 +114,6 @@ static int tah_probe(struct platform_device *ofdev) return 0; } =20 -static void tah_remove(struct platform_device *ofdev) -{ - struct tah_instance *dev =3D platform_get_drvdata(ofdev); - - WARN_ON(dev->users !=3D 0); - - iounmap(dev->base); -} - static const struct of_device_id tah_match[] =3D { { @@ -149,7 +132,6 @@ static struct platform_driver tah_driver =3D { .of_match_table =3D tah_match, }, .probe =3D tah_probe, - .remove_new =3D tah_remove, }; =20 module_platform_driver(tah_driver); --=20 2.46.2 From nobody Thu Nov 28 10:42:16 2024 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 9456C1CFEBA; Tue, 1 Oct 2024 20:59:00 +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=1727816342; cv=none; b=TbSscmykhoILSWmiP6/nvGpxfidP33UyYXH2dMJ0I1iSERiJ6S3YSvdPPy8o1fprQHe7TnfSH6RbvxEHxZaThGZxOqULKcsGhEr4KO7pzWEP+TTPkX6VZVAaVg1Jw3avteygvoQa920eQj4UchHmA5Fh7s4+fQjJSfN14cGLz8w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816342; c=relaxed/simple; bh=A8gJS6fEP9QvIScx57iYcjbGzw0KGh8cHqIn3dIOJyA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M8ok74GHnMeDhuNB3m66LJ1v7zwZBDDWtSKhEGICLxW4PVB3S/qemplsjwr2GL7xF/NrOgMJTrcWNf0DmFbohhtxYlZy4qrmMdlPGFdKaYYGtUvFyBgLqVLkRq98PHoh0p/XdP1A9ht2YW/8dkt1DKtXqUuS7GFQ5VL2cVo1zCE= 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=EO0rBQNA; 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="EO0rBQNA" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-718816be6cbso5081560b3a.1; Tue, 01 Oct 2024 13:59:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727816340; x=1728421140; 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=IT1fHxwhP5+cPvxE4VxQE/C0xITWVI3wQQyc3orisuY=; b=EO0rBQNAcDfLplKQ8xS6tMw93MN+4WT+UsKEe0ImAtMbTvNbuxNGDj4cr8F7JP+9Uw jQmlVOQ6NkKDWFBf5muzZUZBOCT09COLzNndaumPbYWMAgmx2/urqv1xrSCRavtPRQxv 0qTaX2IKKIq/R3Il5MM+9gKGNW96jqHenHr82lPxsBkv6scqFxucXEgMgHlExUkKGcAk bDBlBPG0WC2SAsM+olMBga8BI80xfcIt2q55A7LDAweaUBWC2g9upA6BRVuaHDJsNfEE 1W+qJnThnyg78qXBN6FAqS4fCu8IeBVms7CVJ7esxgv6FkO/uwoaFqgfgIyiGV6pn2WG t6SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727816340; x=1728421140; 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=IT1fHxwhP5+cPvxE4VxQE/C0xITWVI3wQQyc3orisuY=; b=ThMMKbgZQUAU4KzqekZx1ulhW/J5ZCRh6ZBjtchDZQm6sqVe4DB0VotSWR3aT6U5TT IpzeOamsfEZdtlOn9Of1Mj7N2PhmZ2zuhonI6qBOIVjrTKvErGaz92VBiE1sTmBrwHRx cBhpoW1kGk23HmWT65Oe1H6YGEnczyPjvwhPftnQqwllCon7jmi9T9Tsh6QWaLmWDS9i bmE57lHuKIzAB9AjdytrLfiAFxa8Doj4IYKiqknkQwMbHMc3rh9LTBHoOLIueDc0EpoL gfvhoYjCDHotZAklhXo6gKMb1TaukiyqXsSmSXgtCO/Ogmj0araIYiSuFr/phU7A/D1o No2g== X-Forwarded-Encrypted: i=1; AJvYcCXx6IeoL++AAIzEUy5KPDKbiYuSvAVULhcWPpY/UXW/YA5J80kjLKFXf88jeSOZVACjnanHWnGrx4xxjb4=@vger.kernel.org X-Gm-Message-State: AOJu0Yxg4BUIOtkY6ZBcsNBx0vjX3F2f8RWAVj660HlIzQzEq6/spyRl UUP4M+ZxhSuOwMjk65gGNI5N2t7qdcB3EZwJtT4zLJiHbVXCCnecyMnFBM0g X-Google-Smtp-Source: AGHT+IGxV8yw8dGy1HxC4vZs8LyHRKP00v2LFKwzT1j2din20QknoSxr7++3F2aJ3Bo49+gdJv6akg== X-Received: by 2002:a05:6a20:9f08:b0:1cf:32d1:48f with SMTP id adf61e73a8af0-1d5e2cbf20emr1291574637.36.1727816339704; Tue, 01 Oct 2024 13:58:59 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26518a2asm8545765b3a.107.2024.10.01.13.58.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 13:58:59 -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: [PATCHv2 net-next 09/18] net: ibm: emac: rgmii: use devm for kzalloc Date: Tue, 1 Oct 2024 13:58:35 -0700 Message-ID: <20241001205844.306821-10-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241001205844.306821-1-rosenp@gmail.com> References: <20241001205844.306821-1-rosenp@gmail.com> 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" Simplifies the probe function by removing gotos. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/rgmii.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/rgmii.c b/drivers/net/ethernet/i= bm/emac/rgmii.c index 52f080661f87..8c646a5e5c56 100644 --- a/drivers/net/ethernet/ibm/emac/rgmii.c +++ b/drivers/net/ethernet/ibm/emac/rgmii.c @@ -219,28 +219,25 @@ static int rgmii_probe(struct platform_device *ofdev) struct device_node *np =3D ofdev->dev.of_node; struct rgmii_instance *dev; struct resource regs; - int rc; =20 - rc =3D -ENOMEM; - dev =3D kzalloc(sizeof(struct rgmii_instance), GFP_KERNEL); - if (dev =3D=3D NULL) - goto err_gone; + dev =3D devm_kzalloc(&ofdev->dev, sizeof(struct rgmii_instance), + GFP_KERNEL); + if (!dev) + return -ENOMEM; =20 mutex_init(&dev->lock); dev->ofdev =3D ofdev; =20 - rc =3D -ENXIO; if (of_address_to_resource(np, 0, ®s)) { printk(KERN_ERR "%pOF: Can't get registers address\n", np); - goto err_free; + return -ENXIO; } =20 - rc =3D -ENOMEM; dev->base =3D (struct rgmii_regs __iomem *)ioremap(regs.start, sizeof(struct rgmii_regs)); if (dev->base =3D=3D NULL) { printk(KERN_ERR "%pOF: Can't map device registers!\n", np); - goto err_free; + return -ENOMEM; } =20 /* Check for RGMII flags */ @@ -266,11 +263,6 @@ static int rgmii_probe(struct platform_device *ofdev) platform_set_drvdata(ofdev, dev); =20 return 0; - - err_free: - kfree(dev); - err_gone: - return rc; } =20 static void rgmii_remove(struct platform_device *ofdev) @@ -280,7 +272,6 @@ static void rgmii_remove(struct platform_device *ofdev) WARN_ON(dev->users !=3D 0); =20 iounmap(dev->base); - kfree(dev); } =20 static const struct of_device_id rgmii_match[] =3D --=20 2.46.2 From nobody Thu Nov 28 10:42:16 2024 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (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 CFC291D0145; Tue, 1 Oct 2024 20:59:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816343; cv=none; b=MKQSVTg7aHTGmtd8meMomJilvOxgGMcSKHTh/sMkCVsXjn/KHZt+ABd1Vwj+Bbj9EEDrPWH4DfGNBhESatSEWWBdPGPzUL7vIIP6dikZSLW+CXRzvfuYLUH2WEjNeMogJe6fjXpp6MeXemfrqCeRysJXOM+EjfTBOowtpTNqyzg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816343; c=relaxed/simple; bh=FHY66iZ1UrcrbeXKE99B9ikoT6GAi0J+noOtDA2DGFw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tFCFIu6yMs+BIl869K2SyIcy0ycWhN+6WQEpoGsb8+Tzyj1Pblk8LlIjk6Bg6pMHIq8fZXFPFNyF0Oet3fEQO+vrc3kdjpgQKv47YPb1qKBVOlXhAMhxWSVIO32kIUuGLX6YIlbGa5DXPzssck8MOFJMCqnNIIbvk6phGmvHSrE= 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=m+QEYX8h; arc=none smtp.client-ip=209.85.210.177 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="m+QEYX8h" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-71788bfe60eso4458832b3a.1; Tue, 01 Oct 2024 13:59:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727816341; x=1728421141; 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=PCLbZsayLlcNqhgpjNVIbKiCMjSAjR3dphSfWdGQgSs=; b=m+QEYX8hOAmeVGqfu2gN8Xsx9xAVJewp7hMh7WZ9aKp4GtY4LIKigcJjm0c/7J4/1v JNR05Z8DFn9tdUxydmxFS3bezBAD0+flQE3W7OY+d7c+aQEyLNGA6RLoQBuDGzTHJUid tS7l0szKh/qXro3Dk9xdjpJmitNL8TbZrFAdNxDt7U5tn6iAmhgDqA7IDqYP+nB9Nmq/ r1xfWpI4J8bsPz+mjeNUNqSIbiGQC13UFUB+1ZvtM9uHqWDA2Db2093kKhf8eaD0I6Fw IATSVMjutm7EiZylzgo0Ra5NFIeWC61vCDaOKuiKUsoqN4B/4Lr46y2KAJNRvR4Ta7Q6 qN6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727816341; x=1728421141; 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=PCLbZsayLlcNqhgpjNVIbKiCMjSAjR3dphSfWdGQgSs=; b=CCA91bPb0GjKe2k/FGGZZJRXC9zziQ5xlonPQI2Qo2hs4YGOL1wtgr3A4Dp3dV3W9K XFJlzJvSyXbo2SodmWFJRsfrmVl1EP7WgZL029iaEc9w29+eZVPlD8wRfi4uDIQCQBQt RkJ9fbtIOITAd4VEb1a4FcRko0G70Mw+o0Mx7ioUt85ST04n2HYQsIAeIAXEcF3MRJEP Vq7RHxfxN25uPE/hQoMeM3z0Pm5xAyxLMIQbocwQmmldiLHu2KCRkvPofz9IGNZik3at WZcDvnV8LyP/ZL9uNJ9w2RH7wbW9Fj3Vzhlg0elMKhEPEM+LJV9nZJr8yGITPqossOWA RcYg== X-Forwarded-Encrypted: i=1; AJvYcCXVZpHDLyTv9cZAW2TPhp7XRkmUuI0wl1pU8A2o2O7XOqIkHlfffI3FXDgYAmUvUpyP7Y3thmCDpQjuC9c=@vger.kernel.org X-Gm-Message-State: AOJu0YzpUQbkF4W+KUmdskC9dxIjwUHMJVLtWSLcEKNbhN7GDckGZ9fQ 3BZj7xo5LoU/wOGZFcckOeC0/kEJFTAEvxhB6v+cY+QKuWPtsA18P1bANOTE X-Google-Smtp-Source: AGHT+IH2e2iz/6iGzx2q06St1nGx7MBiueTm87p85AqIrG7BHenR97sY1ssoMmd3g42AqZS8mTeW7Q== X-Received: by 2002:a05:6a20:4499:b0:1d5:377c:224c with SMTP id adf61e73a8af0-1d5e2d9e14emr1378603637.37.1727816341077; Tue, 01 Oct 2024 13:59:01 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26518a2asm8545765b3a.107.2024.10.01.13.58.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 13:59:00 -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: [PATCHv2 net-next 10/18] net: ibm: emac: rgmii: devm_platform_get_resource Date: Tue, 1 Oct 2024 13:58:36 -0700 Message-ID: <20241001205844.306821-11-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241001205844.306821-1-rosenp@gmail.com> References: <20241001205844.306821-1-rosenp@gmail.com> 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" Simplifies the probe function by a bit and allows removing the _remove function such that devm now handles all cleanup. printk gets converted to dev_err as np is now gone. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/rgmii.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/rgmii.c b/drivers/net/ethernet/i= bm/emac/rgmii.c index 8c646a5e5c56..25a13a00a614 100644 --- a/drivers/net/ethernet/ibm/emac/rgmii.c +++ b/drivers/net/ethernet/ibm/emac/rgmii.c @@ -216,9 +216,7 @@ void *rgmii_dump_regs(struct platform_device *ofdev, vo= id *buf) =20 static int rgmii_probe(struct platform_device *ofdev) { - struct device_node *np =3D ofdev->dev.of_node; struct rgmii_instance *dev; - struct resource regs; =20 dev =3D devm_kzalloc(&ofdev->dev, sizeof(struct rgmii_instance), GFP_KERNEL); @@ -228,16 +226,10 @@ static int rgmii_probe(struct platform_device *ofdev) mutex_init(&dev->lock); dev->ofdev =3D ofdev; =20 - if (of_address_to_resource(np, 0, ®s)) { - printk(KERN_ERR "%pOF: Can't get registers address\n", np); - return -ENXIO; - } - - dev->base =3D (struct rgmii_regs __iomem *)ioremap(regs.start, - sizeof(struct rgmii_regs)); - if (dev->base =3D=3D NULL) { - printk(KERN_ERR "%pOF: Can't map device registers!\n", np); - return -ENOMEM; + dev->base =3D devm_platform_ioremap_resource(ofdev, 0); + if (IS_ERR(dev->base)) { + dev_err(&ofdev->dev, "can't map device registers"); + return PTR_ERR(dev->base); } =20 /* Check for RGMII flags */ @@ -265,15 +257,6 @@ static int rgmii_probe(struct platform_device *ofdev) return 0; } =20 -static void rgmii_remove(struct platform_device *ofdev) -{ - struct rgmii_instance *dev =3D platform_get_drvdata(ofdev); - - WARN_ON(dev->users !=3D 0); - - iounmap(dev->base); -} - static const struct of_device_id rgmii_match[] =3D { { @@ -291,7 +274,6 @@ static struct platform_driver rgmii_driver =3D { .of_match_table =3D rgmii_match, }, .probe =3D rgmii_probe, - .remove_new =3D rgmii_remove, }; =20 module_platform_driver(rgmii_driver); --=20 2.46.2 From nobody Thu Nov 28 10:42:16 2024 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (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 2E4181CFED6; Tue, 1 Oct 2024 20:59:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816344; cv=none; b=Q0JAPdOaBLzswAgv6h9QLZ5KCvTD8YhW7i58ST9KIy2KhFvIWithi7A8F2RzmsGfsqdCHENUds0JIamKutKJZLbuUxkIBoXCgd6ElUN6j6I3dFmEOAl58mYSPXGPP5JM6MKa/RqOERRCkWnS1sbn3OvmnPTx1tmeQDTyCY6nNNE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816344; c=relaxed/simple; bh=jcEPPiC20NiN9gN9PQRjLJGI4IFmPIwO1pV6PvaDEDM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I7LRpWrdT5qYBTKBU0TRwLmZ7jI4mxeQliUUqeoWjXk3HZvlAo+obQdDvH2SG94u7FuAgfeKZl4on0cVa3jdLObShFOq0rCSKP0hZhauEqPKWUTy43WecRCVP7oGhidUuPV2PT4RWJnlS4aIpAOtBcADRFqey4McgVZSeY2vKf4= 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=KmkngTzK; arc=none smtp.client-ip=209.85.210.178 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="KmkngTzK" Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-7179069d029so4352760b3a.2; Tue, 01 Oct 2024 13:59:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727816342; x=1728421142; 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=z5PeKEFZjGrSAzWG8C4rr3WYbWfyAh6vUs2OEDpSIRE=; b=KmkngTzKSOz1gy50cOolKn57ITeBke85nBPP9BvOEiCSRFDev/K6LV0isf9i9dYdwn QSz7sJDWFhm16egqFcpNgwV1sB6L4ogIPPGxxfvR9w5zsWBLWCDGvm/d4XbHgbqY1hB0 WlSUYatjJ/FYiyFNwoKL52Km6LXkqsg1RLiZ3jgiaCeOeNVUzgvkdsBC3Av+XtIEXhKY nsBb5Ac7x6/edM8aoYPByBlD0wymEgovYWOLPTmXLHX4YGuydibXTc1/sGW8ZswrQygl Yo0q0MbGqZMOVJMRxcUPFWROrOdYwBf2vWpF+T1DOGcKQfkSt8MqXDMvsTIsKvSiJZN1 apmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727816342; x=1728421142; 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=z5PeKEFZjGrSAzWG8C4rr3WYbWfyAh6vUs2OEDpSIRE=; b=RdkrEtUIr7FQQJHQbavhVvF24sJyz0fDJwYSPstar9QYvNwgvKvA2FWmhrGwnkphV1 ypzicxxHx9hfiKITnzwQTyCHcAKhLk3pVtLAGR6z/GfjyIvM/VVdWHF456CYkQQGEdSx GC1f+p5CSJl3t16ra/HHTVJUQTN9rbI3ECQN5YwybUpritsccg5ZoXSCTAtJOg9leTXw kd5ZAojxTH1QsFQZn4z0D6OUKWrSty6DOl4k+jcbm066MU2Mz8Gh1NTv+xpbLkFEYUGx KmDkaBi/xQqRHIUTGQFTNo9TU1m6k57h9TPGOYy52qJxQmhdB63xAwJjvr+nNA1qHfbW nCIQ== X-Forwarded-Encrypted: i=1; AJvYcCXZGqQTNytlTQ4jlWxQLwMre7ykluohtfI3gZOog9nl3C5H69RqROAbhFnFZOXnVCVihINi8TbEQnHyD6Y=@vger.kernel.org X-Gm-Message-State: AOJu0YwoChc2gVytEtNw7Tr34Z1Nz1Ih+p0KR/OAqe9y6G6cpNgjAYfS e4dC1WngpTZs4tkq8m/i7cH1MlPDOHTsggN73GgGwuUXYylQfSIb1wPEYsVj X-Google-Smtp-Source: AGHT+IEJl9jp7E0wfRjiQJ4HhJobY59MYo5IrBRZ+mLg1s3hkFrFO+DP+EpyMmIbl3dBTOYi8fmlvQ== X-Received: by 2002:a05:6a00:1812:b0:718:dd1e:de1a with SMTP id d2e1a72fcca58-71dc5d6ee67mr1457606b3a.28.1727816342509; Tue, 01 Oct 2024 13:59:02 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26518a2asm8545765b3a.107.2024.10.01.13.59.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 13:59:02 -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: [PATCHv2 net-next 11/18] net: ibm: emac: zmii: use devm for kzalloc Date: Tue, 1 Oct 2024 13:58:37 -0700 Message-ID: <20241001205844.306821-12-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241001205844.306821-1-rosenp@gmail.com> References: <20241001205844.306821-1-rosenp@gmail.com> 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" Simplifies the probe function by removing gotos. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/zmii.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/zmii.c b/drivers/net/ethernet/ib= m/emac/zmii.c index 97cea64abe55..c38eb6b3173e 100644 --- a/drivers/net/ethernet/ibm/emac/zmii.c +++ b/drivers/net/ethernet/ibm/emac/zmii.c @@ -235,29 +235,26 @@ static int zmii_probe(struct platform_device *ofdev) struct device_node *np =3D ofdev->dev.of_node; struct zmii_instance *dev; struct resource regs; - int rc; =20 - rc =3D -ENOMEM; - dev =3D kzalloc(sizeof(struct zmii_instance), GFP_KERNEL); - if (dev =3D=3D NULL) - goto err_gone; + dev =3D devm_kzalloc(&ofdev->dev, sizeof(struct zmii_instance), + GFP_KERNEL); + if (!dev) + return -ENOMEM; =20 mutex_init(&dev->lock); dev->ofdev =3D ofdev; dev->mode =3D PHY_INTERFACE_MODE_NA; =20 - rc =3D -ENXIO; if (of_address_to_resource(np, 0, ®s)) { printk(KERN_ERR "%pOF: Can't get registers address\n", np); - goto err_free; + return -ENXIO; } =20 - rc =3D -ENOMEM; dev->base =3D (struct zmii_regs __iomem *)ioremap(regs.start, sizeof(struct zmii_regs)); - if (dev->base =3D=3D NULL) { + if (!dev->base) { printk(KERN_ERR "%pOF: Can't map device registers!\n", np); - goto err_free; + return -ENOMEM; } =20 /* We may need FER value for autodetection later */ @@ -271,11 +268,6 @@ static int zmii_probe(struct platform_device *ofdev) platform_set_drvdata(ofdev, dev); =20 return 0; - - err_free: - kfree(dev); - err_gone: - return rc; } =20 static void zmii_remove(struct platform_device *ofdev) @@ -285,7 +277,6 @@ static void zmii_remove(struct platform_device *ofdev) WARN_ON(dev->users !=3D 0); =20 iounmap(dev->base); - kfree(dev); } =20 static const struct of_device_id zmii_match[] =3D --=20 2.46.2 From nobody Thu Nov 28 10:42:16 2024 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (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 AAB431D0419; Tue, 1 Oct 2024 20:59:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816346; cv=none; b=Y/AFyZfnTCCdds0KewwCnlvOszrfPZptRhrjPI7jexaguc9kx9F0nHKP/P8FIMtkp6XDkjvlmAerDq9rgGG0L8T3+Z+YrXqM6mLHTHbwGivNwGvvnqrLNvfSqUjfuV4ATVpELKqR3ks+3Ywu7wm0nptRkwhtXTT02znydJCFoAo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816346; c=relaxed/simple; bh=/JFQ1f+yHsjb5Zt6+gt8OydljzAA9ds8/yUsrr7/NQY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q/oi9mvSk+QeC48UJQm8WE2szUxJbkVzNjmZYRowdFCdQN+wj03GhTgtOWHjd65N/tTnmloTY8hCnVrWqMbNT2Zz2sLIB3fDo0Jl67Me6RVgS5qXt4W0IiyQsHxzMzcQOUwyOsnDIYVYODQfNwNz0qX4n/YiTgRiJCXqK9EY0Gk= 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=gX8UZAn+; arc=none smtp.client-ip=209.85.210.169 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="gX8UZAn+" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-718d606726cso4292438b3a.3; Tue, 01 Oct 2024 13:59:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727816344; x=1728421144; 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=JLSo4Y+RlvJE8rHN+xUYDaCM/v2W+3AtNr9b9F2/l8E=; b=gX8UZAn+JIE7EKi4orSs93tOETvLn8Wrlcrm4NApsZgTwkr7RLQJwME/2RKtg5No/J hkkbNXTwKoyRGrxsX0oH6GinbnxCOgaoGNxvAwN5CKaxkuAHu71wFU0f19rod7IIgyC5 clYtHsYXFmR5TDNZUjkPzWTJxER+Eh8msQqzISHvG2RoZjt1lrfVmIPMiN1rcvvOwXXP PddxD2PbUZSbwgsK+FZioWLRWip5/CsKgspnHdZ12JMVlT5j1dX/VRv0AoMuZv+8kDfB EJoIPO3I/G9JcmV5lDYaT4BCBUUhC+0/WL0R+IH7UsY4HBro4C7CaJ8XAqujYuiBNDiu blwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727816344; x=1728421144; 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=JLSo4Y+RlvJE8rHN+xUYDaCM/v2W+3AtNr9b9F2/l8E=; b=glq8qDvIBe7sQJ+qDhezmHoEoEZVP2d+POiHV+E/FhnnsIojQ7uA3lmk7X7GP0+J3v oJRt6dFKOwBLoklRwYFg5lObLq/bR4oHlpIjRYQmKgDx45XpvNoScy+ljsD1xCpUjaST kHcd7sJ958mS2s1+k97AMd/pBT+GEaCjLFfjpg6f6JzXwZOST6xcSa4Fu7llYuIW5Oyr 56a4phhnGhQUhsVKoeUBneKgOakaDdfSu/PsjhjH86ejcobIq7uPsEUB7lZ3UuKu10fM demX/8keVpnTb2SzHgHPoc9kkqfX4Bk1mo2676jf1nfdjrwy1VMur960DFFriA4G72Hh K+BA== X-Forwarded-Encrypted: i=1; AJvYcCUDjXkXeBhJNkv/GzADxXUPXT8VBvd4Rg3p0plAq3eJZHUT7a6Aby2+NBOovnW09s5pIDimV6XS6rCv6dY=@vger.kernel.org X-Gm-Message-State: AOJu0YxC0/a18DAa0MvgPnTMa04d5By2it2fK0osAMrty2GK40I9+YY7 SFJeFOXWNHpFEjA8T2QrgsrLKs7Zdhj4fDQIQ0/QiDejwKrjdQcbUqvgjfqu X-Google-Smtp-Source: AGHT+IFEBRLobt6TFhfSwc1KaG2FVTkG+GoIH6LlYyDbTeZR1H7TIWh9jwc0S2SrCduHb3V6noJyOg== X-Received: by 2002:a05:6a00:4f8f:b0:70e:a524:6490 with SMTP id d2e1a72fcca58-71dc5c42a8dmr1575449b3a.1.1727816343907; Tue, 01 Oct 2024 13:59:03 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26518a2asm8545765b3a.107.2024.10.01.13.59.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 13:59:03 -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: [PATCHv2 net-next 12/18] net: ibm: emac: zmii: devm_platform_get_resource Date: Tue, 1 Oct 2024 13:58:38 -0700 Message-ID: <20241001205844.306821-13-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241001205844.306821-1-rosenp@gmail.com> References: <20241001205844.306821-1-rosenp@gmail.com> 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" Simplifies the probe function by a bit and allows removing the _remove function such that devm now handles all cleanup. printk gets converted to dev_err as np is now gone. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/zmii.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/zmii.c b/drivers/net/ethernet/ib= m/emac/zmii.c index c38eb6b3173e..abe14f4a8ea6 100644 --- a/drivers/net/ethernet/ibm/emac/zmii.c +++ b/drivers/net/ethernet/ibm/emac/zmii.c @@ -232,9 +232,7 @@ void *zmii_dump_regs(struct platform_device *ofdev, voi= d *buf) =20 static int zmii_probe(struct platform_device *ofdev) { - struct device_node *np =3D ofdev->dev.of_node; struct zmii_instance *dev; - struct resource regs; =20 dev =3D devm_kzalloc(&ofdev->dev, sizeof(struct zmii_instance), GFP_KERNEL); @@ -245,16 +243,10 @@ static int zmii_probe(struct platform_device *ofdev) dev->ofdev =3D ofdev; dev->mode =3D PHY_INTERFACE_MODE_NA; =20 - if (of_address_to_resource(np, 0, ®s)) { - printk(KERN_ERR "%pOF: Can't get registers address\n", np); - return -ENXIO; - } - - dev->base =3D (struct zmii_regs __iomem *)ioremap(regs.start, - sizeof(struct zmii_regs)); - if (!dev->base) { - printk(KERN_ERR "%pOF: Can't map device registers!\n", np); - return -ENOMEM; + dev->base =3D devm_platform_ioremap_resource(ofdev, 0); + if (IS_ERR(dev->base)) { + dev_err(&ofdev->dev, "can't map device registers"); + return PTR_ERR(dev->base); } =20 /* We may need FER value for autodetection later */ @@ -270,15 +262,6 @@ static int zmii_probe(struct platform_device *ofdev) return 0; } =20 -static void zmii_remove(struct platform_device *ofdev) -{ - struct zmii_instance *dev =3D platform_get_drvdata(ofdev); - - WARN_ON(dev->users !=3D 0); - - iounmap(dev->base); -} - static const struct of_device_id zmii_match[] =3D { { @@ -297,7 +280,6 @@ static struct platform_driver zmii_driver =3D { .of_match_table =3D zmii_match, }, .probe =3D zmii_probe, - .remove_new =3D zmii_remove, }; =20 module_platform_driver(zmii_driver); --=20 2.46.2 From nobody Thu Nov 28 10:42:16 2024 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 1EA361D0480; Tue, 1 Oct 2024 20:59:06 +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=1727816347; cv=none; b=KKF/IcSFVZc/FvAeAFRipJOIYl1BD0vEcYp91I0VySHDyRexFlrkVapg6rJMsz+WAEBMs1GwK3PwXx3jP18QPGMoLBz/JDsm5u/tjTbH+hH9xcxAZoDywnKbu5X5paryEAtK6zF3mzO6/YYNGpIaftQCsqgi8QPpuovwZwJRiCA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816347; c=relaxed/simple; bh=kih75HuZ1ZXc3JQHkzwuj//sPN9nSONeRe7im09vADU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mD+Nz3ZsrfDUyfpGRTqyvy7cypbfAIVl1MyfFxbqHpgQ7fLSr5XEKBdh1xJWYFZCANj0fbDUtSBOVbgZbExLrI4CzO/Tn9pm5X1xeGSLWhj6YjNjjrJ4KaxtyStihfQheIViScB5tUc/1Z3u/h5VVUnygAfN4TsyFp23zNsxiVA= 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=iEdYJizs; 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="iEdYJizs" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-718e9c8bd83so143472b3a.1; Tue, 01 Oct 2024 13:59:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727816345; x=1728421145; 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=RUV0cdXbjkkkderKYay9dxBu1U/jTzVeigZXhXzokHI=; b=iEdYJizs2gYyID5wiR64E/pt1edqBYSeAO3BEYiO3ZYpbvmXO4oVp1oBSp3HlfCB+p OvQNcTtMMoTrRaAvPDaPzydtlxq6QtqqNVYdqaBo9D3brIEjgMPk59caC9LNCdrO4qV7 CHiVAGIxnfbrwgQupUKT85n+l7se2vFwoP7waCg6fAUjTXriT/TIQjq6J11ws/+a0aRc ORGE6ZGwTgg7ZnPG86xXJizzW87uKOYyZmYIkgmB+obJmGWoeHR/N17ZM1WzHxXfj6kv W3hU6FSHvODYF8IaB1ZM4pDeu4HA0hOsg70FFlbq+5ajn9vrnTVmuY/AUllb0ZeVgewj TI5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727816345; x=1728421145; 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=RUV0cdXbjkkkderKYay9dxBu1U/jTzVeigZXhXzokHI=; b=r8MG911U/bfXJ3B1Yd2nGSo6Yc+S5dNpO03XKP/OxSOIHSJQLy/MN22OcR01WTok8E 5cS00S4AUcj6yp3Qscx8FgO8esf0cl94slOnqbcaDk8Wn6eygV11NralGE1nfJhskpNx 4Vyl3sQ5m3OKYmZmltxt/eHo2c9SkPbqErcMO5O76i5NADFc/gnROhXFGgQqd1SFxLz9 bqJLItqkZWIb+Dg24ESmKHJL056HVi6+y67aHhMgo1Ts191UUuCCqnp1rNoLad3Kfa0g xYvwx2Q71cpvSqIB2A8nmnJvl8eKW8XDKPqzEWSktDDNzmbKnzVcyDINgiwVwCjyMy9A hxMw== X-Forwarded-Encrypted: i=1; AJvYcCUXPn0BmzY1K4aTwLGEfm/4GE8H7JRDeZSRM6c9EwMyOWXuPuABLFsL5Im928nYP4YIrLU06sQK1ZdKqiU=@vger.kernel.org X-Gm-Message-State: AOJu0YzxPG4GcHlM+NuM+GMznIgy+NV88z6fnbOh1HK2ju3fomWBV9Bk X6d6kQ/vF/YbtUBmi//u6RfJP97v9rIobDQ8RdJM1XNLNAYdq+NgvwfAXzVh X-Google-Smtp-Source: AGHT+IEPxzvNScKQNQm7dPkLR90wp5u61+WvMqPKalhuzUb0NjIffa1x8azk9U+tSHd6wFEUw0mLTQ== X-Received: by 2002:a05:6a21:3996:b0:1d3:1fea:27d8 with SMTP id adf61e73a8af0-1d62e1deae6mr1303764637.5.1727816345372; Tue, 01 Oct 2024 13:59:05 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26518a2asm8545765b3a.107.2024.10.01.13.59.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 13:59:05 -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: [PATCHv2 net-next 13/18] net: ibm: emac: mal: use devm for kzalloc Date: Tue, 1 Oct 2024 13:58:39 -0700 Message-ID: <20241001205844.306821-14-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241001205844.306821-1-rosenp@gmail.com> References: <20241001205844.306821-1-rosenp@gmail.com> 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" Simplifies the probe function by removing gotos. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/mal.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm= /emac/mal.c index a632d3a207d3..70019ced47ff 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c @@ -524,7 +524,8 @@ static int mal_probe(struct platform_device *ofdev) unsigned long irqflags; irq_handler_t hdlr_serr, hdlr_txde, hdlr_rxde; =20 - mal =3D kzalloc(sizeof(struct mal_instance), GFP_KERNEL); + mal =3D devm_kzalloc(&ofdev->dev, sizeof(struct mal_instance), + GFP_KERNEL); if (!mal) return -ENOMEM; =20 @@ -539,8 +540,7 @@ static int mal_probe(struct platform_device *ofdev) printk(KERN_ERR "mal%d: can't find MAL num-tx-chans property!\n", index); - err =3D -ENODEV; - goto fail; + return -ENODEV; } mal->num_tx_chans =3D prop[0]; =20 @@ -549,8 +549,7 @@ static int mal_probe(struct platform_device *ofdev) printk(KERN_ERR "mal%d: can't find MAL num-rx-chans property!\n", index); - err =3D -ENODEV; - goto fail; + return -ENODEV; } mal->num_rx_chans =3D prop[0]; =20 @@ -558,15 +557,13 @@ static int mal_probe(struct platform_device *ofdev) if (dcr_base =3D=3D 0) { printk(KERN_ERR "mal%d: can't find DCR resource!\n", index); - err =3D -ENODEV; - goto fail; + return -ENODEV; } mal->dcr_host =3D dcr_map(ofdev->dev.of_node, dcr_base, 0x100); if (!DCR_MAP_OK(mal->dcr_host)) { printk(KERN_ERR "mal%d: failed to map DCRs !\n", index); - err =3D -ENODEV; - goto fail; + return -ENODEV; } =20 if (of_device_is_compatible(ofdev->dev.of_node, "ibm,mcmal-405ez")) { @@ -577,8 +574,7 @@ static int mal_probe(struct platform_device *ofdev) #else printk(KERN_ERR "%pOF: Support for 405EZ not enabled!\n", ofdev->dev.of_node); - err =3D -ENODEV; - goto fail; + return -ENODEV; #endif } =20 @@ -711,9 +707,6 @@ static int mal_probe(struct platform_device *ofdev) free_netdev(mal->dummy_dev); fail_unmap: dcr_unmap(mal->dcr_host, 0x100); - fail: - kfree(mal); - return err; } =20 @@ -744,10 +737,9 @@ static void mal_remove(struct platform_device *ofdev) =20 dma_free_coherent(&ofdev->dev, sizeof(struct mal_descriptor) * - (NUM_TX_BUFF * mal->num_tx_chans + - NUM_RX_BUFF * mal->num_rx_chans), mal->bd_virt, - mal->bd_dma); - kfree(mal); + (NUM_TX_BUFF * mal->num_tx_chans + + NUM_RX_BUFF * mal->num_rx_chans), + mal->bd_virt, mal->bd_dma); } =20 static const struct of_device_id mal_platform_match[] =3D --=20 2.46.2 From nobody Thu Nov 28 10:42:16 2024 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.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 9E4061D04BE; Tue, 1 Oct 2024 20:59:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816349; cv=none; b=UvOw+yZw5K9OMbo3Ew11uubfSEOak9fCmmTiYujbUq3LJKLMlOALSz0ZcKNav9sz3xRRct3iFotYgGQkEggtSYMraa8rM+aAw0Q+lwzDsivgdZ9izrIEGyMT8pkzks8azxLR04GK5RFStHVeVt9BQ7kryamiiql4DhpvahyP6tk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816349; c=relaxed/simple; bh=tPMaKKCrP3tEFhfNaUWKZ/JHAt5j/C2Ms8f8SpstWRk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D29bLxqFBd/GT52j3oOX4yWysF7y+I3qyp1O9DqF/RN51U47zmVTkxcx50ZUYl5bEcnsumxlg9VclsNdbpdTDx++2MJ7oWqVvQolYMxu+0q0T0aS382QWh8CCSax4BTpXMosVXhCemZXNdfaVjjc9/ep232M4BxkFuO0z6ThYWg= 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=ZD6fM2XR; arc=none smtp.client-ip=209.85.210.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="ZD6fM2XR" Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-7193010d386so5144570b3a.1; Tue, 01 Oct 2024 13:59:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727816347; x=1728421147; 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=r2CvXoVohK/pulVhxC+r21/PlsTS5FXZz7L5qVXfWFU=; b=ZD6fM2XRLw0PajlHufPELfPGlqQfmACA4v9lLMOiTa1QbAlkdpTBgMWChe31jSKtZi xNX9u0BvuESd/YCCQj+ABsnMVuR+awhKJSBDjBVgXq/lc4nCKMdS3vvXD13DoDwQQvjN Nhf1IHITaB2wk8q4mGemWRULapui3GQD94Fd4OWTNaiiLdqh8IUu5kE1aWKCkqj2Otcn D8SVUoe2T2maLtNwMQewjHVMFhClTbtkcJ6GWwwduB2VSCbSZaazsnhOIcSOOVbPRxB4 kd6ctkXvavS9n6WEKepgEMVa0wBEHBEiV3Du3YvF/eYUfPOiAbkt5Nz+I29/pjkSZn2I X+PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727816347; x=1728421147; 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=r2CvXoVohK/pulVhxC+r21/PlsTS5FXZz7L5qVXfWFU=; b=AwGo0w78w8U8Ei0wIt0sMjzmOuUZNcEXISWc0vvXp3dCgyDZtEF2yoE/WeNp11zIS3 sT0OpRSgmijD5bqX8uCuk5BEaKZdFoRxiuEEtTAn8qrtnI1O9RJ4U5MUe2pwlfQIP56e YkMEO4trzAdC8/5/DzR0K4Fy3s0V+21r5SM1G1q3/E/1d0IfbCJCLagDu15KO6bi7gAC xMfuXw2gYIGM/6MF5AUT0vbwrGGcBAwc0budRsuRIuOdSuS6SXlDQhnH2YpGicMYurNT CVu6EEuBBrUjGkXPk9lu3NtEo3nRgwEMSZLxw9z801iqVoYwqqAjRk74fDY60Gju7dlu WwVQ== X-Forwarded-Encrypted: i=1; AJvYcCWqetJxO5Lk7OJfI6mk1YMp6a2iT5jtinVEPmj4q8xJTDv32SKhACqMbSo8VMBU2x+m/DWh+l2ovoKNeiw=@vger.kernel.org X-Gm-Message-State: AOJu0Yx6+5bylTDOkIxeCTR90GeSEP/xpesyMr+P9Yjrht/xL3AYlw9a H6sQS+vnCCbqrxtjRvzYvHR1xxs4Mn5pp74yd6DqwlNy2zcBcye+LTcjNOmB X-Google-Smtp-Source: AGHT+IExqskSEPlAaAbl03P2c1voIEJdJ164dJl1VdCiwHO8F0nt0h1G2m7qpC6svetf+ya9cFr/Gw== X-Received: by 2002:a05:6a00:21ce:b0:710:9d5d:f532 with SMTP id d2e1a72fcca58-71dc5d5c02emr1486774b3a.19.1727816346801; Tue, 01 Oct 2024 13:59:06 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26518a2asm8545765b3a.107.2024.10.01.13.59.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 13:59:06 -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: [PATCHv2 net-next 14/18] net: ibm: emac: mal: use devm for request_irq Date: Tue, 1 Oct 2024 13:58:40 -0700 Message-ID: <20241001205844.306821-15-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241001205844.306821-1-rosenp@gmail.com> References: <20241001205844.306821-1-rosenp@gmail.com> 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" Avoids manual frees. Also replaced irq_of_parse_and_map with platform_get_irq since it's simpler and does the same thing. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/mal.c | 51 ++++++++++++----------------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm= /emac/mal.c index 70019ced47ff..b07b2e0ce478 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c @@ -578,19 +578,19 @@ static int mal_probe(struct platform_device *ofdev) #endif } =20 - mal->txeob_irq =3D irq_of_parse_and_map(ofdev->dev.of_node, 0); - mal->rxeob_irq =3D irq_of_parse_and_map(ofdev->dev.of_node, 1); - mal->serr_irq =3D irq_of_parse_and_map(ofdev->dev.of_node, 2); + mal->txeob_irq =3D platform_get_irq(ofdev, 0); + mal->rxeob_irq =3D platform_get_irq(ofdev, 1); + mal->serr_irq =3D platform_get_irq(ofdev, 2); =20 if (mal_has_feature(mal, MAL_FTR_COMMON_ERR_INT)) { mal->txde_irq =3D mal->rxde_irq =3D mal->serr_irq; } else { - mal->txde_irq =3D irq_of_parse_and_map(ofdev->dev.of_node, 3); - mal->rxde_irq =3D irq_of_parse_and_map(ofdev->dev.of_node, 4); + mal->txde_irq =3D platform_get_irq(ofdev, 3); + mal->rxde_irq =3D platform_get_irq(ofdev, 4); } =20 - if (!mal->txeob_irq || !mal->rxeob_irq || !mal->serr_irq || - !mal->txde_irq || !mal->rxde_irq) { + if (mal->txeob_irq < 0 || mal->rxeob_irq < 0 || mal->serr_irq < 0 || + mal->txde_irq < 0 || mal->rxde_irq < 0) { printk(KERN_ERR "mal%d: failed to map interrupts !\n", index); err =3D -ENODEV; @@ -660,21 +660,26 @@ static int mal_probe(struct platform_device *ofdev) hdlr_rxde =3D mal_rxde; } =20 - err =3D request_irq(mal->serr_irq, hdlr_serr, irqflags, "MAL SERR", mal); + err =3D devm_request_irq(&ofdev->dev, mal->serr_irq, hdlr_serr, irqflags, + "MAL SERR", mal); if (err) goto fail2; - err =3D request_irq(mal->txde_irq, hdlr_txde, irqflags, "MAL TX DE", mal); + err =3D devm_request_irq(&ofdev->dev, mal->txde_irq, hdlr_txde, irqflags, + "MAL TX DE", mal); if (err) - goto fail3; - err =3D request_irq(mal->txeob_irq, mal_txeob, 0, "MAL TX EOB", mal); + goto fail2; + err =3D devm_request_irq(&ofdev->dev, mal->txeob_irq, mal_txeob, 0, + "MAL TX EOB", mal); if (err) - goto fail4; - err =3D request_irq(mal->rxde_irq, hdlr_rxde, irqflags, "MAL RX DE", mal); + goto fail2; + err =3D devm_request_irq(&ofdev->dev, mal->rxde_irq, hdlr_rxde, irqflags, + "MAL RX DE", mal); if (err) - goto fail5; - err =3D request_irq(mal->rxeob_irq, mal_rxeob, 0, "MAL RX EOB", mal); + goto fail2; + err =3D devm_request_irq(&ofdev->dev, mal->rxeob_irq, mal_rxeob, 0, + "MAL RX EOB", mal); if (err) - goto fail6; + goto fail2; =20 /* Enable all MAL SERR interrupt sources */ set_mal_dcrn(mal, MAL_IER, MAL_IER_EVENTS); @@ -693,14 +698,6 @@ static int mal_probe(struct platform_device *ofdev) =20 return 0; =20 - fail6: - free_irq(mal->rxde_irq, mal); - fail5: - free_irq(mal->txeob_irq, mal); - fail4: - free_irq(mal->txde_irq, mal); - fail3: - free_irq(mal->serr_irq, mal); fail2: dma_free_coherent(&ofdev->dev, bd_size, mal->bd_virt, mal->bd_dma); fail_dummy: @@ -725,12 +722,6 @@ static void mal_remove(struct platform_device *ofdev) "mal%d: commac list is not empty on remove!\n", mal->index); =20 - free_irq(mal->serr_irq, mal); - free_irq(mal->txde_irq, mal); - free_irq(mal->txeob_irq, mal); - free_irq(mal->rxde_irq, mal); - free_irq(mal->rxeob_irq, mal); - mal_reset(mal); =20 free_netdev(mal->dummy_dev); --=20 2.46.2 From nobody Thu Nov 28 10:42:16 2024 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (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 025CE1D0795; Tue, 1 Oct 2024 20:59:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816350; cv=none; b=YOhkylZKbYfaWdV8zCIkGt91fSpT+quwLY0UQn7RTScla9c2+1xvYjnpXBKNVD5/aP49UZSZZS6JVaKC7i+sfHnsoPkNc3d6lPb3rJeFs5kb8QnYJIjIeD8bzoOc79MMSUHkJZc/K7jDswNGqCMl2mu5iRfKCHJJB550gNgmGr0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816350; c=relaxed/simple; bh=eKiO/LEIBXXwlQ4KH7qVz+fyrkTR0L1Ipshtf4VGCgw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sNtBUF1iaEQVlOazmGDjBbB9cU6ni5CjcNpCLLBBR/E8nGEj7BsdmrRxm838FxyfeLlUDOnWHT98g+5pFjOWZdn04cXB0DXsDvICzS/7GV3+RIJ8zH3gyXijfE6e/fIHqcTavLYxdOVGnhBEVKXONastOMxZt1jM1jrrKWABWfc= 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=ZC9NU5Rz; arc=none smtp.client-ip=209.85.210.177 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="ZC9NU5Rz" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-71b20ffd809so4528775b3a.0; Tue, 01 Oct 2024 13:59:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727816348; x=1728421148; 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=Dq4R22bB9X5Y2tGuUBetWh4QBzSEUK/HudSJSZz34VU=; b=ZC9NU5Rzy5qyEZIVpJ9tT3lOfsTX4H+dZ/aYYe3AB9eyoagKVSaS8MoZzVBnxCkMtC h3b9+sx/K2oFkBBgdb9brkj4AcJtOjEXPkm94gjMiBdlwllDML1fsocVV+nVNIdhEKPd C4LftyTTw5qErRslT8W3OMmT/pz/NGvMYbwYxBwlMP6R707strFiMbzjgRJXWZYrvSoW W7u1z67pe5dX1VEyXYT7nKdoXkFc47kkZTzF0btaqCG1wlq/QQgLpFUFzy37HKlIaqsk Mzao3sjC86rbM3/Y2EyIJPwRKF19PbOLN5fo3/Ceb2WR+urnNe/oNTtVyBoFawRp9NHX qOQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727816348; x=1728421148; 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=Dq4R22bB9X5Y2tGuUBetWh4QBzSEUK/HudSJSZz34VU=; b=IbWs+02U8tr7qC68fzTb4sHlr+nXVJf8jpP+P2Yk6fXkxsqgDXVmiTKDFZ4POh6mrz 7eKdu11hkJZdUB8fS21bV5dHnX2Y2oWAsOf/G+Yd/kOJ6XajrOpJmdOlmw+GxC/CUL0X SM5zPuAM8NlW/mfLm82G2PeozX5y8rttN7SHjwph/tp1SltJcIqWKJLgBTQiS+DJJIOf exZgJb19d7wBDt68VjOMJn7E8ZqbKHfuS60C/Hm8cPx7nAHTc972pfpDDuuEkHxxVt6Q CAC0dTwE+jh2QCuGXs+7Mp0DED717HMr1/lcQFB8p6tsqu9vv2tA3FZkqOWv4mxVA6Dd fApA== X-Forwarded-Encrypted: i=1; AJvYcCUlYJMYwQkwdGkjUIsLD68CKvIc7NBOYZq0o16VSzfwZk1wojv6ZavvnY6v2bmHYJSUN+tpHq59kkHwaPs=@vger.kernel.org X-Gm-Message-State: AOJu0YxkW6hyXnSu4SpTIE5HXgxbMQEl7d+99XgfT7OsRGf5EU16wsAQ hfNp1LBdvwhokSh0HcMAyL0OEhnPimimfNHBm1uDcZzeo/p+noxdY+CWhLJZ X-Google-Smtp-Source: AGHT+IEciGVV/hoMrTmiuBt8dbyqzKLSexLbyVJuiGff+aDP4NS5+mdQCI1Bx+jJ/eCycGK2j6AagQ== X-Received: by 2002:a05:6a00:178c:b0:70d:2fb5:f996 with SMTP id d2e1a72fcca58-71dc5c67164mr1214460b3a.11.1727816348240; Tue, 01 Oct 2024 13:59:08 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26518a2asm8545765b3a.107.2024.10.01.13.59.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 13:59:07 -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: [PATCHv2 net-next 15/18] net: ibm: emac: mal: move irq maps down Date: Tue, 1 Oct 2024 13:58:41 -0700 Message-ID: <20241001205844.306821-16-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241001205844.306821-1-rosenp@gmail.com> References: <20241001205844.306821-1-rosenp@gmail.com> 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" Moves the handling right before they are used and allows merging a branch. Also get rid of the error handling as devm_request_irq can handle that. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/mal.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm= /emac/mal.c index b07b2e0ce478..3fae1f0ec020 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c @@ -578,25 +578,6 @@ static int mal_probe(struct platform_device *ofdev) #endif } =20 - mal->txeob_irq =3D platform_get_irq(ofdev, 0); - mal->rxeob_irq =3D platform_get_irq(ofdev, 1); - mal->serr_irq =3D platform_get_irq(ofdev, 2); - - if (mal_has_feature(mal, MAL_FTR_COMMON_ERR_INT)) { - mal->txde_irq =3D mal->rxde_irq =3D mal->serr_irq; - } else { - mal->txde_irq =3D platform_get_irq(ofdev, 3); - mal->rxde_irq =3D platform_get_irq(ofdev, 4); - } - - if (mal->txeob_irq < 0 || mal->rxeob_irq < 0 || mal->serr_irq < 0 || - mal->txde_irq < 0 || mal->rxde_irq < 0) { - printk(KERN_ERR - "mal%d: failed to map interrupts !\n", index); - err =3D -ENODEV; - goto fail_unmap; - } - INIT_LIST_HEAD(&mal->poll_list); INIT_LIST_HEAD(&mal->list); spin_lock_init(&mal->lock); @@ -650,10 +631,17 @@ static int mal_probe(struct platform_device *ofdev) sizeof(struct mal_descriptor) * mal_rx_bd_offset(mal, i)); =20 + mal->txeob_irq =3D platform_get_irq(ofdev, 0); + mal->rxeob_irq =3D platform_get_irq(ofdev, 1); + mal->serr_irq =3D platform_get_irq(ofdev, 2); + if (mal_has_feature(mal, MAL_FTR_COMMON_ERR_INT)) { + mal->txde_irq =3D mal->rxde_irq =3D mal->serr_irq; irqflags =3D IRQF_SHARED; hdlr_serr =3D hdlr_txde =3D hdlr_rxde =3D mal_int; } else { + mal->txde_irq =3D platform_get_irq(ofdev, 3); + mal->rxde_irq =3D platform_get_irq(ofdev, 4); irqflags =3D 0; hdlr_serr =3D mal_serr; hdlr_txde =3D mal_txde; --=20 2.46.2 From nobody Thu Nov 28 10:42:16 2024 Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.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 7B0041D07BC; Tue, 1 Oct 2024 20:59:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816351; cv=none; b=g9sDjlSmgpXulcBePpuTYWqS4Pgyl8ycNaRViB7tG/pgK6MQudYjxWHg1+ugGqwjwpGWZkhoCIm+hbguttFO/Ngqii7UnsSuv6zrsHgMmu2+jaT0BgpXbk8RtK9OpjR7rm2Co5u6cRERVj6TvWmgYUSO/4KxGFrXuZsQ+yKG22M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816351; c=relaxed/simple; bh=/0DU2D4l0suTpTwxFVnBC2pcYA9TXDtFcn/7RuksLhM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b6caJo5/FLucnV9Li7sfsE5BhU9n2WPEufCDncqg1xJEH/mB8B1U88ooM53CfFaZf7blOK4csjluYitfRyZe7C0ABHFxsd4PajH2WMYkCs4rYrsUYYZa+t+/5QGfQdCmcbxIqwh+/A4P+LSLtbWkhcr7nqMsFQsYn9YoVYJJvww= 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=lLeVRkEP; arc=none smtp.client-ip=209.85.215.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="lLeVRkEP" Received: by mail-pg1-f175.google.com with SMTP id 41be03b00d2f7-7db1f13b14aso5009052a12.1; Tue, 01 Oct 2024 13:59:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727816350; x=1728421150; 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=DK/BBviZxJUtdFW+6zpJff7e0YBzhNFMUMwbSlcUsKw=; b=lLeVRkEPwbccx5TJyRqTH8kwXPisMb05YWUmop/fncW2RKIo+ZjhkfauxTvq0085uh ndWmLCDM3IFZuGcjaHIZWbUebJrIMmNKQ1WWqWNT3RVWfU6i6OXifGQrInOPHGd+3S3Y AixqgVAzO4FwM5sUsQ3bT1AHgK6HkjBj18ey/PYStdD0tFSagbAO7Zl7D34oV61jukmY tmqh8NbbvfaxLo3BCVNRWCD1a39RFu9DCEF0KM1ey5/4RqbP0Zaz/ybyF526yEGWoncv TWDcBfU1NHSPxJoXbWt7hf7RXbWb9nHDhJFLa+cDS5i2bdHFG+RFgZd7uJckRZM26qYx frAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727816350; x=1728421150; 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=DK/BBviZxJUtdFW+6zpJff7e0YBzhNFMUMwbSlcUsKw=; b=JOHWrkWfnwQLr86g41/e6pHBIeWSVZnFF9f50tRzUc+c6T2MCfSb0wKudHnzezs8iX oPt24EL/ZQ0XxewZaC2bvfp3DQm+awg45AO0o02sKFfPriuMDQDhMSaQtMBBawpqyA7Z h1Pl9NrLxFbMmzA9/AftKEWEg8zigOoiwqm4MA7jxYaHAPPhPqNX9qlPEcaJQfUan1pY 6eT9OmcYP1xz1TYSQiXrq/rvd6GlMRkE30UG/6UqNZLth1UgHS2DckEaXG8SL3tn6zVE CE7Z4mAm1DLIG2k4GEo4sbBqdf/L9MbOj2uXKcs9rMLfbJ9jZIka7EiNGfXaBox4daij TxEw== X-Forwarded-Encrypted: i=1; AJvYcCV5BS0zcMDqqiCIvBXW+d/FKXsQ/ZmuU2xtC2ja++FLJFXuEwSQyODqd7blCqsTMkBGdlNw4InRHabfOsU=@vger.kernel.org X-Gm-Message-State: AOJu0YwUqlzVEC7B7Xgibq1ZJI3+LMOMI0BCYiDCbPuhsU12V7pRFnsI mTIEuqMOtBa5pQKCowO+N6Rw7C7/FZFS15WEs9UaOHKf5nEPFGOARXUmwEhz X-Google-Smtp-Source: AGHT+IEqR3Ntnw9FH4GLtsZ5pJzLemMtDGf6vcKhQouuIUbDygeYNjlSsb+48YPbkHKPpeFOt/GXsA== X-Received: by 2002:a05:6a21:3a96:b0:1d2:bb49:8e6a with SMTP id adf61e73a8af0-1d5e2d7b851mr1593055637.34.1727816349675; Tue, 01 Oct 2024 13:59:09 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26518a2asm8545765b3a.107.2024.10.01.13.59.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 13:59:09 -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: [PATCHv2 net-next 16/18] net: ibm: emac: mal: move alloc_netdev_dummy down Date: Tue, 1 Oct 2024 13:58:42 -0700 Message-ID: <20241001205844.306821-17-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241001205844.306821-1-rosenp@gmail.com> References: <20241001205844.306821-1-rosenp@gmail.com> 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" Removes a goto from the probe function. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/mal.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm= /emac/mal.c index 3fae1f0ec020..71781c7f6dcf 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c @@ -582,15 +582,6 @@ static int mal_probe(struct platform_device *ofdev) INIT_LIST_HEAD(&mal->list); spin_lock_init(&mal->lock); =20 - mal->dummy_dev =3D alloc_netdev_dummy(0); - if (!mal->dummy_dev) { - err =3D -ENOMEM; - goto fail_unmap; - } - - netif_napi_add_weight(mal->dummy_dev, &mal->napi, mal_poll, - CONFIG_IBM_EMAC_POLL_WEIGHT); - /* Load power-on reset defaults */ mal_reset(mal); =20 @@ -618,7 +609,7 @@ static int mal_probe(struct platform_device *ofdev) GFP_KERNEL); if (mal->bd_virt =3D=3D NULL) { err =3D -ENOMEM; - goto fail_dummy; + goto fail_unmap; } =20 for (i =3D 0; i < mal->num_tx_chans; ++i) @@ -684,12 +675,19 @@ static int mal_probe(struct platform_device *ofdev) wmb(); platform_set_drvdata(ofdev, mal); =20 + mal->dummy_dev =3D alloc_netdev_dummy(0); + if (!mal->dummy_dev) { + err =3D -ENOMEM; + goto fail2; + } + + netif_napi_add_weight(mal->dummy_dev, &mal->napi, mal_poll, + CONFIG_IBM_EMAC_POLL_WEIGHT); + return 0; =20 fail2: dma_free_coherent(&ofdev->dev, bd_size, mal->bd_virt, mal->bd_dma); - fail_dummy: - free_netdev(mal->dummy_dev); fail_unmap: dcr_unmap(mal->dcr_host, 0x100); return err; --=20 2.46.2 From nobody Thu Nov 28 10:42:16 2024 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.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 E68E11CEAD7; Tue, 1 Oct 2024 20:59:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816353; cv=none; b=BooIfOYGL0q1Dbxk0gaEcDtUbu12NAcIDISLnO9A/urVDouj8ACIo1yiMeDuR05P7INn+fqLgdOB/44mHk3KZC0/kc+/t3dDCyajmNso9esICwVbsPjXXg3gpPgAaK1qWnHebMEnee8XmZPvTMtJDJLBfXZFz/uKTDW6XADrQ6s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816353; c=relaxed/simple; bh=+sGyQCcZnRYWNT483wXFzGA+PmhOO4e5FirWiWJ02f8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=usxuGzN7s5zKBxFu9YX3ePCmHU0olqMlbJSFfX5r3IQuipXj850CEhZe6b7tS+HtEfTnJ7yu5DrNcvg96TcH9cuThcgPepI4DO0VGUwzoRY4vohcqGJqyAFR9+sbv1FNoq705blcNrrdpyJMOnQK++nXWfgSMgTfiiYrKVYzxZ4= 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=aZ3cp3mp; arc=none smtp.client-ip=209.85.210.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="aZ3cp3mp" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-71788bfe60eso4458917b3a.1; Tue, 01 Oct 2024 13:59:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727816351; x=1728421151; 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=jdRjniAk0MF9qWVuayHAMYrBOU6R++71cqj//gbyZcE=; b=aZ3cp3mpbRpoDSRMCQqNdeJ9MqGBHJFPtmZdoPBASs3HWQjerNCQ+iXmwFtR35AQhp CaNX+2yAVgPsfVch6o9ww4JyqwH7OVsTrtyxywFwvnCvkX/i2PLuoUBfypJ9GGkgYqxc jFWN4EpWgCJY1p2EVhcqeHEfyVDEHAsH1HckHkrN4lkvE3ypSYK4I8IGLh45Q6y3X5RO kVaA/XGC4ka8c1VneVecWwwWwv7Qh5UuppbH9+AYEcgDrXRmsWhglBkwKhxHEpdwnGby ANs0N0+DMdqGpY2LsPoS4O2EczQnQL5Rtw0MPQ3UKHveWwLWFjC6gaUPNgOAfjKqsrSu fTHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727816351; x=1728421151; 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=jdRjniAk0MF9qWVuayHAMYrBOU6R++71cqj//gbyZcE=; b=Y9VgnEOxhbC9Qi5D0idJtV1deCOw/Xw2gJ7Brqd46r5X6SQKiy4WKlnSrHH6FNvqzY x04aGwf4b5lZkgE2XO4oKXFHXL0UKD1KCDW8irwlH9n6eD4FZlu0ZTjRQy1uZYzmzz/X CJU0RZW6IaxqW0qhVqOPvzB326cs35MUsw9NVos0M9ksoPQOqXhQFv7JUulZMjWfUNii i7BVhBhUJ0p5s6Yhrt9W7gahjFmEquhb5iZDNeee/5wN01JyjfxAgHgRUTp5mFG5IU66 /NleFMbLHwOtT8SxIIJEH8+TiqQ1dvHlJm22UMb0P241Xt8T9EfaY5LKLwTRykTP5X5V kNng== X-Forwarded-Encrypted: i=1; AJvYcCXTuGz/NAcFYnCbW/BE7ogL0ukgwEuWJDJf54jdxvevRgXL9f0/bi9ojoJjGvObnMd9+n+HOVDR3mmk1Kc=@vger.kernel.org X-Gm-Message-State: AOJu0YzYiovRV14lzQY1ZqxjcwtPWRiVkqeUlfgDZJ/TIV8SvEwUftzB D2Nju3MDBYDjBvvJDGDvLOMjGX8bC5qR0DOhWp1C4+iae9SvyGqnMrpOsMAb X-Google-Smtp-Source: AGHT+IF5QjAvrG7j9FN1GlkO7iGTCNvYhrHo2nykJNVcqiQvb2Cn2FumPaa66/zYQkYRcMmVYP9VHw== X-Received: by 2002:a05:6a20:d045:b0:1d3:298a:7bd3 with SMTP id adf61e73a8af0-1d5e2ddc16emr1305187637.47.1727816351099; Tue, 01 Oct 2024 13:59:11 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26518a2asm8545765b3a.107.2024.10.01.13.59.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 13:59:10 -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: [PATCHv2 net-next 17/18] net: ibm: emac: add dcr_unmap to _remove Date: Tue, 1 Oct 2024 13:58:43 -0700 Message-ID: <20241001205844.306821-18-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241001205844.306821-1-rosenp@gmail.com> References: <20241001205844.306821-1-rosenp@gmail.com> 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" It's done in probe so it should be done here. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/mal.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm= /emac/mal.c index 71781c7f6dcf..2434673ed00b 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c @@ -712,6 +712,8 @@ static void mal_remove(struct platform_device *ofdev) =20 free_netdev(mal->dummy_dev); =20 + dcr_unmap(mal->dcr_host, 0x100); + dma_free_coherent(&ofdev->dev, sizeof(struct mal_descriptor) * (NUM_TX_BUFF * mal->num_tx_chans + --=20 2.46.2 From nobody Thu Nov 28 10:42:16 2024 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.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 3F6941D0B9B; Tue, 1 Oct 2024 20:59:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816354; cv=none; b=lnufP8+F68jjrlkNB5IdlZHu1+0nVgDtQNuEunIRwI6nqNdaCpZQCVrigX3JVdM4db9D9wiWQqYFCkF08o6GTlmyhxxFtH6mpXwKWI/asXFDvf7RjVR/isZeRAH5Sjjd6kBMQCyxeonaiYh55G78mn6e9J0gbcGchO8CoMEnMCE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727816354; c=relaxed/simple; bh=kIpYMffnv2Jsrflqi0UBGLS1xlxbxCI2z0viDXyO2ug=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tnjYsfqEGWC7GtoQ1tyVQ+cWcg1ZdFVoaEYmNTbuBtqpULiCOZVh43n6sQGiPQjvJ+c5hu4hHwE5xVZHzI2WyXKNrtoaLDygW8JQ5CIGbOqp4wtJMuWxYT3+Qbi6uQkNWWimKqvIfBSLBk1fYFHIE7I4oSj7jzcoazdAf9tQBxc= 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=WR+DWywV; arc=none smtp.client-ip=209.85.210.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="WR+DWywV" Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-71dba8b05cbso1241041b3a.3; Tue, 01 Oct 2024 13:59:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727816352; x=1728421152; 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=PgLa4BgBe2CooTJVa2laJtRpnBqwaZiL8qbHDW7oMYA=; b=WR+DWywVw07tJUa4AmpHNT+ZDjZ3VmzLMgW8i7qG0mAHpq78tFkXIZVIGQmGy83R8f 4/ErweOX7NSa8gY7PG3yrrX9JjNn6z3kI1R7qjpSc2b1wTTOyrf0e6i/vRyooUElsaAi 0Dh8a1JevnzGNKtFGM1SJ2rVQhA0tqVhhTF/nfY5SSiFsObgoA687pVvJWBNqYxIW9aX hecVVFekd4sJlFhq6+5V1LYg25tIqSEXAD6gTj+QG8sIZT28OZOFoYp761GeHP0cEgrn qvVCSntQc3H8aTlYH1EDQ1A5ciNyxdKomzWoHzOk8koGBnpuhGMwoMtr7r9vXQsVHURP DINA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727816352; x=1728421152; 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=PgLa4BgBe2CooTJVa2laJtRpnBqwaZiL8qbHDW7oMYA=; b=fSBv01Y/Fw6a6lO1WMgdSTyuvYgDxF0UAQ9zrlBps3kOrB5JyDMiFTJFNdOGFM5PSj OKXoo8EctmK4W5E0MFKzI5XQCSRVOx//xp5qa5uG5zDOGsfPDebYESc5oMQ0vFkYT7p8 xvQFE1IBUCrWaFknXMBXyhbpNLDV4xMAlyQPPtvFBfGuqBfLOhzSix8p4NEj+mG/O5J4 veXPqgSfp+uNRpVwCaVdMUsPCDZXf9dQgflloPupzZmgiCd4kc7cpA1wZqWNpepUfg7A hbDZWWRreZxtuw3wfpAAGI5KSkd+xhAk/08FBVgGolkYFXdXoKVmqN3LnG4Bn+UKFhSz M9vw== X-Forwarded-Encrypted: i=1; AJvYcCWDm4x90BRP3VNMjX6vOMUSzCXvR/fvdFJ6cyHldH5MW3qRTVKI2jW9jBwNKqW9W4/OoxJIqy9Ba7zLQCI=@vger.kernel.org X-Gm-Message-State: AOJu0YwmPJ917svFXx3RSW4OP1qa6tjm77ArFt05CQClsdNTNJKbKeex x36hb87kr2l3hvadEwGUtL+bdw1oJy6GUJoVdE9CTcoGUJEsdjQJo0oFoRsu X-Google-Smtp-Source: AGHT+IEEpCmC4VF8DcR1Mhn4JEwlfphG24IusTTuqQgC6OU/ggYnxNm1+uQpMVsg/LtCAHxajSowHg== X-Received: by 2002:a05:6a00:2188:b0:718:d9fb:63e1 with SMTP id d2e1a72fcca58-71dc5c6726dmr1526542b3a.10.1727816352520; Tue, 01 Oct 2024 13:59:12 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26518a2asm8545765b3a.107.2024.10.01.13.59.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 13:59:12 -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: [PATCHv2 net-next 18/18] net: ibm: emac: mal: move dcr map down Date: Tue, 1 Oct 2024 13:58:44 -0700 Message-ID: <20241001205844.306821-19-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241001205844.306821-1-rosenp@gmail.com> References: <20241001205844.306821-1-rosenp@gmail.com> 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" There's actually a bug above where it returns instead of calling goto. Instead of calling goto, move dcr_map and friends down as they're used right after the spinlock in mal_reset. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/mal.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm= /emac/mal.c index 2434673ed00b..259f38950b6a 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c @@ -553,6 +553,18 @@ static int mal_probe(struct platform_device *ofdev) } mal->num_rx_chans =3D prop[0]; =20 + if (of_device_is_compatible(ofdev->dev.of_node, "ibm,mcmal-405ez")) { +#if defined(CONFIG_IBM_EMAC_MAL_CLR_ICINTSTAT) && \ + defined(CONFIG_IBM_EMAC_MAL_COMMON_ERR) + mal->features |=3D (MAL_FTR_CLEAR_ICINTSTAT | + MAL_FTR_COMMON_ERR_INT); +#else + printk(KERN_ERR "%pOF: Support for 405EZ not enabled!\n", + ofdev->dev.of_node); + return -ENODEV; +#endif + } + dcr_base =3D dcr_resource_start(ofdev->dev.of_node, 0); if (dcr_base =3D=3D 0) { printk(KERN_ERR @@ -566,18 +578,6 @@ static int mal_probe(struct platform_device *ofdev) return -ENODEV; } =20 - if (of_device_is_compatible(ofdev->dev.of_node, "ibm,mcmal-405ez")) { -#if defined(CONFIG_IBM_EMAC_MAL_CLR_ICINTSTAT) && \ - defined(CONFIG_IBM_EMAC_MAL_COMMON_ERR) - mal->features |=3D (MAL_FTR_CLEAR_ICINTSTAT | - MAL_FTR_COMMON_ERR_INT); -#else - printk(KERN_ERR "%pOF: Support for 405EZ not enabled!\n", - ofdev->dev.of_node); - return -ENODEV; -#endif - } - INIT_LIST_HEAD(&mal->poll_list); INIT_LIST_HEAD(&mal->list); spin_lock_init(&mal->lock); --=20 2.46.2