Module Name:    src
Committed By:   phx
Date:           Mon Sep  4 17:26:06 UTC 2017

Modified Files:
        src/sys/arch/amiga/dev: efa.c efavar.h wdc_acafh.c wdc_xsurf.c

Log Message:
Remove double device pointers. The pointer is already part of sc_wdcdev.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/amiga/dev/efa.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/amiga/dev/efavar.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/amiga/dev/wdc_acafh.c \
    src/sys/arch/amiga/dev/wdc_xsurf.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/amiga/dev/efa.c
diff -u src/sys/arch/amiga/dev/efa.c:1.12 src/sys/arch/amiga/dev/efa.c:1.13
--- src/sys/arch/amiga/dev/efa.c:1.12	Fri Jan  3 00:33:06 2014
+++ src/sys/arch/amiga/dev/efa.c	Mon Sep  4 17:26:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: efa.c,v 1.12 2014/01/03 00:33:06 rkujawa Exp $ */
+/*	$NetBSD: efa.c,v 1.13 2017/09/04 17:26:06 phx Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -136,8 +136,6 @@ efa_attach(device_t parent, device_t sel
 
 	gayle_init();
 
-	sc->sc_dev = self;
-
 	efa_set_opts(sc);
 
 	if (!efa_mapbase(sc)) {
@@ -200,6 +198,12 @@ efa_attach(device_t parent, device_t sel
 static void
 efa_attach_channel(struct efa_softc *sc, int chnum) 
 {
+#ifdef EFA_DEBUG
+	device_t self;
+
+	self = sc->sc_wdcdev.sc_atac.atac_dev;
+#endif /* EFA_DEBUG */
+
 	sc->sc_chanlist[chnum] = &sc->sc_ports[chnum].chan;
 
 	sc->sc_ports[chnum].chan.ch_channel = chnum;
@@ -216,7 +220,7 @@ efa_attach_channel(struct efa_softc *sc,
 	wdcattach(&sc->sc_ports[chnum].chan);	
 
 #ifdef EFA_DEBUG
-	aprint_normal_dev(sc->sc_dev, "done init for channel %d\n", chnum);
+	aprint_normal_dev(self, "done init for channel %d\n", chnum);
 #endif
 
 }
@@ -238,6 +242,10 @@ efa_poll_kthread(void *arg)
 static void
 efa_set_opts(struct efa_softc *sc)
 {
+	device_t self;
+
+	self = sc->sc_wdcdev.sc_atac.atac_dev;
+
 #ifdef EFA_32BIT_IO 
 	sc->sc_32bit_io = true;	
 #else
@@ -251,10 +259,10 @@ efa_set_opts(struct efa_softc *sc)
 #endif /* EFA_NO_INTR */
 
 	if (sc->sc_no_intr)
-		aprint_verbose_dev(sc->sc_dev, "hardware interrupt disabled\n");
+		aprint_verbose_dev(self, "hardware interrupt disabled\n");
 
 	if (sc->sc_32bit_io)
-		aprint_verbose_dev(sc->sc_dev, "32-bit I/O enabled\n");
+		aprint_verbose_dev(self, "32-bit I/O enabled\n");
 }
 
 int
