10 Mar
2014
10 Mar
'14
1:30 p.m.
(Mar 10 2014 06:27), Clemens Ladisch wrote:
This function is always used with a constant master parameter, and the two branches don't really share much code. Two functions would be simpler:
static u64 mpr_address(struct cmp_connection *c) { if (c->direction == CMP_INPUT) return CSR_REGISTER_BASE + CSR_IMPR; else return CSR_REGISTER_BASE + CSR_OMPR; }
static u64 pcr_address(struct cmp_connection *c) { if (c->direction == CMP_INPUT) return CSR_REGISTER_BASE + CSR_IPCR(c->pcr_index); else return CSR_REGISTER_BASE + CSR_OPCR(c->pcr_index); }
This is a good idea.
Takashi Sakamoto o-takashi@sakamocchi.jp