rohde-schwarz-sme-0x: Coding style fixes

This commit is contained in:
Soeren Apel 2017-02-23 17:33:47 +01:00
parent a28b3df111
commit 9e50659470
3 changed files with 49 additions and 52 deletions

View File

@ -28,37 +28,43 @@ SR_PRIV struct sr_dev_driver rohde_schwarz_sme_0x_driver_info;
static const char *manufacturer = "Rohde&Schwarz"; static const char *manufacturer = "Rohde&Schwarz";
static const struct rs_device_model device_models[] = {{ static const struct rs_device_model device_models[] = {
{
.model_str = "SME02", .model_str = "SME02",
.freq_max = SR_GHZ(1.5), .freq_max = SR_GHZ(1.5),
.freq_min = SR_KHZ(5), .freq_min = SR_KHZ(5),
.power_max = 16, .power_max = 16,
.power_min = -144 .power_min = -144
}, { },
{
.model_str = "SME03E", .model_str = "SME03E",
.freq_max = SR_GHZ(2.2), .freq_max = SR_GHZ(2.2),
.freq_min = SR_KHZ(5), .freq_min = SR_KHZ(5),
.power_max = 16, .power_max = 16,
.power_min = -144 .power_min = -144
}, { },
{
.model_str = "SME03A", .model_str = "SME03A",
.freq_max = SR_GHZ(3), .freq_max = SR_GHZ(3),
.freq_min = SR_KHZ(5), .freq_min = SR_KHZ(5),
.power_max = 16, .power_max = 16,
.power_min = -144 .power_min = -144
}, { },
{
.model_str = "SME03", .model_str = "SME03",
.freq_max = SR_GHZ(3), .freq_max = SR_GHZ(3),
.freq_min = SR_KHZ(5), .freq_min = SR_KHZ(5),
.power_max = 16, .power_max = 16,
.power_min = -144 .power_min = -144
}, { },
{
.model_str = "SME06", .model_str = "SME06",
.freq_max = SR_GHZ(1.5), .freq_max = SR_GHZ(1.5),
.freq_min = SR_KHZ(5), .freq_min = SR_KHZ(5),
.power_max = 16, .power_max = 16,
.power_min = -144 .power_min = -144
}}; }
};
static const uint32_t scanopts[] = { static const uint32_t scanopts[] = {
SR_CONF_CONN, SR_CONF_CONN,
@ -70,15 +76,6 @@ static const uint32_t devopts[] = {
SR_CONF_AMPLITUDE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, SR_CONF_AMPLITUDE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
}; };
static int check_manufacturer(const char *str)
{
if (!strcmp(str, manufacturer)) {
return SR_OK;
}
return SR_ERR;
}
static int rs_init_device(struct sr_dev_inst *sdi) static int rs_init_device(struct sr_dev_inst *sdi)
{ {
struct dev_context *devc; struct dev_context *devc;
@ -119,7 +116,7 @@ static struct sr_dev_inst *rs_probe_serial_device(struct sr_scpi_dev_inst *scpi)
goto fail; goto fail;
} }
if (check_manufacturer(hw_info->manufacturer) != SR_OK) { if (strcmp(hw_info->manufacturer, manufacturer) != 0) {
goto fail; goto fail;
} }
@ -169,7 +166,7 @@ static int dev_clear(const struct sr_dev_driver *di)
static int dev_open(struct sr_dev_inst *sdi) static int dev_open(struct sr_dev_inst *sdi)
{ {
if (sdi->status != SR_ST_ACTIVE && sr_scpi_open(sdi->conn) != SR_OK) { if ((sdi->status != SR_ST_ACTIVE) && (sr_scpi_open(sdi->conn) != SR_OK)) {
return SR_ERR; return SR_ERR;
} }

View File

@ -66,7 +66,7 @@ SR_PRIV int rs_sme0x_set_freq(const struct sr_dev_inst *sdi, double freq) {
devc = sdi->priv; devc = sdi->priv;
config = devc->model_config; config = devc->model_config;
if (freq > config->freq_max || freq < config->freq_min) { if ((freq > config->freq_max) || (freq < config->freq_min)) {
return SR_ERR_ARG; return SR_ERR_ARG;
} }
@ -80,7 +80,7 @@ SR_PRIV int rs_sme0x_set_power(const struct sr_dev_inst *sdi, double power) {
devc = sdi->priv; devc = sdi->priv;
config = devc->model_config; config = devc->model_config;
if (power > config->power_max || power < config->power_min) { if ((power > config->power_max) || (power < config->power_min)) {
return SR_ERR_ARG; return SR_ERR_ARG;
} }