From patchwork Thu Oct 10 17:44:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13830584 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.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 A18FA1CB526; Thu, 10 Oct 2024 17:44:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728582272; cv=none; b=cv7aGwOc6bmgNeczbzKMT2oajrXn0plw1Hh8ysyMlhKmV/UnCgvsOEhSv0wjGwAEv9sKnNp0mf2w/QQcjS2NQtQhSfTGvkWkwcDc2fRP5fTS5w8261whPYntJrvWLz+Aikt0aaBefgycQyPn1iofl6UjXV9vOQVW61XW/6E2N10= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728582272; c=relaxed/simple; bh=b3COy/bCyxAsFDqcstoYVVq7OIpHQpWBc95pMEOzU6k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fLxhTnhhXYhPYbRx1goVhLWkEl2VWahg4NvoKEX/6ksBR3WKg/2nK5UhnAMOI1Umr/McvT281MA0YzTHY/+CllvdY8WK4sWJEN4KupCsivyRJQ5YlUFbS0+MJkO9KeQVrJaovWQrXEPMvSy6jETXocTvIBoUDPqRCrzxwC0gElk= 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=OzzuHwcw; arc=none smtp.client-ip=209.85.215.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="OzzuHwcw" Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-7c1324be8easo1654227a12.1; Thu, 10 Oct 2024 10:44:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728582270; x=1729187070; 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=ZKCACtY/jZU9xUxgPtIRpsO4jXSZMWh6ueCItzG0rys=; b=OzzuHwcwtkrRLN770R7+DXFJLALp2or92rErwDC+H400bKW+n9xWdNUY8AVm4C0JH4 g1DCHDF44HIvozlB2gTdmhiVivnwi59rerPJgj39e7x6h0aJc0LtXVcKhgq0Q/O9c0mF T0WDBApsuEJuta3C8IL8NGYaYpTx32xys10DJIpTpJNxJZs+fHIwNdOvL2AxKbejCfr2 bR1/FuY1IdPv3P10knBITWF5fxmk+DUQd/qn+pHI1zZS9d0JnPylBzxh2kcL6vFxIn8H PNJJbqGVP1hpYDbcyIhZA0XTXzXONoomjwvDea4T/C0uIYLqaUhWrBVsVEz91Sx/urki uzTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728582270; x=1729187070; 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=ZKCACtY/jZU9xUxgPtIRpsO4jXSZMWh6ueCItzG0rys=; b=CpAFi4n4KAFgLq8gNCaIt6UJv6lkld4b68qICWytm9FqvobuIP6SONxlIMa+mBQWRA JL6JklcLFpP8kP45q9aPTPgm1y+eLQu0zXOrbhzpzursbXVLRSjyr7iG9DS3ZhhOM+0d 0PuQDzXwyDniOnlcm9l1Ir+U8toBdnYwQWMPJ/RjYOodr97W38ZUpd7mKKcUkF0iLgh0 JdTnMTzFLl/SdZI330xCJe4Vj1vq5wPtUla5rS/BHM3ksSNzcwa5to5McnmUTKUL6ImO 9Z8TAN5xRuDxeiP2OayNKNSI02OHMXbUE/CRUj8otYM+kvNpVr84RoT5EaGVZb3eJnr7 dqQQ== X-Forwarded-Encrypted: i=1; AJvYcCWhCDnmjuRQ+XA1FsEbeAzgbLB522LbHDgsAWQ3TliKalhnDpkGT+gWcIBtkDNxC8Fs2miDq5bgqtqK3LI=@vger.kernel.org X-Gm-Message-State: AOJu0YzVvoK2DnXqeP55p9CJwjqggFYL9nAX1qXrFXjbDm162vqxE5j0 q/tI9ufHcDCR4meTsJz0JrGbqb3VMsZCWtjijfVu4EN5E31tYi7BlzB9qqUQ X-Google-Smtp-Source: AGHT+IHLIBfslHC+Inva6Xxmsqu1yy9RJWhUE+2slKLhlPYRhaM0C9rDXrQLvc61KAwQyNk7igJXHw== X-Received: by 2002:a17:902:d510:b0:206:9dfb:3e9e with SMTP id d9443c01a7336-20c80460f43mr58381025ad.10.1728582269797; Thu, 10 Oct 2024 10:44:29 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c8c0eb470sm11826495ad.126.2024.10.10.10.44.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 10:44:29 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rosen Penev , Andrew Lunn , Simon Horman , =?utf-8?q?Uw?= =?utf-8?q?e_Kleine-K=C3=B6nig?= , Breno Leitao , Jeff Johnson , Christian Marangi , linux-kernel@vger.kernel.org (open list) Subject: [PATCHv5 net-next 2/7] net: ibm: emac: remove custom init/exit functions Date: Thu, 10 Oct 2024 10:44:19 -0700 Message-ID: <20241010174424.7310-3-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241010174424.7310-1-rosenp@gmail.com> References: <20241010174424.7310-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org c092d0be38f4f754cdbdc76dc6df628ca48ac0eb introduced EPROBE_DEFER support. Because of that, we can defer initialization until all modules are ready instead of handling it explicitly with custom init/exit functions. As a consequence of removing explicit module initialization and deferring probe until everything is ready, there's no need for custom init and exit functions. There are now module_init and module_exit calls but no real change in functionality as these init and exit functions are no longer directly called by core. Signed-off-by: Rosen Penev --- drivers/net/ethernet/ibm/emac/core.c | 39 +-------------------------- drivers/net/ethernet/ibm/emac/mal.c | 10 +------ drivers/net/ethernet/ibm/emac/mal.h | 4 --- drivers/net/ethernet/ibm/emac/rgmii.c | 10 +------ drivers/net/ethernet/ibm/emac/rgmii.h | 4 --- drivers/net/ethernet/ibm/emac/tah.c | 10 +------ drivers/net/ethernet/ibm/emac/tah.h | 4 --- drivers/net/ethernet/ibm/emac/zmii.c | 10 +------ drivers/net/ethernet/ibm/emac/zmii.h | 4 --- 9 files changed, 5 insertions(+), 90 deletions(-) diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index 0edcb435e62f..644abd37cfb4 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) static int __init emac_init(void) { - int rc; - - printk(KERN_INFO DRV_DESC ", version " DRV_VERSION "\n"); - /* Build EMAC boot list */ emac_make_bootlist(); - /* Init submodules */ - rc = mal_init(); - if (rc) - goto err; - rc = zmii_init(); - if (rc) - goto err_mal; - rc = rgmii_init(); - if (rc) - goto err_zmii; - rc = tah_init(); - if (rc) - goto err_rgmii; - rc = 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); } static void __exit emac_exit(void) @@ -3327,11 +3295,6 @@ static void __exit emac_exit(void) platform_driver_unregister(&emac_driver); - tah_exit(); - rgmii_exit(); - zmii_exit(); - mal_exit(); - /* Destroy EMAC boot list */ for (i = 0; i < EMAC_BOOT_LIST_SIZE; i++) of_node_put(emac_boot_list[i]); diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm/emac/mal.c index 7d70056e9008..6c1c47bdc607 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c @@ -753,12 +753,4 @@ static struct platform_driver mal_of_driver = { .remove = mal_remove, }; -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/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); } -/* 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.c b/drivers/net/ethernet/ibm/emac/rgmii.c index b544dd8633b7..6b61c49aa1f4 100644 --- a/drivers/net/ethernet/ibm/emac/rgmii.c +++ b/drivers/net/ethernet/ibm/emac/rgmii.c @@ -280,12 +280,4 @@ static struct platform_driver rgmii_driver = { .probe = rgmii_probe, }; -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/rgmii.h b/drivers/net/ethernet/ibm/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 { #ifdef CONFIG_IBM_EMAC_RGMII -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); #else -# 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.c b/drivers/net/ethernet/ibm/emac/tah.c index 09f6373ed2f9..9e7d79e76a12 100644 --- a/drivers/net/ethernet/ibm/emac/tah.c +++ b/drivers/net/ethernet/ibm/emac/tah.c @@ -138,12 +138,4 @@ static struct platform_driver tah_driver = { .probe = tah_probe, }; -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/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 { #ifdef CONFIG_IBM_EMAC_TAH -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); #else -# 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.c b/drivers/net/ethernet/ibm/emac/zmii.c index 69ca6065de1c..40744733fd02 100644 --- a/drivers/net/ethernet/ibm/emac/zmii.c +++ b/drivers/net/ethernet/ibm/emac/zmii.c @@ -286,12 +286,4 @@ static struct platform_driver zmii_driver = { .probe = zmii_probe, }; -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); diff --git a/drivers/net/ethernet/ibm/emac/zmii.h b/drivers/net/ethernet/ibm/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 { #ifdef CONFIG_IBM_EMAC_ZMII -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); #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)