diff --git a/amplifiers/elecraft/kpa.c b/amplifiers/elecraft/kpa.c index 308a63cb9..372873109 100644 --- a/amplifiers/elecraft/kpa.c +++ b/amplifiers/elecraft/kpa.c @@ -83,6 +83,17 @@ int kpa_init(AMP *amp) return RIG_OK; } +int kpa_close(AMP *amp) +{ + rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); + + if (amp->state.priv) { free(amp->state.priv); } + + amp->state.priv = NULL; + + return RIG_OK; +} + int kpa_flushbuffer(AMP *amp) { struct amp_state *rs; diff --git a/amplifiers/elecraft/kpa.h b/amplifiers/elecraft/kpa.h index c4169ea93..6825ee1e8 100644 --- a/amplifiers/elecraft/kpa.h +++ b/amplifiers/elecraft/kpa.h @@ -40,21 +40,23 @@ extern const struct amp_caps kpa1500_rot_caps; */ struct kpa_priv_data { - char tmpbuf[256]; // for unknown error msg + char tmpbuf[256]; // for unknown error msg }; int kpa_init(AMP *amp); +int kpa_close(AMP *amp); int kpa_reset(AMP *amp, amp_reset_t reset); int kpa_flush_buffer(AMP *amp); -int kpa_transaction(AMP *amp, const char *cmd, char *response, int response_len); -const char *kpa_get_info (AMP *amp); -int kpa_get_freq (AMP *amp, freq_t *freq); -int kpa_set_freq (AMP *amp, freq_t freq); +int kpa_transaction(AMP *amp, const char *cmd, char *response, + int response_len); +const char *kpa_get_info(AMP *amp); +int kpa_get_freq(AMP *amp, freq_t *freq); +int kpa_set_freq(AMP *amp, freq_t freq); -int kpa_get_level (AMP *amp, setting_t level, value_t *val); -int kpa_get_powerstat (AMP *amp, powerstat_t *status); -int kpa_set_powerstat (AMP *amp, powerstat_t status); +int kpa_get_level(AMP *amp, setting_t level, value_t *val); +int kpa_get_powerstat(AMP *amp, powerstat_t *status); +int kpa_set_powerstat(AMP *amp, powerstat_t status); #endif /* _AMP_ELECRAFT_H */ diff --git a/amplifiers/elecraft/kpa1500.c b/amplifiers/elecraft/kpa1500.c index 89942de9f..8a494a513 100644 --- a/amplifiers/elecraft/kpa1500.c +++ b/amplifiers/elecraft/kpa1500.c @@ -41,8 +41,6 @@ struct kpa_priv_data *kpa1500_priv; * */ -static int kpa1500_cleanup(AMP *amp); - /* * Private helper function prototypes */ @@ -67,7 +65,7 @@ const struct amp_caps kpa1500_amp_caps = .amp_model = AMP_MODEL_ELECRAFT_KPA1500, .model_name = "KPA1500", .mfg_name = "Elecraft", - .version = "2019-12-06", + .version = "2020-01-12", .copyright = "LGPL", .status = RIG_STATUS_ALPHA, .amp_type = AMP_TYPE_OTHER, @@ -85,7 +83,7 @@ const struct amp_caps kpa1500_amp_caps = .amp_open = amp_open, .amp_init = kpa_init, - .amp_cleanup = kpa1500_cleanup, + .amp_close = kpa_close, .reset = kpa_reset, .get_info = kpa_get_info, .get_powerstat = kpa_get_powerstat, @@ -103,31 +101,6 @@ const struct amp_caps kpa1500_amp_caps = * ************************************ */ -/* - * Clean up allocated memory structures - */ - -static int kpa1500_cleanup(AMP *amp) -{ - - rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__); - - if (!amp) - { - return -RIG_EINVAL; - } - - if (amp->state.priv) - { - free(amp->state.priv); - } - - amp->state.priv = NULL; - - return RIG_OK; -} - - /* * */