@@ -301,9 +309,14 @@ efa_intr(void *arg)
 static bool
 efa_mapbase(struct efa_softc *sc) 
 {
-	int i, j;
 	static struct bus_space_tag fata_cmd_iot;
 	static struct bus_space_tag gayle_cmd_iot;
+	int i, j;
+#ifdef EFA_DEBUG
+	device_t self;
+
+	self = sc->sc_wdcdev.sc_atac.atac_dev;
+#endif /* EFA_DEBUG */
 	
 	gayle_cmd_iot.base = (bus_addr_t) ztwomap(GAYLE_IDE_BASE + 2);
 	gayle_cmd_iot.absm = &amiga_bus_stride_4swap;
@@ -311,7 +324,7 @@ efa_mapbase(struct efa_softc *sc) 
 	fata_cmd_iot.absm = &amiga_bus_stride_4swap;
 
 #ifdef EFA_DEBUG
-	aprint_normal_dev(sc->sc_dev, "Gayle %x -> %x, FastATA %x -> %x\n",
+	aprint_normal_dev(self, "Gayle %x -> %x, FastATA %x -> %x\n",
 	    GAYLE_IDE_BASE, gayle_cmd_iot.base, FATA1_BASE, fata_cmd_iot.base);
 #endif
 
@@ -370,9 +383,14 @@ efa_mapreg_gayle(struct efa_softc *sc)
 static bool
 efa_mapreg_native(struct efa_softc *sc) 
 {
-	int i,j;
 	struct wdc_regs *wdr_gayle = &sc->sc_gayle_wdc_regs;
 	struct wdc_regs *wdr_fata;
+	int i,j;
+#ifdef EFA_DEBUG
+	device_t self;
+
+	self = sc->sc_wdcdev.sc_atac.atac_dev;
+#endif /* EFA_DEBUG */
 
 	for (i = 0; i < FATA1_CHANNELS; i++) {
 
@@ -383,7 +401,7 @@ efa_mapreg_native(struct efa_softc *sc) 
 
 			if (pio_offsets[j] == PIO_NSUPP) {
 #ifdef EFA_DEBUG
-				aprint_normal_dev(sc->sc_dev, 
+				aprint_normal_dev(self, 
 				    "Skipping mapping for PIO mode %x\n", j);
 #endif
 				continue;
@@ -395,7 +413,7 @@ efa_mapreg_native(struct efa_softc *sc) 
 			    return false;
 			}
 #ifdef EFA_DEBUG
-			aprint_normal_dev(sc->sc_dev, 
+			aprint_normal_dev(self, 
 			    "Chan %x PIO mode %x mapped %x -> %x\n",
 			    i, j, (bus_addr_t) kvtop((void*) 
 			    wdr_fata->cmd_baseioh), (unsigned int) 
@@ -465,15 +483,20 @@ efa_setup_channel(struct ata_channel *ch
 	struct ata_drive_datas *drvp;
 	struct efa_softc *sc;
 	int ipl;
+#ifdef EFA_DEBUG
+	device_t self;
+#endif /* EFA_DEBUG */
 
 	chnum = chp->ch_channel;
 	atac = chp->ch_atac;
+
 	sc = device_private(atac->atac_dev);
 
 	mode = 5; /* start with fastest possible setting */
 
 #ifdef EFA_DEBUG
-	aprint_normal_dev(sc->sc_dev, "efa_setup_channel for ch %d\n",
+	self = sc->sc_wdcdev.sc_atac.atac_dev;
+	aprint_normal_dev(self, "efa_setup_channel for ch %d\n",
 	    chnum);
 #endif /* EFA_DEBUG */
 
@@ -492,7 +515,7 @@ efa_setup_channel(struct ata_channel *ch
 		/* TODO: check if sc_ports->mode_ok */
 
 #ifdef EFA_DEBUG
-		aprint_normal_dev(sc->sc_dev, "drive %d supports %d\n",
+		aprint_normal_dev(self, "drive %d supports %d\n",
 		    drive, drvp->PIO_cap);
 #endif /* EFA_DEBUG */
 
@@ -511,12 +534,17 @@ static void 
 efa_select_regset(struct efa_softc *sc, int chnum, uint8_t piomode) 
 {
 	struct wdc_softc *wdc;
+#ifdef EFA_DEBUG
+	device_t self;
+
+	self = sc->sc_wdcdev.sc_atac.atac_dev;
+#endif /* EFA_DEBUG */
 
 	wdc = CHAN_TO_WDC(&sc->sc_ports[chnum].chan);	
 	wdc->regs[chnum] = sc->sc_ports[chnum].wdr[piomode]; 
 
 #ifdef EFA_DEBUG
-	aprint_normal_dev(sc->sc_dev, "switched ch %d to PIO %d\n",
+	aprint_normal_dev(self, "switched ch %d to PIO %d\n",
 	    chnum, piomode);
 
 	efa_debug_print_regmapping(&wdc->regs[chnum]);

Index: src/sys/arch/amiga/dev/efavar.h
diff -u src/sys/arch/amiga/dev/efavar.h:1.1 src/sys/arch/amiga/dev/efavar.h:1.2
--- src/sys/arch/amiga/dev/efavar.h:1.1	Thu Oct 27 22:12:23 2011
+++ src/sys/arch/amiga/dev/efavar.h	Mon Sep  4 17:26:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: efavar.h,v 1.1 2011/10/27 22:12:23 rkujawa Exp $ */
+/*	$NetBSD: efavar.h,v 1.2 2017/09/04 17:26:06 phx Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -36,7 +36,6 @@
 #define PIO_COUNT		6
 
 struct efa_port {
-
 	struct ata_channel	chan;
 	struct ata_queue	queue;
 
@@ -48,8 +47,6 @@ struct efa_port {
 };
 
 struct efa_softc {
-	device_t		sc_dev;
-
 	struct wdc_softc	sc_wdcdev;
 	struct ata_channel	*sc_chanlist[FATA1_CHANNELS];
 

Index: src/sys/arch/amiga/dev/wdc_acafh.c
diff -u src/sys/arch/amiga/dev/wdc_acafh.c:1.3 src/sys/arch/amiga/dev/wdc_acafh.c:1.4
--- src/sys/arch/amiga/dev/wdc_acafh.c:1.3	Fri Jan  3 00:33:06 2014
+++ src/sys/arch/amiga/dev/wdc_acafh.c	Mon Sep  4 17:26:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: wdc_acafh.c,v 1.3 2014/01/03 00:33:06 rkujawa Exp $ */
+/*	$NetBSD: wdc_acafh.c,v 1.4 2017/09/04 17:26:06 phx Exp $ */
 
 /*-
  * Copyright (c) 2000, 2003, 2013 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc_acafh.c,v 1.3 2014/01/03 00:33:06 rkujawa Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_acafh.c,v 1.4 2017/09/04 17:26:06 phx Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -74,8 +74,6 @@ struct wdc_acafh_slot {
 };
 
 struct wdc_acafh_softc {
-	device_t		sc_dev;
-
 	struct wdc_softc	sc_wdcdev;
 	struct ata_channel	*sc_chanlist[WDC_ACAFH_SLOTS];
 	struct wdc_acafh_slot	sc_slots[WDC_ACAFH_SLOTS];
@@ -113,8 +111,6 @@ wdc_acafh_attach(device_t parent, device
 	int i;
 
 	aprint_normal(": ACA500 CompactFlash interface\n");
-
-	sc->sc_dev = device_private(self);
 	sc->aca_sc = device_private(parent);
 
 	gayle_init();
@@ -148,6 +144,12 @@ wdc_acafh_attach(device_t parent, device
 void
 wdc_acafh_attach_channel(struct wdc_acafh_softc *sc, int chnum)
 {
+#ifdef WDC_ACAFH_DEBUG
+	device_t self;
+
+	self = sc->sc_wdcdev.sc_atac.atac_dev;
+#endif /* WDC_ACAFH_DEBUG */
+
 	sc->sc_chanlist[chnum] = &sc->sc_slots[chnum].channel;
 	memset(&sc->sc_slots[chnum],0,sizeof(struct wdc_acafh_slot));
 	sc->sc_slots[chnum].channel.ch_channel = chnum;
@@ -160,17 +162,19 @@ wdc_acafh_attach_channel(struct wdc_acaf
 	wdcattach(&sc->sc_slots[chnum].channel);
 
 #ifdef WDC_ACAFH_DEBUG
-	aprint_normal_dev(sc->sc_dev, "done init for channel %d\n", chnum);
+	aprint_normal_dev(self, "done init for channel %d\n", chnum);
 #endif /* WDC_ACAFH_DEBUG */
-
 }
 
 void
 wdc_acafh_map_channel(struct wdc_acafh_softc *sc, int chnum)
 {
 	struct wdc_regs *wdr;
-	int i;
 	bus_addr_t off;
+	device_t self;
+	int i;
+
+	self = sc->sc_wdcdev.sc_atac.atac_dev;
 
 	wdr = CHAN_TO_WDC_REGS(&sc->sc_slots[chnum].channel);
 	wdr->cmd_iot = &sc->cmd_iot;
@@ -182,7 +186,7 @@ wdc_acafh_map_channel(struct wdc_acafh_s
 
 	if (bus_space_map(wdr->cmd_iot, off, 0x40, 0,
 			  &wdr->cmd_baseioh)) {
-		aprint_error_dev(sc->sc_dev, "couldn't map regs\n");
+		aprint_error_dev(self, "couldn't map regs\n");
 		return;
 	}
 
@@ -193,7 +197,7 @@ wdc_acafh_map_channel(struct wdc_acafh_s
 
 			bus_space_unmap(wdr->cmd_iot,
 			    wdr->cmd_baseioh, 0x40);
-			aprint_error_dev(sc->sc_dev, "couldn't map regs\n");
+			aprint_error_dev(self, "couldn't map regs\n");
 			return;
 		}
 	}
Index: src/sys/arch/amiga/dev/wdc_xsurf.c
diff -u src/sys/arch/amiga/dev/wdc_xsurf.c:1.3 src/sys/arch/amiga/dev/wdc_xsurf.c:1.4
--- src/sys/arch/amiga/dev/wdc_xsurf.c:1.3	Mon Sep  4 14:39:00 2017
+++ src/sys/arch/amiga/dev/wdc_xsurf.c	Mon Sep  4 17:26:06 2017
@@ -1,4 +1,4 @@
-/*      $NetBSD: wdc_xsurf.c,v 1.3 2017/09/04 14:39:00 phx Exp $ */
+/*      $NetBSD: wdc_xsurf.c,v 1.4 2017/09/04 17:26:06 phx Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -73,8 +73,6 @@ struct wdc_xsurf_port {
 };
 
 struct wdc_xsurf_softc {
-	device_t		sc_dev;	
-
 	struct wdc_softc 	sc_wdcdev;
 	struct ata_channel 	*sc_chanarray[WDC_XSURF_CHANNELS];
 	struct wdc_xsurf_port	sc_ports[WDC_XSURF_CHANNELS];
@@ -123,7 +121,6 @@ wdc_xsurf_attach(device_t parent, device
 	aprint_naive("\n");
 	xsb_aa = aux;
 	sc = device_private(self);
-	sc->sc_dev = self;
 
 	sc->sc_bst.base = xsb_aa->xaa_base;
 	sc->sc_bst.absm = &amiga_bus_stride_1swap;
@@ -158,6 +155,12 @@ wdc_xsurf_attach(device_t parent, device
 void
 wdc_xsurf_attach_channel(struct wdc_xsurf_softc *sc, int chnum)
 {
+#ifdef WDC_XSURF_DEBUG
+	device_t self;
+
+	self = sc->sc_wdcdev.sc_atac.atac_dev;
+#endif /* WDC_XSURF_DEBUG */
+
 	sc->sc_chanarray[chnum] = &sc->sc_ports[chnum].channel;
 	memset(&sc->sc_ports[chnum],0,sizeof(struct wdc_xsurf_port));
 	sc->sc_ports[chnum].channel.ch_channel = chnum;
@@ -170,7 +173,7 @@ wdc_xsurf_attach_channel(struct wdc_xsur
 	wdcattach(&sc->sc_ports[chnum].channel);
 
 #ifdef WDC_XSURF_DEBUG
-	aprint_normal_dev(sc->sc_dev, "done init for channel %d\n", chnum);
+	aprint_normal_dev(self, "done init for channel %d\n", chnum);
 #endif /* WDC_XSURF_DEBUG */
 }
 

Reply via email to