Commit 66881887 authored by Alessandro Rubini's avatar Alessandro Rubini

kernel: rename hardware-access functions

This has long been a pain for me, and even Federico agrees the initial
choice of names was wrong.  The common_info_get/common_conf_set
function are now renamed to hardware_read/hardware_write, because this
is what actually they are.

People reviewing the code would have a hard time before realizing that
info_get reads a machine register. I hope this solves the issue for
everybody else.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 61ab0ba9
......@@ -218,20 +218,20 @@ int zfad_map_dma(struct zio_cset *cset, struct zfad_block *zfad_block,
/* The first item is written on the device */
if (i == 0) {
zfa_common_conf_set(fa, ZFA_DMA_ADDR,
zfa_hardware_write(fa, ZFA_DMA_ADDR,
items[i].start_addr);
zfa_common_conf_set(fa, ZFA_DMA_ADDR_L,
zfa_hardware_write(fa, ZFA_DMA_ADDR_L,
items[i].dma_addr_l);
zfa_common_conf_set(fa, ZFA_DMA_ADDR_H,
zfa_hardware_write(fa, ZFA_DMA_ADDR_H,
items[i].dma_addr_h);
zfa_common_conf_set(fa, ZFA_DMA_LEN,
zfa_hardware_write(fa, ZFA_DMA_LEN,
items[i].dma_len);
zfa_common_conf_set(fa, ZFA_DMA_NEXT_L,
zfa_hardware_write(fa, ZFA_DMA_NEXT_L,
items[i].next_addr_l);
zfa_common_conf_set(fa, ZFA_DMA_NEXT_H,
zfa_hardware_write(fa, ZFA_DMA_NEXT_H,
items[i].next_addr_h);
/* Set that there is a next item */
zfa_common_conf_set(fa, ZFA_DMA_BR_LAST,
zfa_hardware_write(fa, ZFA_DMA_BR_LAST,
items[i].attribute);
}
}
......
This diff is collapsed.
......@@ -122,7 +122,7 @@ static int zfat_conf_set(struct device *dev, struct zio_attribute *zattr,
break;
}
return zfa_common_conf_set(fa, zattr->id, tmp_val);
return zfa_hardware_write(fa, zattr->id, tmp_val);
}
......@@ -135,7 +135,7 @@ static int zfat_info_get(struct device *dev, struct zio_attribute *zattr,
{
struct fa_dev *fa = get_zfadc(dev);
zfa_common_info_get(fa, zattr->id, usr_val);
zfa_hardware_read(fa, zattr->id, usr_val);
dev_dbg(dev, "Reading %d from the sysfs attribute %s\n",
*usr_val, zattr->attr.attr.name);
......@@ -166,9 +166,9 @@ static struct zio_ti *zfat_create(struct zio_trigger_type *trig,
return ERR_PTR(-ENOMEM);
/* Disable Software trigger*/
zfa_common_conf_set(fa, ZFAT_CFG_SW_EN, 0);
zfa_hardware_write(fa, ZFAT_CFG_SW_EN, 0);
/* Enable Hardware trigger*/
zfa_common_conf_set(fa, ZFAT_CFG_HW_EN, 1);
zfa_hardware_write(fa, ZFAT_CFG_HW_EN, 1);
zfat->fa = fa;
zfat->ti.cset = cset;
......@@ -182,15 +182,15 @@ static void zfat_destroy(struct zio_ti *ti)
struct zfat_instance *zfat = to_zfat_instance(ti);
/* Enable Software trigger */
zfa_common_conf_set(fa, ZFAT_CFG_SW_EN, 1);
zfa_hardware_write(fa, ZFAT_CFG_SW_EN, 1);
/* Disable Hardware trigger */
zfa_common_conf_set(fa, ZFAT_CFG_HW_EN, 0);
zfa_hardware_write(fa, ZFAT_CFG_HW_EN, 0);
/* Other triggers cannot use pre-samples */
zfa_common_conf_set(fa, ZFAT_PRE, 0);
zfa_hardware_write(fa, ZFAT_PRE, 0);
/* Reset post samples */
zfa_common_conf_set(fa, ZFAT_POST, 0);
zfa_hardware_write(fa, ZFAT_POST, 0);
/* Other triggers can handle only 1 shot */
zfa_common_conf_set(fa, ZFAT_SHOTS_NB, 1);
zfa_hardware_write(fa, ZFAT_SHOTS_NB, 1);
kfree(zfat);
}
......@@ -205,7 +205,7 @@ static void zfat_change_status(struct zio_ti *ti, unsigned int status)
{
struct fa_dev *fa = ti->cset->zdev->priv_d;
zfa_common_conf_set(fa, ZFAT_CFG_HW_EN, !status);
zfa_hardware_write(fa, ZFAT_CFG_HW_EN, !status);
}
/*
......
......@@ -347,7 +347,7 @@ static inline struct fa_dev *get_zfadc(struct device *dev)
#define FA_SPI_SS_DAC(ch) ((ch) + 1)
/* Hardware filed-based access */
static inline int zfa_common_conf_set(struct fa_dev *fa,
static inline int zfa_hardware_write(struct fa_dev *fa,
enum zfadc_dregs_enum index,
uint32_t usr_val)
{
......@@ -366,7 +366,7 @@ static inline int zfa_common_conf_set(struct fa_dev *fa,
fmc_writel(fa->fmc, val, zfad_regs[index].addr);
return 0;
}
static inline void zfa_common_info_get(struct fa_dev *fa,
static inline void zfa_hardware_read(struct fa_dev *fa,
enum zfadc_dregs_enum index,
uint32_t *usr_val)
{
......
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