Skip to content

Commit 112794d

Browse files
committed
iio: cf_axi_dds: move dds_{read,write} functions to C file
The intent is to make the cf_axi_dds_state struct opaque to users from outside the cf_axi_dds.c file. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
1 parent 78c2c72 commit 112794d

File tree

2 files changed

+42
-28
lines changed

2 files changed

+42
-28
lines changed

drivers/iio/frequency/cf_axi_dds.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,40 @@
3939

4040
static const unsigned int interpolation_factors_available[] = {1, 8};
4141

42+
void dds_write(struct cf_axi_dds_state *st,
43+
unsigned int reg, unsigned int val)
44+
{
45+
iowrite32(val, st->regs + reg);
46+
}
47+
EXPORT_SYMBOL(dds_write);
48+
49+
int dds_read(struct cf_axi_dds_state *st, unsigned int reg)
50+
{
51+
return ioread32(st->regs + reg);
52+
}
53+
EXPORT_SYMBOL(dds_read);
54+
55+
void dds_slave_write(struct cf_axi_dds_state *st,
56+
unsigned int reg, unsigned int val)
57+
{
58+
iowrite32(val, st->slave_regs + reg);
59+
}
60+
EXPORT_SYMBOL(dds_slave_write);
61+
62+
unsigned int dds_slave_read(struct cf_axi_dds_state *st, unsigned int reg)
63+
{
64+
return ioread32(st->slave_regs + reg);
65+
}
66+
EXPORT_SYMBOL(dds_slave_read);
67+
68+
void dds_master_write(struct cf_axi_dds_state *st,
69+
unsigned int reg, unsigned int val)
70+
{
71+
if (st->master_regs)
72+
iowrite32(val, st->master_regs + reg);
73+
}
74+
EXPORT_SYMBOL(dds_master_write);
75+
4276
static int cf_axi_dds_to_signed_mag_fmt(int val, int val2, unsigned int *res)
4377
{
4478
unsigned i;

drivers/iio/frequency/cf_axi_dds.h

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -296,33 +296,13 @@ int cf_axi_dds_pl_ddr_fifo_ctrl(struct cf_axi_dds_state *st, bool enable);
296296
* IO accessors
297297
*/
298298

299-
static inline void dds_write(struct cf_axi_dds_state *st,
300-
unsigned reg, unsigned val)
301-
{
302-
iowrite32(val, st->regs + reg);
303-
}
304-
305-
static inline unsigned int dds_read(struct cf_axi_dds_state *st, unsigned reg)
306-
{
307-
return ioread32(st->regs + reg);
308-
}
309-
310-
static inline void dds_slave_write(struct cf_axi_dds_state *st,
311-
unsigned reg, unsigned val)
312-
{
313-
iowrite32(val, st->slave_regs + reg);
314-
}
315-
316-
static inline unsigned int dds_slave_read(struct cf_axi_dds_state *st, unsigned reg)
317-
{
318-
return ioread32(st->slave_regs + reg);
319-
}
320-
321-
static inline void dds_master_write(struct cf_axi_dds_state *st,
322-
unsigned reg, unsigned val)
323-
{
324-
if (st->master_regs)
325-
iowrite32(val, st->master_regs + reg);
326-
}
299+
void dds_write(struct cf_axi_dds_state *st,
300+
unsigned int reg, unsigned int val);
301+
int dds_read(struct cf_axi_dds_state *st, unsigned int reg);
302+
void dds_slave_write(struct cf_axi_dds_state *st,
303+
unsigned int reg, unsigned int val);
304+
unsigned int dds_slave_read(struct cf_axi_dds_state *st, unsigned int reg);
305+
void dds_master_write(struct cf_axi_dds_state *st,
306+
unsigned int reg, unsigned int val);
327307

328308
#endif /* ADI_AXI_DDS_H_ */

0 commit comments

Comments
 (0)