Commit a528f56c authored by Federico Vaga's avatar Federico Vaga

drv: checkpatch fixes

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent bf291cc3
......@@ -285,8 +285,8 @@ static int ft_zio_block_nr_pages(struct zio_block *block)
}
static int sg_alloc_table_from_block(struct device *dev,
struct sg_table *sgt,
struct zio_block *block)
struct sg_table *sgt,
struct zio_block *block)
{
struct page **pages;
unsigned int nr_pages;
......@@ -294,7 +294,7 @@ static int sg_alloc_table_from_block(struct device *dev,
void *data;
int i;
int err = 0;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)
#if KERNEL_VERSION(5, 9, 0) <= LINUX_VERSION_CODE
struct scatterlist *sg;
#endif
......@@ -304,13 +304,12 @@ static int sg_alloc_table_from_block(struct device *dev,
nr_pages = ft_zio_block_nr_pages(block);
pages = kcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL);
if (!pages)
return -ENOMEM;
return -ENOMEM;
data = (void *) block->data;
if (is_vmalloc_addr(data)) {
for (i = 0; i < nr_pages; ++i) {
for (i = 0; i < nr_pages; ++i)
pages[i] = vmalloc_to_page(data + PAGE_SIZE * i);
}
} else {
for (i = 0; i < nr_pages; ++i)
pages[i] = virt_to_page(data + PAGE_SIZE * i);
......@@ -318,7 +317,7 @@ static int sg_alloc_table_from_block(struct device *dev,
max_segment_size = dma_get_max_seg_size(dev);
max_segment_size &= PAGE_MASK; /* to make alloc_table happy */
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0)
#if KERNEL_VERSION(5, 9, 0) > LINUX_VERSION_CODE
err = __sg_alloc_table_from_pages(sgt, pages, nr_pages,
offset_in_page(data),
block->datalen,
......
......@@ -33,7 +33,7 @@ int irq_timeout_ms_default = 10;
module_param_named(irq_timeout_ms, irq_timeout_ms_default, int, 0444);
MODULE_PARM_DESC(irq_timeout_ms, "IRQ coalesing timeout (default: 10ms).");
static int test_data_period = 0;
static int test_data_period;
module_param_named(test_data_period, test_data_period, int, 0444);
MODULE_PARM_DESC(test_data_period,
"It sets how many fake timestamps to generate every seconds on the first channel, 0 to disable (default: 0)");
......@@ -208,6 +208,7 @@ static int ft_channels_init(struct fmctdc_dev *ft)
for (i = FT_CH_1; i <= FT_NUM_CHANNELS; i++) {
int ret = ft_init_channel(ft, i);
if (ret < 0)
return ret;
/* termination is off by default */
......@@ -449,7 +450,7 @@ int ft_probe(struct platform_device *pdev)
}
}
if(!ft_fmc_slot_is_valid(ft))
if (!ft_fmc_slot_is_valid(ft))
goto out_fmc_err;
err = sysfs_create_link(&ft->pdev->dev.kobj, &ft->slot->dev.kobj,
......@@ -460,7 +461,7 @@ int ft_probe(struct platform_device *pdev)
goto err_fmc_link;
}
ret = ft_calib_init(ft);
ret = ft_calib_init(ft);
if (ret < 0)
goto err_calib;
......@@ -491,9 +492,9 @@ int ft_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ft);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0)
#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE
ret = ft_hwmon_init(ft);
if(ret != 0)
if (ret != 0)
dev_err(dev, "Could not create HWMON device: %d", ret);
#endif
......@@ -545,6 +546,7 @@ int ft_remove(struct platform_device *pdev)
i = ARRAY_SIZE(init_subsystems);
while (--i >= 0) {
struct ft_modlist *m = init_subsystems + i;
if (m->exit)
m->exit(ft);
}
......
......@@ -146,7 +146,7 @@ static irqreturn_t ft_irq_handler_ts_fifo(int irq, void *dev_id)
redo--;
}
}
} while(irq_stat && redo);
} while (irq_stat && redo);
ft_iowrite(ft, irq_stat_orig, ft->ft_irq_base + TDC_EIC_REG_EIC_ISR);
return IRQ_HANDLED;
......
......@@ -10,7 +10,7 @@
#include <linux/hwmon.h>
#include "fmc-tdc.h"
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0)
#if KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE
static umode_t ft_hwmon_temp_is_visible(const void *_data,
enum hwmon_sensor_types type, u32 attr,
......@@ -25,23 +25,23 @@ static int ft_hwmon_temp_read(struct device *dev, enum hwmon_sensor_types type,
int value, ret;
struct fmctdc_dev *ft = dev_get_drvdata(dev);
switch(attr) {
case hwmon_temp_min:
*val = -25*1000;
return 0;
switch (attr) {
case hwmon_temp_min:
*val = -25*1000;
return 0;
case hwmon_temp_max:
*val = 60*1000;
return 0;
case hwmon_temp_max:
*val = 60*1000;
return 0;
case hwmon_temp_crit:
*val = 65*1000;
return 0;
case hwmon_temp_crit:
*val = 65*1000;
return 0;
}
ret = ft_temperature_get(ft, &value);
if(ret < 0) {
if (ret < 0) {
dev_err(dev, "Could not read temperature: %d", ret);
return ret;
}
......@@ -88,12 +88,12 @@ int ft_hwmon_init(struct fmctdc_dev *ft)
ft,
&ft_hwmon_temp_chip_info,
NULL);
if(!IS_ERR(ft->hwmon_dev)) {
if (!IS_ERR(ft->hwmon_dev)) {
ft->hwmon_temp_sensor_id = devm_kasprintf(ft->hwmon_dev,
GFP_KERNEL,
"Temperature [%s]",
dev_name(&ft->slot->dev));
if(!ft->hwmon_temp_sensor_id) {
if (!ft->hwmon_temp_sensor_id) {
devm_hwmon_device_unregister(dev);
return -ENOMEM;
}
......
......@@ -137,10 +137,10 @@ int ft_temperature_get(struct fmctdc_dev *ft, int *temp)
static int ft_unique_id_get(struct fmctdc_dev *ft, uint64_t *id)
{
int stat = ft_ioread( ft, ft->ft_owregs_base + TDC_OW_REG_CSR);
int stat = ft_ioread(ft, ft->ft_owregs_base + TDC_OW_REG_CSR);
uint32_t tmp_l, tmp_h;
if( !( stat & TDC_OW_CSR_VALID ) )
if (!(stat & TDC_OW_CSR_VALID))
return -EIO;
tmp_l = ft_ioread(ft, ft->ft_owregs_base + TDC_OW_REG_ID_L);
......@@ -486,10 +486,10 @@ static struct zio_driver ft_zdrv = {
.probe = ft_zio_probe,
.remove = ft_zio_remove,
/* Take the version from ZIO git sub-module */
/* Change it if you use new features from a specific patch */
.min_version = ZIO_VERSION(__ZIO_MIN_MAJOR_VERSION,
__ZIO_MIN_MINOR_VERSION,
0), /* Change it if you use new features from
a specific patch */
0),
};
#define FT_TRIG_POST_DEFAULT 1
......@@ -589,11 +589,11 @@ static int ft_trig_data_done(struct zio_cset *cset)
goto out;
ts = cset->chan->active_block->data;
for(i = 0; i < cset->ti->nsamples; ++i) {
for (i = 0; i < cset->ti->nsamples; ++i) {
dev_dbg(&cset->head.dev,
"%s TS = {ts-num: %d, ts-num-max: %d, sec: 0x%x, coarse: 0x%x frac: 0x%x, meta: 0x%x}\n",
__func__, i, cset->ti->nsamples,
ts[i].seconds,ts[i].coarse,
ts[i].seconds, ts[i].coarse,
ts[i].frac, ts[i].metadata);
}
ft_zio_update_ctrl(cset, &ts[0]);
......@@ -677,7 +677,7 @@ int ft_zio_init(struct fmctdc_dev *ft)
if (err)
goto err_dev_reg;
for(i = 0; i < FT_NUM_CHANNELS; i++) {
for (i = 0; i < FT_NUM_CHANNELS; i++) {
ft_raw_mode_set(ft, i, 0);
ft_update_offsets(ft, i);
}
......
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