Commit 18d73c58 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

V4L/DVB (7638): CodingStyle fixes for au8522 and au0828

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent bbdf855b
...@@ -43,8 +43,12 @@ struct au8522_state { ...@@ -43,8 +43,12 @@ struct au8522_state {
}; };
static int debug = 0; static int debug;
#define dprintk if (debug) printk
#define dprintk(arg...) do { \
if (debug) \
printk(##arg); } \
} while (0)
/* 16 bit registers, 8 bit values */ /* 16 bit registers, 8 bit values */
static int au8522_writereg(struct au8522_state *state, u16 reg, u8 data) static int au8522_writereg(struct au8522_state *state, u16 reg, u8 data)
...@@ -284,7 +288,8 @@ static struct mse2snr_tab qam256_mse2snr_tab[] = { ...@@ -284,7 +288,8 @@ static struct mse2snr_tab qam256_mse2snr_tab[] = {
{ 256, 280 }, { 256, 280 },
}; };
static int au8522_mse2snr_lookup(struct mse2snr_tab *tab, int sz, int mse, u16 *snr) static int au8522_mse2snr_lookup(struct mse2snr_tab *tab, int sz, int mse,
u16 *snr)
{ {
int i, ret = -EINVAL; int i, ret = -EINVAL;
dprintk("%s()\n", __func__); dprintk("%s()\n", __func__);
...@@ -427,7 +432,7 @@ static int au8522_enable_modulation(struct dvb_frontend *fe, ...@@ -427,7 +432,7 @@ static int au8522_enable_modulation(struct dvb_frontend *fe,
dprintk("%s(0x%08x)\n", __func__, m); dprintk("%s(0x%08x)\n", __func__, m);
switch(m) { switch (m) {
case VSB_8: case VSB_8:
dprintk("%s() VSB_8\n", __func__); dprintk("%s() VSB_8\n", __func__);
for (i = 0; i < ARRAY_SIZE(VSB_mod_tab); i++) for (i = 0; i < ARRAY_SIZE(VSB_mod_tab); i++)
...@@ -469,9 +474,11 @@ static int au8522_set_frontend(struct dvb_frontend *fe, ...@@ -469,9 +474,11 @@ static int au8522_set_frontend(struct dvb_frontend *fe,
msleep(100); msleep(100);
if (fe->ops.tuner_ops.set_params) { if (fe->ops.tuner_ops.set_params) {
if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
fe->ops.tuner_ops.set_params(fe, p); fe->ops.tuner_ops.set_params(fe, p);
if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 0);
} }
return 0; return 0;
...@@ -515,7 +522,7 @@ static int au8522_read_status(struct dvb_frontend *fe, fe_status_t *status) ...@@ -515,7 +522,7 @@ static int au8522_read_status(struct dvb_frontend *fe, fe_status_t *status)
*status |= FE_HAS_LOCK | FE_HAS_SYNC; *status |= FE_HAS_LOCK | FE_HAS_SYNC;
} }
switch(state->config->status_mode) { switch (state->config->status_mode) {
case AU8522_DEMODLOCKING: case AU8522_DEMODLOCKING:
dprintk("%s() DEMODLOCKING\n", __func__); dprintk("%s() DEMODLOCKING\n", __func__);
if (*status & FE_HAS_VITERBI) if (*status & FE_HAS_VITERBI)
...@@ -651,6 +658,7 @@ error: ...@@ -651,6 +658,7 @@ error:
kfree(state); kfree(state);
return NULL; return NULL;
} }
EXPORT_SYMBOL(au8522_attach);
static struct dvb_frontend_ops au8522_ops = { static struct dvb_frontend_ops au8522_ops = {
...@@ -682,10 +690,3 @@ MODULE_PARM_DESC(debug, "Enable verbose debug messages"); ...@@ -682,10 +690,3 @@ MODULE_PARM_DESC(debug, "Enable verbose debug messages");
MODULE_DESCRIPTION("Auvitek AU8522 QAM-B/ATSC Demodulator driver"); MODULE_DESCRIPTION("Auvitek AU8522 QAM-B/ATSC Demodulator driver");
MODULE_AUTHOR("Steven Toth"); MODULE_AUTHOR("Steven Toth");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
EXPORT_SYMBOL(au8522_attach);
/*
* Local variables:
* c-basic-offset: 8
*/
...@@ -24,8 +24,7 @@ ...@@ -24,8 +24,7 @@
#include <linux/dvb/frontend.h> #include <linux/dvb/frontend.h>
struct au8522_config struct au8522_config {
{
/* the demodulator's i2c address */ /* the demodulator's i2c address */
u8 demod_address; u8 demod_address;
...@@ -35,7 +34,8 @@ struct au8522_config ...@@ -35,7 +34,8 @@ struct au8522_config
u8 status_mode; u8 status_mode;
}; };
#if defined(CONFIG_DVB_AU8522) || (defined(CONFIG_DVB_AU8522_MODULE) && defined(MODULE)) #if defined(CONFIG_DVB_AU8522) || \
(defined(CONFIG_DVB_AU8522_MODULE) && defined(MODULE))
extern struct dvb_frontend *au8522_attach(const struct au8522_config *config, extern struct dvb_frontend *au8522_attach(const struct au8522_config *config,
struct i2c_adapter *i2c); struct i2c_adapter *i2c);
#else #else
......
...@@ -47,7 +47,7 @@ int au0828_tuner_callback(void *priv, int command, int arg) ...@@ -47,7 +47,7 @@ int au0828_tuner_callback(void *priv, int command, int arg)
dprintk(1, "%s()\n", __func__); dprintk(1, "%s()\n", __func__);
switch(dev->board) { switch (dev->board) {
case AU0828_BOARD_HAUPPAUGE_HVR850: case AU0828_BOARD_HAUPPAUGE_HVR850:
case AU0828_BOARD_HAUPPAUGE_HVR950Q: case AU0828_BOARD_HAUPPAUGE_HVR950Q:
case AU0828_BOARD_DVICO_FUSIONHDTV7: case AU0828_BOARD_DVICO_FUSIONHDTV7:
...@@ -59,8 +59,7 @@ int au0828_tuner_callback(void *priv, int command, int arg) ...@@ -59,8 +59,7 @@ int au0828_tuner_callback(void *priv, int command, int arg)
au0828_set(dev, REG_001, 2); au0828_set(dev, REG_001, 2);
mdelay(50); mdelay(50);
return 0; return 0;
} } else {
else {
printk(KERN_ERR printk(KERN_ERR
"%s(): Unknown command.\n", __func__); "%s(): Unknown command.\n", __func__);
return -EINVAL; return -EINVAL;
...@@ -103,7 +102,7 @@ void au0828_card_setup(struct au0828_dev *dev) ...@@ -103,7 +102,7 @@ void au0828_card_setup(struct au0828_dev *dev)
tveeprom_read(&dev->i2c_client, eeprom, sizeof(eeprom)); tveeprom_read(&dev->i2c_client, eeprom, sizeof(eeprom));
} }
switch(dev->board) { switch (dev->board) {
case AU0828_BOARD_HAUPPAUGE_HVR850: case AU0828_BOARD_HAUPPAUGE_HVR850:
case AU0828_BOARD_HAUPPAUGE_HVR950Q: case AU0828_BOARD_HAUPPAUGE_HVR950Q:
if (dev->i2c_rc == 0) if (dev->i2c_rc == 0)
...@@ -121,7 +120,7 @@ void au0828_gpio_setup(struct au0828_dev *dev) ...@@ -121,7 +120,7 @@ void au0828_gpio_setup(struct au0828_dev *dev)
{ {
dprintk(1, "%s()\n", __func__); dprintk(1, "%s()\n", __func__);
switch(dev->board) { switch (dev->board) {
case AU0828_BOARD_HAUPPAUGE_HVR850: case AU0828_BOARD_HAUPPAUGE_HVR850:
case AU0828_BOARD_HAUPPAUGE_HVR950Q: case AU0828_BOARD_HAUPPAUGE_HVR950Q:
/* GPIO's /* GPIO's
......
...@@ -32,15 +32,15 @@ ...@@ -32,15 +32,15 @@
* 4 = I2C related * 4 = I2C related
* 8 = Bridge related * 8 = Bridge related
*/ */
unsigned int debug = 0; unsigned int debug;
module_param(debug, int, 0644); module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "enable debug messages"); MODULE_PARM_DESC(debug, "enable debug messages");
unsigned int usb_debug = 0; unsigned int usb_debug;
module_param(usb_debug, int, 0644); module_param(usb_debug, int, 0644);
MODULE_PARM_DESC(usb_debug, "enable usb debug messages"); MODULE_PARM_DESC(usb_debug, "enable usb debug messages");
unsigned int bridge_debug = 0; unsigned int bridge_debug;
module_param(bridge_debug, int, 0644); module_param(bridge_debug, int, 0644);
MODULE_PARM_DESC(bridge_debug, "enable bridge debug messages"); MODULE_PARM_DESC(bridge_debug, "enable bridge debug messages");
...@@ -66,16 +66,17 @@ u32 au0828_readreg(struct au0828_dev *dev, u16 reg) ...@@ -66,16 +66,17 @@ u32 au0828_readreg(struct au0828_dev *dev, u16 reg)
u32 au0828_writereg(struct au0828_dev *dev, u16 reg, u32 val) u32 au0828_writereg(struct au0828_dev *dev, u16 reg, u32 val)
{ {
dprintk(8, "%s(0x%x, 0x%x)\n", __func__, reg, val); dprintk(8, "%s(0x%x, 0x%x)\n", __func__, reg, val);
return send_control_msg(dev, CMD_REQUEST_OUT, val, reg, dev->ctrlmsg, 0); return send_control_msg(dev, CMD_REQUEST_OUT, val, reg,
dev->ctrlmsg, 0);
} }
static void cmd_msg_dump(struct au0828_dev *dev) static void cmd_msg_dump(struct au0828_dev *dev)
{ {
int i; int i;
for (i = 0;i < sizeof(dev->ctrlmsg); i+=16) for (i = 0; i < sizeof(dev->ctrlmsg); i += 16)
dprintk(2,"%s() %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x " dprintk(2, "%s() %02x %02x %02x %02x %02x %02x %02x %02x "
"%02x %02x %02x %02x %02x %02x\n", "%02x %02x %02x %02x %02x %02x %02x %02x\n",
__func__, __func__,
dev->ctrlmsg[i+0], dev->ctrlmsg[i+1], dev->ctrlmsg[i+0], dev->ctrlmsg[i+1],
dev->ctrlmsg[i+2], dev->ctrlmsg[i+3], dev->ctrlmsg[i+2], dev->ctrlmsg[i+3],
...@@ -136,8 +137,7 @@ static int recv_control_msg(struct au0828_dev *dev, u16 request, u32 value, ...@@ -136,8 +137,7 @@ static int recv_control_msg(struct au0828_dev *dev, u16 request, u32 value,
if (status < 0) { if (status < 0) {
printk(KERN_ERR "%s() Failed receiving control message, error %d.\n", printk(KERN_ERR "%s() Failed receiving control message, error %d.\n",
__func__, status); __func__, status);
} } else
else
cmd_msg_dump(dev); cmd_msg_dump(dev);
} }
mutex_unlock(&dev->mutex); mutex_unlock(&dev->mutex);
...@@ -166,7 +166,7 @@ static void au0828_usb_disconnect(struct usb_interface *interface) ...@@ -166,7 +166,7 @@ static void au0828_usb_disconnect(struct usb_interface *interface)
} }
static int au0828_usb_probe (struct usb_interface *interface, static int au0828_usb_probe(struct usb_interface *interface,
const struct usb_device_id *id) const struct usb_device_id *id)
{ {
int ifnum; int ifnum;
......
...@@ -111,9 +111,8 @@ static int start_urb_transfer(struct au0828_dev *dev) ...@@ -111,9 +111,8 @@ static int start_urb_transfer(struct au0828_dev *dev)
for (i = 0; i < URB_COUNT; i++) { for (i = 0; i < URB_COUNT; i++) {
dev->urbs[i] = usb_alloc_urb(0, GFP_KERNEL); dev->urbs[i] = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->urbs[i]) { if (!dev->urbs[i])
goto err; goto err;
}
purb = dev->urbs[i]; purb = dev->urbs[i];
......
...@@ -23,17 +23,17 @@ ...@@ -23,17 +23,17 @@
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <asm/io.h> #include <linux/io.h>
#include "au0828.h" #include "au0828.h"
#include <media/v4l2-common.h> #include <media/v4l2-common.h>
unsigned int i2c_debug = 0; unsigned int i2c_debug;
module_param(i2c_debug, int, 0444); module_param(i2c_debug, int, 0444);
MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");
unsigned int i2c_scan = 0; unsigned int i2c_scan;
module_param(i2c_scan, int, 0444); module_param(i2c_scan, int, 0444);
MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time"); MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time");
...@@ -323,9 +323,9 @@ static struct i2c_client au0828_i2c_client_template = { ...@@ -323,9 +323,9 @@ static struct i2c_client au0828_i2c_client_template = {
}; };
static char *i2c_devs[128] = { static char *i2c_devs[128] = {
[ 0x8e >> 1 ] = "au8522", [0x8e >> 1] = "au8522",
[ 0xa0 >> 1 ] = "eeprom", [0xa0 >> 1] = "eeprom",
[ 0xc2 >> 1 ] = "tuner/xc5000", [0xc2 >> 1] = "tuner/xc5000",
}; };
static void do_i2c_scan(char *name, struct i2c_client *c) static void do_i2c_scan(char *name, struct i2c_client *c)
...@@ -338,7 +338,7 @@ static void do_i2c_scan(char *name, struct i2c_client *c) ...@@ -338,7 +338,7 @@ static void do_i2c_scan(char *name, struct i2c_client *c)
rc = i2c_master_recv(c, &buf, 0); rc = i2c_master_recv(c, &buf, 0);
if (rc < 0) if (rc < 0)
continue; continue;
printk("%s: i2c scan: found device @ 0x%x [%s]\n", printk(KERN_INFO "%s: i2c scan: found device @ 0x%x [%s]\n",
name, i << 1, i2c_devs[i] ? i2c_devs[i] : "???"); name, i << 1, i2c_devs[i] ? i2c_devs[i] : "???");
} }
} }
...@@ -368,11 +368,11 @@ int au0828_i2c_register(struct au0828_dev *dev) ...@@ -368,11 +368,11 @@ int au0828_i2c_register(struct au0828_dev *dev)
dev->i2c_client.adapter = &dev->i2c_adap; dev->i2c_client.adapter = &dev->i2c_adap;
if (0 == dev->i2c_rc) { if (0 == dev->i2c_rc) {
printk("%s: i2c bus registered\n", DRIVER_NAME); printk(KERN_INFO "%s: i2c bus registered\n", DRIVER_NAME);
if (i2c_scan) if (i2c_scan)
do_i2c_scan(DRIVER_NAME, &dev->i2c_client); do_i2c_scan(DRIVER_NAME, &dev->i2c_client);
} else } else
printk("%s: i2c bus register FAILED\n", DRIVER_NAME); printk(KERN_INFO "%s: i2c bus register FAILED\n", DRIVER_NAME);
return dev->i2c_rc; return dev->i2c_rc;
} }
......
...@@ -83,13 +83,14 @@ struct au0828_buff { ...@@ -83,13 +83,14 @@ struct au0828_buff {
}; };
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
#define au0828_read(dev,reg) au0828_readreg(dev,reg) #define au0828_read(dev, reg) au0828_readreg(dev, reg)
#define au0828_write(dev,reg,value) au0828_writereg(dev,reg,value) #define au0828_write(dev, reg, value) au0828_writereg(dev, reg, value)
#define au0828_andor(dev,reg,mask,value) \ #define au0828_andor(dev, reg, mask, value) \
au0828_writereg(dev,reg,(au0828_readreg(dev,reg)&~(mask))|((value)&(mask))) au0828_writereg(dev, reg, \
(au0828_readreg(dev, reg) & ~(mask)) | ((value) & (mask)))
#define au0828_set(dev,reg,bit) au0828_andor(dev,(reg),(bit),(bit))
#define au0828_clear(dev,reg,bit) au0828_andor(dev,(reg),(bit),0) #define au0828_set(dev, reg, bit) au0828_andor(dev, (reg), (bit), (bit))
#define au0828_clear(dev, reg, bit) au0828_andor(dev, (reg), (bit), 0)
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
/* au0828-core.c */ /* au0828-core.c */
......
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