From: Uwe Hermann Date: Wed, 8 Apr 2020 21:49:38 +0000 (+0200) Subject: Use std_session_send_df_frame_begin()/_end() where possible. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=4c5f70063ad6ae311809ee7818ddc9070fbe05cf;p=libsigrok.git Use std_session_send_df_frame_begin()/_end() where possible. --- diff --git a/src/hardware/arachnid-labs-re-load-pro/protocol.c b/src/hardware/arachnid-labs-re-load-pro/protocol.c index 3d7a0146..2c1031a2 100644 --- a/src/hardware/arachnid-labs-re-load-pro/protocol.c +++ b/src/hardware/arachnid-labs-re-load-pro/protocol.c @@ -338,9 +338,7 @@ static void handle_packet(const struct sr_dev_inst *sdi) g_strfreev(tokens); /* Begin frame. */ - packet.type = SR_DF_FRAME_BEGIN; - packet.payload = NULL; - sr_session_send(sdi, &packet); + std_session_send_df_frame_begin(sdi); sr_analog_init(&analog, &encoding, &meaning, &spec, 4); @@ -373,9 +371,7 @@ static void handle_packet(const struct sr_dev_inst *sdi) g_slist_free(l); /* End frame. */ - packet.type = SR_DF_FRAME_END; - packet.payload = NULL; - sr_session_send(sdi, &packet); + std_session_send_df_frame_end(sdi); sr_sw_limits_update_samples_read(&devc->limits, 1); } diff --git a/src/hardware/baylibre-acme/protocol.c b/src/hardware/baylibre-acme/protocol.c index 17ae5b90..89391d54 100644 --- a/src/hardware/baylibre-acme/protocol.c +++ b/src/hardware/baylibre-acme/protocol.c @@ -703,7 +703,7 @@ SR_PRIV void bl_acme_close_channel(struct sr_channel *ch) SR_PRIV int bl_acme_receive_data(int fd, int revents, void *cb_data) { uint64_t nrexpiration; - struct sr_datafeed_packet packet, framep; + struct sr_datafeed_packet packet; struct sr_datafeed_analog analog; struct sr_analog_encoding encoding; struct sr_analog_meaning meaning; @@ -759,8 +759,7 @@ SR_PRIV int bl_acme_receive_data(int fd, int revents, void *cb_data) * accuracy. */ for (i = 0; i < nrexpiration; i++) { - framep.type = SR_DF_FRAME_BEGIN; - sr_session_send(sdi, &framep); + std_session_send_df_frame_begin(sdi); /* * Due to different units used in each channel we're sending @@ -788,8 +787,7 @@ SR_PRIV int bl_acme_receive_data(int fd, int revents, void *cb_data) sr_session_send(sdi, &packet); } - framep.type = SR_DF_FRAME_END; - sr_session_send(sdi, &framep); + std_session_send_df_frame_end(sdi); } sr_sw_limits_update_samples_read(&devc->limits, 1); diff --git a/src/hardware/gwinstek-gds-800/api.c b/src/hardware/gwinstek-gds-800/api.c index 2926bf07..9d45266e 100644 --- a/src/hardware/gwinstek-gds-800/api.c +++ b/src/hardware/gwinstek-gds-800/api.c @@ -189,17 +189,13 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) { struct sr_scpi_dev_inst *scpi; struct dev_context *devc; - struct sr_datafeed_packet packet; scpi = sdi->conn; devc = sdi->priv; if (devc->df_started) { - packet.type = SR_DF_FRAME_END; - sr_session_send(sdi, &packet); - + std_session_send_df_frame_end(sdi); std_session_send_df_end(sdi); - devc->df_started = FALSE; } diff --git a/src/hardware/gwinstek-gds-800/protocol.c b/src/hardware/gwinstek-gds-800/protocol.c index ce9e8d41..5feb25b1 100644 --- a/src/hardware/gwinstek-gds-800/protocol.c +++ b/src/hardware/gwinstek-gds-800/protocol.c @@ -141,11 +141,8 @@ SR_PRIV int gwinstek_gds_800_receive_data(int fd, int revents, void *cb_data) } else { /* Start acquiring next frame. */ if (devc->df_started) { - packet.type = SR_DF_FRAME_END; - sr_session_send(sdi, &packet); - - packet.type = SR_DF_FRAME_BEGIN; - sr_session_send(sdi, &packet); + std_session_send_df_frame_end(sdi); + std_session_send_df_frame_begin(sdi); } devc->cur_acq_frame++; @@ -202,10 +199,7 @@ SR_PRIV int gwinstek_gds_800_receive_data(int fd, int revents, void *cb_data) if (!devc->df_started) { std_session_send_df_header(sdi); - - packet.type = SR_DF_FRAME_BEGIN; - sr_session_send(sdi, &packet); - + std_session_send_df_frame_begin(sdi); devc->df_started = TRUE; } break; @@ -271,11 +265,8 @@ SR_PRIV int gwinstek_gds_800_receive_data(int fd, int revents, void *cb_data) } else { /* Start acquiring next frame. */ if (devc->df_started) { - packet.type = SR_DF_FRAME_END; - sr_session_send(sdi, &packet); - - packet.type = SR_DF_FRAME_BEGIN; - sr_session_send(sdi, &packet); + std_session_send_df_frame_end(sdi); + std_session_send_df_frame_begin(sdi); } devc->cur_acq_frame++; devc->state = START_ACQUISITION; diff --git a/src/hardware/hameg-hmo/protocol.c b/src/hardware/hameg-hmo/protocol.c index 457fb86b..d15d7a89 100644 --- a/src/hardware/hameg-hmo/protocol.c +++ b/src/hardware/hameg-hmo/protocol.c @@ -1402,10 +1402,8 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data) * Send "frame begin" packet upon reception of data for the * first enabled channel. */ - if (devc->current_channel == devc->enabled_channels) { - packet.type = SR_DF_FRAME_BEGIN; - sr_session_send(sdi, &packet); - } + if (devc->current_channel == devc->enabled_channels) + std_session_send_df_frame_begin(sdi); /* * Pass on the received data of the channel(s). @@ -1526,8 +1524,7 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data) */ hmo_cleanup_logic_data(devc); - packet.type = SR_DF_FRAME_END; - sr_session_send(sdi, &packet); + std_session_send_df_frame_end(sdi); /* * End of frame was reached. Stop acquisition after the specified diff --git a/src/hardware/hantek-dso/api.c b/src/hardware/hantek-dso/api.c index c1b18ea9..b0726e98 100644 --- a/src/hardware/hantek-dso/api.c +++ b/src/hardware/hantek-dso/api.c @@ -704,7 +704,6 @@ static void send_chunk(struct sr_dev_inst *sdi, unsigned char *buf, */ static void LIBUSB_CALL receive_transfer(struct libusb_transfer *transfer) { - struct sr_datafeed_packet packet; struct sr_dev_inst *sdi; struct dev_context *devc; int num_samples, pre; @@ -782,8 +781,7 @@ static void LIBUSB_CALL receive_transfer(struct libusb_transfer *transfer) devc->framebuf = NULL; /* Mark the end of this frame. */ - packet.type = SR_DF_FRAME_END; - sr_session_send(sdi, &packet); + std_session_send_df_frame_end(sdi); if (devc->limit_frames && ++devc->num_frames >= devc->limit_frames) { /* Terminate session */ @@ -797,7 +795,6 @@ static void LIBUSB_CALL receive_transfer(struct libusb_transfer *transfer) static int handle_event(int fd, int revents, void *cb_data) { const struct sr_dev_inst *sdi; - struct sr_datafeed_packet packet; struct timeval tv; struct sr_dev_driver *di; struct dev_context *devc; @@ -889,8 +886,7 @@ static int handle_event(int fd, int revents, void *cb_data) devc->dev_state = FETCH_DATA; /* Tell the frontend a new frame is on the way. */ - packet.type = SR_DF_FRAME_BEGIN; - sr_session_send(sdi, &packet); + std_session_send_df_frame_begin(sdi); break; case CAPTURE_READY_9BIT: /* TODO */ diff --git a/src/hardware/hung-chang-dso-2100/protocol.c b/src/hardware/hung-chang-dso-2100/protocol.c index 3df5b3f2..92d52c35 100644 --- a/src/hardware/hung-chang-dso-2100/protocol.c +++ b/src/hardware/hung-chang-dso-2100/protocol.c @@ -415,7 +415,6 @@ static int read_subframe(const struct sr_dev_inst *sdi, uint8_t *buf) SR_PRIV int hung_chang_dso_2100_poll(int fd, int revents, void *cb_data) { - struct sr_datafeed_packet packet = { .type = SR_DF_FRAME_BEGIN }; struct sr_dev_inst *sdi; struct dev_context *devc; uint8_t state, buf[1000]; @@ -443,7 +442,7 @@ SR_PRIV int hung_chang_dso_2100_poll(int fd, int revents, void *cb_data) return FALSE; } - sr_session_send(sdi, &packet); + std_session_send_df_frame_begin(sdi); if (devc->channel) { while (read_subframe(sdi, buf)) { @@ -456,8 +455,7 @@ SR_PRIV int hung_chang_dso_2100_poll(int fd, int revents, void *cb_data) } } - packet.type = SR_DF_FRAME_END; - sr_session_send(sdi, &packet); + std_session_send_df_frame_end(sdi); if (++devc->frame >= devc->frame_limit) sr_dev_acquisition_stop(sdi); diff --git a/src/hardware/lecroy-xstream/protocol.c b/src/hardware/lecroy-xstream/protocol.c index 802cda32..9693c6d3 100644 --- a/src/hardware/lecroy-xstream/protocol.c +++ b/src/hardware/lecroy-xstream/protocol.c @@ -679,10 +679,8 @@ SR_PRIV int lecroy_xstream_receive_data(int fd, int revents, void *cb_data) * Send "frame begin" packet upon reception of data for the * first enabled channel. */ - if (devc->current_channel == devc->enabled_channels) { - packet.type = SR_DF_FRAME_BEGIN; - sr_session_send(sdi, &packet); - } + if (devc->current_channel == devc->enabled_channels) + std_session_send_df_frame_begin(sdi); meaning.channels = g_slist_append(NULL, ch); packet.payload = &analog; @@ -706,8 +704,7 @@ SR_PRIV int lecroy_xstream_receive_data(int fd, int revents, void *cb_data) return TRUE; } - packet.type = SR_DF_FRAME_END; - sr_session_send(sdi, &packet); + std_session_send_df_frame_end(sdi); /* * End of frame was reached. Stop acquisition after the specified diff --git a/src/hardware/maynuo-m97/protocol.c b/src/hardware/maynuo-m97/protocol.c index c369fa6c..3a4c2d46 100644 --- a/src/hardware/maynuo-m97/protocol.c +++ b/src/hardware/maynuo-m97/protocol.c @@ -166,7 +166,6 @@ SR_PRIV int maynuo_m97_receive_data(int fd, int revents, void *cb_data) struct sr_dev_inst *sdi; struct dev_context *devc; struct sr_modbus_dev_inst *modbus; - struct sr_datafeed_packet packet; uint16_t registers[4]; (void)fd; @@ -180,8 +179,7 @@ SR_PRIV int maynuo_m97_receive_data(int fd, int revents, void *cb_data) devc->expecting_registers = 0; if (sr_modbus_read_holding_registers(modbus, -1, 4, registers) == SR_OK) { - packet.type = SR_DF_FRAME_BEGIN; - sr_session_send(sdi, &packet); + std_session_send_df_frame_begin(sdi); maynuo_m97_session_send_value(sdi, sdi->channels->data, RBFL(registers + 0), @@ -190,8 +188,7 @@ SR_PRIV int maynuo_m97_receive_data(int fd, int revents, void *cb_data) RBFL(registers + 2), SR_MQ_CURRENT, SR_UNIT_AMPERE, 4); - packet.type = SR_DF_FRAME_END; - sr_session_send(sdi, &packet); + std_session_send_df_frame_end(sdi); sr_sw_limits_update_samples_read(&devc->limits, 1); } diff --git a/src/hardware/rdtech-dps/protocol.c b/src/hardware/rdtech-dps/protocol.c index 77cc0a08..65f40ab9 100644 --- a/src/hardware/rdtech-dps/protocol.c +++ b/src/hardware/rdtech-dps/protocol.c @@ -120,7 +120,6 @@ SR_PRIV int rdtech_dps_receive_data(int fd, int revents, void *cb_data) struct sr_dev_inst *sdi; struct dev_context *devc; struct sr_modbus_dev_inst *modbus; - struct sr_datafeed_packet packet; uint16_t registers[8]; int ret; @@ -143,8 +142,7 @@ SR_PRIV int rdtech_dps_receive_data(int fd, int revents, void *cb_data) if (ret == SR_OK) { /* Send channel values */ - packet.type = SR_DF_FRAME_BEGIN; - sr_session_send(sdi, &packet); + std_session_send_df_frame_begin(sdi); send_value(sdi, sdi->channels->data, RB16(registers + 0) / devc->voltage_multiplier, @@ -158,8 +156,7 @@ SR_PRIV int rdtech_dps_receive_data(int fd, int revents, void *cb_data) RB16(registers + 2) / 100.0f, SR_MQ_POWER, 0, SR_UNIT_WATT, 2); - packet.type = SR_DF_FRAME_END; - sr_session_send(sdi, &packet); + std_session_send_df_frame_end(sdi); /* Check for state changes */ if (devc->actual_ovp_state != (RB16(registers + 5) == STATE_OVP)) { diff --git a/src/hardware/rigol-ds/api.c b/src/hardware/rigol-ds/api.c index 0146f3a0..10c579ce 100644 --- a/src/hardware/rigol-ds/api.c +++ b/src/hardware/rigol-ds/api.c @@ -878,7 +878,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) struct sr_scpi_dev_inst *scpi; struct dev_context *devc; struct sr_channel *ch; - struct sr_datafeed_packet packet; gboolean some_digital; GSList *l; char *cmd; @@ -994,8 +993,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) return SR_ERR; /* Start of first frame. */ - packet.type = SR_DF_FRAME_BEGIN; - sr_session_send(sdi, &packet); + std_session_send_df_frame_begin(sdi); return SR_OK; } diff --git a/src/hardware/rigol-ds/protocol.c b/src/hardware/rigol-ds/protocol.c index 3ea0cea8..688dcc39 100644 --- a/src/hardware/rigol-ds/protocol.c +++ b/src/hardware/rigol-ds/protocol.c @@ -666,8 +666,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data) return TRUE; if (len == -1) { sr_err("Error while reading block header, aborting capture."); - packet.type = SR_DF_FRAME_END; - sr_session_send(sdi, &packet); + std_session_send_df_frame_end(sdi); sr_dev_acquisition_stop(sdi); return TRUE; } @@ -699,8 +698,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data) if (len == -1) { sr_err("Error while reading block data, aborting capture."); - packet.type = SR_DF_FRAME_END; - sr_session_send(sdi, &packet); + std_session_send_df_frame_end(sdi); sr_dev_acquisition_stop(sdi); return TRUE; } @@ -761,8 +759,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data) /* End acquisition when data for all channels is acquired. */ if (!sr_scpi_read_complete(scpi) && !devc->channel_entry->next) { sr_err("Read should have been completed"); - packet.type = SR_DF_FRAME_END; - sr_session_send(sdi, &packet); + std_session_send_df_frame_end(sdi); sr_dev_acquisition_stop(sdi); return TRUE; } @@ -796,8 +793,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data) rigol_ds_channel_start(sdi); } else { /* Done with this frame. */ - packet.type = SR_DF_FRAME_END; - sr_session_send(sdi, &packet); + std_session_send_df_frame_end(sdi); if (++devc->num_frames == devc->limit_frames) { /* Last frame, stop capture. */ @@ -809,8 +805,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data) rigol_ds_capture_start(sdi); /* Start of next frame. */ - packet.type = SR_DF_FRAME_BEGIN; - sr_session_send(sdi, &packet); + std_session_send_df_frame_begin(sdi); } } diff --git a/src/hardware/serial-lcr/protocol.c b/src/hardware/serial-lcr/protocol.c index e5b89dc5..f0e99731 100644 --- a/src/hardware/serial-lcr/protocol.c +++ b/src/hardware/serial-lcr/protocol.c @@ -31,7 +31,6 @@ static void send_frame_start(struct sr_dev_inst *sdi) struct lcr_parse_info *info; uint64_t freq; const char *model; - struct sr_datafeed_packet packet; devc = sdi->priv; info = &devc->parse_info; @@ -51,8 +50,7 @@ static void send_frame_start(struct sr_dev_inst *sdi) } /* Data is about to get sent. Start a new frame. */ - packet.type = SR_DF_FRAME_BEGIN; - sr_session_send(sdi, &packet); + std_session_send_df_frame_begin(sdi); } static int handle_packet(struct sr_dev_inst *sdi, const uint8_t *pkt) diff --git a/src/hardware/siglent-sds/api.c b/src/hardware/siglent-sds/api.c index 76af6712..172c8af2 100644 --- a/src/hardware/siglent-sds/api.c +++ b/src/hardware/siglent-sds/api.c @@ -799,7 +799,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) struct sr_scpi_dev_inst *scpi; struct dev_context *devc; struct sr_channel *ch; - struct sr_datafeed_packet packet; gboolean some_digital; GSList *l, *d; @@ -900,8 +899,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) return SR_ERR; /* Start of first frame. */ - packet.type = SR_DF_FRAME_BEGIN; - sr_session_send(sdi, &packet); + std_session_send_df_frame_begin(sdi); return SR_OK; } diff --git a/src/hardware/siglent-sds/protocol.c b/src/hardware/siglent-sds/protocol.c index af2f2d9b..69c07db5 100644 --- a/src/hardware/siglent-sds/protocol.c +++ b/src/hardware/siglent-sds/protocol.c @@ -539,8 +539,7 @@ SR_PRIV int siglent_sds_receive(int fd, int revents, void *cb_data) return TRUE; if (len == -1) { sr_err("Read error, aborting capture."); - packet.type = SR_DF_FRAME_END; - sr_session_send(sdi, &packet); + std_session_send_df_frame_end(sdi); sdi->driver->dev_acquisition_stop(sdi); return TRUE; } @@ -549,8 +548,7 @@ SR_PRIV int siglent_sds_receive(int fd, int revents, void *cb_data) if (len == -1) { sr_err("Read error, aborting capture."); - packet.type = SR_DF_FRAME_END; - sr_session_send(sdi, &packet); + std_session_send_df_frame_end(sdi); sdi->driver->dev_acquisition_stop(sdi); return TRUE; } @@ -567,8 +565,7 @@ SR_PRIV int siglent_sds_receive(int fd, int revents, void *cb_data) len = sr_scpi_read_data(scpi, (char *)devc->buffer, devc->num_samples-devc->num_block_bytes); if (len == -1) { sr_err("Read error, aborting capture."); - packet.type = SR_DF_FRAME_END; - sr_session_send(sdi, &packet); + std_session_send_df_frame_end(sdi); sdi->driver->dev_acquisition_stop(sdi); return TRUE; } @@ -615,8 +612,7 @@ SR_PRIV int siglent_sds_receive(int fd, int revents, void *cb_data) read_complete = TRUE; if (!sr_scpi_read_complete(scpi)) { sr_err("Read should have been completed."); - packet.type = SR_DF_FRAME_END; - sr_session_send(sdi, &packet); + std_session_send_df_frame_end(sdi); sdi->driver->dev_acquisition_stop(sdi); return TRUE; } @@ -633,8 +629,7 @@ SR_PRIV int siglent_sds_receive(int fd, int revents, void *cb_data) siglent_sds_channel_start(sdi); } else { /* Done with this frame. */ - packet.type = SR_DF_FRAME_END; - sr_session_send(sdi, &packet); + std_session_send_df_frame_end(sdi); if (++devc->num_frames == devc->limit_frames) { /* Last frame, stop capture. */ sdi->driver->dev_acquisition_stop(sdi); @@ -644,8 +639,7 @@ SR_PRIV int siglent_sds_receive(int fd, int revents, void *cb_data) siglent_sds_capture_start(sdi); /* Start of next frame. */ - packet.type = SR_DF_FRAME_BEGIN; - sr_session_send(sdi, &packet); + std_session_send_df_frame_begin(sdi); } } } @@ -658,8 +652,7 @@ SR_PRIV int siglent_sds_receive(int fd, int revents, void *cb_data) packet.type = SR_DF_LOGIC; packet.payload = &logic; sr_session_send(sdi, &packet); - packet.type = SR_DF_FRAME_END; - sr_session_send(sdi, &packet); + std_session_send_df_frame_end(sdi); sdi->driver->dev_acquisition_stop(sdi); if (++devc->num_frames == devc->limit_frames) { @@ -671,14 +664,12 @@ SR_PRIV int siglent_sds_receive(int fd, int revents, void *cb_data) siglent_sds_capture_start(sdi); /* Start of next frame. */ - packet.type = SR_DF_FRAME_BEGIN; - sr_session_send(sdi, &packet); + std_session_send_df_frame_begin(sdi); } } // sr_session_send(sdi, &packet); - // packet.type = SR_DF_FRAME_END; - // sr_session_send(sdi, &packet); + // std_session_send_df_frame_end(sdi); // sdi->driver->dev_acquisition_stop(sdi); return TRUE; diff --git a/src/hardware/yokogawa-dlm/protocol.c b/src/hardware/yokogawa-dlm/protocol.c index 1bd863ee..d2c51cda 100644 --- a/src/hardware/yokogawa-dlm/protocol.c +++ b/src/hardware/yokogawa-dlm/protocol.c @@ -1018,7 +1018,6 @@ SR_PRIV int dlm_data_receive(int fd, int revents, void *cb_data) struct scope_state *model_state; struct dev_context *devc; struct sr_channel *ch; - struct sr_datafeed_packet packet; int chunk_len, num_bytes; static GArray *data = NULL; @@ -1065,10 +1064,8 @@ SR_PRIV int dlm_data_receive(int fd, int revents, void *cb_data) devc->data_pending = FALSE; /* Signal the beginning of a new frame if this is the first channel. */ - if (devc->current_channel == devc->enabled_channels) { - packet.type = SR_DF_FRAME_BEGIN; - sr_session_send(sdi, &packet); - } + if (devc->current_channel == devc->enabled_channels) + std_session_send_df_frame_begin(sdi); if (dlm_block_data_header_process(data, &num_bytes) != SR_OK) { sr_err("Encountered malformed block data header."); @@ -1111,8 +1108,7 @@ SR_PRIV int dlm_data_receive(int fd, int revents, void *cb_data) * and set the next enabled channel. Then, request its data. */ if (!devc->current_channel->next) { - packet.type = SR_DF_FRAME_END; - sr_session_send(sdi, &packet); + std_session_send_df_frame_end(sdi); devc->current_channel = devc->enabled_channels; /* diff --git a/src/hardware/zketech-ebd-usb/protocol.c b/src/hardware/zketech-ebd-usb/protocol.c index 0c99ea50..b3098c5d 100644 --- a/src/hardware/zketech-ebd-usb/protocol.c +++ b/src/hardware/zketech-ebd-usb/protocol.c @@ -224,9 +224,7 @@ SR_PRIV int ebd_receive_data(int fd, int revents, void *cb_data) sr_dbg("Current limit %f", current_limit); /* Begin frame. */ - packet.type = SR_DF_FRAME_BEGIN; - packet.payload = NULL; - sr_session_send(sdi, &packet); + std_session_send_df_frame_begin(sdi); sr_analog_init(&analog, &encoding, &meaning, &spec, 4); @@ -257,9 +255,7 @@ SR_PRIV int ebd_receive_data(int fd, int revents, void *cb_data) g_slist_free(l); /* End frame. */ - packet.type = SR_DF_FRAME_END; - packet.payload = NULL; - sr_session_send(sdi, &packet); + std_session_send_df_frame_end(sdi); sr_sw_limits_update_samples_read(&devc->limits, 1); if (sr_sw_limits_check(&devc->limits))