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