Commit 757d78d3 authored by Daniel Scheller's avatar Daniel Scheller Committed by Mauro Carvalho Chehab

media: ddbridge: fixup checkpatch-strict issues

Fixes several alignment, braces, space-before-cast, camelcase et al issues
reported by checkpatch --strict, plus a few more checkpatch didn't report.

Three checks are left after this though:
- one CamelCase in ddbridge-core, related to defines/vars/enums referenced
  from the stv090x demod driver
- one macro argument reuse in ddbridge-core aswell
- one unbalanced braces around else in ddbridge-main, which is due to
  #ifdefs related to CONFIG_PCI_MSI, which preferrably should be kept
  as-is for readability.
Signed-off-by: default avatarDaniel Scheller <d.scheller@gmx.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 1d8343aa
...@@ -112,7 +112,6 @@ static void ddb_set_dma_tables(struct ddb *dev) ...@@ -112,7 +112,6 @@ static void ddb_set_dma_tables(struct ddb *dev)
} }
} }
/****************************************************************************/ /****************************************************************************/
/****************************************************************************/ /****************************************************************************/
/****************************************************************************/ /****************************************************************************/
...@@ -210,9 +209,10 @@ static int ddb_redirect(u32 i, u32 p) ...@@ -210,9 +209,10 @@ static int ddb_redirect(u32 i, u32 p)
if (input->redi) { if (input->redi) {
input2->redi = input->redi; input2->redi = input->redi;
input->redi = NULL; input->redi = NULL;
} else } else {
input2->redi = input; input2->redi = input;
} }
}
input->redo = port->output; input->redo = port->output;
port->output->redi = input; port->output->redi = input;
...@@ -357,9 +357,9 @@ static void calc_con(struct ddb_output *output, u32 *con, u32 *con2, u32 flags) ...@@ -357,9 +357,9 @@ static void calc_con(struct ddb_output *output, u32 *con, u32 *con2, u32 flags)
max_bitrate = 0; max_bitrate = 0;
gap = 0; gap = 0;
if (bitrate != 72000) { if (bitrate != 72000) {
if (bitrate >= 96000) if (bitrate >= 96000) {
*con |= 0x800; *con |= 0x800;
else { } else {
*con |= 0x1000; *con |= 0x1000;
nco = (bitrate * 8192 + 71999) nco = (bitrate * 8192 + 71999)
/ 72000; / 72000;
...@@ -506,7 +506,6 @@ static void ddb_input_start(struct ddb_input *input) ...@@ -506,7 +506,6 @@ static void ddb_input_start(struct ddb_input *input)
} }
} }
static void ddb_input_start_all(struct ddb_input *input) static void ddb_input_start_all(struct ddb_input *input)
{ {
struct ddb_input *i = input; struct ddb_input *i = input;
...@@ -572,7 +571,7 @@ static ssize_t ddb_output_write(struct ddb_output *output, ...@@ -572,7 +571,7 @@ static ssize_t ddb_output_write(struct ddb_output *output,
while (left) { while (left) {
len = output->dma->size - output->dma->coff; len = output->dma->size - output->dma->coff;
if ((((output->dma->cbuf + 1) % output->dma->num) == idx) && if ((((output->dma->cbuf + 1) % output->dma->num) == idx) &&
(off == 0)) { off == 0) {
if (len <= 188) if (len <= 188)
break; break;
len -= 188; len -= 188;
...@@ -593,7 +592,8 @@ static ssize_t ddb_output_write(struct ddb_output *output, ...@@ -593,7 +592,8 @@ static ssize_t ddb_output_write(struct ddb_output *output,
buf, len)) buf, len))
return -EIO; return -EIO;
if (alt_dma) if (alt_dma)
dma_sync_single_for_device(dev->dev, dma_sync_single_for_device(
dev->dev,
output->dma->pbuf[output->dma->cbuf], output->dma->pbuf[output->dma->cbuf],
output->dma->size, DMA_TO_DEVICE); output->dma->size, DMA_TO_DEVICE);
left -= len; left -= len;
...@@ -648,7 +648,8 @@ static ssize_t ddb_input_read(struct ddb_input *input, ...@@ -648,7 +648,8 @@ static ssize_t ddb_input_read(struct ddb_input *input,
if (free > left) if (free > left)
free = left; free = left;
if (alt_dma) if (alt_dma)
dma_sync_single_for_cpu(dev->dev, dma_sync_single_for_cpu(
dev->dev,
input->dma->pbuf[input->dma->cbuf], input->dma->pbuf[input->dma->cbuf],
input->dma->size, DMA_FROM_DEVICE); input->dma->size, DMA_FROM_DEVICE);
ret = copy_to_user(buf, input->dma->vbuf[input->dma->cbuf] + ret = copy_to_user(buf, input->dma->vbuf[input->dma->cbuf] +
...@@ -792,8 +793,10 @@ static int ts_open(struct inode *inode, struct file *file) ...@@ -792,8 +793,10 @@ static int ts_open(struct inode *inode, struct file *file)
} else if ((file->f_flags & O_ACCMODE) == O_WRONLY) { } else if ((file->f_flags & O_ACCMODE) == O_WRONLY) {
if (!output) if (!output)
return -EINVAL; return -EINVAL;
} else } else {
return -EINVAL; return -EINVAL;
}
err = dvb_generic_open(inode, file); err = dvb_generic_open(inode, file);
if (err < 0) if (err < 0)
return err; return err;
...@@ -822,7 +825,6 @@ static struct dvb_device dvbdev_ci = { ...@@ -822,7 +825,6 @@ static struct dvb_device dvbdev_ci = {
.fops = &ci_fops, .fops = &ci_fops,
}; };
/****************************************************************************/ /****************************************************************************/
/****************************************************************************/ /****************************************************************************/
...@@ -1017,7 +1019,7 @@ static int tuner_attach_tda18212(struct ddb_input *input, u32 porttype) ...@@ -1017,7 +1019,7 @@ static int tuner_attach_tda18212(struct ddb_input *input, u32 porttype)
/* perform tuner init/attach */ /* perform tuner init/attach */
client = i2c_new_device(adapter, &board_info); client = i2c_new_device(adapter, &board_info);
if (client == NULL || client->dev.driver == NULL) if (!client || !client->dev.driver)
goto err; goto err;
if (!try_module_get(client->dev.driver->owner)) { if (!try_module_get(client->dev.driver->owner)) {
...@@ -1262,7 +1264,8 @@ static void dvb_input_detach(struct ddb_input *input) ...@@ -1262,7 +1264,8 @@ static void dvb_input_detach(struct ddb_input *input)
dvb_frontend_detach(dvb->fe2); dvb_frontend_detach(dvb->fe2);
if (dvb->fe) if (dvb->fe)
dvb_frontend_detach(dvb->fe); dvb_frontend_detach(dvb->fe);
dvb->fe = dvb->fe2 = NULL; dvb->fe = NULL;
dvb->fe2 = NULL;
/* fallthrough */ /* fallthrough */
case 0x20: case 0x20:
client = dvb->i2c_client[0]; client = dvb->i2c_client[0];
...@@ -1406,7 +1409,8 @@ static int dvb_input_attach(struct ddb_input *input) ...@@ -1406,7 +1409,8 @@ static int dvb_input_attach(struct ddb_input *input)
DMX_SECTION_FILTERING | DMX_MEMORY_BASED_FILTERING; DMX_SECTION_FILTERING | DMX_MEMORY_BASED_FILTERING;
dvbdemux->start_feed = start_feed; dvbdemux->start_feed = start_feed;
dvbdemux->stop_feed = stop_feed; dvbdemux->stop_feed = stop_feed;
dvbdemux->filternum = dvbdemux->feednum = 256; dvbdemux->filternum = 256;
dvbdemux->feednum = 256;
ret = dvb_dmx_init(dvbdemux); ret = dvb_dmx_init(dvbdemux);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -1433,7 +1437,8 @@ static int dvb_input_attach(struct ddb_input *input) ...@@ -1433,7 +1437,8 @@ static int dvb_input_attach(struct ddb_input *input)
return ret; return ret;
dvb->attached = 0x20; dvb->attached = 0x20;
dvb->fe = dvb->fe2 = NULL; dvb->fe = NULL;
dvb->fe2 = NULL;
switch (port->type) { switch (port->type) {
case DDB_TUNER_MXL5XX: case DDB_TUNER_MXL5XX:
if (fe_attach_mxl5xx(input) < 0) if (fe_attach_mxl5xx(input) < 0)
...@@ -1715,7 +1720,6 @@ static int init_xo2_ci(struct ddb_port *port) ...@@ -1715,7 +1720,6 @@ static int init_xo2_ci(struct ddb_port *port)
i2c_write_reg(i2c, 0x10, 0x08, 3); i2c_write_reg(i2c, 0x10, 0x08, 3);
usleep_range(2000, 3000); usleep_range(2000, 3000);
/* speed: 0=55,1=75,2=90,3=104 MBit/s */ /* speed: 0=55,1=75,2=90,3=104 MBit/s */
i2c_write_reg(i2c, 0x10, 0x09, 1); i2c_write_reg(i2c, 0x10, 0x09, 1);
...@@ -1909,7 +1913,6 @@ static void ddb_port_probe(struct ddb_port *port) ...@@ -1909,7 +1913,6 @@ static void ddb_port_probe(struct ddb_port *port)
} }
} }
/****************************************************************************/ /****************************************************************************/
/****************************************************************************/ /****************************************************************************/
/****************************************************************************/ /****************************************************************************/
...@@ -1999,7 +2002,7 @@ static int slot_reset(struct dvb_ca_en50221 *ca, int slot) ...@@ -1999,7 +2002,7 @@ static int slot_reset(struct dvb_ca_en50221 *ca, int slot)
CI_CONTROL(ci->nr)); CI_CONTROL(ci->nr));
ddbwritel(ci->port->dev, CI_ENABLE | CI_POWER_ON | CI_RESET_CAM, ddbwritel(ci->port->dev, CI_ENABLE | CI_POWER_ON | CI_RESET_CAM,
CI_CONTROL(ci->nr)); CI_CONTROL(ci->nr));
udelay(20); usleep_range(20, 25);
ddbwritel(ci->port->dev, CI_ENABLE | CI_POWER_ON, ddbwritel(ci->port->dev, CI_ENABLE | CI_POWER_ON,
CI_CONTROL(ci->nr)); CI_CONTROL(ci->nr));
return 0; return 0;
...@@ -2264,7 +2267,7 @@ static int ddb_port_attach(struct ddb_port *port) ...@@ -2264,7 +2267,7 @@ static int ddb_port_attach(struct ddb_port *port)
case DDB_PORT_LOOP: case DDB_PORT_LOOP:
ret = dvb_register_device(port->dvb[0].adap, ret = dvb_register_device(port->dvb[0].adap,
&port->dvb[0].dev, &port->dvb[0].dev,
&dvbdev_ci, (void *) port->output, &dvbdev_ci, (void *)port->output,
DVB_DEVICE_SEC, 0); DVB_DEVICE_SEC, 0);
break; break;
default: default:
...@@ -2323,7 +2326,6 @@ void ddb_ports_detach(struct ddb *dev) ...@@ -2323,7 +2326,6 @@ void ddb_ports_detach(struct ddb *dev)
dvb_unregister_adapters(dev); dvb_unregister_adapters(dev);
} }
/* Copy input DMA pointers to output DMA and ACK. */ /* Copy input DMA pointers to output DMA and ACK. */
static void input_write_output(struct ddb_input *input, static void input_write_output(struct ddb_input *input,
...@@ -2350,16 +2352,18 @@ static void input_write_dvb(struct ddb_input *input, ...@@ -2350,16 +2352,18 @@ static void input_write_dvb(struct ddb_input *input,
struct ddb *dev = input->port->dev; struct ddb *dev = input->port->dev;
int ack = 1; int ack = 1;
dma = dma2 = input->dma; dma = input->dma;
/* if there also is an output connected, do not ACK. dma2 = input->dma;
/*
* if there also is an output connected, do not ACK.
* input_write_output will ACK. * input_write_output will ACK.
*/ */
if (input->redo) { if (input->redo) {
dma2 = input->redo->dma; dma2 = input->redo->dma;
ack = 0; ack = 0;
} }
while (dma->cbuf != ((dma->stat >> 11) & 0x1f) while (dma->cbuf != ((dma->stat >> 11) & 0x1f) ||
|| (4 & dma->ctrl)) { (4 & dma->ctrl)) {
if (4 & dma->ctrl) { if (4 & dma->ctrl) {
/* dev_err(dev->dev, "Overflow dma %d\n", dma->nr); */ /* dev_err(dev->dev, "Overflow dma %d\n", dma->nr); */
ack = 1; ack = 1;
...@@ -2382,7 +2386,7 @@ static void input_write_dvb(struct ddb_input *input, ...@@ -2382,7 +2386,7 @@ static void input_write_dvb(struct ddb_input *input,
static void input_work(struct work_struct *work) static void input_work(struct work_struct *work)
{ {
struct ddb_dma *dma = container_of(work, struct ddb_dma, work); struct ddb_dma *dma = container_of(work, struct ddb_dma, work);
struct ddb_input *input = (struct ddb_input *) dma->io; struct ddb_input *input = (struct ddb_input *)dma->io;
struct ddb *dev = input->port->dev; struct ddb *dev = input->port->dev;
unsigned long flags; unsigned long flags;
...@@ -2404,11 +2408,11 @@ static void input_work(struct work_struct *work) ...@@ -2404,11 +2408,11 @@ static void input_work(struct work_struct *work)
static void input_handler(unsigned long data) static void input_handler(unsigned long data)
{ {
struct ddb_input *input = (struct ddb_input *) data; struct ddb_input *input = (struct ddb_input *)data;
struct ddb_dma *dma = input->dma; struct ddb_dma *dma = input->dma;
/*
/* If there is no input connected, input_tasklet() will * If there is no input connected, input_tasklet() will
* just copy pointers and ACK. So, there is no need to go * just copy pointers and ACK. So, there is no need to go
* through the tasklet scheduler. * through the tasklet scheduler.
*/ */
...@@ -2420,7 +2424,7 @@ static void input_handler(unsigned long data) ...@@ -2420,7 +2424,7 @@ static void input_handler(unsigned long data)
static void output_handler(unsigned long data) static void output_handler(unsigned long data)
{ {
struct ddb_output *output = (struct ddb_output *) data; struct ddb_output *output = (struct ddb_output *)data;
struct ddb_dma *dma = output->dma; struct ddb_dma *dma = output->dma;
struct ddb *dev = output->port->dev; struct ddb *dev = output->port->dev;
...@@ -2512,7 +2516,7 @@ static void ddb_input_init(struct ddb_port *port, int nr, int pnr, int anr) ...@@ -2512,7 +2516,7 @@ static void ddb_input_init(struct ddb_port *port, int nr, int pnr, int anr)
port->lnr, nr, dma_nr + base); port->lnr, nr, dma_nr + base);
dev->handler[0][dma_nr + base] = input_handler; dev->handler[0][dma_nr + base] = input_handler;
dev->handler_data[0][dma_nr + base] = (unsigned long) input; dev->handler_data[0][dma_nr + base] = (unsigned long)input;
ddb_dma_init(input, dma_nr, 0); ddb_dma_init(input, dma_nr, 0);
} }
} }
...@@ -2538,7 +2542,7 @@ static void ddb_output_init(struct ddb_port *port, int nr) ...@@ -2538,7 +2542,7 @@ static void ddb_output_init(struct ddb_port *port, int nr)
u32 base = rm0->irq_base_odma; u32 base = rm0->irq_base_odma;
dev->handler[0][nr + base] = output_handler; dev->handler[0][nr + base] = output_handler;
dev->handler_data[0][nr + base] = (unsigned long) output; dev->handler_data[0][nr + base] = (unsigned long)output;
ddb_dma_init(output, nr, 1); ddb_dma_init(output, nr, 1);
} }
} }
...@@ -2606,7 +2610,7 @@ void ddb_ports_init(struct ddb *dev) ...@@ -2606,7 +2610,7 @@ void ddb_ports_init(struct ddb *dev)
port->dvb[0].adap = &dev->adap[2 * p]; port->dvb[0].adap = &dev->adap[2 * p];
port->dvb[1].adap = &dev->adap[2 * p + 1]; port->dvb[1].adap = &dev->adap[2 * p + 1];
if ((port->class == DDB_PORT_NONE) && i && p && if (port->class == DDB_PORT_NONE && i && p &&
dev->port[p - 1].type == DDB_CI_EXTERNAL_XO2) { dev->port[p - 1].type == DDB_CI_EXTERNAL_XO2) {
port->class = DDB_PORT_CI; port->class = DDB_PORT_CI;
port->type = DDB_CI_EXTERNAL_XO2_B; port->type = DDB_CI_EXTERNAL_XO2_B;
...@@ -2738,7 +2742,7 @@ static void irq_handle_io(struct ddb *dev, u32 s) ...@@ -2738,7 +2742,7 @@ static void irq_handle_io(struct ddb *dev, u32 s)
irqreturn_t ddb_irq_handler0(int irq, void *dev_id) irqreturn_t ddb_irq_handler0(int irq, void *dev_id)
{ {
struct ddb *dev = (struct ddb *) dev_id; struct ddb *dev = (struct ddb *)dev_id;
u32 s = ddbreadl(dev, INTERRUPT_STATUS); u32 s = ddbreadl(dev, INTERRUPT_STATUS);
do { do {
...@@ -2755,7 +2759,7 @@ irqreturn_t ddb_irq_handler0(int irq, void *dev_id) ...@@ -2755,7 +2759,7 @@ irqreturn_t ddb_irq_handler0(int irq, void *dev_id)
irqreturn_t ddb_irq_handler1(int irq, void *dev_id) irqreturn_t ddb_irq_handler1(int irq, void *dev_id)
{ {
struct ddb *dev = (struct ddb *) dev_id; struct ddb *dev = (struct ddb *)dev_id;
u32 s = ddbreadl(dev, INTERRUPT_STATUS); u32 s = ddbreadl(dev, INTERRUPT_STATUS);
do { do {
...@@ -2772,7 +2776,7 @@ irqreturn_t ddb_irq_handler1(int irq, void *dev_id) ...@@ -2772,7 +2776,7 @@ irqreturn_t ddb_irq_handler1(int irq, void *dev_id)
irqreturn_t ddb_irq_handler(int irq, void *dev_id) irqreturn_t ddb_irq_handler(int irq, void *dev_id)
{ {
struct ddb *dev = (struct ddb *) dev_id; struct ddb *dev = (struct ddb *)dev_id;
u32 s = ddbreadl(dev, INTERRUPT_STATUS); u32 s = ddbreadl(dev, INTERRUPT_STATUS);
int ret = IRQ_HANDLED; int ret = IRQ_HANDLED;
...@@ -2820,7 +2824,7 @@ static int flashio(struct ddb *dev, u32 lnr, u8 *wbuf, u32 wlen, u8 *rbuf, ...@@ -2820,7 +2824,7 @@ static int flashio(struct ddb *dev, u32 lnr, u8 *wbuf, u32 wlen, u8 *rbuf,
ddbwritel(dev, 1, tag | SPI_CONTROL); ddbwritel(dev, 1, tag | SPI_CONTROL);
while (wlen > 4) { while (wlen > 4) {
/* FIXME: check for big-endian */ /* FIXME: check for big-endian */
data = swab32(*(u32 *) wbuf); data = swab32(*(u32 *)wbuf);
wbuf += 4; wbuf += 4;
wlen -= 4; wlen -= 4;
ddbwritel(dev, data, tag | SPI_DATA); ddbwritel(dev, data, tag | SPI_DATA);
...@@ -2860,7 +2864,7 @@ static int flashio(struct ddb *dev, u32 lnr, u8 *wbuf, u32 wlen, u8 *rbuf, ...@@ -2860,7 +2864,7 @@ static int flashio(struct ddb *dev, u32 lnr, u8 *wbuf, u32 wlen, u8 *rbuf,
if (reg_wait(dev, tag | SPI_CONTROL, 4)) if (reg_wait(dev, tag | SPI_CONTROL, 4))
goto fail; goto fail;
data = ddbreadl(dev, tag | SPI_DATA); data = ddbreadl(dev, tag | SPI_DATA);
*(u32 *) rbuf = swab32(data); *(u32 *)rbuf = swab32(data);
rbuf += 4; rbuf += 4;
rlen -= 4; rlen -= 4;
} }
...@@ -3073,7 +3077,6 @@ static ssize_t led_show(struct device *device, ...@@ -3073,7 +3077,6 @@ static ssize_t led_show(struct device *device,
return sprintf(buf, "%d\n", dev->leds & (1 << num) ? 1 : 0); return sprintf(buf, "%d\n", dev->leds & (1 << num) ? 1 : 0);
} }
static void ddb_set_led(struct ddb *dev, int num, int val) static void ddb_set_led(struct ddb *dev, int num, int val)
{ {
if (!dev->link[0].info->led_num) if (!dev->link[0].info->led_num)
...@@ -3205,7 +3208,6 @@ static ssize_t gap_show(struct device *device, ...@@ -3205,7 +3208,6 @@ static ssize_t gap_show(struct device *device,
int num = attr->attr.name[3] - 0x30; int num = attr->attr.name[3] - 0x30;
return sprintf(buf, "%d\n", dev->port[num].gap); return sprintf(buf, "%d\n", dev->port[num].gap);
} }
static ssize_t gap_store(struct device *device, struct device_attribute *attr, static ssize_t gap_store(struct device *device, struct device_attribute *attr,
...@@ -3384,7 +3386,7 @@ static void ddb_device_attrs_del(struct ddb *dev) ...@@ -3384,7 +3386,7 @@ static void ddb_device_attrs_del(struct ddb *dev)
device_remove_file(dev->ddb_dev, &ddb_attrs_snr[i]); device_remove_file(dev->ddb_dev, &ddb_attrs_snr[i]);
device_remove_file(dev->ddb_dev, &ddb_attrs_ctemp[i]); device_remove_file(dev->ddb_dev, &ddb_attrs_ctemp[i]);
} }
for (i = 0; ddb_attrs[i].attr.name != NULL; i++) for (i = 0; ddb_attrs[i].attr.name; i++)
device_remove_file(dev->ddb_dev, &ddb_attrs[i]); device_remove_file(dev->ddb_dev, &ddb_attrs[i]);
} }
...@@ -3392,7 +3394,7 @@ static int ddb_device_attrs_add(struct ddb *dev) ...@@ -3392,7 +3394,7 @@ static int ddb_device_attrs_add(struct ddb *dev)
{ {
int i; int i;
for (i = 0; ddb_attrs[i].attr.name != NULL; i++) for (i = 0; ddb_attrs[i].attr.name; i++)
if (device_create_file(dev->ddb_dev, &ddb_attrs[i])) if (device_create_file(dev->ddb_dev, &ddb_attrs[i]))
goto fail; goto fail;
for (i = 0; i < dev->link[0].info->temp_num; i++) for (i = 0; i < dev->link[0].info->temp_num; i++)
...@@ -3444,8 +3446,9 @@ int ddb_device_create(struct ddb *dev) ...@@ -3444,8 +3446,9 @@ int ddb_device_create(struct ddb *dev)
device_destroy(&ddb_class, MKDEV(ddb_major, dev->nr)); device_destroy(&ddb_class, MKDEV(ddb_major, dev->nr));
ddbs[dev->nr] = NULL; ddbs[dev->nr] = NULL;
dev->ddb_dev = ERR_PTR(-ENODEV); dev->ddb_dev = ERR_PTR(-ENODEV);
} else } else {
ddb_num++; ddb_num++;
}
fail: fail:
mutex_unlock(&ddb_mutex); mutex_unlock(&ddb_mutex);
return res; return res;
...@@ -3497,7 +3500,7 @@ static void tempmon_setfan(struct ddb_link *link) ...@@ -3497,7 +3500,7 @@ static void tempmon_setfan(struct ddb_link *link)
static void temp_handler(unsigned long data) static void temp_handler(unsigned long data)
{ {
struct ddb_link *link = (struct ddb_link *) data; struct ddb_link *link = (struct ddb_link *)data;
spin_lock(&link->temp_lock); spin_lock(&link->temp_lock);
tempmon_setfan(link); tempmon_setfan(link);
...@@ -3519,7 +3522,7 @@ static int tempmon_init(struct ddb_link *link, int first_time) ...@@ -3519,7 +3522,7 @@ static int tempmon_init(struct ddb_link *link, int first_time)
sizeof(temperature_table)); sizeof(temperature_table));
} }
dev->handler[l][link->info->tempmon_irq] = temp_handler; dev->handler[l][link->info->tempmon_irq] = temp_handler;
dev->handler_data[l][link->info->tempmon_irq] = (unsigned long) link; dev->handler_data[l][link->info->tempmon_irq] = (unsigned long)link;
ddblwritel(link, (TEMPMON_CONTROL_OVERTEMP | TEMPMON_CONTROL_AUTOSCAN | ddblwritel(link, (TEMPMON_CONTROL_OVERTEMP | TEMPMON_CONTROL_AUTOSCAN |
TEMPMON_CONTROL_INTENABLE), TEMPMON_CONTROL_INTENABLE),
TEMPMON_CONTROL); TEMPMON_CONTROL);
......
...@@ -185,7 +185,7 @@ static const struct ddb_info ddb_ctv7 = { ...@@ -185,7 +185,7 @@ static const struct ddb_info ddb_ctv7 = {
.board_control_2 = 4, .board_control_2 = 4,
}; };
static const struct ddb_info ddb_satixS2v3 = { static const struct ddb_info ddb_satixs2v3 = {
.type = DDB_OCTOPUS, .type = DDB_OCTOPUS,
.name = "Mystique SaTiX-S2 V3 DVB adapter", .name = "Mystique SaTiX-S2 V3 DVB adapter",
.regmap = &octopus_map, .regmap = &octopus_map,
...@@ -336,7 +336,7 @@ static const struct ddb_device_id ddb_device_ids[] = { ...@@ -336,7 +336,7 @@ static const struct ddb_device_id ddb_device_ids[] = {
DDB_DEVID(0x0006, 0x0022, ddb_v7), DDB_DEVID(0x0006, 0x0022, ddb_v7),
DDB_DEVID(0x0006, 0x0024, ddb_v7a), DDB_DEVID(0x0006, 0x0024, ddb_v7a),
DDB_DEVID(0x0003, 0x0030, ddb_dvbct), DDB_DEVID(0x0003, 0x0030, ddb_dvbct),
DDB_DEVID(0x0003, 0xdb03, ddb_satixS2v3), DDB_DEVID(0x0003, 0xdb03, ddb_satixs2v3),
DDB_DEVID(0x0006, 0x0031, ddb_ctv7), DDB_DEVID(0x0006, 0x0031, ddb_ctv7),
DDB_DEVID(0x0006, 0x0032, ddb_ctv7), DDB_DEVID(0x0006, 0x0032, ddb_ctv7),
DDB_DEVID(0x0006, 0x0033, ddb_ctv7), DDB_DEVID(0x0006, 0x0033, ddb_ctv7),
...@@ -367,8 +367,8 @@ const struct ddb_info *get_ddb_info(u16 vendor, u16 device, ...@@ -367,8 +367,8 @@ const struct ddb_info *get_ddb_info(u16 vendor, u16 device,
if (vendor == id->vendor && if (vendor == id->vendor &&
device == id->device && device == id->device &&
subvendor == id->subvendor && subvendor == id->subvendor &&
((subdevice == id->subdevice) || (subdevice == id->subdevice ||
(id->subdevice == 0xffff))) id->subdevice == 0xffff))
return id->info; return id->info;
} }
......
...@@ -81,7 +81,7 @@ static int ddb_i2c_cmd(struct ddb_i2c *i2c, u32 adr, u32 cmd) ...@@ -81,7 +81,7 @@ static int ddb_i2c_cmd(struct ddb_i2c *i2c, u32 adr, u32 cmd)
static int ddb_i2c_master_xfer(struct i2c_adapter *adapter, static int ddb_i2c_master_xfer(struct i2c_adapter *adapter,
struct i2c_msg msg[], int num) struct i2c_msg msg[], int num)
{ {
struct ddb_i2c *i2c = (struct ddb_i2c *) i2c_get_adapdata(adapter); struct ddb_i2c *i2c = (struct ddb_i2c *)i2c_get_adapdata(adapter);
struct ddb *dev = i2c->dev; struct ddb *dev = i2c->dev;
u8 addr = 0; u8 addr = 0;
...@@ -149,7 +149,7 @@ void ddb_i2c_release(struct ddb *dev) ...@@ -149,7 +149,7 @@ void ddb_i2c_release(struct ddb *dev)
static void i2c_handler(unsigned long priv) static void i2c_handler(unsigned long priv)
{ {
struct ddb_i2c *i2c = (struct ddb_i2c *) priv; struct ddb_i2c *i2c = (struct ddb_i2c *)priv;
complete(&i2c->completion); complete(&i2c->completion);
} }
...@@ -177,7 +177,7 @@ static int ddb_i2c_add(struct ddb *dev, struct ddb_i2c *i2c, ...@@ -177,7 +177,7 @@ static int ddb_i2c_add(struct ddb *dev, struct ddb_i2c *i2c,
adap = &i2c->adap; adap = &i2c->adap;
i2c_set_adapdata(adap, i2c); i2c_set_adapdata(adap, i2c);
#ifdef I2C_ADAP_CLASS_TV_DIGITAL #ifdef I2C_ADAP_CLASS_TV_DIGITAL
adap->class = I2C_ADAP_CLASS_TV_DIGITAL|I2C_CLASS_TV_ANALOG; adap->class = I2C_ADAP_CLASS_TV_DIGITAL | I2C_CLASS_TV_ANALOG;
#else #else
#ifdef I2C_CLASS_TV_ANALOG #ifdef I2C_CLASS_TV_ANALOG
adap->class = I2C_CLASS_TV_ANALOG; adap->class = I2C_CLASS_TV_ANALOG;
...@@ -210,7 +210,7 @@ int ddb_i2c_init(struct ddb *dev) ...@@ -210,7 +210,7 @@ int ddb_i2c_init(struct ddb *dev)
if (!(dev->link[l].info->i2c_mask & (1 << i))) if (!(dev->link[l].info->i2c_mask & (1 << i)))
continue; continue;
i2c = &dev->i2c[num]; i2c = &dev->i2c[num];
dev->handler_data[l][i + base] = (unsigned long) i2c; dev->handler_data[l][i + base] = (unsigned long)i2c;
dev->handler[l][i + base] = i2c_handler; dev->handler[l][i + base] = i2c_handler;
stat = ddb_i2c_add(dev, i2c, regmap, l, i, num); stat = ddb_i2c_add(dev, i2c, regmap, l, i, num);
if (stat) if (stat)
...@@ -224,7 +224,9 @@ int ddb_i2c_init(struct ddb *dev) ...@@ -224,7 +224,9 @@ int ddb_i2c_init(struct ddb *dev)
adap = &i2c->adap; adap = &i2c->adap;
i2c_del_adapter(adap); i2c_del_adapter(adap);
} }
} else } else {
dev->i2c_num = num; dev->i2c_num = num;
}
return stat; return stat;
} }
...@@ -107,7 +107,7 @@ static void ddb_irq_exit(struct ddb *dev) ...@@ -107,7 +107,7 @@ static void ddb_irq_exit(struct ddb *dev)
static void ddb_remove(struct pci_dev *pdev) static void ddb_remove(struct pci_dev *pdev)
{ {
struct ddb *dev = (struct ddb *) pci_get_drvdata(pdev); struct ddb *dev = (struct ddb *)pci_get_drvdata(pdev);
ddb_device_destroy(dev); ddb_device_destroy(dev);
ddb_ports_detach(dev); ddb_ports_detach(dev);
...@@ -133,9 +133,10 @@ static void ddb_irq_msi(struct ddb *dev, int nr) ...@@ -133,9 +133,10 @@ static void ddb_irq_msi(struct ddb *dev, int nr)
dev->msi = stat; dev->msi = stat;
dev_info(dev->dev, "using %d MSI interrupt(s)\n", dev_info(dev->dev, "using %d MSI interrupt(s)\n",
dev->msi); dev->msi);
} else } else {
dev_info(dev->dev, "MSI not available.\n"); dev_info(dev->dev, "MSI not available.\n");
} }
}
} }
#endif #endif
...@@ -160,11 +161,11 @@ static int ddb_irq_init(struct ddb *dev) ...@@ -160,11 +161,11 @@ static int ddb_irq_init(struct ddb *dev)
irq_flag = 0; irq_flag = 0;
if (dev->msi == 2) { if (dev->msi == 2) {
stat = request_irq(dev->pdev->irq, ddb_irq_handler0, stat = request_irq(dev->pdev->irq, ddb_irq_handler0,
irq_flag, "ddbridge", (void *) dev); irq_flag, "ddbridge", (void *)dev);
if (stat < 0) if (stat < 0)
return stat; return stat;
stat = request_irq(dev->pdev->irq + 1, ddb_irq_handler1, stat = request_irq(dev->pdev->irq + 1, ddb_irq_handler1,
irq_flag, "ddbridge", (void *) dev); irq_flag, "ddbridge", (void *)dev);
if (stat < 0) { if (stat < 0) {
free_irq(dev->pdev->irq, dev); free_irq(dev->pdev->irq, dev);
return stat; return stat;
...@@ -173,7 +174,7 @@ static int ddb_irq_init(struct ddb *dev) ...@@ -173,7 +174,7 @@ static int ddb_irq_init(struct ddb *dev)
#endif #endif
{ {
stat = request_irq(dev->pdev->irq, ddb_irq_handler, stat = request_irq(dev->pdev->irq, ddb_irq_handler,
irq_flag, "ddbridge", (void *) dev); irq_flag, "ddbridge", (void *)dev);
if (stat < 0) if (stat < 0)
return stat; return stat;
} }
...@@ -202,8 +203,8 @@ static int ddb_probe(struct pci_dev *pdev, ...@@ -202,8 +203,8 @@ static int ddb_probe(struct pci_dev *pdev,
if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))
return -ENODEV; return -ENODEV;
dev = vzalloc(sizeof(struct ddb)); dev = vzalloc(sizeof(*dev));
if (dev == NULL) if (!dev)
return -ENOMEM; return -ENOMEM;
mutex_init(&dev->mutex); mutex_init(&dev->mutex);
...@@ -317,7 +318,7 @@ static __init int module_init_ddbridge(void) ...@@ -317,7 +318,7 @@ static __init int module_init_ddbridge(void)
if (ddb_class_create() < 0) if (ddb_class_create() < 0)
return -1; return -1;
ddb_wq = create_workqueue("ddbridge"); ddb_wq = create_workqueue("ddbridge");
if (ddb_wq == NULL) if (!ddb_wq)
goto exit1; goto exit1;
stat = pci_register_driver(&ddb_pci_driver); stat = pci_register_driver(&ddb_pci_driver);
if (stat < 0) if (stat < 0)
......
...@@ -291,34 +291,45 @@ static int max_set_voltage(struct dvb_frontend *fe, enum fe_sec_voltage voltage) ...@@ -291,34 +291,45 @@ static int max_set_voltage(struct dvb_frontend *fe, enum fe_sec_voltage voltage)
if (nv != ov) { if (nv != ov) {
if (nv) { if (nv) {
lnb_set_voltage(dev, lnb_set_voltage(
port->lnr, 0, SEC_VOLTAGE_13); dev, port->lnr,
0, SEC_VOLTAGE_13);
if (fmode == 1) { if (fmode == 1) {
lnb_set_voltage(dev, port->lnr, lnb_set_voltage(
dev, port->lnr,
0, SEC_VOLTAGE_13); 0, SEC_VOLTAGE_13);
if (old_quattro) { if (old_quattro) {
lnb_set_voltage(dev, port->lnr, lnb_set_voltage(
dev, port->lnr,
1, SEC_VOLTAGE_18); 1, SEC_VOLTAGE_18);
lnb_set_voltage(dev, port->lnr, lnb_set_voltage(
dev, port->lnr,
2, SEC_VOLTAGE_13); 2, SEC_VOLTAGE_13);
} else { } else {
lnb_set_voltage(dev, port->lnr, lnb_set_voltage(
dev, port->lnr,
1, SEC_VOLTAGE_13); 1, SEC_VOLTAGE_13);
lnb_set_voltage(dev, port->lnr, lnb_set_voltage(
dev, port->lnr,
2, SEC_VOLTAGE_18); 2, SEC_VOLTAGE_18);
} }
lnb_set_voltage(dev, port->lnr, lnb_set_voltage(
dev, port->lnr,
3, SEC_VOLTAGE_18); 3, SEC_VOLTAGE_18);
} }
} else { } else {
lnb_set_voltage(dev, port->lnr, lnb_set_voltage(
dev, port->lnr,
0, SEC_VOLTAGE_OFF); 0, SEC_VOLTAGE_OFF);
if (fmode == 1) { if (fmode == 1) {
lnb_set_voltage(dev, port->lnr, lnb_set_voltage(
dev, port->lnr,
1, SEC_VOLTAGE_OFF); 1, SEC_VOLTAGE_OFF);
lnb_set_voltage(dev, port->lnr, lnb_set_voltage(
dev, port->lnr,
2, SEC_VOLTAGE_OFF); 2, SEC_VOLTAGE_OFF);
lnb_set_voltage(dev, port->lnr, lnb_set_voltage(
dev, port->lnr,
3, SEC_VOLTAGE_OFF); 3, SEC_VOLTAGE_OFF);
} }
} }
...@@ -331,7 +342,6 @@ static int max_set_voltage(struct dvb_frontend *fe, enum fe_sec_voltage voltage) ...@@ -331,7 +342,6 @@ static int max_set_voltage(struct dvb_frontend *fe, enum fe_sec_voltage voltage)
static int max_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg) static int max_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg)
{ {
return 0; return 0;
} }
......
...@@ -95,16 +95,16 @@ ...@@ -95,16 +95,16 @@
#define DMA_BASE_WRITE (0x100) #define DMA_BASE_WRITE (0x100)
#define DMA_BASE_READ (0x140) #define DMA_BASE_READ (0x140)
#define TS_CONTROL(_io) (_io->regs + 0x00) #define TS_CONTROL(_io) ((_io)->regs + 0x00)
#define TS_CONTROL2(_io) (_io->regs + 0x04) #define TS_CONTROL2(_io) ((_io)->regs + 0x04)
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* DMA Buffer */ /* DMA Buffer */
#define DMA_BUFFER_CONTROL(_dma) (_dma->regs + 0x00) #define DMA_BUFFER_CONTROL(_dma) ((_dma)->regs + 0x00)
#define DMA_BUFFER_ACK(_dma) (_dma->regs + 0x04) #define DMA_BUFFER_ACK(_dma) ((_dma)->regs + 0x04)
#define DMA_BUFFER_CURRENT(_dma) (_dma->regs + 0x08) #define DMA_BUFFER_CURRENT(_dma) ((_dma)->regs + 0x08)
#define DMA_BUFFER_SIZE(_dma) (_dma->regs + 0x0c) #define DMA_BUFFER_SIZE(_dma) ((_dma)->regs + 0x0c)
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* CI Interface (only CI-Bridge) */ /* CI Interface (only CI-Bridge) */
...@@ -148,8 +148,8 @@ ...@@ -148,8 +148,8 @@
#define LNB_CMD_OFF 5 #define LNB_CMD_OFF 5
#define LNB_CMD_DISEQC 6 #define LNB_CMD_DISEQC 6
#define LNB_BUSY (1ULL << 4) #define LNB_BUSY BIT_ULL(4)
#define LNB_TONE (1ULL << 15) #define LNB_TONE BIT_ULL(15)
#define LNB_BUF_LEVEL(i) (LNB_BASE + (i) * 0x20 + 0x10) #define LNB_BUF_LEVEL(i) (LNB_BASE + (i) * 0x20 + 0x10)
#define LNB_BUF_WRITE(i) (LNB_BASE + (i) * 0x20 + 0x14) #define LNB_BUF_WRITE(i) (LNB_BASE + (i) * 0x20 + 0x14)
......
...@@ -143,11 +143,11 @@ struct ddb_info { ...@@ -143,11 +143,11 @@ struct ddb_info {
#define DMA_MAX_BUFS 32 /* hardware table limit */ #define DMA_MAX_BUFS 32 /* hardware table limit */
#define INPUT_DMA_BUFS 8 #define INPUT_DMA_BUFS 8
#define INPUT_DMA_SIZE (128*47*21) #define INPUT_DMA_SIZE (128 * 47 * 21)
#define INPUT_DMA_IRQ_DIV 1 #define INPUT_DMA_IRQ_DIV 1
#define OUTPUT_DMA_BUFS 8 #define OUTPUT_DMA_BUFS 8
#define OUTPUT_DMA_SIZE (128*47*21) #define OUTPUT_DMA_SIZE (128 * 47 * 21)
#define OUTPUT_DMA_IRQ_DIV 1 #define OUTPUT_DMA_IRQ_DIV 1
struct ddb; struct ddb;
...@@ -166,7 +166,7 @@ struct ddb_dma { ...@@ -166,7 +166,7 @@ struct ddb_dma {
u32 bufval; u32 bufval;
struct work_struct work; struct work_struct work;
spinlock_t lock; spinlock_t lock; /* DMA lock */
wait_queue_head_t wq; wait_queue_head_t wq;
int running; int running;
u32 stat; u32 stat;
...@@ -206,7 +206,6 @@ struct ddb_ci { ...@@ -206,7 +206,6 @@ struct ddb_ci {
struct dvb_ca_en50221 en; struct dvb_ca_en50221 en;
struct ddb_port *port; struct ddb_port *port;
u32 nr; u32 nr;
struct mutex lock;
}; };
struct ddb_io { struct ddb_io {
...@@ -240,7 +239,7 @@ struct ddb_port { ...@@ -240,7 +239,7 @@ struct ddb_port {
u32 regs; u32 regs;
u32 lnr; u32 lnr;
struct ddb_i2c *i2c; struct ddb_i2c *i2c;
struct mutex i2c_gate_lock; struct mutex i2c_gate_lock; /* I2C access lock */
u32 class; u32 class;
#define DDB_PORT_NONE 0 #define DDB_PORT_NONE 0
#define DDB_PORT_CI 1 #define DDB_PORT_CI 1
...@@ -297,7 +296,7 @@ struct ddb_port { ...@@ -297,7 +296,7 @@ struct ddb_port {
#define TS_CAPTURE_LEN (4096) #define TS_CAPTURE_LEN (4096)
struct ddb_lnb { struct ddb_lnb {
struct mutex lock; struct mutex lock; /* lock lnb access */
u32 tone; u32 tone;
enum fe_sec_voltage oldvoltage[4]; enum fe_sec_voltage oldvoltage[4];
u32 voltage[4]; u32 voltage[4];
...@@ -310,13 +309,13 @@ struct ddb_link { ...@@ -310,13 +309,13 @@ struct ddb_link {
const struct ddb_info *info; const struct ddb_info *info;
u32 nr; u32 nr;
u32 regs; u32 regs;
spinlock_t lock; spinlock_t lock; /* lock link access */
struct mutex flash_mutex; struct mutex flash_mutex; /* lock flash access */
struct ddb_lnb lnb; struct ddb_lnb lnb;
struct tasklet_struct tasklet; struct tasklet_struct tasklet;
struct ddb_ids ids; struct ddb_ids ids;
spinlock_t temp_lock; spinlock_t temp_lock; /* lock temp chip access */
int overtemperature_error; int overtemperature_error;
u8 temp_tab[11]; u8 temp_tab[11];
}; };
...@@ -355,7 +354,7 @@ struct ddb { ...@@ -355,7 +354,7 @@ struct ddb {
u32 ts_irq; u32 ts_irq;
u32 i2c_irq; u32 i2c_irq;
struct mutex mutex; struct mutex mutex; /* lock access to global ddb array */
u8 tsbuf[TS_CAPTURE_LEN]; u8 tsbuf[TS_CAPTURE_LEN];
}; };
......
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