Commit 3053b3af authored by Alessandro Rubini's avatar Alessandro Rubini

general: remove two bitfields (use flags instead)

Bitfields are a bad practice. And this removes a few bytes in the wrpc
builds (no change in other builds).
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent ea6042b4
......@@ -20,8 +20,7 @@ static struct pp_runtime_opts sim_master_rt_opts = {
.outbound_latency = {0, PP_DEFAULT_OUTBOUND_LATENCY},
.max_rst = PP_DEFAULT_MAX_RESET,
.max_dly = PP_DEFAULT_MAX_DELAY,
.no_adjust = PP_DEFAULT_NO_ADJUST,
.no_rst_clk = PP_DEFAULT_NO_RESET_CLOCK,
.flags = PP_DEFAULT_FLAGS,
.ap = PP_DEFAULT_AP,
.ai = PP_DEFAULT_AI,
.s = PP_DEFAULT_DELAY_S,
......
......@@ -18,7 +18,7 @@
#define PP_DEFAULT_INBOUND_LATENCY 0 /* in nsec */
#define PP_DEFAULT_OUTBOUND_LATENCY 0 /* in nsec */
#define PP_DEFAULT_NO_RESET_CLOCK 0
#define PP_DEFAULT_FLAGS 0
#define PP_DEFAULT_ETHERNET_MODE 0
#define PP_DEFAULT_DOMAIN_NUMBER 0
#define PP_DEFAULT_AP 10
......@@ -46,7 +46,6 @@
#define PP_NR_FOREIGN_RECORDS 5
#define PP_DEFAULT_MAX_RESET 0
#define PP_DEFAULT_MAX_DELAY 0
#define PP_DEFAULT_NO_ADJUST 0
#define PP_DEFAULT_TTL 1
/* We use an array of timeouts, with these indexes */
......
......@@ -20,13 +20,14 @@ struct pp_runtime_opts {
Integer32 max_rst; /* Maximum number of nanoseconds to reset */
Integer32 max_dly; /* Maximum number of nanoseconds of delay */
Integer32 ttl;
UInteger32 /* slave_only:1, -- moved to ppsi, is no more global */
/* master_only:1, -- moved to ppsi, is no more global */
no_adjust:1,
/* ethernet_mode:1, -- moved to ppsi, is no more global */
/* e2e_mode:1, -- no more: we only support e2e */
/* gptp_mode:1, -- no more: peer-to-peer unsupported */
no_rst_clk:1;
int flags;
#define PP_FLAG_NO_ADJUST 0x01
#define PP_FLAG_NO_RESET 0x02
/* slave_only:1, -- moved to ppi, no more global */
/* master_only:1, -- moved to ppi, no more global */
/* ethernet_mode:1, -- moved to ppi, no more global */
/* e2e_mode:1, -- no more: we only support e2e */
/* gptp_mode:1, -- no more: peer-to-peer unsupported */
Integer16 ap, ai;
Integer16 s;
Integer8 announce_intvl;
......
......@@ -121,7 +121,7 @@ int pp_parse_cmdline(struct pp_globals *ppg, int argc, char **argv)
return -1;
break;
case 'x':
GOPTS(ppg)->no_rst_clk = 1;
GOPTS(ppg)->flags |= PP_FLAG_NO_RESET;
break;
case 'O':
a = argv[++i];
......@@ -142,7 +142,7 @@ int pp_parse_cmdline(struct pp_globals *ppg, int argc, char **argv)
}
break;
case 't':
GOPTS(ppg)->no_adjust = 1;
GOPTS(ppg)->flags |= PP_FLAG_NO_ADJUST;
break;
case 'a':
a = argv[++i];
......
......@@ -21,8 +21,7 @@ struct pp_runtime_opts __pp_default_rt_opts = {
.outbound_latency = {0, PP_DEFAULT_OUTBOUND_LATENCY},
.max_rst = PP_DEFAULT_MAX_RESET,
.max_dly = PP_DEFAULT_MAX_DELAY,
.no_adjust = PP_DEFAULT_NO_ADJUST,
.no_rst_clk = PP_DEFAULT_NO_RESET_CLOCK,
.flags = PP_DEFAULT_FLAGS,
.ap = PP_DEFAULT_AP,
.ai = PP_DEFAULT_AI,
.s = PP_DEFAULT_DELAY_S,
......
......@@ -26,7 +26,7 @@ void pp_servo_init(struct pp_instance *ppi)
SRV(ppi)->obs_drift = -d << 10; /* note "-" */
} else {
/* level clock */
if (!OPTS(ppi)->no_adjust)
if (!(OPTS(ppi)->flags & PP_FLAG_NO_ADJUST))
ppi->t_ops->adjust(ppi, 0, 0);
SRV(ppi)->obs_drift = 0;
}
......@@ -209,8 +209,8 @@ void pp_servo_got_resp(struct pp_instance *ppi)
TimeInternal time_tmp;
/* if secs, reset clock or set freq adjustment to max */
if (!OPTS(ppi)->no_adjust) {
if (!OPTS(ppi)->no_rst_clk) {
if (!(OPTS(ppi)->flags & PP_FLAG_NO_ADJUST)) {
if (!(OPTS(ppi)->flags & PP_FLAG_NO_RESET)) {
/* Can't use adjust, limited to +/- 2s */
time_tmp = ppi->t4;
add_TimeInternal(&time_tmp, &time_tmp,
......@@ -278,7 +278,7 @@ void pp_servo_got_resp(struct pp_instance *ppi)
/* apply controller output as a clock tick rate adjustment, if
* provided by arch, or as a raw offset otherwise */
if (!OPTS(ppi)->no_adjust) {
if (!(OPTS(ppi)->flags & PP_FLAG_NO_ADJUST)) {
if (ppi->t_ops->adjust_freq)
ppi->t_ops->adjust_freq(ppi, -adj);
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment