From nobody Thu Nov 28 06:46:44 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 4B94117991; Thu, 3 Oct 2024 02:11:40 +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=1727921501; cv=none; b=ccv6Ryc3hmbgX88mag7OWEuUuwLK+My2NwpO7YhZmLCjDCiqpc/uOHtMmnnjcESoBTZaAFj94D7ZzZ5EjBHd/dbuGhV0logt4ZtgDwqqoYG0xLbnGQm6fQcSFAoPSx0O9RFjRr3iXjRiUGwIi+mozMFSQgxA1AW7MwrDzuMRfJ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921501; c=relaxed/simple; bh=VLHNOJVF2xYI9xFz0sdYpst/JrodikRXh5fZnHMPKUw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LOeKnwyafdNMUDJ2q399tvZNH3aIMtSHdqEaXPVX0682Uabswt/FioPvt2ybshNs+6dbJYCLqoBpA6MCNcbInxwxhb38ls6u9I/b0Wov+QvqVfwP5aqIVDXgw2eAZ9i0N4883Wc/gkw+H50a6MxFBeujOcHf4Ei4v/nfn/cWBkw= 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=Ai76wE8/; 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="Ai76wE8/" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-718d91eef2eso340605b3a.1; Wed, 02 Oct 2024 19:11:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727921499; x=1728526299; 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=Ai76wE8/GO3zj4eE1LgUsTUkQWnCylp8rTReFLvXriJr3yHlyYFkWEYstelBcON/xL iDr+wtIc+nUY13IGF5mzM2c55H61KDKKV0ZbyHq1TiUsOPZgCyLpeu8FONvsMnGilQFw ytQ2V9FygUeMGMs7yjqTACXprgRBL72rD1hERmoBThwGqlNaAMjHwFk+O6Lg0JH8fwwa I8bcUlPF6cgur/CDFVINJfJ36ByTtaNs2ERgjseS8ZQrewW2OyCqpazdPCTCVjpFl1QP J//1bT8aaiTYzFooKTapCe5pkmIGYJwiYLzOcVVSwDLwNwH1iUmKy4DCmXQCaY5+am8e 7cFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727921499; x=1728526299; 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=OhClQKiI/IJxG8dkgxRVraZT5YP2vb4o9XS8U+4MFYtIyBQfIqdjsSu9pEth0A7OYj R3hAbvnBvgK7GXWkVHKnytNak8Xg0oiFrMGG2selNHPELBpF8XMYh2nHZoSfGGI8i/bx C70B6deAgJGSmkglz3FiWSwXvR6Yp4U0ZuuZoPEsWmzgYJTJZr09pd8gcCeegatrLay9 Y/BvykCN5QvPf47yoaVuRQd627posld8a9GeZcLsGp6IzOvnKZGsSPUYm+QQYpyWsfEu uZZ7LZSeXGW9fhYRpQIle3nQRsA0EIn+TLGPMI4qT1Oi4hN3QSP4Cu+aAiXeibswZcc2 jdiw== X-Forwarded-Encrypted: i=1; AJvYcCVRohZLRtDx1bIDf4CFZqp3EC/ZjlAbl2pE38D/qyQlAJ9Cy8fCVcFEFXBZglshIZDZcO5UIwztb+9Knxc=@vger.kernel.org X-Gm-Message-State: AOJu0YzcEajzZbVLXf0qODOMSyKlNdZez2xgSmCmBZ5xBj8jyIKVUWYy ts+Ap8GLuvvUL+ALfg+WD+bKo+GoQuluzTbolBmFKEo7DDHQBjclDJOQWpRw X-Google-Smtp-Source: AGHT+IGnF/vG6j6X2Sjz4JiYV+crJcihzLxUtpZHSZY4a/DvTIWBbDqKNLhC4ChLNNckFej06MJ3Mw== X-Received: by 2002:aa7:93bb:0:b0:718:dda3:d7fe with SMTP id d2e1a72fcca58-71dd5b6949emr2148105b3a.12.1727921499336; Wed, 02 Oct 2024 19:11:39 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71dd9ddb3c2sm190176b3a.111.2024.10.02.19.11.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 19:11:39 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCH net-next v3 01/17] net: ibm: emac: use netif_receive_skb_list Date: Wed, 2 Oct 2024 19:11:19 -0700 Message-ID: <20241003021135.1952928-2-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241003021135.1952928-1-rosenp@gmail.com> References: <20241003021135.1952928-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 06:46:44 2024 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (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 C06D71A270; Thu, 3 Oct 2024 02:11:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921503; cv=none; b=HVWP+9NuvjRElbrAAty9iGsS0ztUr9Fhr5z/5nvfWGbOszeSOcDlkf1iROSYfWpUK1jaYSDSpmr5PFw1+sxtbycyC05pDq9pm5F7nat+yKOQpELJtblnILzLHgBCtzYGJ8V1EdHlvGRmyZsPCJqXjCf4wJZD1STeERdvXkUFCsE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921503; c=relaxed/simple; bh=A+1j/Ugq/kUN7xpD6mKc0h/usxX2L7w7reuIgtpSPxc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=T51uCEky3Av4JqjF5UVXWn9LRmbQ7gjvDooCLpxOqYD1/QB/NwDW17Bx8/LMQ5/K6HmbaajHcEsAXFQFM5cAfkw9yQzrXUt1dBR8JpxHZyMnzMlkvZoaE7ntdt46fMN85RPyxFRbDSFCwNVNMypgrbOGAHV1zcrLxBjZd7IVc4o= 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=Hbq1Ws1M; arc=none smtp.client-ip=209.85.210.176 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="Hbq1Ws1M" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-717934728adso418444b3a.2; Wed, 02 Oct 2024 19:11:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727921501; x=1728526301; 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=Hbq1Ws1MuQYwivZeWkjsSVJZecYSsupTk4MLf41EYL+BUYlyxBup9sefrqBtVX+OJU 0hTWHRZb0d42CO2QcFlV7jS7I0qo6EEcfR9NTtFrsZ+886rZ93q8mod1qyV6isvFWuuj 3lsBlCn+/zKKBMgqSeEh7OtM6UvasTIHu7seLPoC/avh0EEK6yJoHwMSv2R0XNqMieLX ypGwQm8XneaSLR59XsWNscjEVedBdu7Ufux9FtZsBuJ3wGL88QJROx3TuAnmN/WHEQD4 nJyTPX8bppoW++UvyNVVpq/DCueFLH+4R3X7Gb02AKnwA92D1Eo66IU6GTn2QnC9Y7Rc xb0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727921501; x=1728526301; 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=wXRlJsq42wOxjvq1F2PTbFG6cFwP4qB3gL7Tg0b0eevwv9KfLQDoTB//xE6d/XoPjQ P7uSVEq4xHsjuGETB6X9dpeN2oa+RywX5ciaN0nV5y/tv1KTw6lGpd3BA9M9lJQgQueM 6tnWaElA5whIg10FPru2CzwppDQrMZfVQzJ0w0Ix35xWDOmihbRj7ItT/34ggRoMI6Tl r5sPM8StPhFqn2OMMWYihHrTcqreoQ1MV5YTI/RhukRg9qJYcawLKuNV9XlezzOttE0r qaZHGugRZuWs4vN7xHqJwe3pxjeOGEpssq3bxy8XXIfmNVA8A85IM2/MyJNqqOx+4y8v xk0w== X-Forwarded-Encrypted: i=1; AJvYcCUxqXzRjfz83zRzY+YOInrtyi4JOm9xXwbsrI3tIISY5RCmeJuMg+hMjziyA4Va+zajtG9UsR4DyqClVbI=@vger.kernel.org X-Gm-Message-State: AOJu0YwB7jbTjDFNrP0NO7acifRjpNkofSC5hXRxAzEVcdhwgz49WdFF gXzbWYONs7H1qSZA2/FAHkRJPICG1h3GSSX4Km64zBgIF1gw1SDnwzT273WK X-Google-Smtp-Source: AGHT+IELAHkKkRjaOhHkS4Z0nvYTiLvoV18UNoiKR+QhIhfFNLhcs6IsREUb7rXcp+9T1O6oOzMTyw== X-Received: by 2002:a05:6a00:188d:b0:718:d96d:34d7 with SMTP id d2e1a72fcca58-71dc5c4dcffmr7484503b3a.3.1727921500771; Wed, 02 Oct 2024 19:11:40 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71dd9ddb3c2sm190176b3a.111.2024.10.02.19.11.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 19:11:40 -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: [PATCH net-next v3 02/17] net: ibm: emac: remove custom init/exit functions Date: Wed, 2 Oct 2024 19:11:20 -0700 Message-ID: <20241003021135.1952928-3-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241003021135.1952928-1-rosenp@gmail.com> References: <20241003021135.1952928-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 06:46:44 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 334BD2110E; Thu, 3 Oct 2024 02:11:42 +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=1727921504; cv=none; b=ZOuXv/nd1DWw49ltcsRWnjApvmjipH03HtaccdIOuS9Yd61/v3t38ANwOaPmH3/imwPEbakuT+j68vSgzEaCUaGMoSGAheMPlIizw9dEMxXQnMs4HjqcpLrRo+C5zEehvSkmPGyX5a6G0NanscHC9NcYiBj5HJj4fQZPjT65zwI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921504; c=relaxed/simple; bh=E2lpnkQkB6alWziSY4dY/baMJyxnTAm4Bw4gm3jpZVg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q93zGJysegEzCLPL+k8kmEcADyRTAcNoCNaRcwl8Y7uMidTj+6RVB/GIf6Iq7Jt8VW0m+/ZjD+uppNsBSc4GD3GgwuZxJa1mBQXe4cu86rWIXcZew/kXOiSeZoO6CjqkhN0oxGuE63eKMmIWXgo1A75Jj6vQxDXkCV/6Pjn4f6g= 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=OmIpzWKD; 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="OmIpzWKD" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-71979bf5e7aso316863b3a.1; Wed, 02 Oct 2024 19:11:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727921502; x=1728526302; 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=OmIpzWKDEcfHTuRm7emi/CvfAumVRUYXgUAsm0XqlSLkyqqK1KcH9NLNKro6oeQ76r arSYPjV7RKLz3MMLS2Y4MJ8MK9RklSnwcEYbnaF396gSe6GPLg2mlrmUvcfvpoEuD73s k/ktTzNftnY5t+S/ZR6SlyQkuELVJ8bW4rFOyjPmWMSO+Hbi/B2hFtHNv+HmWMhAGoDg B/Kgg9ZokJfSglN+H7Mbx5I06skaU8ddQTWNS2cK2Wc5m3jYR5c0E41Dr39NK05KW/uf WrKbvgjZPk1G6Y69OD4JvMp6yC3EnD3i6Hf9IR5/9ec1vzT0i2hW4JvM9h+LfvnGXIiK Xe+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727921502; x=1728526302; 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=vRAb7uD0fh+/m77ysIBSF+qgHdWRsSB4VFh/TY04+HfAc1W05gE7ngafocZNSN2pKM Gx0nNugl1IB75wtH+ODueErqgNRjunBb5kez6G39N3Uz+1rNoTtIYLM1iy9NiSAvakQP weerLYuAZH7aZcRZ8PAM7SiZmMNgVS0aPNy5zXDBTSUwZOeHLdsYe4qPIL58+eeJCAvq 44WZcJap8sT9tCSLmQrGAJ17AbzQVF5T9OzspJs2a7q+rJeyYYe5P/x7H5oLF0a5pcSu SjhaX5kHT7duk4lwj3sD+KzIGbnZIkAJTeC8pcvhQWegsrguu9dBS0G/jz4wFWXKjzMu J6eA== X-Forwarded-Encrypted: i=1; AJvYcCVGLzgdVZWIrgz2WIHWWL5D7ujtzWre/TR//Se30g+prb7m4cqhz/mVYKJmkimm+ZHwb7wyQs7dODeS9QQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwpzkHlOprni9l063leX1EulzRHQ6WRA5LBdCszcpfn6+SwRSkC I3lg79uKKRMVsfS38zy+Ux1vjSesIpoQwucoAgjr7LO/nPICoIh5OPksAJv5 X-Google-Smtp-Source: AGHT+IFTVND3heBNMaHST81acB5w+HKZ/SyyyrDiZYgelESbh6V2H6dKli9j8r1wqkKiu3k+2LA6ZA== X-Received: by 2002:aa7:8881:0:b0:718:ebdc:6c81 with SMTP id d2e1a72fcca58-71dc5d6e8demr7611701b3a.26.1727921502261; Wed, 02 Oct 2024 19:11:42 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71dd9ddb3c2sm190176b3a.111.2024.10.02.19.11.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 19:11:41 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCH net-next v3 03/17] net: ibm: emac: use module_platform_driver for modules Date: Wed, 2 Oct 2024 19:11:21 -0700 Message-ID: <20241003021135.1952928-4-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241003021135.1952928-1-rosenp@gmail.com> References: <20241003021135.1952928-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 06:46:44 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 918DC3AC2B; Thu, 3 Oct 2024 02:11:44 +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=1727921506; cv=none; b=rZ9xf0ulS5qqHyVHMvkiNwYzUvpStQNU9h0ItcjARqIrAIyTcJ4DjSeJVxl0RXigCiONxVGg0xaiHCVY2iUmN/CGFYuLPM02b5+RXv45MeF/OSA3Tyo+oLfDh/OmNkfjS4PdJ41hnbsEsMFUfbuxNi8xgUNC+VMSlbIuOFs8uSA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921506; c=relaxed/simple; bh=kk6BZgx6e1aK6qkYUJ4gDXK7X1PwsJgqDQzdqq529+8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bBVFp+Nl+kAoSkMn8CQ2aZuTU8Cunh87wVJaLCEj2KVuEnwl9sRluFWmDtf0rotHHswFuXAm6NKyItw7YxyRxC/GHDXjLRm0GzxvaQtLWXCEEPWHQbViRzK1ijszUWr3/8lSIW9miuNUvNVyKBXBObEOc6CyZYzNw8MG5/vwHKk= 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=W8G9k7jW; 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="W8G9k7jW" Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-71afb729f24so368203b3a.0; Wed, 02 Oct 2024 19:11:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727921504; x=1728526304; 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=W8G9k7jWOI3Lh3PeBz39au0pnqEfAeIhflFGtq0ZqSKBJlt3Xkbg56zbs/tX1hxi8h dzwllFDy9W7GV07Aj0edfIHXBkn2hPeh+3dfWa9eJMDAsMHsaKBF+yPI7d9F3CBl008d 3Pbitz1Ico/H5PaiznBOVb/vCtY+rhSScWj2a3FPHtPigKjZAMn6QwNWvD7rZcAA2rPQ BTo2anKpDNQ7uEu6aQIm+YBlWeNNMNEebAr5z46jcGG0NXKciPoaAdffhprTc8DmB8/8 p5idSiCBHM97hsps1doK+4LfGzv1BK5bo5ADL2WK1c7qHGxfyXbCgHbT67ECGKHwZAou V8jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727921504; x=1728526304; 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=uBj0s2q6hvEbYg6atXiu9hudg9SScdqbl8Cu4fWmt1vZ4JFG07smmv33ExAcOl7FD4 E9PL4jeuBDSYAE5de/kUrxE6oZA39aZjN9hIZ7Q5UogiXWBv5guJDq1ClTmr2is09ZxU Jph2yAqTeQAadw5DgD4CgUjBV39LgBu8VHkYVlk1t3+1m1M/3TrNPGHNCQjFHMIXKc33 jIDcJ7xPowHpYwzh/o+52JPnBjHZ0yD/pUn5K1SmhUO1A/wNLXUsVri7oN2OpPAM3yMp Rrsa5SR8ABZmk5JPed0Ye1vPnXoRd8sf4wrPMEoXHa1H7P8IetcsN3mX4IuCGsfNSvlZ YVvQ== X-Forwarded-Encrypted: i=1; AJvYcCWWnrqqoKqN6jrBbfQp6SouUn300zCrQD/7yS7jbC0aZoquDH3gylWptt9Wu5rurTca0IsDJrSNgx/Vozg=@vger.kernel.org X-Gm-Message-State: AOJu0YyzTnMMvaDEwtZga34svUhQDX3c4RvIYHZl+/xunq1M11Z4apnV XybggQjWtqaTFswL0bF9wQiN7EK21WknLpEGw0Chh3678w0iGsg0UY9Bpard X-Google-Smtp-Source: AGHT+IHkc8P2japkEIzULnRrVy/ChAtOuhgjVE/ESfuxDMJOhPOceWA8y1QAVVhqLI3oq0l6sVzpAw== X-Received: by 2002:aa7:9edb:0:b0:718:d516:a02a with SMTP id d2e1a72fcca58-71dc5d5436cmr6121362b3a.19.1727921503657; Wed, 02 Oct 2024 19:11:43 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71dd9ddb3c2sm190176b3a.111.2024.10.02.19.11.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 19:11:43 -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: [PATCH net-next v3 04/17] net: ibm: emac: use devm_platform_ioremap_resource Date: Wed, 2 Oct 2024 19:11:22 -0700 Message-ID: <20241003021135.1952928-5-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241003021135.1952928-1-rosenp@gmail.com> References: <20241003021135.1952928-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 06:46:44 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 F05784642D; Thu, 3 Oct 2024 02:11:45 +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=1727921507; cv=none; b=ANAhThUYqw4hV389IHn7e6BpFm1rEYy4Ld+tnQp2Ap4iezsCMkZHcKUSNg0/eIxDvLSUKXFtreUCFYnjOV+tv7HrBQDTnT21NYeZNP1cq3LkpcZaD2f047mm0AU314TCm/UPjWvXPW11LvFQ6uEZyGscZDkn0uqixnPgRasL7B0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921507; c=relaxed/simple; bh=k+hWWt4RJCuaq34feyjRdwmdzmEmgz88H7zHH0eqdeo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Rjw8EsFxeWBJceJP1FH3VinUVIrPXqXbY6hP71yG/tGTsuoPbxvay+iOENPfA3C+dcaAA29++kw74RZ4tAKSPIbERZ2gX/nb4ojHeZ0DT2bskTRnCcZMLc/fVSTeaNDqpzDNf3rVusF1wsTPxqz0pqLwoRXe4FaZC314DsTXrjI= 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=lPbafzKB; 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="lPbafzKB" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-7198de684a7so359591b3a.2; Wed, 02 Oct 2024 19:11:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727921505; x=1728526305; 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=lPbafzKBde7Regcec+ImiHWqOmxNWDT+ouXlSUVAXZNiE0EhsOhwLHJyzvxkulEoAV VZ5T3x7+ABgNBP++h37MPG2g7gAy+anyqJ42ArXHPnZIVU7tPqQdmK+/550EeEn1KaqL Lqv9PJB9MrbxWmraa5OKdXTN+pNjkxw8m4b6M3+J7Pb5YW1Jwf5C0+wYSp9NJYYYqkZU 8R6adiBlj4BCIHDAzmSlYyZ9R0i5TfEeQfVJf0GTksd6Rf1c2LsC+jEqkcWGe8q4Vloz 7v/ZyMiZ2euyZYJrhCFzmZLJbjBVuO/m8aR2bJvI1ripuvJ5Q4a9raZ3hIW7Ybmg09Xs pQtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727921505; x=1728526305; 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=YBEOJO3tuGR8Gj7F9NMiaEMLTnBg8gSHQyuYdQ3xDm1y6szV/evQ2kUC/2xZ88aask jYImexCytvWFy4qz3u4ekl0MZNYVzXQO3jpjxKVifyAl0a3kcdSVNujUqoIQ54AlotPL v7DrCUnSg2rnWYRY4/O6GRE4wyvCiIKIq+z9xain/yEYP992YvLr0uu9lH+W+DhvjqEQ cXb1H2IKhZ8af4f1ah/Py+BZks3H81QKrGyUvgcvX1I97t5Je70ZyDVX6EQWqyiyxZ4S WK+XTIWBC+saO2/MVmrn8/svdpfcPKWW2tSbykP2ngurEGbZ6Q96Lu7meNUAOvm1kZCr 0YMQ== X-Forwarded-Encrypted: i=1; AJvYcCUKykzwIGF6rOWhitToAGp+HVIX7YjU60YozqBjyrzm2IO3cSgXFO9RyUM4vz3YYJiJEwlt1qE3+OH2INo=@vger.kernel.org X-Gm-Message-State: AOJu0YzE8SunHIpixJeGXpKdfNr4fzQzqhSMEeZIk76c9A5Fc68pHqkb VkxJlMnFPdu4chU7WaQxAGj8Hh4SgSHIzyjUhwPSxUl7g4Zu4INU9nn2q0Go X-Google-Smtp-Source: AGHT+IEi9Y7oofKSN2Re6/SrOzCBFD+VdwLrNlj8NfxwpTyjT7dEYjEjSRUtHV59chclIR40oAnVhQ== X-Received: by 2002:a05:6a00:2ea2:b0:717:87a1:786 with SMTP id d2e1a72fcca58-71dc5c64385mr7151009b3a.9.1727921505171; Wed, 02 Oct 2024 19:11:45 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71dd9ddb3c2sm190176b3a.111.2024.10.02.19.11.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 19:11:44 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCH net-next v3 05/17] net: ibm: emac: use platform_get_irq Date: Wed, 2 Oct 2024 19:11:23 -0700 Message-ID: <20241003021135.1952928-6-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241003021135.1952928-1-rosenp@gmail.com> References: <20241003021135.1952928-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 06:46:44 2024 Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) (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 62CB16EB7C; Thu, 3 Oct 2024 02:11:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921509; cv=none; b=QyTZl+4piA8C3/xx+oplMofzW26InmxKKCxMcJDTLfI9rvVfjvlihT/PFDsWs+MJ2foBmfpv/+KWAFr8hwgYrsIaBuU1tL1LrN+JwKg7EnNNMHm16CkJUq6HhEI797zB4rDR7dnNWdCBXLXXWJfda+p6AURG33Bfn/jp+OT4QK8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921509; c=relaxed/simple; bh=8lBOVvzvGRf+RpMwtTpzh+BQKToFBXpodpfesW9+iz8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uaqRVIfEZlItKDWJ7vV/m1Oi4no9r2XGxPWdcPsLOyYm3m2sOeUWGE5OIwptN+TGJtaLp9TiExzZqfvbI+XQnhgL9fE1gNtSQ8hNEd+1HzIRtrANvG5TSBcxtktAFrublt0UhXI/T+LFepEAVNtHi+GX+h4IUQ7+zJgLW5MpzPI= 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=Vaqd8u2v; arc=none smtp.client-ip=209.85.215.180 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="Vaqd8u2v" Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-7db1f13b14aso309644a12.1; Wed, 02 Oct 2024 19:11:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727921506; x=1728526306; 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=Vaqd8u2vMfnud729RLIBWNzS3o33NXSv9XXGG67il6ANDgbyTE0TogjxDA1gdBNNhv 5/La0ErMXSuJdwiGhRzpRzzlHzi+a9S3ygSGZTNpM3AyFjVtbAcXRK86iZBws477K6Yf azR4HA8O1omyLrlZk3WPvxFVbajl4pByzF0q/TUP7uEfALT7Bspp9qUVcQwnbXBXKCzc caANi+ajNSl5sBbc6PwtTNyl5DD6psz80APoDnBsL5/LiERiNEpISFE0g1wM2K5h41X4 F5feEWHdmgdoRq0MZbQ29enbMlHy9Ha6x+mQUZ++JVmp+VfLhnZ+HUumEbCP5d92Mwfc Wbvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727921506; x=1728526306; 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=ry9nWg7sZZf68VV4zXOD7xios+wdw+MmZu15g5jQJIV4RfWJtyt8RbUimbnrVPpNgT IXqmFQqYfYUqknLaGoh2B0AoZLn83RlElOLcz9Cr4vP4Rcpu82SHt/heYDF7w8Zx0l4z ijNrBY9ZG0cjYyJsCVZEoeHlWG/XmWETV33lQm7qa6Cy1L3Dzpq+0wL0aTu9/Il4ZWUT tBwiDEDdQdi8aXCKJUnHf/o8zsdQdtBUXS4oL4GT76EJxIyGOWQ1YSsx/dikDpp457N1 +s1xaz8BN+1NgUllMlph2+yaHLrLxZdq3BHHJkVc+Y8c9rAbNJDOinhMqSZtHXta3ZHG Igwg== X-Forwarded-Encrypted: i=1; AJvYcCVzBQWDWUmnPu5mV/DA0b94JYWm5czwYDJKHeEd8sp9Wwn+13KqrnCPEn9MMPzllqWA8sQ9QMnZgw1CPBE=@vger.kernel.org X-Gm-Message-State: AOJu0Ywfrtlmnz6cgqhfNZAkHFU6ROTyOeb2ObjQ25akWMxqasMEx/l8 6kVd0gRa7+PGFD//7sQXzeVW3PQkV+eocSXbZb8cIJlJVhSSnqWT60N31aTT X-Google-Smtp-Source: AGHT+IGFsS6i+3uSHFMHJrovdIQx0ypzelbIrDNKVMbgXJtBZNCaRMM9fFgkuq5ZTUfNsQex5AZpOw== X-Received: by 2002:a05:6a20:d74d:b0:1d0:3a28:7589 with SMTP id adf61e73a8af0-1d5e2c65741mr6591593637.24.1727921506495; Wed, 02 Oct 2024 19:11:46 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71dd9ddb3c2sm190176b3a.111.2024.10.02.19.11.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 19:11:46 -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: [PATCH net-next v3 06/17] net: ibm: emac: remove bootlist support Date: Wed, 2 Oct 2024 19:11:24 -0700 Message-ID: <20241003021135.1952928-7-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241003021135.1952928-1-rosenp@gmail.com> References: <20241003021135.1952928-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 06:46:44 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 A3C257DA7C; Thu, 3 Oct 2024 02:11:48 +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=1727921510; cv=none; b=JQlefZGgf4KedqtLR5cUJDm7U22j0nf3+I48bXpElB8cDSCQDWSwVtSeElhXg+yvzUk1Te1CEk+7X+h4vbO/BAWafS0waoMf7lBkazM89+03WN1FQpKiBb3Ga5LjH+z7bscg7LO6tdK7P0Sbjdt7p/y6YUnuMDgHhtJrhMvL6sE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921510; c=relaxed/simple; bh=R3/zEAcwhIv1vvXu5eqLy8v9T/QO1blsvg8rxiWDF6o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FMheGixnMZvEv0BNpQWxyC1pnh9x5dT6lksHWpb3/+Gjqwt4R44n6m+Sg2Vn+fWoLoOOyGCPpDDV3LyyhsvAG4vua1OH3kNAdlZZr/LYKeYhkHlxwWxtvFj+bPqVxxrNCV4OulH0gEEpJRjZoUpUcmzCK8vWVfNXoYi3yFEAFU4= 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=YA23dAZd; 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="YA23dAZd" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-718da0821cbso407188b3a.0; Wed, 02 Oct 2024 19:11:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727921508; x=1728526308; 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=YA23dAZdQ7JWjbK5e1FxYbtjCVr089q9eQuhhBdKRcfyb9yULnr0fjmS3Cvkk+BrbI FXlhvBoLZ9WLssBBFJ6ah3ino1lPvPXkGDUyov+FVKnboNsV10479sACU40K3RyliV5G vR/4M2r+NpU3ajDEO5ryFvnRMARZ8hMoz8/ZFDqcUbHNCnORhxV5BiUcQMLsuIrmgC3Z gEXw+jffde4Gtl+W+AwnhejTrKsxs4A8Y1FRfH/TdowjDlroG6YNUQyATGjzUMRy20bZ YIb1DHJFTGkH3lTeN4Qagv26m4nynRKNDfya/YwvyjkTgIC1L6aBQOsLm7ak3rc4/h2g w4Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727921508; x=1728526308; 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=es8hqNLn7p0D0EAgO0zmg0cxl9IA0Jpm8+DVhHTd0itNYM5xrLxj8nzBCeyl6oHg5d 1KGam0ubeZa6vaZEAW+qY10SXa/mCxXaaU3hGQuuFBSqdxizj7mimnDRaS7j06XQTDWP KNkWErjYnZyAwfyvNTOzBYY/colY6etJ7TYcMyEh3bF/pBXHdyKiQaPef28TsFQr6fhM PoRtcNGtyPTGuTTOoliHjDvDGIK0Zgg2eZln4BrSHsZUQPX5IqKjJQXmmKG9kN+NQvES DgoerA5UrIn2YxSj2aUHvzlvlNpOXyhWwngXkHdyPl/R1oMb6G5qN+iQLRcoUVSBGnEA 1O0w== X-Forwarded-Encrypted: i=1; AJvYcCVZ/k051c+yd9cK6Gr3i8dSkcW0UqZ6s+hBG6RczDw0Vdjet4JvZoChC3JinJ9mCXru5iwxe0RM9Pk6hHU=@vger.kernel.org X-Gm-Message-State: AOJu0Yy+04lAQU8NDt0XBJ9EGUlmyOA5DfPU7uIgiYTwR3fIPafdyzh7 ezvoA7GkppgxV/YEzMFz15lo50waCQczRVVjVgG005fw1JSTTLxPtTKdt1VL X-Google-Smtp-Source: AGHT+IGgCjVNhDlPFVINLSkJ6RLQjb3KD4Mnho3sT/dN65Rh6kFxrISKOUAiirDcFZt8AQ98nOD7zQ== X-Received: by 2002:a05:6a00:807:b0:705:a13b:e740 with SMTP id d2e1a72fcca58-71dc5d6a157mr7657929b3a.19.1727921507799; Wed, 02 Oct 2024 19:11:47 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71dd9ddb3c2sm190176b3a.111.2024.10.02.19.11.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 19:11:47 -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: [PATCH net-next v3 07/17] net: ibm: emac: tah: use devm for kzalloc Date: Wed, 2 Oct 2024 19:11:25 -0700 Message-ID: <20241003021135.1952928-8-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241003021135.1952928-1-rosenp@gmail.com> References: <20241003021135.1952928-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 06:46:44 2024 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (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 F199E81ACA; Thu, 3 Oct 2024 02:11:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921511; cv=none; b=BAw6wiCDJodhnN1zJ87VoF0zT/Tm0ee5CGknxTfgSuHKPigGYvX5Za1lJs8V7e/Lc2K66cB3nidaeArY1siHS349yhzM2oNtFy1g0+X4fsoncMJwnK5z5V1/0OdFO4dckX9gheT9I3hUyHYzngjcZqRCVbN9BEBmkiyPtgqPOe8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921511; c=relaxed/simple; bh=2IYzVGZB/me91vV9GKAMx/UOKfRS26DvtY0el6//X54=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hkzVSDIACc4xzzRmfxii176+WPnMSMxcqOqfJUsUERVISf44jHlRPTggbvCde0GHih4Lftiml88P/5nRA0a/eJ41mmaNCREZjsCL7qVDb+X32TUPCGSN7PKO1XX72vF+VmiSV/6FzRp1ZaPhJf6EoK2a2AdUUvCISVba7unAQn8= 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=Q0gGlbUq; arc=none smtp.client-ip=209.85.210.176 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="Q0gGlbUq" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-718d606726cso373769b3a.3; Wed, 02 Oct 2024 19:11:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727921509; x=1728526309; 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=Q0gGlbUqy8tDgQ1nYZ8QSWyVH9uqm+l6+u9UlW8Dd5bkBAZWPvNgJQnu+BNKrDfPjR oWlZr72TGku0/6dfs1QsbNRrsi15fWA4Tpg98fEkgAwODNVqmvd7n08wcWbETcUT+NYs m9AeJ+iZ5tZiPl6AFElgiBIVDz4eiFBhxUDb2WFPwscNw982TkfYKkr0RDpwf5+Ks8mL cKBnAuaDwFjtmyJjFBY2vK+MdnsE6Sz8oG7DtuBOQPV3B5OgdrHxLIlM+BC29tMsF3gy yy0EnEn1Ph2+1C7baCTfb3FcWQ3KCJM4B6P9IMRRJW5adW7TxJMm/NT5PSEVmGVlv1sr N5NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727921509; x=1728526309; 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=eav8JCdwJJ3tKZCKB3Li8/YYB8NaUzzpIP/uPPN8bqP0HEUMr0L/rdLnnvrmlGZwA8 jRyoBUCSKORPvMn4gAgXOgUuzEVpbfrgSxyr3SdjQDP4HYVDbqO3L+ZOuoYCQ1Y6K8a/ 3TlODKR1VUmxxPZl1lGz/iiLuxC9H6MUZKhdrYARgvCyckvs/p4tA6dk2rw9bJuQeom5 VAjumtqwU00+j3k4gGkryjWT0sCQsSghbtdnPtPzzJgg21cYLyKjo7ghqq2pPsO11NPH TzTMnB4V5SnD3zvmqAoPNDALOp6yg2pP1SRLW3zzVkoVSfHzw8uNcpdGYYwb/FgybrpY 4YZw== X-Forwarded-Encrypted: i=1; AJvYcCVtEMm8m0e3PKVQ8tIQHjcSxOEnAGySQ3HfEW5jj7fSMckn05GEwRRq5kGqqsgeQ6Ijw+zXEP4J3bsaQN8=@vger.kernel.org X-Gm-Message-State: AOJu0YxTzmYF0fOF6LtyRd3Gn88P21re20V6AWi1A7jhs/4wLpvgsoES 5DFCMbOjYQ+M9oUXsQmCv07Wcvoxj9uauN3hAp7Bu/PRjIx5NPHwq0d6k2Wl X-Google-Smtp-Source: AGHT+IGbkyk6+otLJKi2NzZaHWMVWHiLLN1ISYnD+BXh+raTDsIrgVxATxQPtN377dOGSmUeXhRMNw== X-Received: by 2002:a05:6a00:3c94:b0:719:7475:f07e with SMTP id d2e1a72fcca58-71dc5c42b2amr8309277b3a.4.1727921509114; Wed, 02 Oct 2024 19:11:49 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71dd9ddb3c2sm190176b3a.111.2024.10.02.19.11.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 19:11: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: [PATCH net-next v3 08/17] net: ibm: emac: tah: devm_platform_get_resources Date: Wed, 2 Oct 2024 19:11:26 -0700 Message-ID: <20241003021135.1952928-9-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241003021135.1952928-1-rosenp@gmail.com> References: <20241003021135.1952928-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 06:46:44 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 5B1EA84A50; Thu, 3 Oct 2024 02:11:51 +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=1727921512; cv=none; b=NnM789s19szJO0qKr5hHvusbE3HEkJ+PF8CnliE09togo5U28qL2b4JzkoE89GU7gDkgeVhzjKCf8rgmuX29jnBtgI34jJSGQN2GleQ9ghF7kgL2aPxADPhPo/WwvsHnLhueZhvG3gH7xc4EM1mjg36mGfM7j8MlZu8RvOUqM/k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921512; c=relaxed/simple; bh=A8gJS6fEP9QvIScx57iYcjbGzw0KGh8cHqIn3dIOJyA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eS6r/EXsMxvgWabuWAo9n24hU+w9WQslKQxTRiNvLQKU+Dkv/nq6aXl/0ohH5RFFSyPJtDCl5XiJs6tEUg3MOr2t8Sx7jr7F85y7Pdnaa/DDjSO8mA3jYlzznDiWhKq0S7hokkcJ3mmlM6ZXdHBI4xZaYXWZQiFeyy0vTNRZ5yE= 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=WNjuHRql; 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="WNjuHRql" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-718d704704aso459251b3a.3; Wed, 02 Oct 2024 19:11:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727921510; x=1728526310; 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=WNjuHRqlS4jdjasA5iWAfmTz4Ik9yxssXQKkb8dd2keWvqDiKSlFJPeckCVjAQpKBX 2jTBaBFew6hk4tBlWyQVXFCB5Lku0BiIk8DMFc2oRGNvLpE/gf9nVsxUAJqUk27zm/qR 3IT7XywMFd02xrnKeKPOBOwAymcDXVGUiMAjUfELnUxVfkKudd6EwLMbp2Ss/PlT1dgO rJtuD0zxR/8Gy0QRxZ5Xtl/KQYu1yO/FtxJ/hJ44eamjum2w5Wy5+axr633sOeg+LzyU SKVpGiZFmD8tPzFjkSMi6fEkLSV9wmXaa2Odu95i0Elmd19C0QgT5vypUxNoA6D+m5H6 i/IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727921510; x=1728526310; 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=hEDL1Nfp0OuZaGJggzBBdtjAmbFUFn3KNCTsehKa9DvFZ5qXmACmkd8/zoDQoVh0VS dpRZv0Ks0MyJFhroELcAZdfwpNpuLGVxec1efO7b2QTS5ekdlETWclMsAalz3jerYPnY M7zmagFJTMRqZ5iZJoqmXfv+sjTzPCgdcfKxye+Ln+9FUdNL3JqZb3Z/v3+NCe/5TMRZ 3B24ChvP58N9U4nQoab+cl4Iyw7FhUM8XUjYdmrALkdCTjyQE0Dr2vGUsiaR06JJaFnk eDD2AzvRc00dNZlD8x35QGPcBzF8u8OwUxKX+g5miH+Do9Vfr/+symhhKVU/Wwd+4gDY U1iQ== X-Forwarded-Encrypted: i=1; AJvYcCVdgJKp1SQ3q9jBlQPDjBYf6kdDWLvLz56kODU778J3A0YcNxljROpLrULIjr9gPM1kT4K8ruLpkrmdLnY=@vger.kernel.org X-Gm-Message-State: AOJu0YzTWd3VedGJFRFnmhVDg4OhlftBXcoHXIYbB51oTGTs73XGNfiT FiNGdQzFyMWkLS0pGthyRu82D9OjRKcX/Nd7nKgmsQKbTQ9mUO9qKhCTFnME X-Google-Smtp-Source: AGHT+IFSoofh/lnpCdFBexu1AKGYGORYJn/eUq5y0qer3JY0wKRLp6VUMVoio9CFoISOpDQ27v8fSQ== X-Received: by 2002:a05:6a00:2d0f:b0:718:d942:3475 with SMTP id d2e1a72fcca58-71dc5c6751amr8574141b3a.7.1727921510524; Wed, 02 Oct 2024 19:11:50 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71dd9ddb3c2sm190176b3a.111.2024.10.02.19.11.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 19:11: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: [PATCH net-next v3 09/17] net: ibm: emac: rgmii: use devm for kzalloc Date: Wed, 2 Oct 2024 19:11:27 -0700 Message-ID: <20241003021135.1952928-10-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241003021135.1952928-1-rosenp@gmail.com> References: <20241003021135.1952928-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 06:46:44 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 A26B4126C04; Thu, 3 Oct 2024 02:11:52 +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=1727921514; cv=none; b=Nhcm7TYPW09Fa4MLw24XYNl7uoSSXgweAR1HHLd0BPksgV1eQkit1+KsBWU58amVLofiOf32FNnXoxeVUWG8Fizuqi1ckwJGKD+f0At4lk4iAAtQexLx0CSnl+tLe60KWJuzLVmNbH940y+d+Xtw1fU+1LIK1gcy2T/i4Tl+wa0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921514; c=relaxed/simple; bh=FHY66iZ1UrcrbeXKE99B9ikoT6GAi0J+noOtDA2DGFw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HpP6oltg3Y59ouwLKtvLKfuVlRReEMB+9iACkjLBZTi1pywd23qM/HJT8xSxroL62n7iV34dmWamVHnudToRzzgo0aV+Rb5OOGn34PXn8XRf1rLEuqEP7x/JmtxxdVKCy0P5Ad7q+wVDvufG6ipmp4o+VpU9X7p5u+7P12x4+Iw= 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=HgWVA9vV; 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="HgWVA9vV" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-718e9c8bd83so1010298b3a.1; Wed, 02 Oct 2024 19:11:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727921512; x=1728526312; 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=HgWVA9vVH0BZk9vSwTDAW/6ofl5f0EebjzH+RT777xnEKClVALAv8o7l5D23C0rY1U K+qCcP1SCrXcn7dR4gYzYPQyo+KJbA1GeqcOXhpaw9vwpHqbqXCK9XpFTgtKlQ+H8nj9 B9wGjXsPfhYyKWXWOCjAoAv+UnIrnW61BzXwcu41elkvy8jmeKTVtO7P31DWcCU6f+9t j2ID6LspBjF5WNBisJj287ADcE/Fbbvw4EuBKJ7Hz/nCgBV2+jB4BsLoalkmtHI2Lb8G nTn9J7cjAbOfy2r3w5Bf1O/uMm0k3GIqiwm/piJeoK2M2ZBjqu2zvq6XVXV6RAq0k7z4 KmyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727921512; x=1728526312; 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=UX5fLYyOE3t0155pIU+TzcRgDUu3+hIBDWmnW0DCWlfFEkXb3rLzinzzqN7rWjsQEM 4nn2d0cQo58jVpS35Pn22hBA81/p2PVlVVdBhEkmqCbsOIOgVbvCKNdjbdqRNHCRN71J urvUcWGRcB2uio6yQaN2aDGWMxeI2wRc4BeTKLGdBaVznfTclYfJ0xIQGcza5gcfryyc AlClxrnn7sqGonIZPMvoADDZD8hE6Kht4n/CN+1e80On9y7KVEAYvbFUSEdoGvayz+vX gUKP4RN0FwUtulqq0LNvNglDnuMBdPLlCwy9gwkr7f28VqV6Tt8EcX0ZUZOlzX9Web5I Mvqw== X-Forwarded-Encrypted: i=1; AJvYcCXtxFRlVjqr1hiZA3b4qxmDbLVbEAuCkF3ERbO0Fc7ucOTT47JsJE5pNA5xYBMTrKDSXmvd6gIIRGXh3FU=@vger.kernel.org X-Gm-Message-State: AOJu0YxIUV/Uy9Uz+WGg4EIDeuLpvdtXAlgiazMOWhb4swiGb7tkjhaT /lD3cuVnyGVQujpyozLunTRFaiuZuFi7FEGUDmCB1A0Bd5irDEXy+Nk1z3uz X-Google-Smtp-Source: AGHT+IFYo+Qepu0Oo6lHgwoU8p/K+itY91wC5VZGRaifHXiVUN2lzbfcEShW7ixCJiENAmHyNYAYog== X-Received: by 2002:a05:6a21:3183:b0:1d2:fad2:a537 with SMTP id adf61e73a8af0-1d6d3a8dfd6mr2501384637.18.1727921511873; Wed, 02 Oct 2024 19:11:51 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71dd9ddb3c2sm190176b3a.111.2024.10.02.19.11.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 19:11:51 -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: [PATCH net-next v3 10/17] net: ibm: emac: rgmii: devm_platform_get_resource Date: Wed, 2 Oct 2024 19:11:28 -0700 Message-ID: <20241003021135.1952928-11-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241003021135.1952928-1-rosenp@gmail.com> References: <20241003021135.1952928-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 06:46:44 2024 Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.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 5A16812F5A5; Thu, 3 Oct 2024 02:11:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921515; cv=none; b=UDxKvtpm+J1bqqVR5nxfVTpZNON3b8Y5WYfIXaa/uNeO1imGtyNSsSABXYyijZrS0CVHJfhioQ/sLoyJ9UZwmnBKONeDz2rFM7zZrBfo/oWCuhVdg+/NTRhW0FUlzj4mBaQIxuXBIWM+xGToq6uACk9TrEkmBhMBDnhXzh9Z7iI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921515; c=relaxed/simple; bh=jcEPPiC20NiN9gN9PQRjLJGI4IFmPIwO1pV6PvaDEDM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tHurZqcjP2XiCMIk0xm3yXLr7k/dMYPZB34qO2bY1zMimpioItUhQ8+KHlOWwvxwhr/sQVzBGvKEwsWys5d9eDqlxKFR8kkgTWESrYAGHtI/rckkKv0d5/O0kV6ah6b5W3mYtnV0dLGadmvJGGrGSN40lIqkWLwbp4mbs/ucBlw= 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=B1lL0+59; arc=none smtp.client-ip=209.85.215.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="B1lL0+59" Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-7c1324be8easo1112937a12.1; Wed, 02 Oct 2024 19:11:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727921513; x=1728526313; 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=B1lL0+598z8EgxP4xnya73ClGIwl6eUmCOJxQI3FH+nkKKfemKhO9WzdOH7FEK/OLK njtOopgP3vdW1vzkkuXQAIH+FGSLLk6l/EDL5ddUWjvoSgywQTahdmFaFSGoTIlT0uj7 i6BiZOU3W7S+Leeqlks5LSPabV5Tm2pyQb7JfeVvpXWZjfWoSfvE37rKD5epzPwYVXh4 RmgrlS3R2XBRxdfb7wNkwT3VZnfjJLFshJF+z7msiSuJjcqUNGvLqgvBpCyp2FxhTPXz KbpBYchLw5poy1tn7535Kbdfskxi4o0OTp9jMJPb2vSoRbP24KD4MW3hWtQ8PYUeozW8 spaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727921513; x=1728526313; 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=hIpRn5oG7uGQ3jK1bHZcUuy2uiNWZucQNrLqYirXe3L7gLDyTSX2WvShqIMUo9okit ssVsj3kKVGXcGwwtk6pUkVaHEcMg4EFZd66X4TzdqId3mUcHHE3AiVI4O+rhpC3voZ3t TyXcHwpF7qqcYlabCy1EyS+c4VOaq8nb7hiwAvzJ4M4sOTmB5FL+7sRepXUinpOdllUG NmdFT474Byt08ZfMw+CS6oXhRfymjTSHisy5r+3iCjcfQ26XsXY31rYsM5OHKl6mUfZj O0QKmwbjWzDfwm3pU3oBKNRt2GWGZmYh4sxBmUNjPe0VXAxo33HnkrOVbEQ1JhHVA6C0 ApJg== X-Forwarded-Encrypted: i=1; AJvYcCU6wnFQk5Gl6V8RC2Vz/gihx+nhNaiMKrM6Uh+tF2/uyK54bL7ArghvHLdUMpYNH6XjJ+NOA94RmOiIv7g=@vger.kernel.org X-Gm-Message-State: AOJu0Yz5mETRTP8qbd+x9ZudbOSS3pxkaf/Q97Vws+gNXG+gnKMCPtTo C2sck3oN0Ejp7vMNJNTWjjffLHgw/uXa4gFjYYTre8GzcSczc3e9oUkODXQT X-Google-Smtp-Source: AGHT+IHExFlcE7tNqpTJwJrTc2jBAZ4k4Y0HHQFxbyjsGm76BduNFtGzaWkipi6ei3+CJvscALU/JQ== X-Received: by 2002:a05:6a21:2d84:b0:1d2:e90a:f4aa with SMTP id adf61e73a8af0-1d6d3a7925dmr2162644637.13.1727921513473; Wed, 02 Oct 2024 19:11:53 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71dd9ddb3c2sm190176b3a.111.2024.10.02.19.11.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 19:11: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: [PATCH net-next v3 11/17] net: ibm: emac: zmii: use devm for kzalloc Date: Wed, 2 Oct 2024 19:11:29 -0700 Message-ID: <20241003021135.1952928-12-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241003021135.1952928-1-rosenp@gmail.com> References: <20241003021135.1952928-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 06:46:44 2024 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (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 C220E13A24A; Thu, 3 Oct 2024 02:11:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921517; cv=none; b=mRqouVnSlpY+oFZ1rTf0FloihishUjZ8hkhEQZgGNSHwYze46CtL2QOR52YvYdOtGJ2cRhiFSCTIcaoQXnJFOiy8XseHHwq6Wgni+KUCbRP9JkrbWATw8ol9Sctzpc7tKIr9AvJ27e13q6xzB15CkD+IN+CEMJ4FXkYutkRoOK0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921517; c=relaxed/simple; bh=/JFQ1f+yHsjb5Zt6+gt8OydljzAA9ds8/yUsrr7/NQY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qygNkwvaZremgK/pb+es5ydafCumxAFkLxbXyFzXF+/yHv9+hqYIeCxAhtrsLyqTATCHBW86QsMoXPaNc4iM7jWoWLJ8qDZ/2zB62Un/rE76A1MVdxyjnIDQRcvdadlzr7QB5KA64PSyEbhPwfgyLfqqWRLZ0COrcWnbQ+He8Fk= 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=em+JAY4b; arc=none smtp.client-ip=209.85.210.176 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="em+JAY4b" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-718d6ad6050so458141b3a.0; Wed, 02 Oct 2024 19:11:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727921515; x=1728526315; 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=em+JAY4b8HYPK2PHujkPJrIdG5whHjjtkx9+nCZcON5F3Yi8d0+jMytQx59WL4B4hL By+b8OuFvGixz4Kt2D22E9aT9nbnJdqASJC0qaT5kM7Jen5mgTSRPkrnMvJEr1wSAJGU VxMpwlYhx7+RTdbIiB3GAGSsz7zq/+9k9myHB4AybkzphCTTebi5T4cVVmGZmaV5xx3E x+pNcD4G2+r9uoSCGlqzRkmg+ll6KkvSEjV9obIfgjiRZGmu4Ozt+/OF+JODHHBmeRGT 7ACHahbZFX4c7MEGcCZE1oDDl9Cx20mBP9B3CReuL/YAeMIjM7///BBqkT78aVFZlWgx rtcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727921515; x=1728526315; 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=OmOfRAyS/+CgTVD5R4crgIYGENrib0EQlX090Fboz3WFYTG4Pj5N5bWFcLX38nqxAI zpXKTEClJfIoIzaQwKpEP8WKyzqRH/hLZnnOw1KziLbT+SEJyvJoaTQDk1hII36/N4KQ O7oZ6o1xL/grOl9zNGGrRstiKdsIV4eLlg/B1rtWVMd/wJMpNa7GGT1nRZMEZVy2/RDK C9CH7SYy6C9gwIbq9FtI/xzfC7W8KIhgYxmMkIkjyYDUotNlXEjZrpsGW9/hCLvjGhNO zDkvs7Z+wpi1RGeT/HHgqRslv1i/EADvRMUyf35ks1cCmp8iFCcIti13kOjCsSCZ7X1a aJrQ== X-Forwarded-Encrypted: i=1; AJvYcCW/Soev4dhWWQCfCVa4lzjipFAezp4c2Bys8ngbGcHsInKlibFLlhO+Thn+xnhOxuVB/4FImU3gng+nbU4=@vger.kernel.org X-Gm-Message-State: AOJu0Yz5/TKvDWkJgar89SRRCAjkd8E4/abOFOVfvx09S6g4Mn6e7EZV rz7+HtjEcg0yjRyKfOI9NIgcJENTpL5OVgPg+ME7Iy6+KlI8RFYcAPRfjQI8 X-Google-Smtp-Source: AGHT+IEB434KDWI/81wHGhJ4XAzv4k2sXRaQ7ctNzjo5e/1oo8U66w4sDbNvm4jOl3o6b1EC6x+Pzw== X-Received: by 2002:a05:6a21:3116:b0:1d3:eb6:c79b with SMTP id adf61e73a8af0-1d5db104fd1mr8355968637.9.1727921515003; Wed, 02 Oct 2024 19:11:55 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71dd9ddb3c2sm190176b3a.111.2024.10.02.19.11.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 19:11: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: [PATCH net-next v3 12/17] net: ibm: emac: zmii: devm_platform_get_resource Date: Wed, 2 Oct 2024 19:11:30 -0700 Message-ID: <20241003021135.1952928-13-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241003021135.1952928-1-rosenp@gmail.com> References: <20241003021135.1952928-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 06:46:44 2024 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.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 2333113D278; Thu, 3 Oct 2024 02:11:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921519; cv=none; b=JdnXfIFQBmT4GuBwtX0Z1xYgKy7PFJSCJVDjI9lizbBa0uag3Lfh9nT+7ZDgrP7Tv9GCUZF/WwWZH4wH98nJxbq7CGBm4qlJD48v0k//OCdoL32lTjFiPhJjcCuoQ9gz9hracbzflz/sLp3uxdmr7kAzcFNbLpwYEiXKIjSqq5s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921519; c=relaxed/simple; bh=kih75HuZ1ZXc3JQHkzwuj//sPN9nSONeRe7im09vADU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gxuSLwTmhPWFpzCbuTIPXAncQPjWYz24Dx3nxNby5eCBPShOFpi0keNRNuPqYd+jQt5XjXPXj3lxkmfGNU2WYpFzyYDYO+IZfAZxYz1AZeRIG/6efunFQUWnCs2rSXi1wWGb9elz1+A0Lozsuh7NAw0xExgJFryqaOCWeyCF6JQ= 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=UIdZGiY/; arc=none smtp.client-ip=209.85.215.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="UIdZGiY/" Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-7e9b2449fd1so332071a12.1; Wed, 02 Oct 2024 19:11:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727921516; x=1728526316; 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=UIdZGiY/sJ75tnNbPfgsvL5PsVo98IidP/umEsuSOZ2HltzY8s3+WH79OCyoX/51vI KSXY7WMxxw1DZhFnWdkRR0LBi1/o/7t6HT+lF+Izj4cjsxFKcWxnZe4AKPEk/4LB0IFR oIB0CwlCQzLHRFCGK6eOYk4ag1JYSDNouYKEU4c9jG2LQlgDSj4nXmpFd/6zflz6uQ7p 91os//deSW/7wxWjPXOCzQEFEknN8C+/7CrWoFSvOtrfhLAr8aL2XSLTJWBbK1XuT0qp SVbpfmm+BIX90j4iIIfGzEhGe555307vfGilvVQMOHQpeMZyENpyjgiCPmnFJsodwnnS O5IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727921516; x=1728526316; 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=g0qwTqjfCqdM0e+A4F/F8OEr03REo5AyjiAav7vyUK73TZRsyvyZMl1DZrdSw1PaQ6 hhkAvtPqMyqq1SPGmQcuial1gpTi0SR34ia7canHNSpL9urc6uWSusgPodd7Sy/2TMYC yHAYr6Xj8LcBbG8i4GtbVlrFTtfk5BKgn2H9wFy/bV2hND2xK7exLXpF3FKcAmlYnpIR Lm2L/meS02UKxqXbOeLY1ef3UuABiWRwPwHBmQYz8aoDAyjVsWe8JuqKLfBUcVfmR+Fv BZnig8xaJVzLYPEU3U8Svno5NZV0FF2rKdJl7A5M/mSyBgiCKCKpy9Mx0lW2K77Ex7PC SQTA== X-Forwarded-Encrypted: i=1; AJvYcCVpjfdrS370SrxQxBmxA6UMo66VG/nrI8Rxq7HUSROUnz+RANh8Pv9AAYqta2kbY3gpvzWI+rZsDsMFrYQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yw206DXPREMKyt1VWEqdliLxQktdozBg0W4SJLdT14/lfAVhGn6 ARFNrTxYj7kOoKcXRDyq9FaPSUxFQPIjgG6xN2fmCXDnWsAAbhtOQamkFay+ X-Google-Smtp-Source: AGHT+IFgniBy5CEEUKA5nE3PVz4GHW89zb7AIBIkBwVuv8ev2zcn0p/U6rKeH1pHjR1g7Qb9jXvHMA== X-Received: by 2002:a05:6a20:6f08:b0:1d3:293d:4c5a with SMTP id adf61e73a8af0-1d5db176d8dmr7412040637.22.1727921516347; Wed, 02 Oct 2024 19:11:56 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71dd9ddb3c2sm190176b3a.111.2024.10.02.19.11.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 19:11: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: [PATCH net-next v3 13/17] net: ibm: emac: mal: use devm for kzalloc Date: Wed, 2 Oct 2024 19:11:31 -0700 Message-ID: <20241003021135.1952928-14-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241003021135.1952928-1-rosenp@gmail.com> References: <20241003021135.1952928-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 06:46:44 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 8F3CA13DBB1; Thu, 3 Oct 2024 02:11:58 +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=1727921521; cv=none; b=QA9QpPVo9J+YeEhh3QlcQU/MG4fdtADSKcMvPZjrE63rID5Zs7vR0etEE4SkGvQNfMW2QdeFIyVfvGmtshVoq9yg3wtbOrTopZOy1y33UqPb/6cGMz+4b7YqxvsZFubjE4XlKhbk8lPJ7IUbFuH7F7p7CClLDENC4sUrPvJx9vY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921521; c=relaxed/simple; bh=tPMaKKCrP3tEFhfNaUWKZ/JHAt5j/C2Ms8f8SpstWRk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lzb9EOb+/t6/CsOrdjA1CDakMEUErYm++/WWrExvAg7ik/zkUQIzMxZkw/H5RlJATTxwDg/08p6LUw6tVHNTNYdnhlRPa8px2OAEPHPzr739y96rSSACuUIDYhdsMtekLbXTwex6DVnMV/QkyJGIKE+FQr29H8bXCzt6eJykXOg= 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=JGdMD9Qi; 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="JGdMD9Qi" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-718d704704aso459335b3a.3; Wed, 02 Oct 2024 19:11:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727921518; x=1728526318; 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=JGdMD9Qi0JMnL6xx9+hm8+q3AJdh3yN52gzJciGEbzsVtUWk5QvGCPTn11f6Bib7uH /L6JPRaWYqPhXAqLVQy0SIcPP0xwweg7qzrcZzObvtgubAn+kWiF6FQF6ZbqDIseq8zL CwtUhOK2n0bWkSn5BwsHHIDeg05fcyr25TASWR+AGFJRTn9iJTFCAzBPHod4tnY2vUFY x6MPR08zOMEKYLLLgoIBQFMqIMz3DiA0Y2AUkPHr4kY+4akmcYm45SvlO62edJgIHPzX 9dKluMD/C7lu7ys5EcnlE+1FUJRO6vMlS4IyMMqBcfVo6GRIFjQuDfRgILkJTRLoJVFH Zpxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727921518; x=1728526318; 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=iQ8B8vXZ6qNiI1TK4KXft8gwY/F4y7rlqKbmOEeCSYgBC3cjwQPvoFgW48qui+4ojq SsiLJ02Pw9sRCbV9tJrk3kmrph955kcqL56k2CUV3ZD5viTrn36t7DqtsKJYmKwLL14W RjZ5uKZa1RKsWjvokHXiSwKlTKwonT6j0iHi7d1kUf+uopL1BOT861FCW9LuUSCHOtCr vTE6EtB4H99edzLsf3OYshXOCqo+ujkvgedguLBajScB922dLg0+ypVusJZKmwXx4eCn EaieA1wgDsxo/OIhsa4Dx7mkIbZUkrczeLlWPOleT5Ww3fvIEJ7gDMzf4beBpseJDgI/ 0T2A== X-Forwarded-Encrypted: i=1; AJvYcCXvzj2fWB+76Pg32S6XI0hoUX/CFukgeBEhQKn+dSBHXlJzfX1VQwMGaxXEgrHrjoZfHUKmhZVqu2pdKOs=@vger.kernel.org X-Gm-Message-State: AOJu0YwXtET+z4pYVacriuiuiUskIWBSdjZoNekd7eXRKRIxIg1a98Eh r2SNhqdZNOOIkznWZWKKmWXtsZc7CHwyifeHBc0UodUZdaZlI9155Tt+5S8J X-Google-Smtp-Source: AGHT+IEs5Un/Ry7HvMhIlekhzfz3MZuxu+S6gQ8h3zzfnHjxgOKkY31gHARC526qPiGpU/0tzLTvPw== X-Received: by 2002:a05:6a00:3d47:b0:718:d7de:3be2 with SMTP id d2e1a72fcca58-71dc5c924cemr8222034b3a.14.1727921517692; Wed, 02 Oct 2024 19:11:57 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71dd9ddb3c2sm190176b3a.111.2024.10.02.19.11.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 19:11:57 -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: [PATCH net-next v3 14/17] net: ibm: emac: mal: use devm for request_irq Date: Wed, 2 Oct 2024 19:11:32 -0700 Message-ID: <20241003021135.1952928-15-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241003021135.1952928-1-rosenp@gmail.com> References: <20241003021135.1952928-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 06:46:44 2024 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (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 D513913F43B; Thu, 3 Oct 2024 02:11:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921521; cv=none; b=cRsTy/PS6SzGQCI7uYecVRT9qKxPXTEmSlpq6Z4DuUegzDRm+wyLcJsKC0/yKXLi0Pd3rQD3m8C6VhVPf7eBL7+2WN/Vr3CtFE+3nBxKIiL2Naz+xyMogK5Ghgn1st0lXe5mKRs9K3P3iiAVvPcKsf56CDK8hyR21Of9wiYiu3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921521; c=relaxed/simple; bh=eKiO/LEIBXXwlQ4KH7qVz+fyrkTR0L1Ipshtf4VGCgw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TSh1qwEpk3IT6cM4s0kJ5rcyQ1UvFMVJpOsXSoWkGys6ZIUOwnhjO0mbynPab1xCzvRWXZsvwvZcAkH4rbDnOpBvCXL+bDC8Mh95NuIbqwIEJhRzgPnL25pu9u0Hp/GWR//2OCE9SNBlV/ePcPdJvDXsDC1P7ee84x/tMCgmSSQ= 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=NnsOAvEi; arc=none smtp.client-ip=209.85.210.174 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="NnsOAvEi" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-71db62281aeso359162b3a.0; Wed, 02 Oct 2024 19:11:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727921519; x=1728526319; 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=NnsOAvEi+JNt1kidodFV6XIMveCOcaEgetRDVeH3pOBtMWnCBGCVKhTLOjsKNRC/vC t+HBmjzwh7Y326RbO8dKQE61EhriRFb5PnUrBNfPw+3RovtBzamkH5Muv9iBOUq5PBTh G2SGaVX0fb9RFDb9OICeGR/9KMivUHpH3Fm7RUCMdHaoSsEQdTlEdIG/2jP/RDz4MNpy ARjapVH8NhCr6Juwagop5+iAbjYqkA5CBcBEkWcjlicrmBrayEKjPmGWD1rj4RY2vQw4 F+YBKg2t5wE8wq37LCwLGNX1/Ez6TzCZ/kFp1b4d8nByC+g5fjlOKABRU2PVf+vPfTk6 d5jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727921519; x=1728526319; 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=YCWZ8MA4b8lgUVIW/3ieJi7OW4+eW/vCmEgEsGfeE2ILxdFfckT28Qx1P6CxQG/iRj 8F6QMoqwne65vNFxKaZL3CrIlxW/5VXJqwleqJUu+s8s6Nm8ys+n8W4xaEFyFVo2isDZ GMsaoZE1s+kZAowrteNMsLCOG9Vzqo/1vWq0Q+4PpXLfiyWO6TN1XivgQceVAaWY8E6R CO8YmpGHmUX6FgTPEGL76Y6HaoeP/C92BwhYQhg0EcC77YUEd1hqyXOPuYobn98rJKLF BtvyP95eVMsFoV2fiPZrbN10Fdquvb3wLVAN3jHG8W8YqdQTDXp/r8+q3yWVPjG18wf2 9sZg== X-Forwarded-Encrypted: i=1; AJvYcCXAbZ/0xOOTmWC5lwNrat5I91oMnjV8a7pnZXcJSSyZE4Q8bmUJoO1cfydZN64ADjL0WUsnwoyckEhJyi0=@vger.kernel.org X-Gm-Message-State: AOJu0Ywt2j8YXdv4temmHROk1irqXIJTjaLeF+p1No3K0CdjWF4rK0J5 vWT0LGUgwxCNlKokdmXPWvFnwy+t3E33qhEXQ7Wa6fLk3QmVdDyQeqSrRV9H X-Google-Smtp-Source: AGHT+IHdFDAnWJyuNqtdEN+Sl0V0X4v17yo5GpnvTbubn1kty4hisPgzI3zlijnZbApS427Npn6yDg== X-Received: by 2002:a05:6a00:3908:b0:717:8a98:8169 with SMTP id d2e1a72fcca58-71dd5ae58b0mr2448519b3a.1.1727921518968; Wed, 02 Oct 2024 19:11:58 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71dd9ddb3c2sm190176b3a.111.2024.10.02.19.11.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 19:11: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: [PATCH net-next v3 15/17] net: ibm: emac: mal: move irq maps down Date: Wed, 2 Oct 2024 19:11:33 -0700 Message-ID: <20241003021135.1952928-16-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241003021135.1952928-1-rosenp@gmail.com> References: <20241003021135.1952928-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 06:46:44 2024 Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.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 19400145A18; Thu, 3 Oct 2024 02:12:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921522; cv=none; b=W5XONKUtxjwbNClJri2Y4QvVEJPw1kDEd/aU1GKq01qQ1DkAr6Cfb7fkM3HQjj0WOzlAwq1+3p7SNwp56DwbOawWSEaJzF6KF2JHDvWISBTlF5Xo6p/SR28kLfucFqlade7e6enVLAPrGHEarf9QZjKv5YyJWrEwbPQ2jtri5wQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921522; c=relaxed/simple; bh=3znYEdrKrSJmBz47ry+O584EposhcMqI2RWTfyP9gqk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hnmThmLCnE7RQnJ1852xvpAbJRaxFCA+g3KZ7vu0jJFW93wgskhQg/Bt8BEkwBXgyb7wq6K80rV8d5QK9e3auPO+CJiRjfypAw3xg1QEpw9RktYoOfXy7r8/XoaU6MCElPWgk9tG3juWsFLoNuM2cEtBDs+vPIw0apqAiN/3vgI= 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=SGm2TaIT; arc=none smtp.client-ip=209.85.215.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="SGm2TaIT" Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-7163489149eso327017a12.1; Wed, 02 Oct 2024 19:12:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727921520; x=1728526320; 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=4i5ri64hrjVdmz3tZTzX5i7c0GV7hJBF3q4OdGMq8f8=; b=SGm2TaITPpLZwBFlRXoQ43Pt28uv1t3xKp/KT7oxqb0v+na8oVLGQo2OguCS0mw5mf U78OrdFNpzVaDdHlDLwc8a/yQwmXy6R67ITUNsL1EkQBHoRmSXlkmMAyomPHcMSbqRhW amKfO6QiQq+em64msEHGthAta8U5jwsqs3szr5zxo3/Cdl867F9kZ0/MynQpL6V9bVHi j7N59AtmA9pbPULYgS/l+TZcdCTdDy5fAjXt92tOflTT9SB9NwYgtgCHNKi8Hspa2dTD 7nE0fFdy9N5qYfEUg2mPloFEw16fVKBp18Ab1X/HT/DE+WOj0hfakr071gFncv2wdEFz vRTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727921520; x=1728526320; 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=4i5ri64hrjVdmz3tZTzX5i7c0GV7hJBF3q4OdGMq8f8=; b=PQLzPLyo8zqgUHb2QpgjYxy/65BGMRSwIh9Oy1nE9YHmsjDAQuPd4XTz7oE2i/5c8k fWf6zb3yP0MFKFtE/kuSP6f9WKuMnlqh/SRJRhdfKzAV3PgypJAxfsknHUtBnqQSr439 wJ//Bbgo476FighH4yF2XJTXuDDtZiH6dunleR182t/yhgDrWoZnJ7xrFxXiWH51Nzxj gPK+sSEeOdkDEYVE/dJs7iXkrXpYGKZcVYT5zAztrTqe+NSf0fckKdRRpsY+DDTL6wRW X0+Wp0BFVPrj5+jk4gXR9sU7/Q5a5QE1yqpht7s8t+gtKWrwCCIAWESSv7KkZXQLZKv6 XQqQ== X-Forwarded-Encrypted: i=1; AJvYcCU64PdY5NcyDbcZg0fr2QHL7ZEumKqL1YyvRXVnbOgxUdbPpnxk1sFpttINFdxhXptpIVMSr9o5QDuAlqA=@vger.kernel.org X-Gm-Message-State: AOJu0YxED5DkJfoFVVeX9XoEMQ295gCM/se5Ihrz260IyY7tbv+9mqjI PGPhQFu4j5KgXKrf+8IV/KXIXviSM9nv/xsj0EtDAfF5sAgil4GrSe9ZbKrx X-Google-Smtp-Source: AGHT+IHfpAnENXQM46P+rxthkomryN99+QR314Lmc2ufSPiJYmyYRHuP+j+x7J4ZyF33Ol2+x3d3dQ== X-Received: by 2002:a05:6a20:6a9d:b0:1d6:d2c7:ac59 with SMTP id adf61e73a8af0-1d6d2c7ad1dmr2310958637.12.1727921520312; Wed, 02 Oct 2024 19:12:00 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71dd9ddb3c2sm190176b3a.111.2024.10.02.19.11.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 19:12: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: [PATCH net-next v3 16/17] net: ibm: emac: mal: add dcr_unmap to _remove Date: Wed, 2 Oct 2024 19:11:34 -0700 Message-ID: <20241003021135.1952928-17-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241003021135.1952928-1-rosenp@gmail.com> References: <20241003021135.1952928-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 3fae1f0ec020..4f58a38f4b32 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c @@ -714,6 +714,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 06:46:44 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 42255146A9F; Thu, 3 Oct 2024 02:12:02 +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=1727921523; cv=none; b=MU1bAETa93RbW/WaKkSrEryUnFTi6T0vCVt9iH38/Rd288IQeYu0vxNCOUz9fOFI0kzB4jY/z9pSe5ZiHsZPTSWxhMWirvADO6AS7+IH0BeHMQzS4RcWynNKqbl1WgVNGBgiF0v2ioML4GkeApWmCMqbPEdowFCkdDAkHjSxlXk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727921523; c=relaxed/simple; bh=xkMQUJ+a/seJ+Y5YjIAKxVPqeaNfl7Neu2vo2r4t7VA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ewx0NTmyfzdcmXAbbiZblV10nUeWNtT8n/SiStTklkT2JyjTi45+4fveQpGotVahqQqNaunhsEBbg0tQpCuMzy97rnLmpLk8m3PX6yJCONVuwL0cH2Vg8kDxj83LQds0KpPq/VptaomkLwARW33qkvxxZBEP8TCxyElSDpLDL64= 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=RcPZUA6g; 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="RcPZUA6g" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-718d91eef2eso340832b3a.1; Wed, 02 Oct 2024 19:12:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727921522; x=1728526322; 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=6KWs0i5ENfOJtknzBiWTETb7i51VBhlSos8aop6cLiw=; b=RcPZUA6gUFD+gZDXGZj69L5+olar5xGTHyDoeGNnSQ2fo+R6tGmLyhKDv9mzaDxUJG IsxWMBQTCDX6Ng8UBqbWOwwkKPw/fEIOuJ2lvPiIGz/Mt1Z1V6E0/9QHuX/znJGCaLYD gjWw1931eCQMB3tvTQWsmq6T5NHdFa0opupkgmz+xnNxFz28s+DlZ8Em+dKDKlQ9o6UM 1JgLboV2u2GmOwN/OEf65PJFjOMBycIvd9nWX6s7Zl4lEgBZOsOFJMqW7p0hl6EyhTnO Ik4iL+iPQW4UD67jXmRsRVUOJEp3zyjmtvoT9C66jMMPyMKdM1DTX4y2sjIqjbNALy+N zOLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727921522; x=1728526322; 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=6KWs0i5ENfOJtknzBiWTETb7i51VBhlSos8aop6cLiw=; b=GlKgJA04K879cAdKjaMgXlDa39TLMSOrguFMJ3W6wFWWjIyg9Zw59mT/dY6jEKQQJz n4KPN1HnFQFg3Uz+b667ArWg1md8jlsor+LYkCKii7EOM/oPxkc2XucXnzNAHR9HzVqH 70mQ+u1inOzc/66daXib1fCAcqZUPgvXvDT/wWJhnySnLGuB+3MA85pPyVyIICAX+McB RHAz6fdLA8F3swpgeTkSP17CA/JgPQUKMFozkdmFivE+1h/bFf/NyDB1oaJScW5tUSbj GefxUwOi4BPS3F6eWV5l9JXB7WDTK7ZxbdcDl27j5nVEJorj3y7bGmofJC+hOOJe113r ED5g== X-Forwarded-Encrypted: i=1; AJvYcCXOiIdcP1y3F9cuggzpbs0PrRKExvkg9ag1Gij35xPz13nMRS07dWO00XSn/lJdNAMrqXIn6Lz6khcDnYY=@vger.kernel.org X-Gm-Message-State: AOJu0YyUv9RvwuwmulG53lCzEmQClj7NUOgrblqy3K1SUl2W8S08FjG8 OqF+hhrFxdR6O9F7gtYAMBwqiaJ2tVdmkzk0Woyr3sKZLO3QzZ/ZJdjIqh9N X-Google-Smtp-Source: AGHT+IHRWlBQbinZxKW2YkqEgAUPGXX4BRTXhu2DQdWTWVAfAe3ITdec7ZyqTN5TGTwdmNR8o0N33g== X-Received: by 2002:aa7:93bb:0:b0:718:dda3:d7fe with SMTP id d2e1a72fcca58-71dd5b6949emr2149177b3a.12.1727921521608; Wed, 02 Oct 2024 19:12:01 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71dd9ddb3c2sm190176b3a.111.2024.10.02.19.12.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 19:12:01 -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: [PATCH net-next v3 17/17] net: ibm: emac: mal: move dcr map down Date: Wed, 2 Oct 2024 19:11:35 -0700 Message-ID: <20241003021135.1952928-18-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241003021135.1952928-1-rosenp@gmail.com> References: <20241003021135.1952928-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 4f58a38f4b32..e6354843d856 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