Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic KNF multi-line comments.
details: https://anonhg.NetBSD.org/src/rev/4b45a5eacf1b
branches: trunk
changeset: 789682:4b45a5eacf1b
user: skrll <skrll%NetBSD.org@localhost>
date: Mon Sep 02 12:20:59 2013 +0000
description:
KNF multi-line comments.
diffstat:
sys/dev/ic/sl811hs.c | 229 +++++++++++++++++++++++++++++++----------------
sys/dev/ic/sl811hsreg.h | 5 +-
2 files changed, 155 insertions(+), 79 deletions(-)
diffs (truncated from 585 to 300 lines):
diff -r c5e5253f09dd -r 4b45a5eacf1b sys/dev/ic/sl811hs.c
--- a/sys/dev/ic/sl811hs.c Mon Sep 02 08:37:11 2013 +0000
+++ b/sys/dev/ic/sl811hs.c Mon Sep 02 12:20:59 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sl811hs.c,v 1.33 2012/06/10 06:15:52 mrg Exp $ */
+/* $NetBSD: sl811hs.c,v 1.34 2013/09/02 12:20:59 skrll Exp $ */
/*
* Not (c) 2007 Matthew Orgass
@@ -74,7 +74,8 @@
* released last when clearing the wait queue.
*/
-/* XXX TODO:
+/*
+ * XXX TODO:
* copy next output packet while transfering
* usb suspend
* could keep track of known values of all buffer space?
@@ -84,7 +85,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.33 2012/06/10 06:15:52 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.34 2013/09/02 12:20:59 skrll Exp $");
#include "opt_slhci.h"
@@ -188,20 +189,24 @@
#define SLHCI_XFER_TYPE(x) (((struct slhci_pipe *)((x)->pipe))->ptype)
-/* Maximum allowable reserved bus time. Since intr/isoc transfers have
+/*
+ * Maximum allowable reserved bus time. Since intr/isoc transfers have
* unconditional priority, this is all that ensures control and bulk transfers
* get a chance. It is a single value for all frames since all transfers can
* use multiple consecutive frames if an error is encountered. Note that it
* is not really possible to fill the bus with transfers, so this value should
* be on the low side. Defaults to giving a warning unless SLHCI_NO_OVERTIME
- * is defined. Full time is 12000 - END_BUSTIME. */
+ * is defined. Full time is 12000 - END_BUSTIME.
+ */
#ifndef SLHCI_RESERVED_BUSTIME
#define SLHCI_RESERVED_BUSTIME 5000
#endif
-/* Rate for "exceeds reserved bus time" warnings (default) or errors.
+/*
+ * Rate for "exceeds reserved bus time" warnings (default) or errors.
* Warnings only happen when an endpoint open causes the time to go above
- * SLHCI_RESERVED_BUSTIME, not if it is already above. */
+ * SLHCI_RESERVED_BUSTIME, not if it is already above.
+ */
#ifndef SLHCI_OVERTIME_WARNING_RATE
#define SLHCI_OVERTIME_WARNING_RATE { 60, 0 } /* 60 seconds */
#endif
@@ -213,10 +218,12 @@
#endif
static const struct timeval overflow_warn_rate = SLHCI_OVERFLOW_WARNING_RATE;
-/* For EOF, the spec says 42 bit times, plus (I think) a possible hub skew of
+/*
+ * For EOF, the spec says 42 bit times, plus (I think) a possible hub skew of
* 20 bit times. By default leave 66 bit times to start the transfer beyond
* the required time. Units are full-speed bit times (a bit over 5us per 64).
- * Only multiples of 64 are significant. */
+ * Only multiples of 64 are significant.
+ */
#define SLHCI_STANDARD_END_BUSTIME 128
#ifndef SLHCI_EXTRA_END_BUSTIME
#define SLHCI_EXTRA_END_BUSTIME 0
@@ -224,18 +231,22 @@
#define SLHCI_END_BUSTIME (SLHCI_STANDARD_END_BUSTIME+SLHCI_EXTRA_END_BUSTIME)
-/* This is an approximation of the USB worst-case timings presented on p. 54 of
+/*
+ * This is an approximation of the USB worst-case timings presented on p. 54 of
* the USB 1.1 spec translated to full speed bit times.
* FS = full speed with handshake, FSII = isoc in, FSIO = isoc out,
- * FSI = isoc (worst case), LS = low speed */
+ * FSI = isoc (worst case), LS = low speed
+ */
#define SLHCI_FS_CONST 114
#define SLHCI_FSII_CONST 92
#define SLHCI_FSIO_CONST 80
#define SLHCI_FSI_CONST 92
#define SLHCI_LS_CONST 804
#ifndef SLHCI_PRECICE_BUSTIME
-/* These values are < 3% too high (compared to the multiply and divide) for
- * max sized packets. */
+/*
+ * These values are < 3% too high (compared to the multiply and divide) for
+ * max sized packets.
+ */
#define SLHCI_FS_DATA_TIME(len) (((u_int)(len)<<3)+(len)+((len)>>1))
#define SLHCI_LS_DATA_TIME(len) (((u_int)(len)<<6)+((u_int)(len)<<4))
#else
@@ -243,7 +254,8 @@
#define SLHCI_LS_DATA_TIME(len) (449*(len)/6)
#endif
-/* Set SLHCI_WAIT_SIZE to the desired maximum size of single FS transfer
+/*
+ * Set SLHCI_WAIT_SIZE to the desired maximum size of single FS transfer
* to poll for after starting a transfer. 64 gets all full speed transfers.
* Note that even if 0 polling will occur if data equal or greater than the
* transfer size is copied to the chip while the transfer is in progress.
@@ -307,8 +319,10 @@
#ifdef SLHCI_PROFILE_TRANSFER
#if defined(__mips__)
-/* MIPS cycle counter does not directly count cpu cycles but is a different
- * fraction of cpu cycles depending on the cpu. */
+/*
+ * MIPS cycle counter does not directly count cpu cycles but is a different
+ * fraction of cpu cycles depending on the cpu.
+ */
typedef u_int32_t cc_type;
#define CC_TYPE_FMT "%u"
#define slhci_cc_set(x) __asm volatile ("mfc0 %[cc], $9\n\tnop\n\tnop\n\tnop" \
@@ -441,8 +455,10 @@
usbd_status slhci_root_start(struct usbd_xfer *);
usbd_status slhci_open(struct usbd_pipe *);
-/* slhci_supported_rev, slhci_preinit, slhci_attach, slhci_detach,
- * slhci_activate */
+/*
+ * slhci_supported_rev, slhci_preinit, slhci_attach, slhci_detach,
+ * slhci_activate
+ */
void slhci_abort(struct usbd_xfer *);
void slhci_close(struct usbd_pipe *);
@@ -568,7 +584,8 @@
* enabling SLHCI_DEBUG.
*/
-/* Add KERNHIST history for debugging:
+/*
+ * Add KERNHIST history for debugging:
*
* Before kern_hist in sys/kern/subr_kernhist.c add:
* KERNHIST_DECL(slhcihist);
@@ -599,10 +616,12 @@
u_long _kernhist_call = 0; KERNHIST_LOG(slhcihist, f, a, b, c, d); \
} while (/*CONSTCOND*/0)
#define DLOG(x, f, a, b, c, d) SLHCI_DEXEC(x, DDOLOG(f, a, b, c, d))
-/* DLOGFLAG8 is a macro not a function so that flag name expressions are not
+/*
+ * DLOGFLAG8 is a macro not a function so that flag name expressions are not
* evaluated unless the flag bit is set (which could save a register read).
* x is debug mask, y is flag identifier, z is flag variable,
- * a-h are flag names (must evaluate to string constants, msb first). */
+ * a-h are flag names (must evaluate to string constants, msb first).
+ */
#define DDOLOGFLAG8(y, z, a, b, c, d, e, f, g, h) do { uint8_t _DLF8 = (z); \
const char *_kernhist_name = __func__; u_long _kernhist_call = 0; \
if (_DLF8 & 0xf0) KERNHIST_LOG(slhcihist, y " %s %s %s %s", _DLF8 & 0x80 ? \
@@ -613,8 +632,10 @@
} while (/*CONSTCOND*/ 0)
#define DLOGFLAG8(x, y, z, a, b, c, d, e, f, g, h) \
SLHCI_DEXEC(x, DDOLOGFLAG8(y, z, a, b, c, d, e, f, g, h))
-/* DDOLOGBUF logs a buffer up to 8 bytes at a time. No identifier so that we
- * can make it a real function. */
+/*
+ * DDOLOGBUF logs a buffer up to 8 bytes at a time. No identifier so that we
+ * can make it a real function.
+ */
static void
DDOLOGBUF(uint8_t *buf, unsigned int length)
{
@@ -774,8 +795,10 @@
uint8_t data[];
};
-/* The SL811HS does not do DMA as a host controller, but NetBSD's USB interface
- * assumes DMA is used. So we fake the DMA block. */
+/*
+ * The SL811HS does not do DMA as a host controller, but NetBSD's USB interface
+ * assumes DMA is used. So we fake the DMA block.
+ */
usbd_status
slhci_allocm(struct usbd_bus *bus, usb_dma_t *dma, u_int32_t size)
{
@@ -882,8 +905,10 @@
* so start it first.
*/
- /* Start next is always done at splusb, so we do this here so
- * start functions are always called at softusb. XXX */
+ /*
+ * Start next is always done at splusb, so we do this here so
+ * start functions are always called at softusb. XXX
+ */
s = splusb();
error = xfer->pipe->methods->start(SIMPLEQ_FIRST(&xfer->pipe->queue));
splx(s);
@@ -975,15 +1000,19 @@
else
spipe->wantshort = 0;
- /* The goal of newbustime and newlen is to avoid bustime calculation
+ /*
+ * The goal of newbustime and newlen is to avoid bustime calculation
* in the interrupt. The calculations are not too complex, but they
* complicate the conditional logic somewhat and doing them all in the
* same place shares constants. Index 0 is "short length" for bulk and
* ctrl data and 1 is "full length" for ctrl data (bulk/intr are
- * already set to full length). */
+ * already set to full length).
+ */
if (spipe->pflags & PF_LS) {
- /* Setting PREAMBLE for directly connnected LS devices will
- * lock up the chip. */
+ /*
+ * Setting PREAMBLE for directly connnected LS devices will
+ * lock up the chip.
+ */
if (spipe->pflags & PF_PREAMBLE)
spipe->control |= SL11_EPCTRL_PREAMBLE;
if (max_packet <= 8) {
@@ -1009,9 +1038,11 @@
xfer->status = USBD_INVAL;
}
- /* The datasheet incorrectly indicates that DIRECTION is for
+ /*
+ * The datasheet incorrectly indicates that DIRECTION is for
* "transmit to host". It is for OUT and SETUP. The app note
- * describes its use correctly. */
+ * describes its use correctly.
+ */
if ((spipe->tregs[PID] & SL11_PID_BITS) != SL11_PID_IN)
spipe->control |= SL11_EPCTRL_DIRECTION;
@@ -1061,9 +1092,11 @@
gcq_init(&spipe->to);
gcq_init(&spipe->xq);
- /* The endpoint descriptor will not have been set up yet in the case
+ /*
+ * The endpoint descriptor will not have been set up yet in the case
* of the standard control pipe, so the max packet checks are also
- * necessary in start. */
+ * necessary in start.
+ */
max_packet = UGETW(ed->wMaxPacketSize);
@@ -1138,9 +1171,11 @@
return (rev >= SLTYPE_SL811HS_R12 && rev <= SLTYPE_SL811HS_R15);
}
-/* Must be called before the ISR is registered. Interrupts can be shared so
+/*
+ * Must be called before the ISR is registered. Interrupts can be shared so
* slhci_intr could be called as soon as the ISR is registered.
- * Note max_current argument is actual current, but stored as current/2 */
+ * Note max_current argument is actual current, but stored as current/2
+ */
void
slhci_preinit(struct slhci_softc *sc, PowerFunc pow, bus_space_tag_t iot,
bus_space_handle_t ioh, uint16_t max_current, uint32_t stride)
@@ -1211,9 +1246,11 @@
KASSERT(!(t->flags & F_ACTIVE));
- /* To be MPSAFE is not sufficient to cancel callouts and soft
+ /*
+ * To be MPSAFE is not sufficient to cancel callouts and soft
* interrupts and assume they are dead since the code could already be
- * running or about to run. Wait until they are known to be done. */
+ * running or about to run. Wait until they are known to be done.
+ */
while (t->flags & (F_RESET|F_CALLBACK))
tsleep(&sc, PPAUSE, "slhci_detach", hz);
@@ -1366,11 +1403,13 @@
s = splhardusb();
simple_lock(&sc->sc_lock);
slhci_reset(sc);
- /* We cannot call the calback directly since we could then be reset
+ /*
+ * We cannot call the calback directly since we could then be reset
* again before finishing and need the callout delay for timing.
* Scheduling the callout again before we exit would defeat the reap
* mechanism since we could be unlocked while the reset flag is not
- * set. The callback code will check the wait queue. */
+ * set. The callback code will check the wait queue.
+ */
slhci_callback_schedule(sc);
simple_unlock(&sc->sc_lock);
splx(s);
@@ -1702,10 +1741,12 @@
}
#endif
-/* After calling waitintr it is necessary to either call slhci_callback or
Home |
Main Index |
Thread Index |
Old Index