Mark config argument to sp_set_config as const.

This commit is contained in:
Martin Ling 2013-11-18 22:07:09 +00:00
parent 823690ae3e
commit bf2cbd652f
2 changed files with 4 additions and 4 deletions

View File

@ -157,7 +157,7 @@ int sp_flush(struct sp_port *port);
/* Basic port configuration */ /* Basic port configuration */
int sp_get_config(struct sp_port *port, struct sp_port_config *config); int sp_get_config(struct sp_port *port, struct sp_port_config *config);
int sp_set_config(struct sp_port *port, struct sp_port_config *config); int sp_set_config(struct sp_port *port, const struct sp_port_config *config);
int sp_set_baudrate(struct sp_port *port, int baudrate); int sp_set_baudrate(struct sp_port *port, int baudrate);
int sp_set_bits(struct sp_port *port, int bits); int sp_set_bits(struct sp_port *port, int bits);
int sp_set_parity(struct sp_port *port, int parity); int sp_set_parity(struct sp_port *port, int parity);

View File

@ -95,7 +95,7 @@ const struct std_baudrate std_baudrates[] = {
static int validate_port(struct sp_port *port); static int validate_port(struct sp_port *port);
static struct sp_port **list_append(struct sp_port **list, const char *portname); static struct sp_port **list_append(struct sp_port **list, const char *portname);
static int get_config(struct sp_port *port, struct port_data *data, struct sp_port_config *config); static int get_config(struct sp_port *port, struct port_data *data, struct sp_port_config *config);
static int set_config(struct sp_port *port, struct port_data *data, struct sp_port_config *config); static int set_config(struct sp_port *port, struct port_data *data, const struct sp_port_config *config);
int sp_get_port_by_name(const char *portname, struct sp_port **port_ptr) int sp_get_port_by_name(const char *portname, struct sp_port **port_ptr)
{ {
@ -726,7 +726,7 @@ static int get_config(struct sp_port *port, struct port_data *data, struct sp_po
return SP_OK; return SP_OK;
} }
static int set_config(struct sp_port *port, struct port_data *data, struct sp_port_config *config) static int set_config(struct sp_port *port, struct port_data *data, const struct sp_port_config *config)
{ {
unsigned int i; unsigned int i;
@ -1005,7 +1005,7 @@ static int set_config(struct sp_port *port, struct port_data *data, struct sp_po
#define TRY(x) do { int ret = x; if (ret != SP_OK) return ret; } while (0) #define TRY(x) do { int ret = x; if (ret != SP_OK) return ret; } while (0)
int sp_set_config(struct sp_port *port, struct sp_port_config *config) int sp_set_config(struct sp_port *port, const struct sp_port_config *config)
{ {
struct port_data data; struct port_data data;
struct sp_port_config prev_config; struct sp_port_config prev_config;