Module Name:    src
Committed By:   riastradh
Date:           Fri Feb 11 23:49:19 UTC 2022

Modified Files:
        src/sys/arch/playstation2/dev: emac3.c emac3var.h if_smap.c

Log Message:
playstation2: Somewhat belated device_t/softc split.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/playstation2/dev/emac3.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/playstation2/dev/emac3var.h
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/playstation2/dev/if_smap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/playstation2/dev/emac3.c
diff -u src/sys/arch/playstation2/dev/emac3.c:1.14 src/sys/arch/playstation2/dev/emac3.c:1.15
--- src/sys/arch/playstation2/dev/emac3.c:1.14	Tue May 28 07:41:47 2019
+++ src/sys/arch/playstation2/dev/emac3.c	Fri Feb 11 23:49:19 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: emac3.c,v 1.14 2019/05/28 07:41:47 msaitoh Exp $	*/
+/*	$NetBSD: emac3.c,v 1.15 2022/02/11 23:49:19 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: emac3.c,v 1.14 2019/05/28 07:41:47 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emac3.c,v 1.15 2022/02/11 23:49:19 riastradh Exp $");
 
 #include "debug_playstation2.h"
 
@@ -103,7 +103,7 @@ emac3_init(struct emac3_softc *sc)
 	r = _emac3_reg_read_4(EMAC3_MR1);
 
 	if (emac3_soft_reset() != 0) {
-		printf("%s: reset failed.\n", sc->dev.dv_xname);
+		printf("%s: reset failed.\n", device_xname(sc->dev));
 		return (1);
 	}
 
@@ -132,7 +132,7 @@ emac3_exit(struct emac3_softc *sc)
 		;
 
 	if (retry == 0)
-		printf("%s: still running.\n", sc->dev.dv_xname);
+		printf("%s: still running.\n", device_xname(sc->dev));
 }
 
 int
@@ -140,7 +140,7 @@ emac3_reset(struct emac3_softc *sc)
 {
 
 	if (emac3_soft_reset() != 0) {
-		printf("%s: reset failed.\n", sc->dev.dv_xname);
+		printf("%s: reset failed.\n", device_xname(sc->dev));
 		return (1);
 	}
 

Index: src/sys/arch/playstation2/dev/emac3var.h
diff -u src/sys/arch/playstation2/dev/emac3var.h:1.7 src/sys/arch/playstation2/dev/emac3var.h:1.8
--- src/sys/arch/playstation2/dev/emac3var.h:1.7	Tue Jan 22 03:42:26 2019
+++ src/sys/arch/playstation2/dev/emac3var.h	Fri Feb 11 23:49:19 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: emac3var.h,v 1.7 2019/01/22 03:42:26 msaitoh Exp $	*/
+/*	$NetBSD: emac3var.h,v 1.8 2022/02/11 23:49:19 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 struct emac3_softc {
-	struct device dev;
+	device_t dev;
 	struct mii_data mii;
 	u_int8_t eaddr[ETHER_ADDR_LEN];
 	u_int32_t mode1_reg;

Index: src/sys/arch/playstation2/dev/if_smap.c
diff -u src/sys/arch/playstation2/dev/if_smap.c:1.33 src/sys/arch/playstation2/dev/if_smap.c:1.34
--- src/sys/arch/playstation2/dev/if_smap.c:1.33	Sat Nov 21 17:46:08 2020
+++ src/sys/arch/playstation2/dev/if_smap.c	Fri Feb 11 23:49:19 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smap.c,v 1.33 2020/11/21 17:46:08 thorpej Exp $	*/
+/*	$NetBSD: if_smap.c,v 1.34 2022/02/11 23:49:19 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_smap.c,v 1.33 2020/11/21 17:46:08 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_smap.c,v 1.34 2022/02/11 23:49:19 riastradh Exp $");
 
 #include "debug_playstation2.h"
 
@@ -108,7 +108,7 @@ struct smap_softc {
 	krndsource_t rnd_source;
 };
 
-#define DEVNAME		(sc->emac3.dev.dv_xname)
+#define DEVNAME		(device_xname(sc->emac3.dev))
 #define ROUND4(x)	(((x) + 3) & ~3)
 #define ROUND16(x)	(((x) + 15) & ~15)
 
@@ -147,7 +147,7 @@ void
 smap_attach(struct device *parent, struct device *self, void *aux)
 {
 	struct spd_attach_args *spa = aux;
-	struct smap_softc *sc = (void *)self;
+	struct smap_softc *sc = device_private(self);
 	struct emac3_softc *emac3 = &sc->emac3;
 	struct ifnet *ifp = &sc->ethercom.ec_if;
 	struct mii_data *mii = &emac3->mii;
@@ -158,6 +158,8 @@ smap_attach(struct device *parent, struc
 	__sc = sc;
 #endif
 
+	sc->dev = self;
+
 	printf(": %s\n", spa->spa_product_name);
 
 	/* SPD EEPROM */
@@ -219,7 +221,7 @@ smap_attach(struct device *parent, struc
 	mii->mii_statchg	= emac3_phy_statchg;
 	sc->ethercom.ec_mii = mii;
 	ifmedia_init(&mii->mii_media, 0, ether_mediachange, ether_mediastatus);
-	mii_attach(&emac3->dev, mii, 0xffffffff, MII_PHY_ANY,
+	mii_attach(emac3->dev, mii, 0xffffffff, MII_PHY_ANY,
 	    MII_OFFSET_ANY, 0);
 
 	/* Choose a default media. */

Reply via email to