diff options
author | Michael Hunold <devnull@localhost> | 2003-07-16 08:55:50 +0000 |
---|---|---|
committer | Michael Hunold <devnull@localhost> | 2003-07-16 08:55:50 +0000 |
commit | be051559d85703fb591c25c7b3acac1d08f808ae (patch) | |
tree | b4a85c0d1ef8f83fecb8915630a374e9b6f9ba9d | |
parent | e72be0c3ee3d13de64a14f5b0fedd00b32f69240 (diff) | |
download | mediapointer-dvb-s2-be051559d85703fb591c25c7b3acac1d08f808ae.tar.gz mediapointer-dvb-s2-be051559d85703fb591c25c7b3acac1d08f808ae.tar.bz2 |
- change function return values from u32 to int where possible
- make all functions static
- comment out unused functions
- fix return values of some functions
- ...
-rw-r--r-- | linux/drivers/media/dvb/b2c2/skystar2.c | 348 |
1 files changed, 181 insertions, 167 deletions
diff --git a/linux/drivers/media/dvb/b2c2/skystar2.c b/linux/drivers/media/dvb/b2c2/skystar2.c index 21f95cc6a..2bc01da37 100644 --- a/linux/drivers/media/dvb/b2c2/skystar2.c +++ b/linux/drivers/media/dvb/b2c2/skystar2.c @@ -35,7 +35,7 @@ #include "demux.h" #include "dvb_net.h" -int debug = 0; +static int debug = 0; #define dprintk(x...) do { if (debug) printk(x); } while (0) #define SizeOfBufDMA1 0x3AC00 @@ -67,7 +67,7 @@ struct adapter { struct pci_dev *pdev; u8 card_revision; - u32 B2C2_revision; + u32 b2c2_revision; u32 PidFilterMax; u32 MacFilterMax; u32 irq; @@ -103,7 +103,7 @@ struct adapter { #define WriteRegDW(adapter,reg,value) writel(value, adapter->io_mem + reg) #define ReadRegDW(adapter,reg) readl(adapter->io_mem + reg) -u32 WriteRegOp(struct adapter * adapter, u32 reg, u32 operation, u32 andvalue, u32 orvalue) +static void WriteRegOp(struct adapter *adapter, u32 reg, u32 operation, u32 andvalue, u32 orvalue) { u32 tmp; @@ -117,12 +117,10 @@ u32 WriteRegOp(struct adapter * adapter, u32 reg, u32 operation, u32 andvalue, u tmp = (tmp & andvalue) | orvalue; WriteRegDW(adapter, reg, tmp); - - return tmp; } /* i2c functions */ -u32 i2cMainWriteForFlex2(struct adapter * adapter, u32 command, u8 * buf, u32 retries) +static int i2cMainWriteForFlex2(struct adapter * adapter, u32 command, u8 * buf, u32 retries) { u32 i; u32 value; @@ -151,28 +149,24 @@ u32 i2cMainWriteForFlex2(struct adapter * adapter, u32 command, u8 * buf, u32 re } /* device = 0x10000000 for tuner, 0x20000000 for eeprom */ -u32 i2cMainSetup(u32 device, u32 chip_addr, u8 op, u8 addr, u32 value, u32 len) +static void i2cMainSetup(u32 device, u32 chip_addr, u8 op, u8 addr, u32 value, u32 len, u32 *command) { - u32 command; - - command = device | ((len - 1) << 26) | (value << 16) | (addr << 8) | chip_addr; + *command = device | ((len - 1) << 26) | (value << 16) | (addr << 8) | chip_addr; if (op != 0) - command = command | 0x03000000; + *command = *command | 0x03000000; else - command = command | 0x01000000; - - return command; + *command = *command | 0x01000000; } -u32 FlexI2cRead4(struct adapter * adapter, u32 device, u32 chip_addr, u16 addr, u8 * buf, u8 len) +static int FlexI2cRead4(struct adapter * adapter, u32 device, u32 chip_addr, u16 addr, u8 * buf, u8 len) { u32 command; u32 value; int result, i; - command = i2cMainSetup(device, chip_addr, 1, addr, 0, len); + i2cMainSetup(device, chip_addr, 1, addr, 0, len, &command); result = i2cMainWriteForFlex2(adapter, command, buf, 100000); @@ -190,7 +184,7 @@ u32 FlexI2cRead4(struct adapter * adapter, u32 device, u32 chip_addr, u16 addr, return result; } -u32 FlexI2cWrite4(struct adapter * adapter, u32 device, u32 chip_addr, u32 addr, u8 * buf, u8 len) +static int FlexI2cWrite4(struct adapter * adapter, u32 device, u32 chip_addr, u32 addr, u8 * buf, u8 len) { u32 command; u32 value; @@ -207,26 +201,26 @@ u32 FlexI2cWrite4(struct adapter * adapter, u32 device, u32 chip_addr, u32 addr, WriteRegDW(adapter, 0x104, value); } - command = i2cMainSetup(device, chip_addr, 0, addr, buf[0], len); + i2cMainSetup(device, chip_addr, 0, addr, buf[0], len, &command); return i2cMainWriteForFlex2(adapter, command, 0, 100000); } -u32 fixChipAddr(u32 device, u32 bus, u32 addr) +static void fixchipaddr(u32 device, u32 bus, u32 addr, u32 *ret) { if (device == 0x20000000) - return bus | ((addr >> 8) & 3); + *ret = bus | ((addr >> 8) & 3); - return bus; + *ret = bus; } -u32 FLEXI2C_read(struct adapter * adapter, u32 device, u32 bus, u32 addr, u8 * buf, u32 len) +static u32 FLEXI2C_read(struct adapter * adapter, u32 device, u32 bus, u32 addr, u8 * buf, u32 len) { - u32 ChipAddr; + u32 chipaddr; u32 bytes_to_transfer; u8 *start; -// dprintk("%s:\n", __FUNCTION__); +// dprintk("%s:\n", __FUNCTION__); start = buf; @@ -236,9 +230,9 @@ u32 FLEXI2C_read(struct adapter * adapter, u32 device, u32 bus, u32 addr, u8 * b if (bytes_to_transfer > 4) bytes_to_transfer = 4; - ChipAddr = fixChipAddr(device, bus, addr); + fixchipaddr(device, bus, addr, &chipaddr); - if (FlexI2cRead4(adapter, device, ChipAddr, addr, buf, bytes_to_transfer) == 0) + if (FlexI2cRead4(adapter, device, chipaddr, addr, buf, bytes_to_transfer) == 0) return buf - start; buf = buf + bytes_to_transfer; @@ -249,13 +243,13 @@ u32 FLEXI2C_read(struct adapter * adapter, u32 device, u32 bus, u32 addr, u8 * b return buf - start; } -u32 FLEXI2C_write(struct adapter * adapter, u32 device, u32 bus, u32 addr, u8 * buf, u32 len) +static u32 FLEXI2C_write(struct adapter * adapter, u32 device, u32 bus, u32 addr, u8 * buf, u32 len) { - u32 ChipAddr; + u32 chipaddr; u32 bytes_to_transfer; u8 *start; -// dprintk("%s:\n", __FUNCTION__); +// dprintk("%s:\n", __FUNCTION__); start = buf; @@ -265,9 +259,9 @@ u32 FLEXI2C_write(struct adapter * adapter, u32 device, u32 bus, u32 addr, u8 * if (bytes_to_transfer > 4) bytes_to_transfer = 4; - ChipAddr = fixChipAddr(device, bus, addr); + fixchipaddr(device, bus, addr, &chipaddr); - if (FlexI2cWrite4(adapter, device, ChipAddr, addr, buf, bytes_to_transfer) == 0) + if (FlexI2cWrite4(adapter, device, chipaddr, addr, buf, bytes_to_transfer) == 0) return buf - start; buf = buf + bytes_to_transfer; @@ -293,7 +287,8 @@ static int master_xfer(struct dvb_i2c_bus *i2c, const struct i2c_msg *msgs, int printk("message %d: flags=%x, addr=0x%04x, buf=%x, len=%d \n", i, msgs[i].flags, msgs[i].addr, (u32) msgs[i].buf, msgs[i].len); } } - // allow only the vp310 frontend to access the bus + + /* allow only the vp310 frontend to access the bus */ if ((msgs[0].addr != 0x0E) && (msgs[0].addr != 0x61)) { up(&tmp->i2c_sem); @@ -342,7 +337,7 @@ static int master_xfer(struct dvb_i2c_bus *i2c, const struct i2c_msg *msgs, int /* SRAM (Skystar2 rev2.3 has one "ISSI IS61LV256" chip on board, but it seems that FlexCopII can work with more than one chip) */ -u32 SRAMSetNetDest(struct adapter * adapter, u8 dest) +static void SRAMSetNetDest(struct adapter * adapter, u8 dest) { u32 tmp; @@ -357,10 +352,11 @@ u32 SRAMSetNetDest(struct adapter * adapter, u8 dest) udelay(1000); - return tmp; + /* return value is never used? */ +/* return tmp; */ } -u32 SRAMSetCaiDest(struct adapter * adapter, u8 dest) +static void SRAMSetCaiDest(struct adapter * adapter, u8 dest) { u32 tmp; @@ -376,10 +372,11 @@ u32 SRAMSetCaiDest(struct adapter * adapter, u8 dest) udelay(1000); - return tmp; + /* return value is never used? */ +/* return tmp; */ } -u32 SRAMSetCaoDest(struct adapter * adapter, u8 dest) +static void SRAMSetCaoDest(struct adapter * adapter, u8 dest) { u32 tmp; @@ -395,10 +392,11 @@ u32 SRAMSetCaoDest(struct adapter * adapter, u8 dest) udelay(1000); - return tmp; + /* return value is never used? */ +/* return tmp; */ } -u32 SRAMSetMediaDest(struct adapter * adapter, u8 dest) +static void SRAMSetMediaDest(struct adapter * adapter, u8 dest) { u32 tmp; @@ -414,7 +412,8 @@ u32 SRAMSetMediaDest(struct adapter * adapter, u8 dest) udelay(1000); - return tmp; + /* return value is never used? */ +/* return tmp; */ } /* SRAM memory is accessed through a buffer register in the FlexCop @@ -426,7 +425,7 @@ u32 SRAMSetMediaDest(struct adapter * adapter, u8 dest) bits 28-29 : memory bank selector bit 31 : busy flag */ -void FlexSramWrite(struct adapter *adapter, u32 bank, u32 addr, u8 * buf, u32 len) +static void FlexSramWrite(struct adapter *adapter, u32 bank, u32 addr, u8 * buf, u32 len) { u32 i, command, retries; @@ -450,7 +449,7 @@ void FlexSramWrite(struct adapter *adapter, u32 bank, u32 addr, u8 * buf, u32 le } } -void FlexSramRead(struct adapter *adapter, u32 bank, u32 addr, u8 * buf, u32 len) +static void FlexSramRead(struct adapter *adapter, u32 bank, u32 addr, u8 * buf, u32 len) { u32 i, command, value, retries; @@ -488,7 +487,7 @@ void FlexSramRead(struct adapter *adapter, u32 bank, u32 addr, u8 * buf, u32 len } } -void SRAM_writeChunk(struct adapter *adapter, u32 addr, u8 * buf, u16 len) +static void SRAM_writeChunk(struct adapter *adapter, u32 addr, u8 * buf, u16 len) { u32 bank; @@ -508,7 +507,7 @@ void SRAM_writeChunk(struct adapter *adapter, u32 addr, u8 * buf, u16 len) FlexSramWrite(adapter, bank, addr & 0x7FFF, buf, len); } -void SRAM_readChunk(struct adapter *adapter, u32 addr, u8 * buf, u16 len) +static void SRAM_readChunk(struct adapter *adapter, u32 addr, u8 * buf, u16 len) { u32 bank; @@ -528,7 +527,7 @@ void SRAM_readChunk(struct adapter *adapter, u32 addr, u8 * buf, u16 len) FlexSramRead(adapter, bank, addr & 0x7FFF, buf, len); } -void SRAM_read(struct adapter *adapter, u32 addr, u8 * buf, u32 len) +static void SRAM_read(struct adapter *adapter, u32 addr, u8 * buf, u32 len) { u32 length; @@ -550,7 +549,7 @@ void SRAM_read(struct adapter *adapter, u32 addr, u8 * buf, u32 len) } } -void SRAM_write(struct adapter *adapter, u32 addr, u8 * buf, u32 len) +static void SRAM_write(struct adapter *adapter, u32 addr, u8 * buf, u32 len) { u32 length; @@ -572,12 +571,12 @@ void SRAM_write(struct adapter *adapter, u32 addr, u8 * buf, u32 len) } } -void SRAM_setSize(struct adapter *adapter, u32 mask) +static void SRAM_setSize(struct adapter *adapter, u32 mask) { WriteRegDW(adapter, 0x71C, (mask | (~0x30000 & ReadRegDW(adapter, 0x71C)))); } -u32 SRAM_init(struct adapter *adapter) +static void SRAM_init(struct adapter *adapter) { u32 tmp; @@ -599,10 +598,11 @@ u32 SRAM_init(struct adapter *adapter) dprintk("%s: dwSramType = %x\n", __FUNCTION__, adapter->dwSramType); } - return adapter->dwSramType; + /* return value is never used? */ +/* return adapter->dwSramType; */ } -int SRAM_testLocation(struct adapter *adapter, u32 mask, u32 addr) +static int SRAM_testLocation(struct adapter *adapter, u32 mask, u32 addr) { u8 tmp1, tmp2; @@ -650,7 +650,7 @@ int SRAM_testLocation(struct adapter *adapter, u32 mask, u32 addr) return 1; } -u32 SRAM_length(struct adapter * adapter) +static u32 SRAM_length(struct adapter * adapter) { if (adapter->dwSramType == 0x10000) return 32768; // 32K @@ -675,7 +675,7 @@ u32 SRAM_length(struct adapter * adapter) bank 2 covers addresses 0x10000-0x17FFF bank 3 covers addresses 0x18000-0x1FFFF */ -int SramDetectForFlex2(struct adapter *adapter) +static int SramDetectForFlex2(struct adapter *adapter) { u32 tmp, tmp2, tmp3; @@ -747,18 +747,18 @@ int SramDetectForFlex2(struct adapter *adapter) return 0; } -void SLL_detectSramSize(struct adapter *adapter) +static void SLL_detectSramSize(struct adapter *adapter) { SramDetectForFlex2(adapter); } /* EEPROM (Skystar2 has one "24LC08B" chip on board) */ -int EEPROM_write(struct adapter *adapter, u16 addr, u8 * buf, u16 len) +static int EEPROM_write(struct adapter *adapter, u16 addr, u8 * buf, u16 len) { return FLEXI2C_write(adapter, 0x20000000, 0x50, addr, buf, len); } -int EEPROM_read(struct adapter *adapter, u16 addr, u8 * buf, u16 len) +static int EEPROM_read(struct adapter *adapter, u16 addr, u8 * buf, u16 len) { return FLEXI2C_read(adapter, 0x20000000, 0x50, addr, buf, len); } @@ -776,7 +776,7 @@ u8 calc_LRC(u8 * buf, u32 len) return sum; } -int EEPROM_LRC_read(struct adapter *adapter, u32 addr, u32 len, u8 * buf, u32 retries) +static int EEPROM_LRC_read(struct adapter *adapter, u32 addr, u32 len, u8 * buf, u32 retries) { int i; @@ -790,7 +790,8 @@ int EEPROM_LRC_read(struct adapter *adapter, u32 addr, u32 len, u8 * buf, u32 re return 0; } -int EEPROM_LRC_write(struct adapter *adapter, u32 addr, u32 len, u8 * wbuf, u8 * rbuf, u32 retries) +/* +static int EEPROM_LRC_write(struct adapter *adapter, u32 addr, u32 len, u8 * wbuf, u8 * rbuf, u32 retries) { int i; @@ -803,6 +804,7 @@ int EEPROM_LRC_write(struct adapter *adapter, u32 addr, u32 len, u8 * wbuf, u8 * return 0; } +*/ /* These functions could be called from the initialization routine to unlock SkyStar2 cards, locked by "Europe On Line". @@ -829,7 +831,8 @@ int EEPROM_LRC_write(struct adapter *adapter, u32 addr, u32 len, u8 * wbuf, u8 * LRC = 0xB2; */ -int EEPROM_writeKey(struct adapter *adapter, u8 * key, u32 len) +/* +static int EEPROM_writeKey(struct adapter *adapter, u8 * key, u32 len) { u8 rbuf[20]; u8 wbuf[20]; @@ -846,8 +849,8 @@ int EEPROM_writeKey(struct adapter *adapter, u8 * key, u32 len) return EEPROM_LRC_write(adapter, 0x3E4, 20, wbuf, rbuf, 4); } - -int EEPROM_readKey(struct adapter *adapter, u8 * key, u32 len) +*/ +static int EEPROM_readKey(struct adapter *adapter, u8 * key, u32 len) { u8 buf[20]; @@ -862,7 +865,7 @@ int EEPROM_readKey(struct adapter *adapter, u8 * key, u32 len) return 1; } -int EEPROM_getMacAddr(struct adapter *adapter, char type, u8 * mac) +static int EEPROM_getMacAddr(struct adapter *adapter, char type, u8 * mac) { u8 tmp[8]; @@ -903,7 +906,7 @@ int EEPROM_getMacAddr(struct adapter *adapter, char type, u8 * mac) } } -char EEPROM_setMacAddr(struct adapter *adapter, char type, u8 * mac) +static char EEPROM_setMacAddr(struct adapter *adapter, char type, u8 * mac) { u8 tmp[8]; @@ -935,7 +938,7 @@ char EEPROM_setMacAddr(struct adapter *adapter, char type, u8 * mac) } /* PID filter */ -void FilterEnableStream1Filter(struct adapter *adapter, u32 op) +static void FilterEnableStream1Filter(struct adapter *adapter, u32 op) { dprintk("%s: op=%x\n", __FUNCTION__, op); @@ -948,7 +951,7 @@ void FilterEnableStream1Filter(struct adapter *adapter, u32 op) } } -void FilterEnableStream2Filter(struct adapter *adapter, u32 op) +static void FilterEnableStream2Filter(struct adapter *adapter, u32 op) { dprintk("%s: op=%x\n", __FUNCTION__, op); @@ -961,7 +964,7 @@ void FilterEnableStream2Filter(struct adapter *adapter, u32 op) } } -void FilterEnablePcrFilter(struct adapter *adapter, u32 op) +static void FilterEnablePcrFilter(struct adapter *adapter, u32 op) { dprintk("%s: op=%x\n", __FUNCTION__, op); @@ -974,7 +977,7 @@ void FilterEnablePcrFilter(struct adapter *adapter, u32 op) } } -void FilterEnablePmtFilter(struct adapter *adapter, u32 op) +static void FilterEnablePmtFilter(struct adapter *adapter, u32 op) { dprintk("%s: op=%x\n", __FUNCTION__, op); @@ -987,7 +990,7 @@ void FilterEnablePmtFilter(struct adapter *adapter, u32 op) } } -void FilterEnableEmmFilter(struct adapter *adapter, u32 op) +static void FilterEnableEmmFilter(struct adapter *adapter, u32 op) { dprintk("%s: op=%x\n", __FUNCTION__, op); @@ -1000,7 +1003,7 @@ void FilterEnableEmmFilter(struct adapter *adapter, u32 op) } } -void FilterEnableEcmFilter(struct adapter *adapter, u32 op) +static void FilterEnableEcmFilter(struct adapter *adapter, u32 op) { dprintk("%s: op=%x\n", __FUNCTION__, op); @@ -1013,7 +1016,8 @@ void FilterEnableEcmFilter(struct adapter *adapter, u32 op) } } -void FilterEnableNullFilter(struct adapter *adapter, u32 op) +/* +static void FilterEnableNullFilter(struct adapter *adapter, u32 op) { dprintk("%s: op=%x\n", __FUNCTION__, op); @@ -1025,8 +1029,9 @@ void FilterEnableNullFilter(struct adapter *adapter, u32 op) WriteRegOp(adapter, 0x208, 1, 0, 0x00000040); } } +*/ -void FilterEnableMaskFilter(struct adapter *adapter, u32 op) +static void FilterEnableMaskFilter(struct adapter *adapter, u32 op) { dprintk("%s: op=%x\n", __FUNCTION__, op); @@ -1040,7 +1045,7 @@ void FilterEnableMaskFilter(struct adapter *adapter, u32 op) } -void CtrlEnableMAC(struct adapter *adapter, u32 op) +static void CtrlEnableMAC(struct adapter *adapter, u32 op) { if (op == 0) { WriteRegOp(adapter, 0x208, 2, ~0x00004000, 0); @@ -1051,7 +1056,7 @@ void CtrlEnableMAC(struct adapter *adapter, u32 op) } } -int CASetMacDstAddrFilter(struct adapter *adapter, u8 * mac) +static int CASetMacDstAddrFilter(struct adapter *adapter, u8 * mac) { u32 tmp1, tmp2; @@ -1064,7 +1069,8 @@ int CASetMacDstAddrFilter(struct adapter *adapter, u8 * mac) return 0; } -void SetIgnoreMACFilter(struct adapter *adapter, u8 op) +/* +static void SetIgnoreMACFilter(struct adapter *adapter, u8 op) { if (op != 0) { WriteRegOp(adapter, 0x208, 2, ~0x00004000, 0); @@ -1080,14 +1086,17 @@ void SetIgnoreMACFilter(struct adapter *adapter, u8 op) } } } +*/ -void CheckNullFilterEnable(struct adapter *adapter) +/* +static void CheckNullFilterEnable(struct adapter *adapter) { FilterEnableNullFilter(adapter, 1); FilterEnableMaskFilter(adapter, 1); } +*/ -void InitPIDsInfo(struct adapter *adapter) +static void InitPIDsInfo(struct adapter *adapter) { int i; @@ -1095,7 +1104,7 @@ void InitPIDsInfo(struct adapter *adapter) adapter->pids[i] = 0x1FFF; } -u32 CheckPID(struct adapter *adapter, u16 pid) +static int CheckPID(struct adapter *adapter, u16 pid) { u32 i; @@ -1110,7 +1119,7 @@ u32 CheckPID(struct adapter *adapter, u16 pid) return 0; } -u32 PidSetGroupPID(struct adapter * adapter, u32 pid) +static void PidSetGroupPID(struct adapter * adapter, u32 pid) { u32 value; @@ -1120,10 +1129,11 @@ u32 PidSetGroupPID(struct adapter * adapter, u32 pid) WriteRegDW(adapter, 0x30C, value); - return value; + /* return value is never used? */ +/* return value; */ } -u32 PidSetGroupMASK(struct adapter * adapter, u32 pid) +static void PidSetGroupMASK(struct adapter * adapter, u32 pid) { u32 value; @@ -1133,10 +1143,11 @@ u32 PidSetGroupMASK(struct adapter * adapter, u32 pid) WriteRegDW(adapter, 0x30C, value); - return value; + /* return value is never used? */ +/* return value; */ } -u32 PidSetStream1PID(struct adapter * adapter, u32 pid) +static void PidSetStream1PID(struct adapter * adapter, u32 pid) { u32 value; @@ -1146,10 +1157,11 @@ u32 PidSetStream1PID(struct adapter * adapter, u32 pid) WriteRegDW(adapter, 0x300, value); - return value; + /* return value is never used? */ +/* return value; */ } -u32 PidSetStream2PID(struct adapter * adapter, u32 pid) +static void PidSetStream2PID(struct adapter * adapter, u32 pid) { u32 value; @@ -1159,10 +1171,11 @@ u32 PidSetStream2PID(struct adapter * adapter, u32 pid) WriteRegDW(adapter, 0x300, value); - return value; + /* return value is never used? */ +/* return value; */ } -u32 PidSetPcrPID(struct adapter * adapter, u32 pid) +static void PidSetPcrPID(struct adapter * adapter, u32 pid) { u32 value; @@ -1172,10 +1185,11 @@ u32 PidSetPcrPID(struct adapter * adapter, u32 pid) WriteRegDW(adapter, 0x304, value); - return value; + /* return value is never used? */ +/* return value; */ } -u32 PidSetPmtPID(struct adapter * adapter, u32 pid) +static void PidSetPmtPID(struct adapter * adapter, u32 pid) { u32 value; @@ -1185,10 +1199,11 @@ u32 PidSetPmtPID(struct adapter * adapter, u32 pid) WriteRegDW(adapter, 0x304, value); - return value; + /* return value is never used? */ +/* return value; */ } -u32 PidSetEmmPID(struct adapter * adapter, u32 pid) +static void PidSetEmmPID(struct adapter * adapter, u32 pid) { u32 value; @@ -1198,10 +1213,11 @@ u32 PidSetEmmPID(struct adapter * adapter, u32 pid) WriteRegDW(adapter, 0x308, value); - return value; + /* return value is never used? */ +/* return value; */ } -u32 PidSetEcmPID(struct adapter * adapter, u32 pid) +static void PidSetEcmPID(struct adapter * adapter, u32 pid) { u32 value; @@ -1211,50 +1227,52 @@ u32 PidSetEcmPID(struct adapter * adapter, u32 pid) WriteRegDW(adapter, 0x308, value); - return value; + /* return value is never used? */ +/* return value; */ } -u32 PidGetStream1PID(struct adapter * adapter) +static int PidGetStream1PID(struct adapter * adapter) { - return ReadRegDW(adapter, 0x300) & 0x0000FFFF; + return ReadRegDW(adapter, 0x300) & 0x00001FFF; } -u32 PidGetStream2PID(struct adapter * adapter) +static int PidGetStream2PID(struct adapter * adapter) { - return ReadRegDW(adapter, 0x300) >> 0x10; + return (ReadRegDW(adapter, 0x300) >> 0x10)& 0x00001FFF; } -u32 PidGetPcrPID(struct adapter * adapter) +static int PidGetPcrPID(struct adapter * adapter) { - return ReadRegDW(adapter, 0x304) & 0x0000FFFF; + return ReadRegDW(adapter, 0x304) & 0x00001FFF; } -u32 PidGetPmtPID(struct adapter * adapter) +static int PidGetPmtPID(struct adapter * adapter) { - return ReadRegDW(adapter, 0x304) >> 0x10; + return (ReadRegDW(adapter, 0x304) >> 0x10)& 0x00001FFF; } -u32 PidGetEmmPID(struct adapter * adapter) +static int PidGetEmmPID(struct adapter * adapter) { - return ReadRegDW(adapter, 0x308) & 0x0000FFFF; + return ReadRegDW(adapter, 0x308) & 0x00001FFF; } -u32 PidGetEcmPID(struct adapter * adapter) +static int PidGetEcmPID(struct adapter * adapter) { - return ReadRegDW(adapter, 0x308) >> 0x10; + return (ReadRegDW(adapter, 0x308) >> 0x10)& 0x00001FFF; } -u32 PidGetGroupPID(struct adapter * adapter) +static int PidGetGroupPID(struct adapter * adapter) { - return ReadRegDW(adapter, 0x30C) & 0x0000FFFF; + return ReadRegDW(adapter, 0x30C) & 0x00001FFF; } -u32 PidGetGroupMASK(struct adapter * adapter) +static int PidGetGroupMASK(struct adapter * adapter) { - return ReadRegDW(adapter, 0x30C) >> 0x10; + return (ReadRegDW(adapter, 0x30C) >> 0x10)& 0x00001FFF; } -void ResetHardwarePIDFilter(struct adapter *adapter) +/* +static void ResetHardwarePIDFilter(struct adapter *adapter) { PidSetStream1PID(adapter, 0x1FFF); @@ -1273,8 +1291,9 @@ void ResetHardwarePIDFilter(struct adapter *adapter) PidSetEmmPID(adapter, 0x1FFF); FilterEnableEmmFilter(adapter, 0); } +*/ -void OpenWholeBandwidth(struct adapter *adapter) +static void OpenWholeBandwidth(struct adapter *adapter) { PidSetGroupPID(adapter, 0); @@ -1283,7 +1302,7 @@ void OpenWholeBandwidth(struct adapter *adapter) FilterEnableMaskFilter(adapter, 1); } -int AddHwPID(struct adapter *adapter, u32 pid) +static int AddHwPID(struct adapter *adapter, u32 pid) { dprintk("%s: pid=%d\n", __FUNCTION__, pid); @@ -1293,7 +1312,7 @@ int AddHwPID(struct adapter *adapter, u32 pid) if ((PidGetGroupMASK(adapter) == 0) && (PidGetGroupPID(adapter) == 0)) return 0; - if ((PidGetStream1PID(adapter) & 0x1FFF) == 0x1FFF) { + if (PidGetStream1PID(adapter) == 0x1FFF) { PidSetStream1PID(adapter, pid & 0xFFFF); FilterEnableStream1Filter(adapter, 1); @@ -1301,7 +1320,7 @@ int AddHwPID(struct adapter *adapter, u32 pid) return 1; } - if ((PidGetStream2PID(adapter) & 0x1FFF) == 0x1FFF) { + if (PidGetStream2PID(adapter) == 0x1FFF) { PidSetStream2PID(adapter, (pid & 0xFFFF)); FilterEnableStream2Filter(adapter, 1); @@ -1309,7 +1328,7 @@ int AddHwPID(struct adapter *adapter, u32 pid) return 1; } - if ((PidGetPcrPID(adapter) & 0x1FFF) == 0x1FFF) { + if (PidGetPcrPID(adapter) == 0x1FFF) { PidSetPcrPID(adapter, (pid & 0xFFFF)); FilterEnablePcrFilter(adapter, 1); @@ -1344,20 +1363,20 @@ int AddHwPID(struct adapter *adapter, u32 pid) return -1; } -int RemoveHwPID(struct adapter *adapter, u32 pid) +static int RemoveHwPID(struct adapter *adapter, u32 pid) { dprintk("%s: pid=%d\n", __FUNCTION__, pid); if (pid <= 0x1F) return 1; - if ((PidGetStream1PID(adapter) & 0x1FFF) == pid) { + if (PidGetStream1PID(adapter) == pid) { PidSetStream1PID(adapter, 0x1FFF); return 1; } - if ((PidGetStream2PID(adapter) & 0x1FFF) == pid) { + if (PidGetStream2PID(adapter) == pid) { PidSetStream2PID(adapter, 0x1FFF); FilterEnableStream2Filter(adapter, 0); @@ -1365,7 +1384,7 @@ int RemoveHwPID(struct adapter *adapter, u32 pid) return 1; } - if ((PidGetPcrPID(adapter) & 0x1FFF) == pid) { + if (PidGetPcrPID(adapter) == pid) { PidSetPcrPID(adapter, 0x1FFF); FilterEnablePcrFilter(adapter, 0); @@ -1373,7 +1392,7 @@ int RemoveHwPID(struct adapter *adapter, u32 pid) return 1; } - if ((PidGetPmtPID(adapter) & 0x1FFF) == pid) { + if (PidGetPmtPID(adapter) == pid) { PidSetPmtPID(adapter, 0x1FFF); FilterEnablePmtFilter(adapter, 0); @@ -1381,7 +1400,7 @@ int RemoveHwPID(struct adapter *adapter, u32 pid) return 1; } - if ((PidGetEmmPID(adapter) & 0x1FFF) == pid) { + if (PidGetEmmPID(adapter) == pid) { PidSetEmmPID(adapter, 0x1FFF); FilterEnableEmmFilter(adapter, 0); @@ -1389,7 +1408,7 @@ int RemoveHwPID(struct adapter *adapter, u32 pid) return 1; } - if ((PidGetEcmPID(adapter) & 0x1FFF) == pid) { + if (PidGetEcmPID(adapter) == pid) { PidSetEcmPID(adapter, 0x1FFF); FilterEnableEcmFilter(adapter, 0); @@ -1400,7 +1419,7 @@ int RemoveHwPID(struct adapter *adapter, u32 pid) return -1; } -int AddPID(struct adapter *adapter, u32 pid) +static int AddPID(struct adapter *adapter, u32 pid) { int i; @@ -1427,7 +1446,7 @@ int AddPID(struct adapter *adapter, u32 pid) return -1; } -int RemovePID(struct adapter *adapter, u32 pid) +static int RemovePID(struct adapter *adapter, u32 pid) { u32 i; @@ -1450,7 +1469,7 @@ int RemovePID(struct adapter *adapter, u32 pid) } /* dma & irq */ -void CtrlEnableSmc(struct adapter *adapter, u32 op) +static void CtrlEnableSmc(struct adapter *adapter, u32 op) { if (op == 0) { WriteRegOp(adapter, 0x208, 2, ~0x00000800, 0); @@ -1461,7 +1480,7 @@ void CtrlEnableSmc(struct adapter *adapter, u32 op) } } -u32 DmaEnableDisableIrq(struct adapter *adapter, u32 flag1, u32 flag2, u32 flag3) +static void DmaEnableDisableIrq(struct adapter *adapter, u32 flag1, u32 flag2, u32 flag3) { adapter->dma_ctrl = adapter->dma_ctrl & 0x000F0000; @@ -1488,11 +1507,9 @@ u32 DmaEnableDisableIrq(struct adapter *adapter, u32 flag1, u32 flag2, u32 flag3 else adapter->dma_ctrl = adapter->dma_ctrl | 0x00080000; } - - return adapter->dma_ctrl; } -u32 IrqDmaEnableDisableIrq(struct adapter * adapter, u32 op) +static void IrqDmaEnableDisableIrq(struct adapter * adapter, u32 op) { u32 value; @@ -1502,8 +1519,6 @@ u32 IrqDmaEnableDisableIrq(struct adapter * adapter, u32 op) value = value | (adapter->dma_ctrl & 0x000F0000); WriteRegDW(adapter, 0x208, value); - - return value; } /* FlexCopII has 2 dma channels. DMA1 is used to transfer TS data to @@ -1543,7 +1558,7 @@ u32 IrqDmaEnableDisableIrq(struct adapter * adapter, u32 op) register 0x018 contains the address of the subbuffer that was filled with TS data, when FlexCopII generates an interrupt. */ -int DmaInitDMA(struct adapter *adapter, u32 dma_channel) +static int DmaInitDMA(struct adapter *adapter, u32 dma_channel) { u32 subbuffers, subbufsize, subbuf0, subbuf1; @@ -1616,7 +1631,7 @@ int DmaInitDMA(struct adapter *adapter, u32 dma_channel) return 0; } -void CtrlEnableReceiveData(struct adapter *adapter, u32 op) +static void CtrlEnableReceiveData(struct adapter *adapter, u32 op) { if (op == 0) { WriteRegOp(adapter, 0x208, 2, ~0x00008000, 0); @@ -1634,7 +1649,7 @@ void CtrlEnableReceiveData(struct adapter *adapter, u32 op) /* bit 0 of dma_mask is set to 1 if dma1 channel has to be enabled/disabled bit 1 of dma_mask is set to 1 if dma2 channel has to be enabled/disabled */ -void DmaStartStop0x2102(struct adapter *adapter, u32 dma_mask, u32 start_stop) +static void DmaStartStop0x2102(struct adapter *adapter, u32 dma_mask, u32 start_stop) { u32 dma_enable, dma1_enable, dma2_enable; @@ -1724,7 +1739,7 @@ void DmaStartStop0x2102(struct adapter *adapter, u32 dma_mask, u32 start_stop) } } -void OpenStream(struct adapter *adapter, u32 pid) +static void OpenStream(struct adapter *adapter, u32 pid) { u32 dma_mask; @@ -1764,7 +1779,7 @@ void OpenStream(struct adapter *adapter, u32 pid) } } -void CloseStream(struct adapter *adapter, u32 pid) +static void CloseStream(struct adapter *adapter, u32 pid) { u32 dma_mask; @@ -1787,7 +1802,7 @@ void CloseStream(struct adapter *adapter, u32 pid) RemovePID(adapter, pid); } -u32 InterruptServiceDMA1(struct adapter *adapter) +static void InterruptServiceDMA1(struct adapter *adapter) { struct dvb_demux *dvbdmx = &adapter->demux; struct packet_header packet_header; @@ -1804,8 +1819,7 @@ u32 InterruptServiceDMA1(struct adapter *adapter) if ((nCurDmaCounter < 0) || (nCurDmaCounter > adapter->dmaq1.buffer_size)) { dprintk("%s: dma counter outside dma buffer\n", __FUNCTION__); - - return 1; + return; } adapter->dmaq1.head = nCurDmaCounter; @@ -1818,12 +1832,12 @@ u32 InterruptServiceDMA1(struct adapter *adapter) nNumNewBytesTransferred = (adapter->dmaq1.buffer_size - adapter->dmaq1.tail) + nCurDmaCounter; } -// dprintk("%s: nCurDmaCounter = %d\n" , __FUNCTION__, nCurDmaCounter); -// dprintk("%s: dmaq1.tail = %d\n" , __FUNCTION__, adapter->dmaq1.tail): -// dprintk("%s: BytesTransferred = %d\n" , __FUNCTION__, nNumNewBytesTransferred); +// dprintk("%s: nCurDmaCounter = %d\n" , __FUNCTION__, nCurDmaCounter); +// dprintk("%s: dmaq1.tail = %d\n" , __FUNCTION__, adapter->dmaq1.tail): +// dprintk("%s: BytesTransferred = %d\n" , __FUNCTION__, nNumNewBytesTransferred); if (nNumNewBytesTransferred < dwDefaultPacketSize) - return 0; + return; nNumBytesParsed = 0; @@ -1855,7 +1869,7 @@ u32 InterruptServiceDMA1(struct adapter *adapter) } else { -// dprintk("%s: pid=%x\n", __FUNCTION__, packet_header.pid); +// dprintk("%s: pid=%x\n", __FUNCTION__, packet_header.pid); } } } @@ -1867,22 +1881,20 @@ u32 InterruptServiceDMA1(struct adapter *adapter) if (adapter->dmaq1.tail >= adapter->dmaq1.buffer_size) adapter->dmaq1.tail = adapter->dmaq1.tail - adapter->dmaq1.buffer_size; }; - - return 1; } -void InterruptServiceDMA2(struct adapter *adapter) +static void InterruptServiceDMA2(struct adapter *adapter) { printk("%s:\n", __FUNCTION__); } -void isr(int irq, void *dev_id, struct pt_regs *regs) +static void isr(int irq, void *dev_id, struct pt_regs *regs) { struct adapter *tmp = dev_id; u32 value; -// dprintk("%s:\n", __FUNCTION__); +// dprintk("%s:\n", __FUNCTION__); spin_lock_irq(&tmp->lock); @@ -1897,7 +1909,7 @@ void isr(int irq, void *dev_id, struct pt_regs *regs) } -void Initdmaqueue(struct adapter *adapter) +static void Initdmaqueue(struct adapter *adapter) { dma_addr_t dma_addr; @@ -1954,7 +1966,7 @@ void Initdmaqueue(struct adapter *adapter) } } -void Freedmaqueue(struct adapter *adapter) +static void Freedmaqueue(struct adapter *adapter) { if (adapter->dmaq1.buffer != 0) { pci_free_consistent(adapter->pdev, SizeOfBufDMA1 + 0x80, adapter->dmaq1.buffer, adapter->dmaq1.bus_addr); @@ -1977,7 +1989,7 @@ void Freedmaqueue(struct adapter *adapter) } } -void FreeAdapterObject(struct adapter *adapter) +static void FreeAdapterObject(struct adapter *adapter) { dprintk("%s:\n", __FUNCTION__); @@ -1995,7 +2007,7 @@ void FreeAdapterObject(struct adapter *adapter) kfree(adapter); } -int ClaimAdapter(struct adapter *adapter) +static int ClaimAdapter(struct adapter *adapter) { struct pci_dev *pdev = adapter->pdev; @@ -2034,15 +2046,17 @@ int ClaimAdapter(struct adapter *adapter) return 1; } -int SLL_reset_FlexCOP(struct adapter *adapter) +/* +static int SLL_reset_FlexCOP(struct adapter *adapter) { WriteRegDW(adapter, 0x208, 0); WriteRegDW(adapter, 0x210, 0xB2FF); return 0; } +*/ -u32 DriverInitialize(struct pci_dev * pdev) +static int DriverInitialize(struct pci_dev * pdev) { struct adapter *adapter; u32 tmp; @@ -2064,7 +2078,7 @@ u32 DriverInitialize(struct pci_dev * pdev) if ((ClaimAdapter(adapter)) != 1) { FreeAdapterObject(adapter); - return 2; + return -ENODEV; } IrqDmaEnableDisableIrq(adapter, 0); @@ -2074,7 +2088,7 @@ u32 DriverInitialize(struct pci_dev * pdev) FreeAdapterObject(adapter); - return 2; + return -ENODEV; } ReadRegDW(adapter, 0x208); @@ -2098,19 +2112,19 @@ u32 DriverInitialize(struct pci_dev * pdev) if ((adapter->dma_status & 0x30000000) == 0) { FreeAdapterObject(adapter); - return 2; + return -ENODEV; } - adapter->B2C2_revision = (ReadRegDW(adapter, 0x204) >> 0x18); + adapter->b2c2_revision = (ReadRegDW(adapter, 0x204) >> 0x18); - if ((adapter->B2C2_revision != 0x82) && (adapter->B2C2_revision != 0xC3)) - if (adapter->B2C2_revision != 0x82) { - dprintk("%s: The revision of the FlexCopII chip on your card is - %d\n", __FUNCTION__, adapter->B2C2_revision); + if ((adapter->b2c2_revision != 0x82) && (adapter->b2c2_revision != 0xC3)) + if (adapter->b2c2_revision != 0x82) { + dprintk("%s: The revision of the FlexCopII chip on your card is - %d\n", __FUNCTION__, adapter->b2c2_revision); dprintk("%s: This driver works now only with FlexCopII(rev.130) and FlexCopIIB(rev.195).\n", __FUNCTION__); FreeAdapterObject(adapter); - return 2; + return -ENODEV; } tmp = ReadRegDW(adapter, 0x204); @@ -2154,10 +2168,10 @@ u32 DriverInitialize(struct pci_dev * pdev) adapter->lock = SPIN_LOCK_UNLOCKED; - return 1; + return 0; } -void DriverHalt(struct pci_dev *pdev) +static void DriverHalt(struct pci_dev *pdev) { struct adapter *adapter; @@ -2201,7 +2215,7 @@ static int dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) } /* lnb control */ -void set_tuner_tone(struct adapter *adapter, u8 tone) +static void set_tuner_tone(struct adapter *adapter, u8 tone) { u16 wzHalfPeriodFor45MHz[] = { 0x01FF, 0x0154, 0x00FF, 0x00CC }; u16 ax; @@ -2235,7 +2249,7 @@ void set_tuner_tone(struct adapter *adapter, u8 tone) } } -void set_tuner_polarity(struct adapter *adapter, u8 polarity) +static void set_tuner_polarity(struct adapter *adapter, u8 polarity) { u32 var; @@ -2353,7 +2367,7 @@ static int skystar2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (pdev == NULL) return -ENODEV; - if (DriverInitialize(pdev) != 1) + if (DriverInitialize(pdev) != 0) return -ENODEV; dvb_register_adapter(&dvb_adapter, pdev->name); |