From nobody Thu Nov 28 15:31:58 2024 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A38A192D7F; Mon, 30 Sep 2024 18:00:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727719242; cv=none; b=t+Rc1ig7H19GVZcf0RM8S4dKnJBKiB9zl4i7zebeeC4cvcVGT7HpxT7o2rqDqkxUAHzIqHgoW01RWSdG7M6NcX+yGtQ1/ktQqSmVu/o/jOkiqvac2mWBEoG4qt0QYFUI9zHIKNMvR9/LghfXySz+vckoq/bLvcX8NTkhPfcsvNo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727719242; c=relaxed/simple; bh=A+1j/Ugq/kUN7xpD6mKc0h/usxX2L7w7reuIgtpSPxc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YGB8/VcgiV7DdrastYhGewqRnFKYy3txNcZbz3kC2vaDyAgTIDNZk+Vs9TAgfM8S4uNQsHjQ/ddSOf/sFhOIcULnySmPQ8vmV8mkd0Prf6C+zHGrF4cXXNRDogsnm0FpT6kA4mABA1R+zpgIVEr5lfDLcPNEV6SO7/Iu5c8Zm0Y= 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=D7GUGngY; arc=none smtp.client-ip=209.85.210.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="D7GUGngY" Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-71970655611so4338135b3a.0; Mon, 30 Sep 2024 11:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727719240; x=1728324040; 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=D7GUGngYWr5TI3TWUookM4AhzJ5eWXKOQtIbWSXLBNZrWJiX76GwP2HKI2EsJwZ/Js 7IrCrf+SGbAAUuzuoHVISd+5IpUjR75cCZYC8nYKIzOXnA/OdWJ32R86iTSgmgUvRoyo Ssh715kPje9QVC5y0ol7t471Ar10LWnYIVH9/nE7E+QGI8qbGgxbnKxHMg4UENbRSRWh /41R5ZjlhrUZ8PTjjiFZCDw7pX6WZIJuB6l9F4ApBySK9SsIC337471Rq523HaAjLxTB oFDF8abvTBqVzAZulkeRwQdpDk/Y7FDApBNElOELqLcaiU03Q38bHUMQ+RpfMPzm+OKT ljfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727719240; x=1728324040; 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=KrFpLF9EAt4wJULnWnC+70ms6PkSWb/BjUeSwzniULwyqerhY8xX+3GUV9BJOpdk4/ kQkPhxn+MIbR/Clm3xXrXI6LMGxAkC+lMc8M4mwrbnp1j+Tza/6NqBnBqTqZu06EZCMd TS+kRZtE+dnDdcKDAh7SWPh4iz1dRS5GmkHC8AJU8nnhR53OoJZ3rE9p8tXCQZ5gwSLi fnmXFZXMHW+iY72dMUYNSHE+bwz5uzPGW7dLOc9pbqaUfyYC5u1VVyciMz6sCuJ7m7ha Cbfw4vW2Bj249m/4Owc0x9SJMAlCSKzXiw/Su40SpwFe2G8/sO5excJeL9+AV15AXU5m +YYA== X-Forwarded-Encrypted: i=1; AJvYcCWC/n0d14OA42AlvA3x3e8kV+A56xRn1wTCpF6436LokqQxAJwKIe8159UWnvPDEnQDn5E8vL2osaXft/c=@vger.kernel.org X-Gm-Message-State: AOJu0Ywxkio3Fp4igS41LaS/8EoR+hqpFhOtqnG93ZgdmD3M8WRzoOft TKJSwoXr9Y4PusCvKjm0OnG4vunqfeYemnf2Li7je62wHktj7erA4IBts4BY X-Google-Smtp-Source: AGHT+IE4PVIQLJAWQLFV88+ZXn/2GKZnbbeR5Y+OI3d508be0nsLxO2TXQuuotSG7+rnl/TSE7Ly4g== X-Received: by 2002:a05:6a00:10d5:b0:717:8deb:c195 with SMTP id d2e1a72fcca58-71b2604937emr20456095b3a.21.1727719240039; Mon, 30 Sep 2024 11:00:40 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26524a56sm6740653b3a.149.2024.09.30.11.00.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 11:00: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 01/13] net: ibm: emac: remove custom init/exit functions Date: Mon, 30 Sep 2024 11:00:24 -0700 Message-ID: <20240930180036.87598-2-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20240930180036.87598-1-rosenp@gmail.com> References: <20240930180036.87598-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 15:31:59 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 487C5199E9A; Mon, 30 Sep 2024 18:00:47 +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=1727719248; cv=none; b=XcAgBdhIUvJVRQK5srvSKvhrdR0l9+0crQTFtsfPiObM54jxJJH16TX2v6kgoy7gxXybl+WzY7vrDPhkfqpsleyzcJYW37/pOrb/VxOqBYpr7a6WDbtRXltSZN+gtkmjAvWfNoLopnE8EH1u4G41TV+EAXsyHlYmmm572uBI6PM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727719248; c=relaxed/simple; bh=E2lpnkQkB6alWziSY4dY/baMJyxnTAm4Bw4gm3jpZVg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BZuZqoY4nbGtmnFuCZHAf/6iEcnUAeUEpxk8bnUoScOnBveKpJgCinwkozN2boWtnEct9UKLckbxihcyCQ+M2tlEpvk06UVHCE3QCLofbV8HUFVRwoElvjmIoPkLVDvL6bx0EilSwWwgwxR5YW8bPBoRUi356OVAabzTF0aR+bo= 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=UfIrdLQc; 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="UfIrdLQc" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-718d6ad6050so3901424b3a.0; Mon, 30 Sep 2024 11:00:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727719246; x=1728324046; 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=UfIrdLQccnayNPDotL3++64el/8RhECGT8zOARX8t3ccBveeCbzCWLvc07uEtX0dBM hj3o+xkWVZYHpDULTtcghMW8PEZMQOYkuGXdsLErdgAJf3LxjOfq5n9smLfa0ioj4JYW 013ehdVPO13QqGdVJip68622fZoSMyzAT6IcxNW7swVRXbz1KnydGqiadDUzV+mZrWl3 7g5Dk29Lp+t8goYI7QYecS3iDTxTYwH1d6Zg8EY5mR2wgOTXewwQ2pDL10T9OKZYdpk9 dTUQB4obtOQwrzCV8K80TNcEH9P47D+oDF2D7p/Y4JaDTHuytm0VSIzQjWTJeAfQJo7O IfUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727719246; x=1728324046; 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=kh2AOsxLYT88DorLLTAXY/rOcuzTuzPqThhH83i9hbYJUdit5h5EsIXNdzP5+h9EbB QW1iF1gXFHeCxpeagt9G3bZsc4QzfYyNjDpMbzkRirWvpeDQjRlui2XYxP5qhzdYp5N6 pJ8/oTsDqQyWxN47q1Shl9CHG2U/CPbPx/OZONk5APEH3J2uCximb8qg+CmCSK+mVE80 eRCqj/mtTXNws76bniYYc0bPIrzMUkI7H3uHRPSO6uwqmj2Vmagru5b18snLOft4Gm6X WJbINQ3sGPuBJ7NhscUdyZ9EpySZl+Jmvb0i633dYhWWEvvVT1hTcI1vrvMCtf5voWmi 1qeQ== X-Forwarded-Encrypted: i=1; AJvYcCXviCOTxM1pO9z669dJJgx4ShEdnf7mk8u++KEn8jicR7Jpwx/WGY78RAbK9o0BiwFBeOBALqvVVKuur8I=@vger.kernel.org X-Gm-Message-State: AOJu0YzjrDC0xOs5rLZObIGI51daFT4UEhthqvmJF1GEQBOdBqPhLrS0 MSdqWq5QyOBSwT6qXU4WBAKJ7TQWsk2QplVauIBMHXNC/W1L95HdvHUaQ1uC X-Google-Smtp-Source: AGHT+IG/rbJ5oVwpsw8XZlptLGvPQBAAH04LnEZIpaWqcQjA8QJwbqDb357nPoa8cFrCnVGemRSbJA== X-Received: by 2002:a05:6a00:c95:b0:718:532f:5a3 with SMTP id d2e1a72fcca58-71b25f37976mr20626768b3a.7.1727719242265; Mon, 30 Sep 2024 11:00:42 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26524a56sm6740653b3a.149.2024.09.30.11.00.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 11:00: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 02/13] net: ibm: emac: use module_platform_driver for modules Date: Mon, 30 Sep 2024 11:00:25 -0700 Message-ID: <20240930180036.87598-3-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20240930180036.87598-1-rosenp@gmail.com> References: <20240930180036.87598-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 15:31:59 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 EE8E6199928; Mon, 30 Sep 2024 18:00:44 +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=1727719246; cv=none; b=QGht9NHc4cvMWNIedU3RUzGmFqJudLvj+nNFZJjt9ulKXtCvIq7eprzUE8UHuI4MkmTi8e2F31lsXX4MjSwWceMzPx7n3PuNbWw9ln3R50xvNaZDgN/4ajeJD96qHE8QM3RZYEK1sFqKXqADAu+rAkiiOT1pjcHWcV7ztVyBhfI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727719246; c=relaxed/simple; bh=kk6BZgx6e1aK6qkYUJ4gDXK7X1PwsJgqDQzdqq529+8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YhlAHkEYnnZKfrawHuif3vMfVpNB1ZQ9Ocqbym5RGnA/uSxqr9709qlXPBWu5HFmHywTTJQHWjwj2s3DfTouoHlayaHUl2Tpnf6WH5KqjPpzi15iiy1VU7Luvp+fvibct6cxtanfwmy7OxfG6QH/9qQ9TmdOqwDtyoDALrLdTyU= 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=OtzQGRtN; 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="OtzQGRtN" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-718816be6cbso3988693b3a.1; Mon, 30 Sep 2024 11:00:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727719244; x=1728324044; 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=OtzQGRtNt4wbPjP7AY+yTX+MArBHvrG57e9ldAkKxQBps/bBbKdyiQ2v11Wli0speg +oifxiSpSgnFVMMJccuccXfTO8NTzIwc1jvNO+Piccl93rQ8aVlmo3+MAM4XV1Uw69CI IL1jNTDB5OOZKmA9yI+1ZiTmDKQQ4dgeYzJ6GOJXZhq/SMr2G+Vbpy5HskGvNk478Ksj 5HjTYi/mRSgyTFWPfKbQju9+JyssuiPNvjUbBLfxbnepY/loER6ZkcDHJ/vqZvy/P7e7 q6st8BDNpWRyYnltwdibK9HshkZxeSIdDQcofBxqgE37WKCOAFhzJaW1RkXf2Yhn+LO2 WjwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727719244; x=1728324044; 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=R3jII9r95rk6H3vjk0pl/4ZSneg71tbpjINFgavoC+bLJ+hyQJMfN2SlhjNFaFEEod DbHKnbnv73aIX7AC4BGc0XxmPrjQQU1BLN0ZVHYT1WPiGW8F4dWRRKNRsfcXteGQvfoq 9uwTs15Eh2hM3UGqC35pUwscgMAnEMRB7HvGrrIcJaGTALBHfTT1bAedXyXl7r23h31i G/Pp/urGaytEI9fOxsbtxifSs+j4fgm6ZcPCXy6JzPWpeHgYbkAwf3py1W57qOEUTtU7 vvqK+/0WZYxMTtb0uqGi21K4ZaKxfH+yGw3HRNyoxJrrWs9k7JuYea6D09oVoqRy+n72 2YKg== X-Forwarded-Encrypted: i=1; AJvYcCUEf9K0jj2YPw8ZuO6dkD7M2zX2NYWIxXzlvc3988SDorhDEp2muThgqGDvIIl4UfT/kHz4AVl13vrJJMM=@vger.kernel.org X-Gm-Message-State: AOJu0YwPeYJlPsOGAHGZCRd/sjAh3Fbnc92fs9M9tYPQ4jXIFn9th9J2 rwUilLY+rMw5wt3ohSIjqm23UR7u5bzu0uk9Ddcd576sPy78K8Z/R0Ypd1NE X-Google-Smtp-Source: AGHT+IFPQCNNFERY9WYij2gd6TzTazHKoJBoHkAmq4dolUqRdFNjctkXTiSCaPsQNpuhiKsXvccuBQ== X-Received: by 2002:a05:6a00:2e13:b0:717:9754:4ade with SMTP id d2e1a72fcca58-71b26057a2bmr20963419b3a.22.1727719243788; Mon, 30 Sep 2024 11:00:43 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26524a56sm6740653b3a.149.2024.09.30.11.00.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 11:00: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 03/13] net: ibm: emac: use devm_platform_ioremap_resource Date: Mon, 30 Sep 2024 11:00:26 -0700 Message-ID: <20240930180036.87598-4-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20240930180036.87598-1-rosenp@gmail.com> References: <20240930180036.87598-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 15:31:59 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 6FCD9199E9F; Mon, 30 Sep 2024 18:00:46 +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=1727719248; cv=none; b=PEwRKMQXHy2VThk9j6QZiXZAdAwdR4/ql8WlPX5sGnTC8PjQquhbxMznL3j9OQC1tLoiMKbMiizDxxtgAo6uazZcXITBnqGjrx0uz/nfQNCqp9E4ZOZV/holnfWzz/J/PH7ZeKOev6D0hp+wOtoOjncOazbYdtWRB8tzZaw1AvE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727719248; c=relaxed/simple; bh=k+hWWt4RJCuaq34feyjRdwmdzmEmgz88H7zHH0eqdeo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ju5xTYLXdvi3xi3BO/yfTiCiejVLdApw+rYvlBe/KVUTUykYfEboc67quqQZvcmi+1pw4Edp8V8zXayLyuLAbIDvP7IWkO40Pi/62fEYcNVHp/qBnuZ0WcZ82DVcb95vIn7G5po72WWw6k0AnAaNTPhaYg+nrFmyl/G0Yn1iNrM= 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=J1bsAkkC; 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="J1bsAkkC" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-718d704704aso3904067b3a.3; Mon, 30 Sep 2024 11:00:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727719245; x=1728324045; 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=J1bsAkkC+5JrgFrXwanW8FSXiqqoVbR2yrk1oQF+2rgR0azzkqP6ADBtPCN1/JQ52f PqqNXpjeLUVl1v4vban8g8gRQhiCaYlW1sAIwxt8+jR22WJBX6B+1piUUP5RGZoc5x6T XVZklCNIYyHNpspzEzyjmrh9qXR0jHuPpPRxxAps9LaiQPs4qBIb5ySsHjDL3RJFKsIo ZuRDoXD1Gt9mMSExEOofKEDmYAi9aZXR+/MIcM3ZxkisrRLLidN22G+VTHJbPL2ceRSL 1UM5DYW7P8/iArbztV7BM8PDQTVQ3gsFn834nT+e5hS6ScTaYnjSCy0lrrzopdr/FthC sHLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727719245; x=1728324045; 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=lFLW8bVI0tWZKMizKCaznDnbEO1HH7iq1rpnoDblJSya43R2rW/CB+sLcLQTAuo8RP 1HQzMPl5ijcpEpI+f80rWPrsN9X9BWmIiteEEV2rrQp6urP4yuOiV8BT8vWt1Xio53CB zAvKWlVutRvYFOwut+dqR/ZzM2VNaQEUN6M3WVEhhLMLBxrco4nlP0A7u3169bBJcDe+ /UB1KorG9xLYJiyKdwQ/1QVJffaamXY4KKdFpVYStEaErKvlN/3JRh7TXF7Foth+XVID IB5TAX1ngBs88ws3JNS33SoFYRPKX5tJL3bpaqk58NV3UlhfJR+b7ozniIZoTtUuUZx6 u6gA== X-Forwarded-Encrypted: i=1; AJvYcCVYHRnQHL8R93Zf7FZqio9OSyUcpGipRtNT3ZJVoX754TijfVZgENuAjwY9JwWndzGX6L0V8TbsuPDv1Ss=@vger.kernel.org X-Gm-Message-State: AOJu0YyMdBgF62E7T6O3PFBgo871BeXd6fJgM7CSo3+601zyJ+I8QoFh bqMKmJqyK358WUdxKZQIbvtHctDvLVBHokRV/armVtgq4nLJdqq7N30v2O0i X-Google-Smtp-Source: AGHT+IFlZ4b9brqjXSgkEe61MDiRpCXUw0Ecmfc8TK1iHAw5gqS93PPIrmyKXi8eAH1RohgdfOo+uw== X-Received: by 2002:a05:6a21:38d:b0:1c6:ecee:1850 with SMTP id adf61e73a8af0-1d4fa7bc317mr18750956637.49.1727719245355; Mon, 30 Sep 2024 11:00:45 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26524a56sm6740653b3a.149.2024.09.30.11.00.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 11:00:45 -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 04/13] net: ibm: emac: use platform_get_irq Date: Mon, 30 Sep 2024 11:00:27 -0700 Message-ID: <20240930180036.87598-5-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20240930180036.87598-1-rosenp@gmail.com> References: <20240930180036.87598-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 15:31:59 2024 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.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 E47D9199EB0; Mon, 30 Sep 2024 18:00:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727719249; cv=none; b=GNijrKhdkHXHqBLHNWHYwdZWAp///upfty43QVo8xfyRGH2XQMImvkuYmUb9i+KdlxlrX3Aj4BPvSkc/VwAPaLiqW3mSQfbEyqp/UNa5TCXFnD5wp6ZZSTEaX2TPY76d1LDzaERvfK4aFcJ3h7Aewt2Ote6OsHTIvMf9dzOdufY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727719249; c=relaxed/simple; bh=8lBOVvzvGRf+RpMwtTpzh+BQKToFBXpodpfesW9+iz8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DyotZgxsEQfWwFfqJZDOZnMQzXbQE0Iex9kW8C3GY/kGmeQleRBhtZyzQLA0elXeg7JDFkX7OsGa18NTIRrH37jQ/XkWW7c3YSmZU00FJUP1r5QCN/H7kr7B1psHZchH9DK5fXRTLydNNVsdP5mE/ChvCDN6Y+izS5diSt7f7rU= 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=MV4i8kth; arc=none smtp.client-ip=209.85.214.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="MV4i8kth" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-20b86298710so12047465ad.1; Mon, 30 Sep 2024 11:00:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727719247; x=1728324047; 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=MV4i8kth2DkgT1+hsswR/Tr+UOL5QIm6R2ZeNZYKciyYEAdN8R4D3qy0qZ4Rr8XjP/ xH+IF5B+xsjIZNSFII4kFW7ssnY33tnPu9bN3E3bz6ELwjxeekVKjQRw5AGlUjAbr5fX mC1JzToDPPdAapOoxYJ7BbpcWeWH0YhUmGNLm1wQyprYUiyiQOdRi8aBE9LEifivcSVy LFYhv0m3XRN9UE/2h5vwi7DWHdiIWL9lGdDE5hxJolYHZRPpSj4zD6xXz+9aLEbG2dhY dSPYbtclgdkYaxgv3yD7zmy4H/dK7pqktL22kRnehnemL6QujPhrlZJSyKwvA3izGp+e 4nqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727719247; x=1728324047; 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=l5JOrLuHFx7aiec/1shLhVIJGLqyOIH0lkYa7xS+po3DEpZwHSOxvL92Nm0B99OQHs qNF0FfyGSNKYkRtPs4BE9ZQiLi2BMSQKEJiMZ3266uiS6Q2Lk7OdHY1L2fY/iZONM2R3 Zp0OtP6YmAfpYwDQ9VQ3S3ax5L6dIP4yYXdY2yJ7exnUWIAlgBGywzhys+unpQ67KUao /CTguJghJ5xTR9drc+zwYNiHtRySf0h/x2pFFoAZ5rJD4jlLPWsfaqclk0DA3I8vxUgD AXhs0oDFoSks8RT7fjLKJLEd5Vx4ygjDRsXeE3vTGMB6o3nJGfHRlcVowonM1R8umev1 hOzg== X-Forwarded-Encrypted: i=1; AJvYcCVYrJxoh9qCs53Y4Ichx4kbgBNYe3W35LeH6K4fW3YbHayEXL6vAGtZ4VIRiTnkiu8CwzRusk3J6juhsvE=@vger.kernel.org X-Gm-Message-State: AOJu0YxIywyEilH1NRxbKxN7NDX0JQvIHCXFzjZ180nEoBCATORDcIRr 2GicvrS5EtGuBSJNARNmI5KFssvC/vLl7y4JwfiE6YX+RcZvs5tngnqfQsgv X-Google-Smtp-Source: AGHT+IHD/1yzjotAV6dt1XZMfm4CmugCKasvgir3TrVHmC+WtZOYvWw8gjBmJfto+tfh8nC9jFNdcw== X-Received: by 2002:a05:6a21:339c:b0:1d4:fc66:8267 with SMTP id adf61e73a8af0-1d4fc668340mr20134350637.4.1727719246970; Mon, 30 Sep 2024 11:00:46 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26524a56sm6740653b3a.149.2024.09.30.11.00.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 11:00: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 05/13] net: ibm: emac: remove bootlist support Date: Mon, 30 Sep 2024 11:00:28 -0700 Message-ID: <20240930180036.87598-6-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20240930180036.87598-1-rosenp@gmail.com> References: <20240930180036.87598-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 15:31:59 2024 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CAAE719A2A3; Mon, 30 Sep 2024 18:00:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727719251; cv=none; b=eqjZQZ0nG5A7+MOBVmYaYl/0NP9nvL222JCKahUZpgcv3bf7uO5219oNFTpKuPknE4wP3eHqPcufC9KFp9TtFFnGVdSS5YHUiDSbk9kyDJmW3NWHIFqVS0G3ahYhEpzjEOQC7ysjxEXpxENK9ePUMLnQWNRFXBlgi8rLuc7239A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727719251; c=relaxed/simple; bh=R3/zEAcwhIv1vvXu5eqLy8v9T/QO1blsvg8rxiWDF6o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Kc1+MxGg8meO2gIjaOgOJNEFO3OtlardA5PAfSKNQk1neblfeo+7Xw9q0vE8K0y2Zmcun6Pf/FSLP9/XvABEz8smvtLyeOphM8ETH5YybbAQHkh3GoAJlTybXftJxLjmPbDqfYYe8R5hJ8h21NXsfqA8yrM3MzP9VII6kTSJxQ0= 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=Gy/0bn6V; arc=none smtp.client-ip=209.85.210.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Gy/0bn6V" Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-7198de684a7so3218958b3a.2; Mon, 30 Sep 2024 11:00:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727719249; x=1728324049; 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=Gy/0bn6V0cBZNZR8Ksih1qf1ft1a+MfObL0hhxajoR/wKhprKjX0QlJPAwFK1HkYmA r6F8Gze60Kj03YZtJdws95XKiDylqFRTEnq/RgUsWkvoGFprV9PXePfqLmTbgdnvI0FU hHGgpXGk0hgNxMmMKW603aICn5Lc3H6+08R36Co45OfyFdjYuY753vlGSpOkUEeeuM0/ r0kq4iu8eQKMR3HM4KlcvAbA0OQ8v+mU8QaYMvv96FC5GUmdDUwYWMhRGQGJqE+qVK8c NhEGhevjcpveDlFrsKPnCn/oqnq/uojjswk7df5/Qa/WHPAJAG6Bn1ashuL/8KnfP3Qz V5lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727719249; x=1728324049; 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=j8qRgjoD/W871QZBfLCUSDUUp+9iAHDrEz9GrqGTMTqMzJ3c0wX14IUHDocHd5qjs3 QLNSuj5kELe2JAIsRKBgGUIQvinceI2omVXe/r+0d7zeIUyj7ZXk7cktuwIsewKbQdAo +F4voAHGhvsO1s6tzaU8/q6QwMwdSq/CJHkZTi06JagU7p9EjPyDvk9Pa1bq8G/W7067 amlcfLMo2RVxStpwzMBFb1znKd50RGZ74gHqeendwal1EtnbiEkfEBiBcsoyTwoaf3C0 vnn+MbvnMOxI0KKP0jxbf9i3RPFL7qOC63WgdVPB3iZzNBVJ0mKKRFR2qUkZLSqtQlms nAmA== X-Forwarded-Encrypted: i=1; AJvYcCUrwMJLsThgeneaY5P73F7Kk+2EO/gs7wTrQb5OboLL1h45MgCoPUEMLrT0prTWML9xstHRSDy/2iTG2Oo=@vger.kernel.org X-Gm-Message-State: AOJu0Yyw9PbswN4TDo+cJ7wW4771BsecOea6CXcBiOZOuVXcELqHlmTf nsKTWB2yYwRcp7SNBGP/UgNqie05WZrvTSUykUVnqgu3RPfaq3DAzMVvR22J X-Google-Smtp-Source: AGHT+IEgds9HZwakhDIm1IWZQClKaaK+cnTjml+XjeD48QSENZjQpoaufg4Qv+n38KO0b6bxp7HdKA== X-Received: by 2002:a05:6a00:22cc:b0:719:7475:f07e with SMTP id d2e1a72fcca58-71b25f0ab4cmr20222220b3a.4.1727719248770; Mon, 30 Sep 2024 11:00:48 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26524a56sm6740653b3a.149.2024.09.30.11.00.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 11:00: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 06/13] net: ibm: emac: tah: use devm for kzalloc Date: Mon, 30 Sep 2024 11:00:29 -0700 Message-ID: <20240930180036.87598-7-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20240930180036.87598-1-rosenp@gmail.com> References: <20240930180036.87598-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 15:31:59 2024 Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) (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 821251990CF; Mon, 30 Sep 2024 18:00:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727719253; cv=none; b=o/MQDUlUT7VoPIo64l9UU+DU7d0l5EVk7kg046mbyxjpDS0Hp7iYORnNrwFpXRuaV0aJVpZfqxmMGHyVp48FQzgiUHEHHgkXqBRUkUcqsA2GiKdhlGsQNVMP4/YqUDYk43CHw03RDa8mieHkb72GZYWBwxMPfI0gB+rmPOuOHIA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727719253; c=relaxed/simple; bh=2IYzVGZB/me91vV9GKAMx/UOKfRS26DvtY0el6//X54=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Yos4JY58ZRyIkXBGt+uQYTO2Ybo6NDBpEAQNqJlgPsZLtwV0YbRf95CPQ9t2KuXXrMStTPBMWVdJh+ipAdJKjiryEkkZloqopnNFLlr8qp8SYQ52T0j8ViBxbbPEgBDPuzb05sTOC+Ps10F/bimHx/dL5xvJW6QJFiqkkO08gJk= 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=gAqPJio2; arc=none smtp.client-ip=209.85.210.48 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="gAqPJio2" Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-710d8cab1c3so3386536a34.0; Mon, 30 Sep 2024 11:00:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727719250; x=1728324050; 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=gAqPJio2KPJygOLA4wF3/XLl6Zd7VumT2nz6RErC8vzbr9tnwJ0GsPPfKJuKFne763 3X4Ro995M7MysDmUtw94G4GcKN80HWATbga/0A69y1ZvU/1a764kG1K0DC7oAHaANS/g Bje7/glch6WI6XsnJ3MjKVDRDvzaC70qg+b8cWV5dD40JYaNDU4I2xm8U5HnNJHvBl+f PvNW09mzMEv55cT9BZhusND2mvhhNyuvpiJAtNQKJA2EE9WEjVlJPQHXYq/vcnqmOnCy OMa6xQhXroGNc5zTQ9ZBFLejrHrTWYBA0h9gLDzLVj526zB4U5rjrVeAXWGB+gQh7Kke mh1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727719250; x=1728324050; 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=ig9+NbUD7InRz1fmrEYopQNzp5AxZHop7ByOCrrDjkYWSWq1V7aGzdHYsNz6MY6ZDE wVigqL1YVpwkBNIjZaNphsTjaJwehU+zwYYSazp5bQcpaehyvQ25Q4shzrMerWSnfceu EwLzGNOIaPuEGykndT7ynJiC2puANWVmSty6gCokR1dvxJ3eOnKG6SBoLZV1WtoqpFpI iOpmqdWvoj6/8nbde8wbEQkVs00KGT+ebAIEF+zXYE9FpVKVnCO571KSQbHPQCX/cd+i TT4wg9MdDH6ompd7coeoolceJyEZMIM5dc3z676/QWg642HNS9e41iFQ8CcxUWEdCg8/ nROQ== X-Forwarded-Encrypted: i=1; AJvYcCUjCw4xIShlqRud1+3LmKsxnezPnobs4RjiZ8MRyiL/nxcR+N/uLLS4u/c+EHKUuSVZfoFUcHekj9G9ux0=@vger.kernel.org X-Gm-Message-State: AOJu0YwWtFXzzyjV/tAyH75ooRTo9rTK3wVU54ZgzLgllEP6LP4c83FB XxC2LthDQXvYjBM5CQUFB7VTVaeSOzYuQSK1y/vegE9z8ddtA4w2xOMI7YwO X-Google-Smtp-Source: AGHT+IGZot+/JUHGiiHQMSsd+QSufVIvSt5CtIgE32V7Kxsuzp904usSCQPJpII8GWn1HQUY71yP6w== X-Received: by 2002:a05:6830:6282:b0:713:7e24:6151 with SMTP id 46e09a7af769-714fbf0ba08mr9482432a34.25.1727719250346; Mon, 30 Sep 2024 11:00:50 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26524a56sm6740653b3a.149.2024.09.30.11.00.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 11:00:49 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCH net-next 07/13] net: ibm: emac: tah: devm_platform_get_resources Date: Mon, 30 Sep 2024 11:00:30 -0700 Message-ID: <20240930180036.87598-8-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20240930180036.87598-1-rosenp@gmail.com> References: <20240930180036.87598-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 15:31:59 2024 Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.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 1325119B5B1; Mon, 30 Sep 2024 18:00:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727719254; cv=none; b=QaQQG8kww1ooWK0297rhMZNA/VTkIzPqSOfmjNJEsQW+AnttR6QsZSawZw3DNnK5V41xorPUvNPeAOxS1ADilnm2ANr7N3wH4LK9HNJgNd/ER5TX00gk/Til15G+4UlpvTILJjTkuyZWZ2BVOmkV5EM5nzuPCdEq+V1A2KwwK78= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727719254; c=relaxed/simple; bh=A8gJS6fEP9QvIScx57iYcjbGzw0KGh8cHqIn3dIOJyA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=B+ia8aFlhhfIT93eEewSympeuCxLP8lmYYiBtXrACl7B4/tE6k/M45/couBgjshmiBP6fRVDR50133LHnIcQzfi8gUoks3mz9SWlduqNPv1ngVnWFKrK9/fbgwDDqOUAMZ/C1KbDwdliubmomKZ7sIHFwDSWXJQyAuqoV3iLWWk= 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=LcyHRdMH; arc=none smtp.client-ip=209.85.215.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="LcyHRdMH" Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-7db908c9c83so2872978a12.2; Mon, 30 Sep 2024 11:00:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727719252; x=1728324052; 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=LcyHRdMHm2y5Y5Vyn11uVTyLxLikbAluZ1wsVHvS4PZ/02OVFjKATXeFrGYBrCoWXH zmbCR9fKNjPcgxFjllWRTTeIU/Z6QP2h3EqvO0Ph7obYPZqTmX6/oQnIXdSfCm+KlgxA aTU61ZwR7ZFwyHtYQ5iGkJ9l3PwRBCEl3SzXh8dPkZyHytV9jvz9omsjU4WpqOPItqSc WR2im4lSNyx9EkTonISIXi1PWwSZcLE4yv0auyYDI9cQ0SUpxc/8hJz472RNXGK41aDt ppNuqBYnd+MrDQgZ256AnfW18h5vqrCTZKaz/nP1EQBdkbDk0JjBbuZLUfodr+6mxJPw jWDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727719252; x=1728324052; 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=jxwbaraO96Y/ho/ZEIEdnljYyhTdF5HQLvQ6HPiT5XI5scyAnFMlgKxhs976biqNoh LJgwfR2yYMJsJhlDV5VnW3AyWP2IYUz2h34raU+KLE7zDvb1wu2dBc5h3cntqkU6b2vn bjv3gyEt5UoJdTmkmwKzgfLDgTztY8ATZsHKwV6KsobyYXMk7JO/bTsMfPfEuYoGZ9bG 9vByenD7fpEOsQs1nquGiqf0S/H6fxGpIPR8H3WU8eqxXxslY9V7yoy4S2hd5rPhYdu8 H5PeFhQPghQj+Vi2tiUxzFqIhww/316w5+GpOQSCVU3fp333n9m8HHwMG5Xa1hsIG84I dy/Q== X-Forwarded-Encrypted: i=1; AJvYcCVFaJlA7ZLeV0hUjbHWzSrBkvnfi7/tl/MArjfygtmEvBCR0p59GWVPuLFNYxVObNQlhCBaDeLeOJnfYZ4=@vger.kernel.org X-Gm-Message-State: AOJu0YzNiLk1rRXaoRnbQ6pTO50JoLq08n18osbas82vbSyYuW12B0UO W2gP8N8XUE8Srk57nb7aNkXPvMWHLUQf6cyZTPPQUSs0PZuGQwJcTSm2lZd5 X-Google-Smtp-Source: AGHT+IHX2MC+Oa53W5Q5flWNCIn9dgtjGOXK4fqIPn33LqTIPXsl4Vu8cc1Uf5Q+tTXyK61lFXVvbg== X-Received: by 2002:a05:6a21:3406:b0:1d4:f6c4:8e7a with SMTP id adf61e73a8af0-1d4fa7ae0e3mr17066023637.31.1727719251899; Mon, 30 Sep 2024 11:00:51 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26524a56sm6740653b3a.149.2024.09.30.11.00.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 11:00: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 08/13] net: ibm: emac: rgmii: use devm for kzalloc Date: Mon, 30 Sep 2024 11:00:31 -0700 Message-ID: <20240930180036.87598-9-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20240930180036.87598-1-rosenp@gmail.com> References: <20240930180036.87598-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 15:31:59 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 7851419CC01; Mon, 30 Sep 2024 18:00:54 +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=1727719255; cv=none; b=ofoWgjZIIhVO698VRDV4oIZibRThGL0ZQ9l5aY1g9Rm2bozWpAPdW2aM5zArII2pnX8bH3Zw7AKOnDHAppmTUVOfVFPb2O4QecbXG068vp2WRY1ZUTpCGqos3BfbsBI+gOTuYmP6S6vb1oZilcvpEKjkQg/LpJZ99Azx8SrpW4c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727719255; c=relaxed/simple; bh=fydThqOD5ClKR+Zw1FUAYrUkTY6IGp1FS2otAaIRZUU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k3lOvAlXr1QviydXYSWOz3nUrsSld3X2CH8xaFAmqe3FNbSdvA2j7yzxN+X3IwSLUmgs/3vbjb0eqwftH8eKT1fG1LUIBH6OVBOgPOiJdjFcDDcYeHiRHGD0KSmSitdkrcI9QWXCgm0GXFSlfmHXplm5Z+INJ1WAAYvAefhX9zs= 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=jrnz8nAp; 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="jrnz8nAp" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-71b20ffd809so3369842b3a.0; Mon, 30 Sep 2024 11:00:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727719254; x=1728324054; 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=ydJgFVEkBtydwBIyqxhItq4Mj8+RadfMw1KRALqgz3M=; b=jrnz8nAp72Eb9sxP30nSyz1fBn6+zmsG7DeJFSU64ngj1ttyaiQ3V5yHSQB0RNduNe Kq6ht7Drq++IQMO+hqEbKlH/X/6FALiku3rNf9TxuocCE5q9nT8l9fNAKDP9rkTv2moQ Qj8nmqZFc3hP431PWhosTc4qgAhdeSp/L6S4QnBQMJiz4CR1RWdnH3FXomZBwzZ9n2re eyUYgEBWCkwhNkbjmifd6cQDl/u7kmH1CRUQ2sNHiAjwSZQH201huyaVUhpBlzjNyoEX K3uxfFPMgiL4PEQ00dYsZ25t12P0Ys5UJS7oJSTHwjNHmTihgYK2BloiPtM8Yd6k6tbr hRsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727719254; x=1728324054; 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=ydJgFVEkBtydwBIyqxhItq4Mj8+RadfMw1KRALqgz3M=; b=QbpL6vBSVJ8xHGT9mhCNmvRlPKm5K+ZX68ejGVMI7Drr5/plmCjmDkVFICZk5JDt41 DhgvmshYjgOx5tJ1BeMVPaSE0PvVeZILIsdt17wgHo28hADMWLunlaZi2HG0a9zfIQlp XnKbSkV+87I6BgV3W4geGr3QCK11b3By+6eVB1za2pyPR0fWJwEsDfSrTY4EZAi8x9dS 6LDPspKR5NlVbgI13AO4hrWBDzRjoWJA9O3wm2tQZMlb3BqFLBLd/a3MqlhaRsy07TwN sC6h/kBy1+q5AinMoudTHCBUpjpBq3eBBolOrBM7OKpItt3WqtMz//8f8rm4fShzmxQ6 r5Cw== X-Forwarded-Encrypted: i=1; AJvYcCXiIRquw5WtAipbHMhOabNKbN7Q2vPXTmi/MeST1ejnBwjF+gafIVewaUXU5HoaX5XUvEhpNHH5T8+CSZQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxYXx/W5DcadFqurmwWZKSw95RI25BGW3wK1yowbrGqEBPxlooS 86Gf/9KLJhhLG6fdwgY9o6POUIIsoEwKD1g5atL90VHgcw2+22WlaVnAI5Qc X-Google-Smtp-Source: AGHT+IH4pJHIa6zedEn3iUXHe5dvnP5pSHtxEFNf2rXQZR0Ijn5rEnwhJ1XkkEEKekLhT8pTf4warQ== X-Received: by 2002:a05:6a00:a93:b0:706:5dab:83c4 with SMTP id d2e1a72fcca58-71b25f8f777mr19253590b3a.14.1727719253609; Mon, 30 Sep 2024 11:00:53 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26524a56sm6740653b3a.149.2024.09.30.11.00.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 11:00:53 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCH net-next 09/13] net: ibm: emac: rgmii: devm_platform_get_resource Date: Mon, 30 Sep 2024 11:00:32 -0700 Message-ID: <20240930180036.87598-10-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20240930180036.87598-1-rosenp@gmail.com> References: <20240930180036.87598-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..d116de4e38a0 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_get_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 15:31:59 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 A569919D070; Mon, 30 Sep 2024 18:00:56 +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=1727719258; cv=none; b=YVI8O1t69lFlwwU64GC6UlmFXLXbky5e3s4QVSu/fFpbyjHtPOgvsb5MzdIwLs87GIdhUAD8yfOLWPUR1vlKHXNKQQFNrxOwgz9sy+h1Lh2G/jZNB0qQ8dqzSD0+jRU7EgKdmjciAREOBp1wVIAuVcJFryip/2Cy7RfCFOVgWNY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727719258; c=relaxed/simple; bh=jcEPPiC20NiN9gN9PQRjLJGI4IFmPIwO1pV6PvaDEDM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H8kwKG/fBcz25QNBxMTVKfMGgtL/Sc8Tjzb5j9uWhAhELHOpBpPkVrtxr6e9BaQaMlwvxlRUh/YdDiGOUtcc9VI+Oc802sogvIMV48ZO/LwUIrSAcW4RneGujhGlFRnEs1jLFiPaQah7i4VrEG0l7cCtu0TMeyWgBPVsnFcCJpA= 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=Ltd1RkW1; 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="Ltd1RkW1" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-71798a15ce5so4333356b3a.0; Mon, 30 Sep 2024 11:00:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727719256; x=1728324056; 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=Ltd1RkW1Yt3W89QMjtfPDxoZOcOWXqo6IQ2XA3TceO/I0g40wKnsHMtViog3ybu8YO 1KH4AAS9AdgG7prh9GHT5WlYFoJxyoyXNoXhVemiLIzpk/XJAYLh4hMNbofJY1pn0I0R 1iY6VdsdUcTgBVD6ZySVI78jbnWY+z96fAQvLtBnurrUdAA1oo25dnMt0YdI5uxCA8op 4soaSY2tdureanL/fJprmst9i3Ps3tfk7kCcqfT6EPxFRUW5zgS39+4DVkKD5aJB7Jpi Uj7KCV+rQ+FlTYuCeiFQ3xmkuLqaIl906GnqczVVjamJTXIks9//BmbmPwDuN/CqY8Qb UnAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727719256; x=1728324056; 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=FlN9wTkP8NcY6hLrejOJA3cffCv2YHieXpVmbORSM/d3J5z71JvrkgmzCSAiycLzGy xt4jn136x+3XRjA+Y4t7uaw2bEuYSjpiG2//YQtV5xfNTy5byHqK5lds5hP6bRp3bl5L 5bdx1cDx9gRkgq36K6D6ssBhan4OCtIrCHgrf8IJ6pnllnBrN4O56dYxjhYGhlPPs2ld 6ots0ueht2GNJsg/bjSTh0EuzNxx1sh3d6sO6pEmvnykUiZOmfLbkt7d9YY3BVXWs5JA uHKJZwYkXRxkdLmmm/gtmk6whP5LtRb61Du/x5p9Th+EYrlwpaoqGMFdvU2OGcU91rA9 YrqA== X-Forwarded-Encrypted: i=1; AJvYcCX1ZMRIRpC5czokdzm2PhJL6KVH90UhkrVKuLCpSi08EcLCMvRywVh+6pqwtmAV0IXCDqpAxa/W0rTZLlI=@vger.kernel.org X-Gm-Message-State: AOJu0YwmhpBIXiFqfLfVXfjInVFcutWDj9620nQ8IfTJksdbF2R+UseP a/32tr+Lj8JFquzyZmx+jVOAx3SP5Sz8bvhsEOpHaySn6EY+5SlnJyRfyz1Q X-Google-Smtp-Source: AGHT+IEdLqQ4UkXrKrNas8xzJBn/q8LOUC+fDCZxwwifudkAI3IO/bBZWxAeNQipKKh0FHyb9SlBhQ== X-Received: by 2002:a05:6a20:4308:b0:1d2:e8f6:7f3 with SMTP id adf61e73a8af0-1d52d10a231mr820620637.11.1727719255655; Mon, 30 Sep 2024 11:00:55 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26524a56sm6740653b3a.149.2024.09.30.11.00.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 11:00: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 10/13] net: ibm: emac: zmii: use devm for kzalloc Date: Mon, 30 Sep 2024 11:00:33 -0700 Message-ID: <20240930180036.87598-11-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20240930180036.87598-1-rosenp@gmail.com> References: <20240930180036.87598-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 15:31:59 2024 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22DDA19CC17; Mon, 30 Sep 2024 18:00:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727719260; cv=none; b=GdY93Mi5G2EAoLnhP83OM2fDkIu6GhkzleBLr2SR8eM9lG5h0JLUkwA465AqujXlaq5aUSGP9iaIcYZWYrql/WkyxD95OcMRDxFefNkk+CV7IxrW/o+pJRgQswX7qw9je5VHlWhPja4wAaFSM72p1fjDPz5K9ur7ep/uW+qHCBM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727719260; c=relaxed/simple; bh=/JFQ1f+yHsjb5Zt6+gt8OydljzAA9ds8/yUsrr7/NQY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=avqrzg1QAzxeSqVogvXMKSvuxc7KOD8sKICdhkFclYpLexoGjr8IUxW3PlcGEixFK7BwP4riFil0xsR8iihmB+Z2UEwWvYNlKUepO2wEKIBbN/PIFRWBVVfhzl5Ors0/UAkUED6d90PtydVQTwuppkghTCGtRhPVztWROqMGdXU= 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=acTZOfQ3; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="acTZOfQ3" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-71b8d10e9b3so2470139b3a.3; Mon, 30 Sep 2024 11:00:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727719258; x=1728324058; 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=acTZOfQ3ft9NpqR1I3xeHxjC4DkjC6srTFmE5IKKzGsgdU3UmiaT/yoYSb2fuQBr8n usOXQM7ZEXhc4SeRjBZWi+d3XuQv08epnAvZuiqVgAJKuqj8MtKSTKXVB/KLMkLnmfcE CUEkOgMalj+dCQDj9FM7bBZIjVXCUaL66WPfvpFOYkKkbyvfblgkcIDbRPAnZY0+0Dug wSOUospH4W/H27Pb7cAXpAzxn1rud54dGqjYn6fIG2eezfsPYVx7NdIAYUr3l7MeyKxI qqHsMg5H3D8ibnqKp8bfHEqgUhPYarDlCsqh5DxRudWfQRll8U4ckqVmJxxksHqhnBy4 oxKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727719258; x=1728324058; 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=w8K4oWOjqkRxbgR7Icjcri3sZ4o+ZwVhsmU7GTztV3oDqJyAMDPTyxB0pjraZbZuqK wbtRyXvRoSt55GU8hCA9ic1y2WDgUzfgCXGSG5uhVdgNDoDkTAq1hJvezOaHsgGtOOJf wyZEo5x+Ep5sxED3CnYNLx4E9la4V1cFuA7kWP71S+PK8PRyBLIyaEluCNjr0iey1mfp 5gqe516Islis2rt7gifsqLOJjKE8XMjw+XzsezXS+IredHzYaz568llcORTE82QTMbrT jN8OocgbFZxKl8o3ZOMqxWp9+SPEP9/oSGkJGqUlvUnAxVdjkEON2HNzAj1wMHQIl0aK Gi5A== X-Forwarded-Encrypted: i=1; AJvYcCVlYdRX7ETLZtsrUknasNOv2f6LY3ITrPykAlTPKRX6N0smZ1EqebBINquYkKSfJWIBGHL9OFiRFiLCjRA=@vger.kernel.org X-Gm-Message-State: AOJu0YydQdrtE6Q0bAG09H8uCY/qWgI1o/2Ar+k2kIJtAOUn1UXP6PCx QSPdsJV3p5OEsAao29dmQub4TdtbyMIfGCvoDn8Cbica/wfV4TIpbbP9SDEp X-Google-Smtp-Source: AGHT+IEiCCpqp4BpRPIK04mYZRGvc4wRMeuiJR8i++/Bxk1tfb9TBwsJgDtaeJxDemG8V0/XAqJOLQ== X-Received: by 2002:a05:6a20:c6cd:b0:1d4:ea81:b1ed with SMTP id adf61e73a8af0-1d4fa6c82cemr15747605637.27.1727719257244; Mon, 30 Sep 2024 11:00:57 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26524a56sm6740653b3a.149.2024.09.30.11.00.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 11:00: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 11/13] net: ibm: emac: zmii: devm_platform_get_resource Date: Mon, 30 Sep 2024 11:00:34 -0700 Message-ID: <20240930180036.87598-12-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20240930180036.87598-1-rosenp@gmail.com> References: <20240930180036.87598-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 15:31:59 2024 Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.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 E7ADD19DF40; Mon, 30 Sep 2024 18:00:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727719262; cv=none; b=JMD6W3Lj+ddxuQmYg4saBGfg618QejFIeoEQGGuuNIDEr057IpXFPblt7s4dqR/0LlFa2c5vEgHuMzS7B3yDvFc2IYNsdpkmFRXWc8iC/bp63e7VRvn01BTkmeOj9NpChBNnwhbJ7PQpdqcIbD3ayIvx/g14jBg4sPKa5pCPyDA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727719262; c=relaxed/simple; bh=kih75HuZ1ZXc3JQHkzwuj//sPN9nSONeRe7im09vADU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Gcff/x7Ss025cwR6xU8pjLW9ulrZZkh9wAxS1+F5Bqkgkp1/Osd+GHCbiEGu06Zak2zludiqZ1yA7ZHbAgqe2TVYYpOja5d6Az3flI1SywY9b7+xBeNrqDGydAEm4qEcPVjbfDxxi0zQzZOyg9KSQx1WdD7TWG50+T1bt4SftkM= 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=gs3B4aTV; arc=none smtp.client-ip=209.85.215.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="gs3B4aTV" Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-7e6afa8baeaso3976932a12.3; Mon, 30 Sep 2024 11:00:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727719259; x=1728324059; 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=gs3B4aTVYoetG63PlToRv1ehZKmk9Z4VRAWbe74ahKVqyf/SJ6/1kpJ54DU/JACVKQ 9rSTQQtpzR1JdZ+RbaT9N4ySHjIxBpdmIWfMwwNgqI6WG7Q89id1In6wnUSDIrOTokxC 1/cwKg58T1Mken3/f0N/eVU0SWAaNNBc2K57Rex/S8iSNwvfIFWIeu5pkR8jGvn6P0+K /STOV8hmWhAg9sywOjnpMR22XUQY0wDv8amtGrpMTPS3JwOOsknLsq/BrwCVA6LUniO2 rTdzu9qeupARVf5EJjOhAWa3zrfSWgaV5UB1ppTDBbx/JagPnYQjFWbwHRvCa/reKtCE Yacw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727719259; x=1728324059; 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=FlSf+BEdJE8pzmvkOwFU5H8EYi5GYa7CjlulgXda3WCmQlwZYC+P3k6wpPlnfLLYaX YeZl6UmsQpeIRYkfQu/YzIN2xjusFVpDLAApCgs3Ray2NicgYE7N0f0ZadUAIb4Jamue yqD7vmhcalkDmpirLOedk8i5UMQEqeLn9MkxR+ZHlw34ASrZOxcjCydadlomHydJdWX4 DBN317RgKIeC1Uy0Cqc2HtdkvN3NWlDP7lBJ2942EPLGpWFjl2OGy18D+h96lqrb5795 hMJmvv7mPE5NJkwcln3nLnb7zc6QeCmaDiTPg2cmT3nQMGOaGtA52M1f3gToNds0FVkA w1Kg== X-Forwarded-Encrypted: i=1; AJvYcCUNlrGkUmUWpMYR2T0+UWZ21sWd2WWyv4pnraGQbuQghqWcyf+6e6ymkArK5xs6dDdROUpWReg7kAffBvc=@vger.kernel.org X-Gm-Message-State: AOJu0YxCtl1B1cAx8qE3fVHSTfeigQeIJ9MdytQSArFkZdHH/+vRtNGL FQ/SqCkr5FpWTdfoHGPuvlQAUnomDwwd/X9KfjqTX4lM5wuZUwh7cK3e8pfM X-Google-Smtp-Source: AGHT+IEcgwhtOpx1Oynnb+DLLdS5yPI+qqFyS+sMQ/xuGcZjH4DMqhjo44SIeURueUn5WmZ+71uL7Q== X-Received: by 2002:a05:6a21:3414:b0:1cf:2901:2506 with SMTP id adf61e73a8af0-1d4fa663e54mr17152879637.14.1727719258796; Mon, 30 Sep 2024 11:00:58 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26524a56sm6740653b3a.149.2024.09.30.11.00.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 11:00: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 12/13] net: ibm: emac: mal: use devm for kzalloc Date: Mon, 30 Sep 2024 11:00:35 -0700 Message-ID: <20240930180036.87598-13-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20240930180036.87598-1-rosenp@gmail.com> References: <20240930180036.87598-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 15:31:59 2024 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.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 5FB3719DF4A; Mon, 30 Sep 2024 18:01:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727719262; cv=none; b=dhMgn4/esbzQTqcPP/dE60AqfskEnjSWiW3s1v1d8oeDCNQXQLNo7apbzhDopfEPiGYXJwStYsuzYLMX5ZuiQr56U983AEWohtdaDs2s8PA5wpsCEmlUMhQ6IHJg4lbI9/q6o+Sq7R8YyzgETQHCnBb3FyvOBCxnXuOElfTQiUI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727719262; c=relaxed/simple; bh=lMQRoVBUULxs9uGBgMvAA2of781zrtmqhPL3IKeHEUM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a9/+8mZr+TTpXkslmxUO+piX3PCznZkElfYhsAs+nJdMS/ZDDp3yDtb1G2CtAyKAOI7kHZP+/TeYpJXnFNr6bAkUwzxANH2JyWHWI4WqVhr5ytcKEJ0fVoCW6WiCZUmcOi3UvSZtjj8NrEU8OQNmljmDtac29R8bMmyB8DWihN0= 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=Tevr1aRF; arc=none smtp.client-ip=209.85.210.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="Tevr1aRF" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-718e2855479so3321328b3a.1; Mon, 30 Sep 2024 11:01:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727719260; x=1728324060; 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=31HvVby4GL7nx+VsgXoYs6/cZZem/Qg2v55znIBPyLI=; b=Tevr1aRFuMMx8wOwqgF7Pzj+NE8cRu0bNLlv+gIFphA5UR7lkD5sR4AOUdJPfwSHbr Kf08VCNWDyevntFDv9DCJC+Z8Y9WIRx6DO5EnfbamV7AGRPOSczBV7bZnkjS8RlrNdSx 80IiDV3dp65bwzux5N8MOmMJVFyzqhozp/xfBufrkJxcRi02tVOz9JSzU/E3OcogVOEW Xap4vkKbETpTogMeK8M3WopaeKis6ODzgyQidweiJ3iL8KgPTIQdzEWPOyjAhiTPF5B1 kn5j7PFBbOYsmvr7qGJ5nAyzewBm8BkUgiRfqFyye8FLb6PfG7vRWFvqcC5xJW7v62IU GZJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727719260; x=1728324060; 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=31HvVby4GL7nx+VsgXoYs6/cZZem/Qg2v55znIBPyLI=; b=uBPg/G1R9FcOurTMF+2PQxxwNqyr0T29K2YAQVonvm4YaRl6If8pw6OcKU0pnpSuFn AzQdeHZLC0WemK+SEOf1kjcUn/wWEZwXR8r6xfsxfFjvHr/SmQImYOFdc5QLdZ9u1Z4b jCTTKGKa1Whbsu7OH5RtT6Hfjs6V/zD31te1VI7YURbzqMHFXBX4CWqbUzyGMRuNR6mT 1iAmOICz7bdL19u1jb5Nj+AaJr8InFRVoVt7xVVtoDp/G391DhrkGb6jVrXQrK9fVjgd SZ4ZLNjz6OG7RfTU42q9sy9Qop06OCdQUj8E8AkoSeFnTWNA2ey9V4gP1N+t5UAMKOrn TwwA== X-Forwarded-Encrypted: i=1; AJvYcCUbeeQKJY42H3XIdHpoqXkPGsYZnjDaV8Ktxq3lIR57LWymG3+8G7yvOz1yezLzSVK1UwMR4wKeseKyK98=@vger.kernel.org X-Gm-Message-State: AOJu0YzgHaYQXLEx/p6V2NvdUAvPnk5Id6txTrFroU1lg20kkeVivdT9 733bY1br4YvFij2ZVO8z0wL5xgs8kQ332/d6JJOQSFvhwci7iWTVmsCfAijf X-Google-Smtp-Source: AGHT+IFyAbHicDROoHhdPPlEuXlM7VoMrxpcjKj0ArsgPHbYgHPDfXC9YRfzrwcARSgI5nwu9K3l+A== X-Received: by 2002:a05:6a00:10c8:b0:706:6962:4b65 with SMTP id d2e1a72fcca58-71b25f74f10mr18620290b3a.14.1727719260278; Mon, 30 Sep 2024 11:01:00 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26524a56sm6740653b3a.149.2024.09.30.11.00.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 11:00:59 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com, horms@kernel.org, sd@queasysnail.net, chunkeey@gmail.com Subject: [PATCH net-next 13/13] net: ibm: emac: mal: use devm for request_irq Date: Mon, 30 Sep 2024 11:00:36 -0700 Message-ID: <20240930180036.87598-14-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20240930180036.87598-1-rosenp@gmail.com> References: <20240930180036.87598-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 | 47 ++++++++++++----------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm= /emac/mal.c index 70019ced47ff..449f0abe6e9e 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c @@ -578,15 +578,15 @@ 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 || @@ -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