aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/ttpci/ttpci-eeprom.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/ttpci/ttpci-eeprom.c')
-rw-r--r--drivers/media/dvb/ttpci/ttpci-eeprom.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/drivers/media/dvb/ttpci/ttpci-eeprom.c b/drivers/media/dvb/ttpci/ttpci-eeprom.c
index e9a8457b0727..18aa22b5478d 100644
--- a/drivers/media/dvb/ttpci/ttpci-eeprom.c
+++ b/drivers/media/dvb/ttpci/ttpci-eeprom.c
@@ -13,7 +13,7 @@
Holger Waechtler Convergence
Copyright (C) 2002-2003 Ralph Metzler <rjkm@metzlerbros.de>
- Metzler Brothers Systementwicklung GbR
+ Metzler Brothers Systementwicklung GbR
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -37,6 +37,7 @@
#include <linux/string.h>
#include <linux/i2c.h>
+#include "ttpci-eeprom.h"
#if 1
#define dprintk(x...) do { printk(x); } while (0)
@@ -47,41 +48,41 @@
static int check_mac_tt(u8 *buf)
{
- int i;
- u16 tmp = 0xffff;
-
- for (i = 0; i < 8; i++) {
- tmp = (tmp << 8) | ((tmp >> 8) ^ buf[i]);
- tmp ^= (tmp >> 4) & 0x0f;
- tmp ^= (tmp << 12) ^ ((tmp & 0xff) << 5);
- }
- tmp ^= 0xffff;
- return (((tmp >> 8) ^ buf[8]) | ((tmp & 0xff) ^ buf[9]));
+ int i;
+ u16 tmp = 0xffff;
+
+ for (i = 0; i < 8; i++) {
+ tmp = (tmp << 8) | ((tmp >> 8) ^ buf[i]);
+ tmp ^= (tmp >> 4) & 0x0f;
+ tmp ^= (tmp << 12) ^ ((tmp & 0xff) << 5);
+ }
+ tmp ^= 0xffff;
+ return (((tmp >> 8) ^ buf[8]) | ((tmp & 0xff) ^ buf[9]));
}
static int getmac_tt(u8 * decodedMAC, u8 * encodedMAC)
{
- u8 xor[20] = { 0x72, 0x23, 0x68, 0x19, 0x5c, 0xa8, 0x71, 0x2c,
+ u8 xor[20] = { 0x72, 0x23, 0x68, 0x19, 0x5c, 0xa8, 0x71, 0x2c,
0x54, 0xd3, 0x7b, 0xf1, 0x9E, 0x23, 0x16, 0xf6,
0x1d, 0x36, 0x64, 0x78};
- u8 data[20];
- int i;
+ u8 data[20];
+ int i;
/* In case there is a sig check failure have the orig contents available */
memcpy(data, encodedMAC, 20);
for (i = 0; i < 20; i++)
- data[i] ^= xor[i];
- for (i = 0; i < 10; i++)
- data[i] = ((data[2 * i + 1] << 8) | data[2 * i])
+ data[i] ^= xor[i];
+ for (i = 0; i < 10; i++)
+ data[i] = ((data[2 * i + 1] << 8) | data[2 * i])
>> ((data[2 * i + 1] >> 6) & 3);
- if (check_mac_tt(data))
- return -ENODEV;
+ if (check_mac_tt(data))
+ return -ENODEV;
decodedMAC[0] = data[2]; decodedMAC[1] = data[1]; decodedMAC[2] = data[0];
decodedMAC[3] = data[6]; decodedMAC[4] = data[5]; decodedMAC[5] = data[4];
- return 0;
+ return 0;
}
static int ttpci_eeprom_read_encodedMAC(struct i2c_adapter *adapter, u8 * encodedMAC)