summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorMarcus Glocker <mglocker@cvs.openbsd.org>2008-08-24 11:43:01 +0000
committerMarcus Glocker <mglocker@cvs.openbsd.org>2008-08-24 11:43:01 +0000
commit51aaeef9a323900b307c1d3780a494a34e682fbd (patch)
treec729b1589d0b4a97627684536cd92d36ef86a62c /sys/dev/usb
parent87a33c84f9a6065aeb32f7da558713c2c03b2b3c (diff)
Use consistent variable names; curr -> cur, err -> error.
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/uvideo.c108
-rw-r--r--sys/dev/usb/uvideo.h4
2 files changed, 56 insertions, 56 deletions
diff --git a/sys/dev/usb/uvideo.c b/sys/dev/usb/uvideo.c
index ed252c54c21..d181b00cfa5 100644
--- a/sys/dev/usb/uvideo.c
+++ b/sys/dev/usb/uvideo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvideo.c,v 1.83 2008/08/24 11:05:02 mglocker Exp $ */
+/* $OpenBSD: uvideo.c,v 1.84 2008/08/24 11:43:00 mglocker Exp $ */
/*
* Copyright (c) 2008 Robert Nagy <robert@openbsd.org>
@@ -364,7 +364,7 @@ uvideo_attach(struct device *parent, struct device *self, void *aux)
return;
/* set default video stream interface */
- error = usbd_set_interface(sc->sc_vs_curr->ifaceh, 0);
+ error = usbd_set_interface(sc->sc_vs_cur->ifaceh, 0);
if (error != USBD_NORMAL_COMPLETION)
return;
@@ -685,7 +685,7 @@ uvideo_vs_parse_desc(struct uvideo_softc *sc, struct usb_attach_arg *uaa,
}
/* XXX for now always use the first video stream */
- sc->sc_vs_curr = &sc->sc_vs_coll[0];
+ sc->sc_vs_cur = &sc->sc_vs_coll[0];
return (USBD_NORMAL_COMPLETION);
}
@@ -1039,7 +1039,7 @@ uvideo_vs_set_alt(struct uvideo_softc *sc, usbd_interface_handle ifaceh,
if (desc->bDescriptorType != UDESC_INTERFACE)
goto next;
id = (usb_interface_descriptor_t *)(uint8_t *)desc;
- if (id->bInterfaceNumber != sc->sc_vs_curr->iface)
+ if (id->bInterfaceNumber != sc->sc_vs_cur->iface)
goto next;
if (id->bNumEndpoints == 0)
goto next;
@@ -1053,9 +1053,9 @@ uvideo_vs_set_alt(struct uvideo_softc *sc, usbd_interface_handle ifaceh,
/* save endpoint with requested bandwidth */
if (UGETW(ed->wMaxPacketSize) >= max_packet_size) {
- sc->sc_vs_curr->endpoint = ed->bEndpointAddress;
- sc->sc_vs_curr->curalt = id->bAlternateSetting;
- sc->sc_vs_curr->max_packet_size = max_packet_size;
+ sc->sc_vs_cur->endpoint = ed->bEndpointAddress;
+ sc->sc_vs_cur->curalt = id->bAlternateSetting;
+ sc->sc_vs_cur->max_packet_size = max_packet_size;
DPRINTF(1, "%s: set alternate iface to ", DEVNAME(sc));
DPRINTF(1, "bAlternateSetting=0x%02x\n",
id->bAlternateSetting);
@@ -1201,7 +1201,7 @@ usbd_status
uvideo_vs_set_probe(struct uvideo_softc *sc, uint8_t *probe_data)
{
usb_device_request_t req;
- usbd_status err;
+ usbd_status error;
uint16_t tmp;
struct usb_video_probe_commit *pc;
@@ -1210,15 +1210,15 @@ uvideo_vs_set_probe(struct uvideo_softc *sc, uint8_t *probe_data)
tmp = VS_PROBE_CONTROL;
tmp = tmp << 8;
USETW(req.wValue, tmp);
- USETW(req.wIndex, sc->sc_vs_curr->iface);
+ USETW(req.wIndex, sc->sc_vs_cur->iface);
USETW(req.wLength, 26);
pc = (struct usb_video_probe_commit *)probe_data;
- err = usbd_do_request(sc->sc_udev, &req, probe_data);
- if (err) {
+ error = usbd_do_request(sc->sc_udev, &req, probe_data);
+ if (error) {
printf("%s: could not SET probe request: %s\n",
- DEVNAME(sc), usbd_errstr(err));
+ DEVNAME(sc), usbd_errstr(error));
return (USBD_INVAL);
}
DPRINTF(1, "%s: SET probe request successfully\n", DEVNAME(sc));
@@ -1245,7 +1245,7 @@ uvideo_vs_get_probe(struct uvideo_softc *sc, uint8_t *probe_data,
uint8_t request)
{
usb_device_request_t req;
- usbd_status err;
+ usbd_status error;
uint16_t tmp;
struct usb_video_probe_commit *pc;
@@ -1254,15 +1254,15 @@ uvideo_vs_get_probe(struct uvideo_softc *sc, uint8_t *probe_data,
tmp = VS_PROBE_CONTROL;
tmp = tmp << 8;
USETW(req.wValue, tmp);
- USETW(req.wIndex, sc->sc_vs_curr->iface);
+ USETW(req.wIndex, sc->sc_vs_cur->iface);
USETW(req.wLength, 26);
pc = (struct usb_video_probe_commit *)probe_data;
- err = usbd_do_request(sc->sc_udev, &req, probe_data);
- if (err) {
+ error = usbd_do_request(sc->sc_udev, &req, probe_data);
+ if (error) {
printf("%s: could not GET probe request: %s\n",
- DEVNAME(sc), usbd_errstr(err));
+ DEVNAME(sc), usbd_errstr(error));
return (USBD_INVAL);
}
DPRINTF(1, "%s: GET probe request successfully\n", DEVNAME(sc));
@@ -1288,7 +1288,7 @@ usbd_status
uvideo_vs_set_commit(struct uvideo_softc *sc, uint8_t *probe_data)
{
usb_device_request_t req;
- usbd_status err;
+ usbd_status error;
uint16_t tmp;
req.bmRequestType = UVIDEO_SET_IF;
@@ -1296,13 +1296,13 @@ uvideo_vs_set_commit(struct uvideo_softc *sc, uint8_t *probe_data)
tmp = VS_COMMIT_CONTROL;
tmp = tmp << 8;
USETW(req.wValue, tmp);
- USETW(req.wIndex, sc->sc_vs_curr->iface);
+ USETW(req.wIndex, sc->sc_vs_cur->iface);
USETW(req.wLength, 26);
- err = usbd_do_request(sc->sc_udev, &req, probe_data);
- if (err) {
+ error = usbd_do_request(sc->sc_udev, &req, probe_data);
+ if (error) {
printf("%s: could not SET commit request: %s\n",
- DEVNAME(sc), usbd_errstr(err));
+ DEVNAME(sc), usbd_errstr(error));
return (USBD_INVAL);
}
DPRINTF(1, "%s: SET commit request successfully\n", DEVNAME(sc));
@@ -1363,18 +1363,18 @@ uvideo_vs_alloc(struct uvideo_softc *sc)
DPRINTF(1, "%s: %s\n", DEVNAME(sc), __func__);
- sc->sc_vs_curr->sc = sc;
+ sc->sc_vs_cur->sc = sc;
- sc->sc_vs_curr->xfer = usbd_alloc_xfer(sc->sc_udev);
- if (sc->sc_vs_curr->xfer == NULL) {
+ sc->sc_vs_cur->xfer = usbd_alloc_xfer(sc->sc_udev);
+ if (sc->sc_vs_cur->xfer == NULL) {
printf("%s: could not allocate VS xfer!\n", DEVNAME(sc));
return (USBD_NOMEM);
}
- size = sc->sc_vs_curr->max_packet_size * sc->sc_nframes;
+ size = sc->sc_vs_cur->max_packet_size * sc->sc_nframes;
- sc->sc_vs_curr->buf = usbd_alloc_buffer(sc->sc_vs_curr->xfer, size);
- if (sc->sc_vs_curr->buf == NULL) {
+ sc->sc_vs_cur->buf = usbd_alloc_buffer(sc->sc_vs_cur->xfer, size);
+ if (sc->sc_vs_cur->buf == NULL) {
printf("%s: could not allocate VS buffer!\n", DEVNAME(sc));
return (USBD_NOMEM);
}
@@ -1389,14 +1389,14 @@ uvideo_vs_free(struct uvideo_softc *sc)
{
DPRINTF(1, "%s: %s\n", DEVNAME(sc), __func__);
- if (sc->sc_vs_curr->buf != NULL) {
- usbd_free_buffer(sc->sc_vs_curr->xfer);
- sc->sc_vs_curr->buf = NULL;
+ if (sc->sc_vs_cur->buf != NULL) {
+ usbd_free_buffer(sc->sc_vs_cur->xfer);
+ sc->sc_vs_cur->buf = NULL;
}
- if (sc->sc_vs_curr->xfer != NULL) {
- usbd_free_xfer(sc->sc_vs_curr->xfer);
- sc->sc_vs_curr->xfer = NULL;
+ if (sc->sc_vs_cur->xfer != NULL) {
+ usbd_free_xfer(sc->sc_vs_cur->xfer);
+ sc->sc_vs_cur->xfer = NULL;
}
}
@@ -1415,7 +1415,7 @@ uvideo_vs_open(struct uvideo_softc *sc)
return (error);
}
- error = uvideo_vs_set_alt(sc, sc->sc_vs_curr->ifaceh,
+ error = uvideo_vs_set_alt(sc, sc->sc_vs_cur->ifaceh,
UGETDW(sc->sc_desc_probe.dwMaxPayloadTransferSize));
if (error != USBD_NORMAL_COMPLETION) {
printf("%s: could not set alternate interface!\n",
@@ -1423,7 +1423,7 @@ uvideo_vs_open(struct uvideo_softc *sc)
return (error);
}
- ed = usbd_interface2endpoint_descriptor(sc->sc_vs_curr->ifaceh, 0);
+ ed = usbd_interface2endpoint_descriptor(sc->sc_vs_cur->ifaceh, 0);
if (ed == NULL) {
printf("%s: no endpoint descriptor for VS iface\n",
DEVNAME(sc));
@@ -1432,15 +1432,15 @@ uvideo_vs_open(struct uvideo_softc *sc)
DPRINTF(1, "%s: open pipe for ", DEVNAME(sc));
DPRINTF(1, "bEndpointAddress=0x%02x (0x%02x), wMaxPacketSize=%d (%d)\n",
ed->bEndpointAddress,
- sc->sc_vs_curr->endpoint,
+ sc->sc_vs_cur->endpoint,
UGETW(ed->wMaxPacketSize),
- sc->sc_vs_curr->max_packet_size);
+ sc->sc_vs_cur->max_packet_size);
error = usbd_open_pipe(
- sc->sc_vs_curr->ifaceh,
- sc->sc_vs_curr->endpoint,
+ sc->sc_vs_cur->ifaceh,
+ sc->sc_vs_cur->endpoint,
USBD_EXCLUSIVE_USE,
- &sc->sc_vs_curr->pipeh);
+ &sc->sc_vs_cur->pipeh);
if (error != USBD_NORMAL_COMPLETION) {
printf("%s: could not open VS pipe: %s\n",
DEVNAME(sc), usbd_errstr(error));
@@ -1451,10 +1451,10 @@ uvideo_vs_open(struct uvideo_softc *sc)
if (strncmp(sc->sc_udev->bus->bdev.dv_xname, "ohci", 4) == 0) {
/* ohci workaround */
sc->sc_nframes = 6400 /
- sc->sc_vs_curr->max_packet_size;
+ sc->sc_vs_cur->max_packet_size;
} else {
sc->sc_nframes = UGETDW(sc->sc_desc_probe.dwMaxVideoFrameSize) /
- sc->sc_vs_curr->max_packet_size;
+ sc->sc_vs_cur->max_packet_size;
}
if (sc->sc_nframes > UVIDEO_NFRAMES_MAX)
sc->sc_nframes = UVIDEO_NFRAMES_MAX;
@@ -1467,12 +1467,12 @@ void
uvideo_vs_close(struct uvideo_softc *sc)
{
/* switch back to default interface (turns off cam LED) */
- (void)usbd_set_interface(sc->sc_vs_curr->ifaceh, 0);
+ (void)usbd_set_interface(sc->sc_vs_cur->ifaceh, 0);
- if (sc->sc_vs_curr->pipeh) {
- usbd_abort_pipe(sc->sc_vs_curr->pipeh);
- usbd_close_pipe(sc->sc_vs_curr->pipeh);
- sc->sc_vs_curr->pipeh = NULL;
+ if (sc->sc_vs_cur->pipeh) {
+ usbd_abort_pipe(sc->sc_vs_cur->pipeh);
+ usbd_close_pipe(sc->sc_vs_cur->pipeh);
+ sc->sc_vs_cur->pipeh = NULL;
}
}
@@ -1514,18 +1514,18 @@ uvideo_vs_start(struct uvideo_softc *sc)
return;
for (i = 0; i < sc->sc_nframes; i++)
- sc->sc_vs_curr->size[i] = sc->sc_vs_curr->max_packet_size;
+ sc->sc_vs_cur->size[i] = sc->sc_vs_cur->max_packet_size;
usbd_setup_isoc_xfer(
- sc->sc_vs_curr->xfer,
- sc->sc_vs_curr->pipeh,
- sc->sc_vs_curr,
- sc->sc_vs_curr->size,
+ sc->sc_vs_cur->xfer,
+ sc->sc_vs_cur->pipeh,
+ sc->sc_vs_cur,
+ sc->sc_vs_cur->size,
sc->sc_nframes,
USBD_NO_COPY | USBD_SHORT_XFER_OK,
uvideo_vs_cb);
- (void)usbd_transfer(sc->sc_vs_curr->xfer);
+ (void)usbd_transfer(sc->sc_vs_cur->xfer);
}
void
diff --git a/sys/dev/usb/uvideo.h b/sys/dev/usb/uvideo.h
index 0fead8a5781..f8c226183a1 100644
--- a/sys/dev/usb/uvideo.h
+++ b/sys/dev/usb/uvideo.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvideo.h,v 1.28 2008/08/24 11:05:03 mglocker Exp $ */
+/* $OpenBSD: uvideo.h,v 1.29 2008/08/24 11:43:00 mglocker Exp $ */
/*
* Copyright (c) 2007 Robert Nagy <robert@openbsd.org>
@@ -586,7 +586,7 @@ struct uvideo_softc {
struct uvideo_format_group sc_fmtgrp[UVIDEO_MAX_FORMAT];
#define UVIDEO_MAX_VS_NUM 8
- struct uvideo_vs_iface *sc_vs_curr;
+ struct uvideo_vs_iface *sc_vs_cur;
struct uvideo_vs_iface sc_vs_coll[UVIDEO_MAX_VS_NUM];
void *sc_uplayer_arg;