diff options
author | Harald Welte <laforge@osmocom.org> | 2022-01-09 23:33:18 +0100 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2022-01-09 23:39:42 +0100 |
commit | 3fff68cbf8fe8ed9cc118db0c7e405e8618d2618 (patch) | |
tree | 3020ad35eec520baf625f3a2db66840b6d21e408 /src | |
parent | 7cc8a7b80638bfa0c46317710bf3d85a246b55b4 (diff) |
cosmetic: Adhere osmocom coding style in for-loops
We either have to bring osmo-e1d in line with other osmocom projects,
or we'd have to disable the linter in jenkins.
Change-Id: I74ab20b22118d471dcdb60d1b9681ab62eb13d51
Diffstat (limited to 'src')
-rw-r--r-- | src/ctl.c | 2 | ||||
-rw-r--r-- | src/intf_line.c | 4 | ||||
-rw-r--r-- | src/mux_demux.c | 10 | ||||
-rw-r--r-- | src/usb.c | 21 |
4 files changed, 17 insertions, 20 deletions
@@ -278,7 +278,7 @@ _e1d_ctl_ts_query(void *data, struct msgb *msgb, struct msgb *rmsgb, int *rfd) if (n == 1) { _e1d_fill_ts_info(ti, &line->ts[hdr->ts]); } else { - for (int i=0; i<32; i++) + for (int i = 0; i < 32; i++) _e1d_fill_ts_info(ti++, &line->ts[i]); } diff --git a/src/intf_line.c b/src/intf_line.c index 5659129..1f833fb 100644 --- a/src/intf_line.c +++ b/src/intf_line.c @@ -192,7 +192,7 @@ e1_line_new(struct e1_intf *intf, void *drv_data) line->drv_data = drv_data; line->mode = E1_LINE_MODE_CHANNELIZED; - for (int i=0; i<32; i++) + for (int i = 0; i < 32; i++) _ts_init(&line->ts[i], line, i); _ts_init(&line->superchan, line, E1DP_TS_SUPERCHAN); @@ -228,7 +228,7 @@ e1_line_destroy(struct e1_line *line) osmo_timer_del(&line->watchdog.timer); /* close all [peer] file descriptors */ - for (int i=0; i<32; i++) + for (int i = 0; i < 32; i++) e1_ts_stop(&line->ts[i]); /* remove from per-interface list of lines */ diff --git a/src/mux_demux.c b/src/mux_demux.c index 2971c87..6a7b326 100644 --- a/src/mux_demux.c +++ b/src/mux_demux.c @@ -151,8 +151,7 @@ _e1_line_mux_out_channelized(struct e1_line *line, uint8_t *buf, int fts) OSMO_ASSERT(line->mode == E1_LINE_MODE_CHANNELIZED); /* Scan timeslots */ - for (int tsn=1; tsn<32; tsn++) - { + for (int tsn = 1; tsn < 32; tsn++) { struct e1_ts *ts = &line->ts[tsn]; uint8_t buf_ts[fts]; int l; @@ -164,7 +163,7 @@ _e1_line_mux_out_channelized(struct e1_line *line, uint8_t *buf, int fts) if (l <= 0) continue; - for (int i=0; i<l; i++) + for (int i = 0; i < l; i++) buf[tsn+(i*32)] = buf_ts[i]; } } @@ -327,15 +326,14 @@ _e1_line_demux_in_channelized(struct e1_line *line, const uint8_t *buf, int ftr) { OSMO_ASSERT(line->mode == E1_LINE_MODE_CHANNELIZED); - for (int tsn=1; tsn<32; tsn++) - { + for (int tsn = 1; tsn < 32; tsn++) { struct e1_ts *ts = &line->ts[tsn]; uint8_t buf_ts[ftr]; if (ts->mode == E1_TS_MODE_OFF) continue; - for (int i=0; i<ftr; i++) + for (int i = 0; i < ftr; i++) buf_ts[i] = buf[tsn+(i*32)]; _e1_ts_write(ts, buf_ts, ftr); @@ -185,7 +185,7 @@ _e1uf_xfr(struct libusb_transfer *xfr) /* FIXME: Check transfer status ? Error handling ? */ if (flow->ep & 0x80) { - for (j=0; j<flow->ppx; j++) { + for (j = 0; j < flow->ppx; j++) { flow->cb(flow, libusb_get_iso_packet_buffer_simple(xfr, j), (xfr->iso_packet_desc[j].status == LIBUSB_TRANSFER_COMPLETED) ? @@ -194,7 +194,7 @@ _e1uf_xfr(struct libusb_transfer *xfr) len += (xfr->iso_packet_desc[j].length = flow->size); } } else { - for (j=0; j<flow->ppx; j++) + for (j = 0; j < flow->ppx; j++) len += (xfr->iso_packet_desc[j].length = flow->cb(flow, &xfr->buffer[len], flow->size)); } @@ -226,7 +226,7 @@ e1uf_create(struct e1_line *line, xfer_cb_t cb, flow->ppx = ppx; flow->entries = talloc_zero_size(ctx, count * sizeof(struct e1_usb_flow_entry)); - for (int i=0; i<count; i++) + for (int i = 0; i < count; i++) flow->entries[i].buf = talloc_zero_size(ctx, size * ppx); return flow; @@ -239,7 +239,7 @@ e1uf_destroy(struct e1_usb_flow *flow) return; /* FIXME: stop pending transfers */ - for (int i=0; i<flow->count; i++) + for (int i = 0; i < flow->count; i++) talloc_free(flow->entries[i].buf); talloc_free(flow->entries); @@ -253,8 +253,7 @@ e1uf_start(struct e1_usb_flow *flow) struct libusb_transfer *xfr; int i, j, rv, len; - for (i=0; i<flow->count; i++) - { + for (i = 0; i < flow->count; i++) { xfr = libusb_alloc_transfer(flow->ppx); if (!xfr) return -ENOMEM; @@ -262,10 +261,10 @@ e1uf_start(struct e1_usb_flow *flow) len = 0; if (flow->ep & 0x80) { - for (j=0; j<flow->ppx; j++) + for (j = 0; j < flow->ppx; j++) len += (xfr->iso_packet_desc[j].length = flow->size); } else { - for (j=0; j<flow->ppx; j++) + for (j = 0; j < flow->ppx; j++) len += (xfr->iso_packet_desc[j].length = flow->cb(flow, &flow->entries[i].buf[len], flow->size)); } @@ -529,7 +528,7 @@ _e1_usb_open_device(struct e1_daemon *e1d, struct libusb_device *dev) return ret; } - for (i=0; i<cd->bNumInterfaces; i++) { + for (i = 0; i < cd->bNumInterfaces; i++) { /* Expect 2 altsettings with proper class/subclass/eps */ if (cd->interface[i].num_altsetting != 2) continue; @@ -559,7 +558,7 @@ _e1_usb_open_device(struct e1_daemon *e1d, struct libusb_device *dev) line_data->r_acc = 0; line_data->r_sw = 8192; - for (j=0; j<id->bNumEndpoints; j++) { + for (j = 0; j < id->bNumEndpoints; j++) { if (id->endpoint[j].bmAttributes == 0x11) { line_data->ep_fb = id->endpoint[j].bEndpointAddress; } else if (id->endpoint[j].bmAttributes == 0x05) { @@ -623,7 +622,7 @@ e1_usb_probe(struct e1_daemon *e1d) return -EIO; } - for (i=0; i<n_dev; i++) { + for (i = 0; i < n_dev; i++) { struct libusb_device_descriptor desc; ret = libusb_get_device_descriptor(dev_list[i], &desc); |