Make inline functions in headers 'static inline'

Future-proofing against newer versions of GCC/binutils which
are stricter about the use of 'inline' functions in headers.

Change-Id: Id620812ed340f0d790ba6c5b8b5cb1d700acfbbf
This commit is contained in:
Aidan MacDonald 2021-12-02 21:31:54 +00:00
parent 4162a46184
commit 2512ed1c56
3 changed files with 9 additions and 8 deletions

View file

@ -247,14 +247,15 @@ extern int i2c_reg_modify1(int bus, uint8_t addr, uint8_t reg,
uint8_t clr, uint8_t set, uint8_t* val); uint8_t clr, uint8_t set, uint8_t* val);
/* Variant to write a single 8-bit value to a register */ /* Variant to write a single 8-bit value to a register */
inline int i2c_reg_write1(int bus, uint8_t addr, uint8_t reg, uint8_t val) static inline int i2c_reg_write1(int bus, uint8_t addr,
uint8_t reg, uint8_t val)
{ {
return i2c_reg_write(bus, addr, reg, 1, &val); return i2c_reg_write(bus, addr, reg, 1, &val);
} }
/* Variant to read an 8-bit value from a register; returns the value /* Variant to read an 8-bit value from a register; returns the value
* directly, or returns -1 on any error. */ * directly, or returns -1 on any error. */
inline int i2c_reg_read1(int bus, uint8_t addr, uint8_t reg) static inline int i2c_reg_read1(int bus, uint8_t addr, uint8_t reg)
{ {
uint8_t v; uint8_t v;
int i = i2c_reg_read(bus, addr, reg, 1, &v); int i = i2c_reg_read(bus, addr, reg, 1, &v);
@ -265,7 +266,7 @@ inline int i2c_reg_read1(int bus, uint8_t addr, uint8_t reg)
} }
/* Variant to set or clear one bit in an 8-bit register */ /* Variant to set or clear one bit in an 8-bit register */
inline int i2c_reg_setbit1(int bus, uint8_t addr, uint8_t reg, static inline int i2c_reg_setbit1(int bus, uint8_t addr, uint8_t reg,
int bit, int value, uint8_t* val) int bit, int value, uint8_t* val)
{ {
uint8_t clr = 0, set = 0; uint8_t clr = 0, set = 0;

View file

@ -80,13 +80,13 @@ extern void clk_set_ccr_div(uint32_t divbits);
extern void clk_set_ddr(x1000_clk_t src, uint32_t div); extern void clk_set_ddr(x1000_clk_t src, uint32_t div);
/* Returns the smallest n such that infreq/n <= outfreq */ /* Returns the smallest n such that infreq/n <= outfreq */
inline uint32_t clk_calc_div(uint32_t infreq, uint32_t outfreq) static inline uint32_t clk_calc_div(uint32_t infreq, uint32_t outfreq)
{ {
return (infreq + (outfreq - 1)) / outfreq; return (infreq + (outfreq - 1)) / outfreq;
} }
/* Returns the smallest n such that (infreq >> n) <= outfreq */ /* Returns the smallest n such that (infreq >> n) <= outfreq */
inline uint32_t clk_calc_shift(uint32_t infreq, uint32_t outfreq) static inline uint32_t clk_calc_shift(uint32_t infreq, uint32_t outfreq)
{ {
uint32_t div = clk_calc_div(infreq, outfreq); uint32_t div = clk_calc_div(infreq, outfreq);
return __builtin_clz(div) ^ 31; return __builtin_clz(div) ^ 31;

View file

@ -87,13 +87,13 @@ extern void sfc_irq_end(void);
extern void sfc_set_clock(uint32_t freq); extern void sfc_set_clock(uint32_t freq);
/* Set the device configuration register */ /* Set the device configuration register */
inline void sfc_set_dev_conf(uint32_t conf) static inline void sfc_set_dev_conf(uint32_t conf)
{ {
REG_SFC_DEV_CONF = conf; REG_SFC_DEV_CONF = conf;
} }
/* Control the state of the write protect pin */ /* Control the state of the write protect pin */
inline void sfc_set_wp_enable(bool en) static inline void sfc_set_wp_enable(bool en)
{ {
jz_writef(SFC_GLB, WP_EN(en ? 1 : 0)); jz_writef(SFC_GLB, WP_EN(en ? 1 : 0));
} }