Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/nick-nhusb]: src/sys/dev/usb Use anonymous unions in various structs and...
details: https://anonhg.NetBSD.org/src/rev/9519cd914469
branches: nick-nhusb
changeset: 334190:9519cd914469
user: skrll <skrll%NetBSD.org@localhost>
date: Mon Apr 06 08:58:43 2015 +0000
description:
Use anonymous unions in various structs and rename the ctl/iso members of
the pipe structs to ctrl/isoc.
No functional change intended.
diffstat:
sys/dev/usb/ehci.c | 74 ++++++++++----------
sys/dev/usb/ehcivar.h | 4 +-
sys/dev/usb/ohci.c | 68 +++++++++---------
sys/dev/usb/uhci.c | 178 +++++++++++++++++++++++++-------------------------
4 files changed, 162 insertions(+), 162 deletions(-)
diffs (truncated from 964 to 300 lines):
diff -r b13ecd34c7d1 -r 9519cd914469 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c Mon Apr 06 07:08:59 2015 +0000
+++ b/sys/dev/usb/ehci.c Mon Apr 06 08:58:43 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci.c,v 1.234.2.47 2015/04/06 07:08:59 skrll Exp $ */
+/* $NetBSD: ehci.c,v 1.234.2.48 2015/04/06 08:58:43 skrll Exp $ */
/*
* Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.47 2015/04/06 07:08:59 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.48 2015/04/06 08:58:43 skrll Exp $");
#include "ohci.h"
#include "uhci.h"
@@ -1824,7 +1824,7 @@
USBHIST_FUNC(); USBHIST_CALLED(ehcidebug);
USBHIST_LOG(ehcidebug, "SITD %p next = %p prev = %p",
- itd, itd->u.frame_list.next, itd->u.frame_list.prev, 0);
+ itd, itd->frame_list.next, itd->frame_list.prev, 0);
USBHIST_LOG(ehcidebug, " xfernext=%p physaddr=%X slot=%d",
itd->xfer_next, itd->physaddr, itd->slot, 0);
}
@@ -2173,18 +2173,18 @@
panic("ehci isoc xfer being freed, but with no itd chain\n");
for (itd = exfer->ex_itdstart; itd != NULL; itd = itd->xfer_next) {
- prev = itd->u.frame_list.prev;
+ prev = itd->frame_list.prev;
/* Unlink itd from hardware chain, or frame array */
if (prev == NULL) { /* We're at the table head */
- sc->sc_softitds[itd->slot] = itd->u.frame_list.next;
+ sc->sc_softitds[itd->slot] = itd->frame_list.next;
sc->sc_flist[itd->slot] = itd->itd.itd_next;
usb_syncmem(&sc->sc_fldma,
sizeof(ehci_link_t) * itd->slot,
sizeof(ehci_link_t),
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
- if (itd->u.frame_list.next != NULL)
- itd->u.frame_list.next->u.frame_list.prev = NULL;
+ if (itd->frame_list.next != NULL)
+ itd->frame_list.next->frame_list.prev = NULL;
} else {
/* XXX this part is untested... */
prev->itd.itd_next = itd->itd.itd_next;
@@ -2192,9 +2192,9 @@
itd->offs + offsetof(ehci_itd_t, itd_next),
sizeof(itd->itd.itd_next), BUS_DMASYNC_PREWRITE);
- prev->u.frame_list.next = itd->u.frame_list.next;
- if (itd->u.frame_list.next != NULL)
- itd->u.frame_list.next->u.frame_list.prev = prev;
+ prev->frame_list.next = itd->frame_list.next;
+ if (itd->frame_list.next != NULL)
+ itd->frame_list.next->frame_list.prev = prev;
}
}
@@ -2221,18 +2221,18 @@
panic("ehci isoc xfer being freed, but with no sitd chain\n");
for (sitd = exfer->ex_sitdstart; sitd != NULL; sitd = sitd->xfer_next) {
- prev = sitd->u.frame_list.prev;
+ prev = sitd->frame_list.prev;
/* Unlink sitd from hardware chain, or frame array */
if (prev == NULL) { /* We're at the table head */
- sc->sc_softsitds[sitd->slot] = sitd->u.frame_list.next;
+ sc->sc_softsitds[sitd->slot] = sitd->frame_list.next;
sc->sc_flist[sitd->slot] = sitd->sitd.sitd_next;
usb_syncmem(&sc->sc_fldma,
sizeof(ehci_link_t) * sitd->slot,
sizeof(ehci_link_t),
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
- if (sitd->u.frame_list.next != NULL)
- sitd->u.frame_list.next->u.frame_list.prev = NULL;
+ if (sitd->frame_list.next != NULL)
+ sitd->frame_list.next->frame_list.prev = NULL;
} else {
/* XXX this part is untested... */
prev->sitd.sitd_next = sitd->sitd.sitd_next;
@@ -2240,9 +2240,9 @@
sitd->offs + offsetof(ehci_sitd_t, sitd_next),
sizeof(sitd->sitd.sitd_next), BUS_DMASYNC_PREWRITE);
- prev->u.frame_list.next = sitd->u.frame_list.next;
- if (sitd->u.frame_list.next != NULL)
- sitd->u.frame_list.next->u.frame_list.prev = prev;
+ prev->frame_list.next = sitd->frame_list.next;
+ if (sitd->frame_list.next != NULL)
+ sitd->frame_list.next->frame_list.prev = prev;
}
}
@@ -2944,7 +2944,7 @@
previndex = (frindex != 0) ? frindex - 1 : sc->sc_flsize;
freeitd = NULL;
- LIST_FOREACH(itd, &sc->sc_freeitds, u.free_list) {
+ LIST_FOREACH(itd, &sc->sc_freeitds, free_list) {
if (itd == NULL)
break;
if (itd->slot != frindex && itd->slot != previndex) {
@@ -2971,20 +2971,20 @@
itd->physaddr = DMAADDR(&dma, offs);
itd->dma = dma;
itd->offs = offs;
- LIST_INSERT_HEAD(&sc->sc_freeitds, itd, u.free_list);
+ LIST_INSERT_HEAD(&sc->sc_freeitds, itd, free_list);
}
freeitd = LIST_FIRST(&sc->sc_freeitds);
}
itd = freeitd;
- LIST_REMOVE(itd, u.free_list);
+ LIST_REMOVE(itd, free_list);
memset(&itd->itd, 0, sizeof(ehci_itd_t));
usb_syncmem(&itd->dma, itd->offs + offsetof(ehci_itd_t, itd_next),
sizeof(itd->itd.itd_next),
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
- itd->u.frame_list.next = NULL;
- itd->u.frame_list.prev = NULL;
+ itd->frame_list.next = NULL;
+ itd->frame_list.prev = NULL;
itd->xfer_next = NULL;
itd->slot = 0;
@@ -3015,7 +3015,7 @@
previndex = (frindex != 0) ? frindex - 1 : sc->sc_flsize;
freesitd = NULL;
- LIST_FOREACH(sitd, &sc->sc_freesitds, u.free_list) {
+ LIST_FOREACH(sitd, &sc->sc_freesitds, free_list) {
if (sitd == NULL)
break;
if (sitd->slot != frindex && sitd->slot != previndex) {
@@ -3042,20 +3042,20 @@
sitd->physaddr = DMAADDR(&dma, offs);
sitd->dma = dma;
sitd->offs = offs;
- LIST_INSERT_HEAD(&sc->sc_freesitds, sitd, u.free_list);
+ LIST_INSERT_HEAD(&sc->sc_freesitds, sitd, free_list);
}
freesitd = LIST_FIRST(&sc->sc_freesitds);
}
sitd = freesitd;
- LIST_REMOVE(sitd, u.free_list);
+ LIST_REMOVE(sitd, free_list);
memset(&sitd->sitd, 0, sizeof(ehci_sitd_t));
usb_syncmem(&sitd->dma, sitd->offs + offsetof(ehci_sitd_t, sitd_next),
sizeof(sitd->sitd.sitd_next), BUS_DMASYNC_PREWRITE |
BUS_DMASYNC_PREREAD);
- sitd->u.frame_list.next = NULL;
- sitd->u.frame_list.prev = NULL;
+ sitd->frame_list.next = NULL;
+ sitd->frame_list.prev = NULL;
sitd->xfer_next = NULL;
sitd->slot = 0;
@@ -3070,7 +3070,7 @@
KASSERT(mutex_owned(&sc->sc_lock));
- LIST_INSERT_HEAD(&sc->sc_freeitds, itd, u.free_list);
+ LIST_INSERT_HEAD(&sc->sc_freeitds, itd, free_list);
}
Static void
@@ -3079,7 +3079,7 @@
KASSERT(mutex_owned(&sc->sc_lock));
- LIST_INSERT_HEAD(&sc->sc_freesitds, sitd, u.free_list);
+ LIST_INSERT_HEAD(&sc->sc_freesitds, sitd, free_list);
}
/****************/
@@ -4318,12 +4318,12 @@
sizeof(ehci_link_t),
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
- sitd->u.frame_list.next = sc->sc_softsitds[frindex];
+ sitd->frame_list.next = sc->sc_softsitds[frindex];
sc->sc_softsitds[frindex] = sitd;
- if (sitd->u.frame_list.next != NULL)
- sitd->u.frame_list.next->u.frame_list.prev = sitd;
+ if (sitd->frame_list.next != NULL)
+ sitd->frame_list.next->frame_list.prev = sitd;
sitd->slot = frindex;
- sitd->u.frame_list.prev = NULL;
+ sitd->frame_list.prev = NULL;
frindex += i;
if (frindex >= sc->sc_flsize)
@@ -4647,12 +4647,12 @@
sizeof(ehci_link_t),
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
- itd->u.frame_list.next = sc->sc_softitds[frindex];
+ itd->frame_list.next = sc->sc_softitds[frindex];
sc->sc_softitds[frindex] = itd;
- if (itd->u.frame_list.next != NULL)
- itd->u.frame_list.next->u.frame_list.prev = itd;
+ if (itd->frame_list.next != NULL)
+ itd->frame_list.next->frame_list.prev = itd;
itd->slot = frindex;
- itd->u.frame_list.prev = NULL;
+ itd->frame_list.prev = NULL;
frindex += i;
if (frindex >= sc->sc_flsize)
diff -r b13ecd34c7d1 -r 9519cd914469 sys/dev/usb/ehcivar.h
--- a/sys/dev/usb/ehcivar.h Mon Apr 06 07:08:59 2015 +0000
+++ b/sys/dev/usb/ehcivar.h Mon Apr 06 08:58:43 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehcivar.h,v 1.42.14.12 2015/03/19 17:26:42 skrll Exp $ */
+/* $NetBSD: ehcivar.h,v 1.42.14.13 2015/04/06 08:58:43 skrll Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
} frame_list;
/* circular list of free itds */
LIST_ENTRY(ehci_soft_itd) free_list;
- } u;
+ };
struct ehci_soft_itd *xfer_next; /* Next soft_itd in xfer */
ehci_physaddr_t physaddr;
usb_dma_t dma;
diff -r b13ecd34c7d1 -r 9519cd914469 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c Mon Apr 06 07:08:59 2015 +0000
+++ b/sys/dev/usb/ohci.c Mon Apr 06 08:58:43 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ohci.c,v 1.254.2.20 2015/03/30 11:56:18 skrll Exp $ */
+/* $NetBSD: ohci.c,v 1.254.2.21 2015/04/06 08:58:44 skrll Exp $ */
/*
* Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.20 2015/03/30 11:56:18 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.21 2015/04/06 08:58:44 skrll Exp $");
#include "opt_usb.h"
@@ -258,7 +258,7 @@
usb_dma_t reqdma;
u_int length;
ohci_soft_td_t *setup, *data, *stat;
- } ctl;
+ } ctrl;
/* Interrupt pipe */
struct {
int nslots;
@@ -269,11 +269,11 @@
u_int length;
int isread;
} bulk;
- /* Iso pipe */
- struct iso {
+ /* Isochronous pipe */
+ struct isoc {
int next, inuse;
- } iso;
- } u;
+ } isoc;
+ };
};
Static const struct usbd_bus_methods ohci_bus_methods = {
@@ -1425,7 +1425,7 @@
ohci_soft_itd_t *next;
opipe = (struct ohci_pipe *)xfer->ux_pipe;
- opipe->u.iso.inuse -= xfer->ux_nframes;
+ opipe->isoc.inuse -= xfer->ux_nframes;
uedir = UE_GET_DIR(xfer->ux_pipe->up_endpoint->ue_edesc->
bEndpointAddress);
xfer->ux_status = USBD_NORMAL_COMPLETION;
@@ -1500,7 +1500,7 @@
if (len)
usb_syncmem(&xfer->ux_dmabuf, 0, len,
isread ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
- usb_syncmem(&opipe->u.ctl.reqdma, 0,
+ usb_syncmem(&opipe->ctrl.reqdma, 0,
sizeof(usb_device_request_t), BUS_DMASYNC_POSTWRITE);
}
@@ -1737,7 +1737,7 @@
tail->xfer = NULL;
Home |
Main Index |
Thread Index |
Old Index