summaryrefslogtreecommitdiff
path: root/linux/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers')
-rw-r--r--linux/drivers/media/dvb/ttpci/ttpci-eeprom.c57
-rw-r--r--linux/drivers/media/dvb/ttpci/ttpci-eeprom.h4
2 files changed, 30 insertions, 31 deletions
diff --git a/linux/drivers/media/dvb/ttpci/ttpci-eeprom.c b/linux/drivers/media/dvb/ttpci/ttpci-eeprom.c
index 188de32bb..6ce63a666 100644
--- a/linux/drivers/media/dvb/ttpci/ttpci-eeprom.c
+++ b/linux/drivers/media/dvb/ttpci/ttpci-eeprom.c
@@ -29,7 +29,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+*/
#include <asm/errno.h>
#include <linux/init.h>
@@ -46,50 +46,51 @@
#endif
-static
-int ttpci_eeprom_read_encodedMAC (struct dvb_i2c_bus *i2c, u8 * encodedMAC )
+static int ttpci_eeprom_read_encodedMAC(struct dvb_i2c_bus *i2c, u8 * encodedMAC)
{
int ret;
- u8 b0 [] = { 0xd4 };
- struct i2c_msg msg [] = { { addr: 0x50, flags: 0, buf: b0, len: 1 },
- { addr: 0x50, flags: I2C_M_RD, buf: encodedMAC, len: 6 } };
+ u8 b0[] = { 0xd4 };
- dprintk ("%s\n", __FUNCTION__);
+ struct i2c_msg msg[] = {
+ {.addr = 0x50,.flags = 0,.buf = b0,.len = 1},
+ {.addr = 0x50,.flags = I2C_M_RD,.buf = encodedMAC,.len = 6}
+ };
- ret = i2c->xfer (i2c, msg, 2);
+ dprintk("%s\n", __FUNCTION__);
- if (ret != 2) // Assume EEPROM isn't there
- return( -ENODEV );
+ ret = i2c->xfer(i2c, msg, 2);
+
+ if (ret != 2) /* Assume EEPROM isn't there */
+ return (-ENODEV);
return 0;
}
-static
-void decodeMAC (u8 *decodedMAC, const u8* encodedMAC)
+static void decodeMAC(u8 * decodedMAC, const u8 * encodedMAC)
{
u8 ormask0[3] = { 0x54, 0x7B, 0x9E };
- u8 ormask1[3] = { 0xD3, 0xF1, 0x23 };
+ u8 ormask1[3] = { 0xD3, 0xF1, 0x23 };
u8 low;
u8 high;
u8 shift;
int i;
decodedMAC[0] = 0x00;
- decodedMAC[1] = 0xD0;
- decodedMAC[2] = 0x5C;
+ decodedMAC[1] = 0xD0;
+ decodedMAC[2] = 0x5C;
- for (i=0; i<3; i++) {
- low = encodedMAC[ 2*i ] ^ ormask0[i];
- high = encodedMAC[ 2*i+1 ] ^ ormask1[i];
- shift = ( high >> 6 ) & 0x3;
+ for (i = 0; i < 3; i++) {
+ low = encodedMAC[2 * i] ^ ormask0[i];
+ high = encodedMAC[2 * i + 1] ^ ormask1[i];
+ shift = (high >> 6) & 0x3;
- decodedMAC[5-i] = ((high<<8) | low) >> shift;
+ decodedMAC[5 - i] = ((high << 8) | low) >> shift;
}
}
-int ttpci_eeprom_parse_mac (struct dvb_i2c_bus *i2c)
+int ttpci_eeprom_parse_mac(struct dvb_i2c_bus *i2c)
{
int ret;
u8 encodedMAC[6];
@@ -97,9 +98,9 @@ int ttpci_eeprom_parse_mac (struct dvb_i2c_bus *i2c)
ret = ttpci_eeprom_read_encodedMAC(i2c, encodedMAC);
- if (ret != 0) { // Will only be -ENODEV
+ if (ret != 0) { /* Will only be -ENODEV */
dprintk("Couldn't read from EEPROM: not there?\n");
- memset(i2c->adapter->proposed_mac, 0, 6);
+ memset(i2c->adapter->proposed_mac, 0, 6);
return ret;
}
@@ -108,12 +109,10 @@ int ttpci_eeprom_parse_mac (struct dvb_i2c_bus *i2c)
dprintk("%s adapter %i has MAC addr = %02x:%02x:%02x:%02x:%02x:%02x\n",
i2c->adapter->name, i2c->adapter->num,
- decodedMAC[0],decodedMAC[1],decodedMAC[2],
- decodedMAC[3],decodedMAC[4],decodedMAC[5]);
+ decodedMAC[0], decodedMAC[1], decodedMAC[2],
+ decodedMAC[3], decodedMAC[4], decodedMAC[5]);
dprintk("encoded MAC was %02x:%02x:%02x:%02x:%02x:%02x\n",
- encodedMAC[0],encodedMAC[1],encodedMAC[2],
- encodedMAC[3],encodedMAC[4],encodedMAC[5]);
+ encodedMAC[0], encodedMAC[1], encodedMAC[2],
+ encodedMAC[3], encodedMAC[4], encodedMAC[5]);
return 0;
}
-
-
diff --git a/linux/drivers/media/dvb/ttpci/ttpci-eeprom.h b/linux/drivers/media/dvb/ttpci/ttpci-eeprom.h
index 66cb85ced..48df7ce53 100644
--- a/linux/drivers/media/dvb/ttpci/ttpci-eeprom.h
+++ b/linux/drivers/media/dvb/ttpci/ttpci-eeprom.h
@@ -20,13 +20,13 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+*/
#ifndef __TTPCI_EEPROM_H__
#define __TTPCI_EEPROM_H__
#include "dvb_i2c.h"
-extern int ttpci_eeprom_parse_mac (struct dvb_i2c_bus *i2c);
+extern int ttpci_eeprom_parse_mac(struct dvb_i2c_bus *i2c);
#endif