Commit 276d0cb1 authored by Federico Vaga's avatar Federico Vaga

kernel: checkpatch cleanup

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 37f4f5df
......@@ -97,7 +97,7 @@ static int spec_reprogram(struct fmc_device *fmc, struct fmc_driver *drv,
}
ret = spec_reprogram_raw(fmc, drv, (void *)fw->data, fw->size);
if (ret <0) {
if (ret < 0) {
dev_err(dev, "write firmware \"%s\": error %i\n", gw, ret);
goto out;
}
......@@ -126,8 +126,9 @@ static int spec_shared_irq_request(struct fmc_device *fmc,
/* A check and a hack, but doesn't work on all computers */
value = gennum_readl(spec, GNPPCI_MSI_CONTROL);
if ((value & 0x810000) != 0x810000)
dev_err(&spec->pdev->dev, "invalid msi control: "
"0x%04x\n", value >> 16);
dev_err(&spec->pdev->dev,
"invalid msi control: 0x%04x\n",
value >> 16);
value = 0xa50000 | (value & 0xffff);
gennum_writel(spec, value, GNPPCI_MSI_CONTROL);
}
......@@ -167,16 +168,16 @@ static irqreturn_t spec_vic_irq_handler(int id, void *data)
static struct fmc_gpio spec_vic_gpio_cfg[] = {
{
.gpio = FMC_GPIO_IRQ(1),
.mode = GPIOF_DIR_IN,
.irqmode = IRQF_TRIGGER_RISING,
},
.gpio = FMC_GPIO_IRQ(1),
.mode = GPIOF_DIR_IN,
.irqmode = IRQF_TRIGGER_RISING,
},
{
.gpio = FMC_GPIO_IRQ(0),
.mode = GPIOF_DIR_IN,
.irqmode = IRQF_TRIGGER_RISING,
}
.gpio = FMC_GPIO_IRQ(0),
.mode = GPIOF_DIR_IN,
.irqmode = IRQF_TRIGGER_RISING,
}
};
static int spec_irq_request(struct fmc_device *fmc, irq_handler_t handler,
......@@ -266,8 +267,8 @@ static int spec_irq_free(struct fmc_device *fmc)
spec_vic_irq_free(spec, fmc->irq);
/*
* If we were not using the VIC, or we released all the VIC handler, then
* release the PCI IRQ handler
* If we were not using the VIC, or we released all the VIC handler,
* then release the PCI IRQ handler
*/
if (!spec->vic)
spec_shared_irq_free(fmc);
......@@ -450,8 +451,9 @@ static int spec_irq_init(struct fmc_device *fmc)
*/
value = gennum_readl(spec, GNPPCI_MSI_CONTROL);
if ((value & 0x810000) != 0x810000)
dev_err(&spec->pdev->dev, "invalid msi control: "
"0x%04x\n", value >> 16);
dev_err(&spec->pdev->dev,
"invalid msi control: 0x%04x\n",
value >> 16);
value = 0xa50000 | (value & 0xffff);
gennum_writel(spec, value, GNPPCI_MSI_CONTROL);
}
......@@ -466,7 +468,7 @@ static int spec_irq_init(struct fmc_device *fmc)
if (spec_use_msi)
gennum_writel(spec, 0x800c, GNINT_CFG(value & 0x03));
else
gennum_writel(spec, 0x800c, GNINT_CFG(0 /* first one */ ));
gennum_writel(spec, 0x800c, GNINT_CFG(0 /* first one */));
/* Finally, ensure we are able to receive it -- if the user asked to */
if (spec_test_irq == 0)
......@@ -511,7 +513,9 @@ static int check_golden(struct fmc_device *fmc)
dev_err(&spec->pdev->dev, "Can't find SDB magic\n");
return -ENODEV;
}
if ( (ret = fmc_scan_sdb_tree(fmc, 0x100)) < 0)
ret = fmc_scan_sdb_tree(fmc, 0x100);
if (ret < 0)
return -ENODEV;
if (fmc_readl(fmc, 0x15c) != 0x0000ce42) {
......
......@@ -35,14 +35,14 @@ static void dumpstruct(char *name, void *ptr, int size)
int i;
unsigned char *p = ptr;
printk("%s: (size 0x%x)\n", name, size);
pr_info("%s: (size 0x%x)\n", name, size);
for (i = 0; i < size; ) {
printk("%02x", p[i]);
pr_info("%02x", p[i]);
i++;
printk(i & 3 ? " " : i & 0xf ? " " : "\n");
pr_info("%s", (i & 3) ? " " : (i & 0xf) ? " " : "\n");
}
if (i & 0xf)
printk("\n");
pr_info("\n");
}
static void set_sda(struct fmc_device *fmc, int val)
......@@ -86,7 +86,7 @@ static int mi2c_put_byte(struct fmc_device *fmc, int data)
int i;
int ack;
for (i = 0; i < 8; i++, data<<=1) {
for (i = 0; i < 8; i++, data <<= 1) {
set_sda(fmc, data & 0x80);
set_scl(fmc, 1);
set_scl(fmc, 0);
......@@ -124,7 +124,7 @@ static int mi2c_get_byte(struct fmc_device *fmc, unsigned char *data, int ack)
set_scl(fmc, 0);
set_sda(fmc, 0);
*data= indata;
*data = indata;
return 0;
}
......@@ -144,7 +144,7 @@ int mi2c_scan(struct fmc_device *fmc)
/* only look for our own device */
mi2c_start(fmc);
if(mi2c_put_byte(fmc, fmc->eeprom_addr << 1) == 0)
if (mi2c_put_byte(fmc, fmc->eeprom_addr << 1) == 0)
found++;
mi2c_stop(fmc);
return found;
......@@ -168,7 +168,7 @@ int spec_eeprom_read(struct fmc_device *fmc, uint32_t offset,
/* Read it all in a single loop: hardware allows it */
mi2c_start(fmc);
if(mi2c_put_byte(fmc, fmc->eeprom_addr << 1) < 0) {
if (mi2c_put_byte(fmc, fmc->eeprom_addr << 1) < 0) {
mi2c_stop(fmc);
return -EIO;
}
......@@ -198,8 +198,7 @@ int spec_eeprom_write(struct fmc_device *fmc, uint32_t offset,
if (offset + size > SPEC_I2C_EEPROM_SIZE)
return -EINVAL;
for(i = 0; i < size; i++) {
for (i = 0; i < size; i++) {
/* if (we are using a fake eeprom, don't access hw */
if (spec->flags & SPEC_FLAG_FAKE_EEPROM) {
fmc->eeprom[offset++] = *buf8++;
......@@ -208,7 +207,7 @@ int spec_eeprom_write(struct fmc_device *fmc, uint32_t offset,
mi2c_start((fmc));
if(mi2c_put_byte(fmc, fmc->eeprom_addr << 1) < 0) {
if (mi2c_put_byte(fmc, fmc->eeprom_addr << 1) < 0) {
mi2c_stop(fmc);
return -1;
}
......@@ -221,7 +220,7 @@ int spec_eeprom_write(struct fmc_device *fmc, uint32_t offset,
mi2c_start(fmc);
busy = mi2c_put_byte(fmc, fmc->eeprom_addr << 1);
mi2c_stop(fmc);
} while(busy);
} while (busy);
fmc->eeprom[offset++] = *buf8++;
}
return size;
......
......@@ -64,7 +64,7 @@ int spec_load_fpga(struct spec_dev *spec, const void *data, int size)
spec->remap[2], data, size);
j = jiffies + 2 * HZ;
/* Wait for DONE interrupt */
while(1) {
while (1) {
udelay(100);
i = readl(spec->remap[2] + FCL_IRQ);
if (i & 0x8) {
......@@ -72,7 +72,7 @@ int spec_load_fpga(struct spec_dev *spec, const void *data, int size)
break;
}
if(i & 0x4) {
if (i & 0x4) {
dev_err(dev, "FPGA program error after %i writes\n",
wrote);
return -ETIMEDOUT;
......@@ -110,7 +110,7 @@ int spec_load_fpga_file(struct spec_dev *spec, char *name)
err = spec_load_fpga(spec, fw->data, fw->size);
release_firmware(fw);
return err;
return err;
}
static int spec_reconfigure(struct spec_dev *spec, struct fmc_gateware *gw)
......@@ -219,7 +219,7 @@ static int spec_probe(struct pci_dev *pdev,
* This should be "4" but arch/x86/kernel/apic/io_apic.c
* says "x86 doesn't support multiple MSI yet".
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
#if KERNEL_VERSION(3, 16, 0) > LINUX_VERSION_CODE
ret = pci_enable_msi_block(pdev, 1);
#else
ret = pci_enable_msi_exact(pdev, 1);
......@@ -232,6 +232,7 @@ static int spec_probe(struct pci_dev *pdev,
/* Remap our 3 bars */
for (i = ret = 0; i < 3; i++) {
struct resource *r = pdev->resource + (2 * i);
if (!r->start)
continue;
spec->area[i] = r;
......
/*
* Copyright (C) 2013 CERN (www.cern.ch)
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* Released according to the GNU GPL, version 2 or any later version
*
* Driver for SPEC (Simple PCI Express FMC carrier) board.
* VIC (Vectored Interrupt Controller) support code.
*/
/**
* Copyright (C) 2013 CERN (www.cern.ch)
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* Released according to the GNU GPL, version 2 or any later version
*
* Driver for SPEC (Simple PCI Express FMC carrier) board.
* VIC (Vectored Interrupt Controller) support code.
*/
#include <linux/interrupt.h>
#include <linux/slab.h>
......
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