Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1589a993 authored by Uwe Bugla's avatar Uwe Bugla Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (11287): Code cleanup (passes checkpatch now) of the b2c2-flexcop-drivers 1/2



This patch cleans up the source code of the b2c2 flexcop-driver. It is the first of a total of two.

The code is now passing the checkpatch-script.

Signed-off-by: default avatarUwe Bugla <uwe.bugla@gmx.de>
Signed-off-by: default avatarPatrick Boettcher <pb@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 7def728f
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@ b2c2-flexcop-objs = flexcop.o flexcop-fe-tuner.o flexcop-i2c.o \
	flexcop-sram.o flexcop-eeprom.o flexcop-misc.o flexcop-hw-filter.o
obj-$(CONFIG_DVB_B2C2_FLEXCOP) += b2c2-flexcop.o


ifneq ($(CONFIG_DVB_B2C2_FLEXCOP_PCI),)
b2c2-flexcop-objs += flexcop-dma.o
endif
+38 −26
Original line number Diff line number Diff line
@@ -28,11 +28,14 @@

/* Steal from usb.h */
#undef err
#define err(format,  arg...) printk(KERN_ERR     FC_LOG_PREFIX ": " format "\n" , ## arg)
#define err(format, arg...) \
	printk(KERN_ERR FC_LOG_PREFIX ": " format "\n" , ## arg)
#undef info
#define info(format, arg...) printk(KERN_INFO    FC_LOG_PREFIX ": " format "\n" , ## arg)
#define info(format, arg...) \
	printk(KERN_INFO FC_LOG_PREFIX ": " format "\n" , ## arg)
#undef warn
#define warn(format, arg...) printk(KERN_WARNING FC_LOG_PREFIX ": " format "\n" , ## arg)
#define warn(format, arg...) \
	printk(KERN_WARNING FC_LOG_PREFIX ": " format "\n" , ## arg)

struct flexcop_dma {
	struct pci_dev *pdev;
@@ -91,16 +94,14 @@ struct flexcop_device {
	int fullts_streaming_state;

	/* bus specific callbacks */
	flexcop_ibi_value (*read_ibi_reg)  (struct flexcop_device *, flexcop_ibi_register);
	int               (*write_ibi_reg) (struct flexcop_device *, flexcop_ibi_register, flexcop_ibi_value);


	flexcop_ibi_value(*read_ibi_reg) (struct flexcop_device *,
			flexcop_ibi_register);
	int (*write_ibi_reg) (struct flexcop_device *,
			flexcop_ibi_register, flexcop_ibi_value);
	int (*i2c_request) (struct flexcop_i2c_adapter *,
		flexcop_access_op_t, u8 chipaddr, u8 addr, u8 *buf, u16 len);
	int (*stream_control) (struct flexcop_device *, int);

	int (*get_mac_addr) (struct flexcop_device *fc, int extended);

	void *bus_specific;
};

@@ -115,18 +116,24 @@ void flexcop_device_kfree(struct flexcop_device*);

int flexcop_device_initialize(struct flexcop_device *);
void flexcop_device_exit(struct flexcop_device *fc);

void flexcop_reset_block_300(struct flexcop_device *fc);

/* from flexcop-dma.c */
int flexcop_dma_allocate(struct pci_dev *pdev, struct flexcop_dma *dma, u32 size);
int flexcop_dma_allocate(struct pci_dev *pdev,
		struct flexcop_dma *dma, u32 size);
void flexcop_dma_free(struct flexcop_dma *dma);

int flexcop_dma_control_timer_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff);
int flexcop_dma_control_size_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff);
int flexcop_dma_config(struct flexcop_device *fc, struct flexcop_dma *dma, flexcop_dma_index_t dma_idx);
int flexcop_dma_xfer_control(struct flexcop_device *fc, flexcop_dma_index_t dma_idx, flexcop_dma_addr_index_t index, int onoff);
int flexcop_dma_config_timer(struct flexcop_device *fc, flexcop_dma_index_t dma_idx, u8 cycles);
int flexcop_dma_control_timer_irq(struct flexcop_device *fc,
		flexcop_dma_index_t no, int onoff);
int flexcop_dma_control_size_irq(struct flexcop_device *fc,
		flexcop_dma_index_t no, int onoff);
int flexcop_dma_config(struct flexcop_device *fc, struct flexcop_dma *dma,
		flexcop_dma_index_t dma_idx);
int flexcop_dma_xfer_control(struct flexcop_device *fc,
		flexcop_dma_index_t dma_idx, flexcop_dma_addr_index_t index,
		int onoff);
int flexcop_dma_config_timer(struct flexcop_device *fc,
		flexcop_dma_index_t dma_idx, u8 cycles);

/* from flexcop-eeprom.c */
/* the PCI part uses this call to get the MAC address, the USB part has its own */
@@ -141,13 +148,15 @@ int flexcop_i2c_request(struct flexcop_i2c_adapter*, flexcop_access_op_t,
	u8 chipaddr, u8 addr, u8 *buf, u16 len);

/* from flexcop-sram.c */
int flexcop_sram_set_dest(struct flexcop_device *fc, flexcop_sram_dest_t dest, flexcop_sram_dest_target_t target);
int flexcop_sram_set_dest(struct flexcop_device *fc, flexcop_sram_dest_t dest,
	flexcop_sram_dest_target_t target);
void flexcop_wan_set_speed(struct flexcop_device *fc, flexcop_wan_speed_t s);
void flexcop_sram_ctrl(struct flexcop_device *fc, int usb_wan, int sramdma, int maximumfill);
void flexcop_sram_ctrl(struct flexcop_device *fc,
		int usb_wan, int sramdma, int maximumfill);

/* global prototypes for the flexcop-chip */
/* from flexcop-fe-tuner.c */
int flexcop_frontend_init(struct flexcop_device *card);
int flexcop_frontend_init(struct flexcop_device *fc);
void flexcop_frontend_exit(struct flexcop_device *fc);

/* from flexcop-i2c.c */
@@ -159,11 +168,14 @@ int flexcop_sram_init(struct flexcop_device *fc);

/* from flexcop-misc.c */
void flexcop_determine_revision(struct flexcop_device *fc);
void flexcop_device_name(struct flexcop_device *fc,const char *prefix,const char *suffix);
void flexcop_dump_reg(struct flexcop_device *fc, flexcop_ibi_register reg, int num);
void flexcop_device_name(struct flexcop_device *fc,
		const char *prefix, const char *suffix);
void flexcop_dump_reg(struct flexcop_device *fc,
		flexcop_ibi_register reg, int num);

/* from flexcop-hw-filter.c */
int flexcop_pid_feed_control(struct flexcop_device *fc, struct dvb_demux_feed *dvbdmxfeed, int onoff);
int flexcop_pid_feed_control(struct flexcop_device *fc,
		struct dvb_demux_feed *dvbdmxfeed, int onoff);
void flexcop_hw_filter_init(struct flexcop_device *fc);

void flexcop_smc_ctrl(struct flexcop_device *fc, int onoff);
+14 −13
Original line number Diff line number Diff line
/*
 * This file is part of linux driver the digital TV devices equipped with B2C2 FlexcopII(b)/III
 *
 * flexcop-dma.c - methods for configuring and controlling the DMA of the FlexCop.
 *
 * see flexcop.c for copyright information.
 * Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III
 * flexcop-dma.c - configuring and controlling the DMA of the FlexCop
 * see flexcop.c for copyright information
 */
#include "flexcop.h"

int flexcop_dma_allocate(struct pci_dev *pdev, struct flexcop_dma *dma, u32 size)
int flexcop_dma_allocate(struct pci_dev *pdev,
		struct flexcop_dma *dma, u32 size)
{
	u8 *tcpu;
	dma_addr_t tdma = 0;
@@ -32,7 +31,8 @@ EXPORT_SYMBOL(flexcop_dma_allocate);

void flexcop_dma_free(struct flexcop_dma *dma)
{
	pci_free_consistent(dma->pdev, dma->size*2,dma->cpu_addr0, dma->dma_addr0);
	pci_free_consistent(dma->pdev, dma->size*2,
			dma->cpu_addr0, dma->dma_addr0);
	memset(dma,0,sizeof(struct flexcop_dma));
}
EXPORT_SYMBOL(flexcop_dma_free);
@@ -57,7 +57,8 @@ int flexcop_dma_config(struct flexcop_device *fc,
		fc->write_ibi_reg(fc,dma2_014,v0x4);
		fc->write_ibi_reg(fc,dma2_01c,v0xc);
	} else {
		err("either DMA1 or DMA2 can be configured at the within one flexcop_dma_config call.");
		err("either DMA1 or DMA2 can be configured within one "
			"flexcop_dma_config call.");
		return -EINVAL;
	}

@@ -81,7 +82,8 @@ int flexcop_dma_xfer_control(struct flexcop_device *fc,
		r0x0 = dma2_010;
		r0xc = dma2_01c;
	} else {
		err("either transfer DMA1 or DMA2 can be started within one flexcop_dma_xfer_control call.");
		err("either transfer DMA1 or DMA2 can be started within one "
			"flexcop_dma_xfer_control call.");
		return -EINVAL;
	}

@@ -154,8 +156,7 @@ EXPORT_SYMBOL(flexcop_dma_control_timer_irq);

/* 1 cycles = 1.97 msec */
int flexcop_dma_config_timer(struct flexcop_device *fc,
		flexcop_dma_index_t dma_idx,
		u8 cycles)
		flexcop_dma_index_t dma_idx, u8 cycles)
{
	flexcop_ibi_register r = (dma_idx & FC_DMA_1) ? dma1_004 : dma2_014;
	flexcop_ibi_value v = fc->read_ibi_reg(fc,r);
+19 −28
Original line number Diff line number Diff line
/*
 * This file is part of linux driver the digital TV devices equipped with B2C2 FlexcopII(b)/III
 *
 * flexcop-eeprom.c - eeprom access methods (currently only MAC address reading is used)
 *
 * see flexcop.c for copyright information.
 * Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III
 * flexcop-eeprom.c - eeprom access methods (currently only MAC address reading)
 * see flexcop.c for copyright information
 */
#include "flexcop.h"

@@ -14,7 +12,8 @@ static int eeprom_write(struct adapter *adapter, u16 addr, u8 *buf, u16 len)
	return flex_i2c_write(adapter, 0x20000000, 0x50, addr, buf, len);
}

static int eeprom_lrc_write(struct adapter *adapter, u32 addr, u32 len, u8 *wbuf, u8 *rbuf, int retries)
static int eeprom_lrc_write(struct adapter *adapter, u32 addr,
		u32 len, u8 *wbuf, u8 *rbuf, int retries)
{
int i;

@@ -24,7 +23,6 @@ static int eeprom_lrc_write(struct adapter *adapter, u32 addr, u32 len, u8 *wbuf
			return 1;
		}
	}

	return 0;
}

@@ -39,12 +37,10 @@ static int eeprom_writeKey(struct adapter *adapter, u8 *key, u32 len)
		return 0;

	memcpy(wbuf, key, len);

	wbuf[16] = 0;
	wbuf[17] = 0;
	wbuf[18] = 0;
	wbuf[19] = calc_lrc(wbuf, 19);

	return eeprom_lrc_write(adapter, 0x3e4, 20, wbuf, rbuf, 4);
}

@@ -59,7 +55,6 @@ static int eeprom_readKey(struct adapter *adapter, u8 *key, u32 len)
		return 0;

	memcpy(key, buf, len);

	return 1;
}

@@ -74,9 +69,7 @@ static char eeprom_set_mac_addr(struct adapter *adapter, char type, u8 *mac)
		tmp[3] = mac[5];
		tmp[4] = mac[6];
		tmp[5] = mac[7];

	} else {

		tmp[0] = mac[0];
		tmp[1] = mac[1];
		tmp[2] = mac[2];
@@ -90,11 +83,11 @@ static char eeprom_set_mac_addr(struct adapter *adapter, char type, u8 *mac)

	if (eeprom_write(adapter, 0x3f8, tmp, 8) == 8)
		return 1;

	return 0;
}

static int flexcop_eeprom_read(struct flexcop_device *fc, u16 addr, u8 *buf, u16 len)
static int flexcop_eeprom_read(struct flexcop_device *fc,
		u16 addr, u8 *buf, u16 len)
{
	return fc->i2c_request(fc,FC_READ,FC_I2C_PORT_EEPROM,0x50,addr,buf,len);
}
@@ -110,7 +103,8 @@ static u8 calc_lrc(u8 *buf, int len)
	return sum;
}

static int flexcop_eeprom_request(struct flexcop_device *fc, flexcop_access_op_t op, u16 addr, u8 *buf, u16 len, int retries)
static int flexcop_eeprom_request(struct flexcop_device *fc,
	flexcop_access_op_t op, u16 addr, u8 *buf, u16 len, int retries)
{
	int i,ret = 0;
	u8 chipaddr =  0x50 | ((addr >> 8) & 3);
@@ -123,7 +117,8 @@ static int flexcop_eeprom_request(struct flexcop_device *fc, flexcop_access_op_t
	return ret;
}

static int flexcop_eeprom_lrc_read(struct flexcop_device *fc, u16 addr, u8 *buf, u16 len, int retries)
static int flexcop_eeprom_lrc_read(struct flexcop_device *fc, u16 addr,
		u8 *buf, u16 len, int retries)
{
	int ret = flexcop_eeprom_request(fc, FC_READ, addr, buf, len, retries);
	if (ret == 0)
@@ -133,8 +128,7 @@ static int flexcop_eeprom_lrc_read(struct flexcop_device *fc, u16 addr, u8 *buf,
}

/* JJ's comment about extended == 1: it is not presently used anywhere but was
 * added to the low-level functions for possible support of EUI64
 */
 * added to the low-level functions for possible support of EUI64 */
int flexcop_eeprom_check_mac_addr(struct flexcop_device *fc, int extended)
{
	u8 buf[8];
@@ -142,12 +136,9 @@ int flexcop_eeprom_check_mac_addr(struct flexcop_device *fc, int extended)

	if ((ret = flexcop_eeprom_lrc_read(fc,0x3f8,buf,8,4)) == 0) {
		if (extended != 0) {
			err("TODO: extended (EUI64) MAC addresses aren't completely supported yet");
			err("TODO: extended (EUI64) MAC addresses aren't "
				"completely supported yet");
			ret = -EINVAL;
/*			memcpy(fc->dvb_adapter.proposed_mac,buf,3);
			mac[3] = 0xfe;
			mac[4] = 0xff;
			memcpy(&fc->dvb_adapter.proposed_mac[3],&buf[5],3); */
		} else
			memcpy(fc->dvb_adapter.proposed_mac,buf,6);
	}
+3 −3
Original line number Diff line number Diff line
@@ -592,14 +592,14 @@ int flexcop_frontend_init(struct flexcop_device *fc)
		fc->fe_sleep = ops->sleep;
		ops->sleep = flexcop_sleep;

		fc->dev_type = FC_SKY;
		fc->dev_type = FC_SKY_REV26;
		goto fe_found;
	}

	/* try the air dvb-t (mt352/Samsung tdtc9251dh0(??)) */
	fc->fe = dvb_attach(mt352_attach, &samsung_tdtc9251dh0_config, i2c);
	if (fc->fe != NULL) {
		fc->dev_type = FC_AIR_DVB;
		fc->dev_type = FC_AIR_DVBT;
		fc->fe->ops.tuner_ops.calc_regs = samsung_tdtc9251dh0_calc_regs;
		goto fe_found;
	}
@@ -653,7 +653,7 @@ int flexcop_frontend_init(struct flexcop_device *fc)
		fc->fe_sleep                = ops->sleep;
		ops->sleep                  = flexcop_sleep;

		fc->dev_type                = FC_SKY_OLD;
		fc->dev_type                = FC_SKY_REV23;
		goto fe_found;
	}

Loading