summaryrefslogtreecommitdiff
path: root/linux/drivers
diff options
context:
space:
mode:
authorHans Verkuil <devnull@localhost>2005-11-27 00:43:58 +0000
committerHans Verkuil <devnull@localhost>2005-11-27 00:43:58 +0000
commitae1cd0f728289a46ce77e20d285526b01ff61c8f (patch)
treeb0c58467b81cb75c401c7d5e56c04dc5449440bb /linux/drivers
parentb378c9b9b9480ef6352bc5f37e30369dda75625e (diff)
downloadmediapointer-dvb-s2-ae1cd0f728289a46ce77e20d285526b01ff61c8f.tar.gz
mediapointer-dvb-s2-ae1cd0f728289a46ce77e20d285526b01ff61c8f.tar.bz2
Fix gcc-4.0.2 compile error in msp3400.c
Fix gcc-4.0.2 compile error in msp3400.c. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'linux/drivers')
-rw-r--r--linux/drivers/media/video/msp3400-driver.c372
-rw-r--r--linux/drivers/media/video/msp3400.c372
2 files changed, 372 insertions, 372 deletions
diff --git a/linux/drivers/media/video/msp3400-driver.c b/linux/drivers/media/video/msp3400-driver.c
index 626bd8860..bf31a0bd1 100644
--- a/linux/drivers/media/video/msp3400-driver.c
+++ b/linux/drivers/media/video/msp3400-driver.c
@@ -182,9 +182,6 @@ struct msp3400c {
#define MSP3400_MAX 4
static struct i2c_client *msps[MSP3400_MAX];
-/* defined at the end of the source */
-extern struct i2c_client client_template;
-
#define VIDEO_MODE_RADIO 16 /* norm magic for radio mode */
/* ---------------------------------------------------------------------- */
@@ -1595,189 +1592,6 @@ static void msp_wake_thread(struct i2c_client *client)
wake_up_interruptible(&msp->wq);
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-static int msp_attach(struct i2c_adapter *adap, int addr, int kind)
-#else
-static int msp_attach(struct i2c_adapter *adap, int addr, unsigned short flags, int kind)
-#endif
-{
- struct msp3400c *msp;
- struct i2c_client *client = &client_template;
- int (*thread_func)(void *data) = NULL;
- int i;
-
- client_template.adapter = adap;
- client_template.addr = addr;
-
- if (-1 == msp3400c_reset(&client_template)) {
- msp3400_dbg("no chip found\n");
- return -1;
- }
-
- if (NULL == (client = kmalloc(sizeof(struct i2c_client),GFP_KERNEL)))
- return -ENOMEM;
- memcpy(client,&client_template,sizeof(struct i2c_client));
- if (NULL == (msp = kmalloc(sizeof(struct msp3400c),GFP_KERNEL))) {
- kfree(client);
- return -ENOMEM;
- }
-
- memset(msp,0,sizeof(struct msp3400c));
- msp->norm = VIDEO_MODE_NTSC;
- msp->left = 58880; /* 0db gain */
- msp->right = 58880; /* 0db gain */
- msp->bass = 32768;
- msp->treble = 32768;
- msp->input = -1;
- msp->muted = 0;
- msp->i2s_mode = 0;
- for (i = 0; i < DFP_COUNT; i++)
- msp->dfp_regs[i] = -1;
-
- i2c_set_clientdata(client, msp);
- init_waitqueue_head(&msp->wq);
-
- if (-1 == msp3400c_reset(client)) {
- kfree(msp);
- kfree(client);
- msp3400_dbg("no chip found\n");
- return -1;
- }
-
- msp->rev1 = msp3400c_read(client, I2C_MSP3400C_DFP, 0x1e);
- if (-1 != msp->rev1)
- msp->rev2 = msp3400c_read(client, I2C_MSP3400C_DFP, 0x1f);
- if ((-1 == msp->rev1) || (0 == msp->rev1 && 0 == msp->rev2)) {
- kfree(msp);
- kfree(client);
- msp3400_dbg("error while reading chip version\n");
- return -1;
- }
- msp3400_dbg("rev1=0x%04x, rev2=0x%04x\n", msp->rev1, msp->rev2);
-
-#if 0
- /* this will turn on a 1kHz beep - might be useful for debugging... */
- msp3400c_write(client,I2C_MSP3400C_DFP, 0x0014, 0x1040);
-#endif
- msp3400c_setvolume(client, msp->muted, msp->left, msp->right);
-
- snprintf(client->name, sizeof(client->name), "MSP%c4%02d%c-%c%d",
- ((msp->rev1>>4)&0x0f) + '3',
- (msp->rev2>>8)&0xff, (msp->rev1&0x0f)+'@',
- ((msp->rev1>>8)&0xff)+'@', msp->rev2&0x1f);
-
- msp->opmode = opmode;
- if (OPMODE_AUTO == msp->opmode) {
- if (HAVE_SIMPLER(msp))
- msp->opmode = OPMODE_SIMPLER;
- else if (HAVE_SIMPLE(msp))
- msp->opmode = OPMODE_SIMPLE;
- else
- msp->opmode = OPMODE_MANUAL;
- }
-
- /* hello world :-) */
- msp3400_info("chip=%s", client->name);
- if (HAVE_NICAM(msp))
- printk(" +nicam");
- if (HAVE_SIMPLE(msp))
- printk(" +simple");
- if (HAVE_SIMPLER(msp))
- printk(" +simpler");
- if (HAVE_RADIO(msp))
- printk(" +radio");
-
- /* version-specific initialization */
- switch (msp->opmode) {
- case OPMODE_MANUAL:
- printk(" mode=manual");
- thread_func = msp3400c_thread;
- break;
- case OPMODE_SIMPLE:
- printk(" mode=simple");
- thread_func = msp3410d_thread;
- break;
- case OPMODE_SIMPLER:
- printk(" mode=simpler");
- thread_func = msp34xxg_thread;
- break;
- }
- printk("\n");
-
- /* startup control thread if needed */
- if (thread_func) {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
- msp->kthread = kthread_run(thread_func, client, "msp34xx");
-
- if (NULL == msp->kthread)
- msp3400_warn("kernel_thread() failed\n");
-#else
- /*FIXME: Not sure if this will work */
-
- msp->kthread = NULL;
- kernel_thread (thread_func, client, 0);
-#endif
- msp_wake_thread(client);
- }
-
- /* done */
- i2c_attach_client(client);
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- MOD_INC_USE_COUNT;
-#endif
- /* update our own array */
- for (i = 0; i < MSP3400_MAX; i++) {
- if (NULL == msps[i]) {
- msps[i] = client;
- break;
- }
- }
-
- return 0;
-}
-
-static int msp_detach(struct i2c_client *client)
-{
- struct msp3400c *msp = i2c_get_clientdata(client);
- int i;
-
- /* shutdown control thread */
- if (msp->kthread) {
- msp->restart = 1;
- kthread_stop(msp->kthread);
- }
- msp3400c_reset(client);
-
- /* update our own array */
- for (i = 0; i < MSP3400_MAX; i++) {
- if (client == msps[i]) {
- msps[i] = NULL;
- break;
- }
- }
-
- i2c_detach_client(client);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- MOD_DEC_USE_COUNT;
-#endif
-
- kfree(msp);
- kfree(client);
- return 0;
-}
-
-static int msp_probe(struct i2c_adapter *adap)
-{
-#ifdef I2C_CLASS_TV_ANALOG
- if (adap->class & I2C_CLASS_TV_ANALOG)
- return i2c_probe(adap, &addr_data, msp_attach);
- return 0;
-#else
- return i2c_probe(adap, &addr_data, msp_attach);
-#endif
-}
-
/* ----------------------------------------------------------------------- */
static int mode_v4l2_to_v4l1(int rxsubchans)
@@ -2246,6 +2060,9 @@ static int msp_resume(struct device * dev, u32 level)
#endif /* LINUX_VERSION_CODE */
/* ----------------------------------------------------------------------- */
+static int msp_probe(struct i2c_adapter *adap);
+static int msp_detach(struct i2c_client *client);
+
static struct i2c_driver driver = {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,54)
.owner = THIS_MODULE,
@@ -2271,6 +2088,189 @@ static struct i2c_client client_template =
.driver = &driver,
};
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+static int msp_attach(struct i2c_adapter *adap, int addr, int kind)
+#else
+static int msp_attach(struct i2c_adapter *adap, int addr, unsigned short flags, int kind)
+#endif
+{
+ struct msp3400c *msp;
+ struct i2c_client *client = &client_template;
+ int (*thread_func)(void *data) = NULL;
+ int i;
+
+ client_template.adapter = adap;
+ client_template.addr = addr;
+
+ if (-1 == msp3400c_reset(&client_template)) {
+ msp3400_dbg("no chip found\n");
+ return -1;
+ }
+
+ if (NULL == (client = kmalloc(sizeof(struct i2c_client),GFP_KERNEL)))
+ return -ENOMEM;
+ memcpy(client,&client_template,sizeof(struct i2c_client));
+ if (NULL == (msp = kmalloc(sizeof(struct msp3400c),GFP_KERNEL))) {
+ kfree(client);
+ return -ENOMEM;
+ }
+
+ memset(msp,0,sizeof(struct msp3400c));
+ msp->norm = VIDEO_MODE_NTSC;
+ msp->left = 58880; /* 0db gain */
+ msp->right = 58880; /* 0db gain */
+ msp->bass = 32768;
+ msp->treble = 32768;
+ msp->input = -1;
+ msp->muted = 0;
+ msp->i2s_mode = 0;
+ for (i = 0; i < DFP_COUNT; i++)
+ msp->dfp_regs[i] = -1;
+
+ i2c_set_clientdata(client, msp);
+ init_waitqueue_head(&msp->wq);
+
+ if (-1 == msp3400c_reset(client)) {
+ kfree(msp);
+ kfree(client);
+ msp3400_dbg("no chip found\n");
+ return -1;
+ }
+
+ msp->rev1 = msp3400c_read(client, I2C_MSP3400C_DFP, 0x1e);
+ if (-1 != msp->rev1)
+ msp->rev2 = msp3400c_read(client, I2C_MSP3400C_DFP, 0x1f);
+ if ((-1 == msp->rev1) || (0 == msp->rev1 && 0 == msp->rev2)) {
+ kfree(msp);
+ kfree(client);
+ msp3400_dbg("error while reading chip version\n");
+ return -1;
+ }
+ msp3400_dbg("rev1=0x%04x, rev2=0x%04x\n", msp->rev1, msp->rev2);
+
+#if 0
+ /* this will turn on a 1kHz beep - might be useful for debugging... */
+ msp3400c_write(client,I2C_MSP3400C_DFP, 0x0014, 0x1040);
+#endif
+ msp3400c_setvolume(client, msp->muted, msp->left, msp->right);
+
+ snprintf(client->name, sizeof(client->name), "MSP%c4%02d%c-%c%d",
+ ((msp->rev1>>4)&0x0f) + '3',
+ (msp->rev2>>8)&0xff, (msp->rev1&0x0f)+'@',
+ ((msp->rev1>>8)&0xff)+'@', msp->rev2&0x1f);
+
+ msp->opmode = opmode;
+ if (OPMODE_AUTO == msp->opmode) {
+ if (HAVE_SIMPLER(msp))
+ msp->opmode = OPMODE_SIMPLER;
+ else if (HAVE_SIMPLE(msp))
+ msp->opmode = OPMODE_SIMPLE;
+ else
+ msp->opmode = OPMODE_MANUAL;
+ }
+
+ /* hello world :-) */
+ msp3400_info("chip=%s", client->name);
+ if (HAVE_NICAM(msp))
+ printk(" +nicam");
+ if (HAVE_SIMPLE(msp))
+ printk(" +simple");
+ if (HAVE_SIMPLER(msp))
+ printk(" +simpler");
+ if (HAVE_RADIO(msp))
+ printk(" +radio");
+
+ /* version-specific initialization */
+ switch (msp->opmode) {
+ case OPMODE_MANUAL:
+ printk(" mode=manual");
+ thread_func = msp3400c_thread;
+ break;
+ case OPMODE_SIMPLE:
+ printk(" mode=simple");
+ thread_func = msp3410d_thread;
+ break;
+ case OPMODE_SIMPLER:
+ printk(" mode=simpler");
+ thread_func = msp34xxg_thread;
+ break;
+ }
+ printk("\n");
+
+ /* startup control thread if needed */
+ if (thread_func) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+ msp->kthread = kthread_run(thread_func, client, "msp34xx");
+
+ if (NULL == msp->kthread)
+ msp3400_warn("kernel_thread() failed\n");
+#else
+ /*FIXME: Not sure if this will work */
+
+ msp->kthread = NULL;
+ kernel_thread (thread_func, client, 0);
+#endif
+ msp_wake_thread(client);
+ }
+
+ /* done */
+ i2c_attach_client(client);
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+ MOD_INC_USE_COUNT;
+#endif
+ /* update our own array */
+ for (i = 0; i < MSP3400_MAX; i++) {
+ if (NULL == msps[i]) {
+ msps[i] = client;
+ break;
+ }
+ }
+
+ return 0;
+}
+
+static int msp_detach(struct i2c_client *client)
+{
+ struct msp3400c *msp = i2c_get_clientdata(client);
+ int i;
+
+ /* shutdown control thread */
+ if (msp->kthread) {
+ msp->restart = 1;
+ kthread_stop(msp->kthread);
+ }
+ msp3400c_reset(client);
+
+ /* update our own array */
+ for (i = 0; i < MSP3400_MAX; i++) {
+ if (client == msps[i]) {
+ msps[i] = NULL;
+ break;
+ }
+ }
+
+ i2c_detach_client(client);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+ MOD_DEC_USE_COUNT;
+#endif
+
+ kfree(msp);
+ kfree(client);
+ return 0;
+}
+
+static int msp_probe(struct i2c_adapter *adap)
+{
+#ifdef I2C_CLASS_TV_ANALOG
+ if (adap->class & I2C_CLASS_TV_ANALOG)
+ return i2c_probe(adap, &addr_data, msp_attach);
+ return 0;
+#else
+ return i2c_probe(adap, &addr_data, msp_attach);
+#endif
+}
+
static int __init msp3400_init_module(void)
{
return i2c_add_driver(&driver);
diff --git a/linux/drivers/media/video/msp3400.c b/linux/drivers/media/video/msp3400.c
index 626bd8860..bf31a0bd1 100644
--- a/linux/drivers/media/video/msp3400.c
+++ b/linux/drivers/media/video/msp3400.c
@@ -182,9 +182,6 @@ struct msp3400c {
#define MSP3400_MAX 4
static struct i2c_client *msps[MSP3400_MAX];
-/* defined at the end of the source */
-extern struct i2c_client client_template;
-
#define VIDEO_MODE_RADIO 16 /* norm magic for radio mode */
/* ---------------------------------------------------------------------- */
@@ -1595,189 +1592,6 @@ static void msp_wake_thread(struct i2c_client *client)
wake_up_interruptible(&msp->wq);
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-static int msp_attach(struct i2c_adapter *adap, int addr, int kind)
-#else
-static int msp_attach(struct i2c_adapter *adap, int addr, unsigned short flags, int kind)
-#endif
-{
- struct msp3400c *msp;
- struct i2c_client *client = &client_template;
- int (*thread_func)(void *data) = NULL;
- int i;
-
- client_template.adapter = adap;
- client_template.addr = addr;
-
- if (-1 == msp3400c_reset(&client_template)) {
- msp3400_dbg("no chip found\n");
- return -1;
- }
-
- if (NULL == (client = kmalloc(sizeof(struct i2c_client),GFP_KERNEL)))
- return -ENOMEM;
- memcpy(client,&client_template,sizeof(struct i2c_client));
- if (NULL == (msp = kmalloc(sizeof(struct msp3400c),GFP_KERNEL))) {
- kfree(client);
- return -ENOMEM;
- }
-
- memset(msp,0,sizeof(struct msp3400c));
- msp->norm = VIDEO_MODE_NTSC;
- msp->left = 58880; /* 0db gain */
- msp->right = 58880; /* 0db gain */
- msp->bass = 32768;
- msp->treble = 32768;
- msp->input = -1;
- msp->muted = 0;
- msp->i2s_mode = 0;
- for (i = 0; i < DFP_COUNT; i++)
- msp->dfp_regs[i] = -1;
-
- i2c_set_clientdata(client, msp);
- init_waitqueue_head(&msp->wq);
-
- if (-1 == msp3400c_reset(client)) {
- kfree(msp);
- kfree(client);
- msp3400_dbg("no chip found\n");
- return -1;
- }
-
- msp->rev1 = msp3400c_read(client, I2C_MSP3400C_DFP, 0x1e);
- if (-1 != msp->rev1)
- msp->rev2 = msp3400c_read(client, I2C_MSP3400C_DFP, 0x1f);
- if ((-1 == msp->rev1) || (0 == msp->rev1 && 0 == msp->rev2)) {
- kfree(msp);
- kfree(client);
- msp3400_dbg("error while reading chip version\n");
- return -1;
- }
- msp3400_dbg("rev1=0x%04x, rev2=0x%04x\n", msp->rev1, msp->rev2);
-
-#if 0
- /* this will turn on a 1kHz beep - might be useful for debugging... */
- msp3400c_write(client,I2C_MSP3400C_DFP, 0x0014, 0x1040);
-#endif
- msp3400c_setvolume(client, msp->muted, msp->left, msp->right);
-
- snprintf(client->name, sizeof(client->name), "MSP%c4%02d%c-%c%d",
- ((msp->rev1>>4)&0x0f) + '3',
- (msp->rev2>>8)&0xff, (msp->rev1&0x0f)+'@',
- ((msp->rev1>>8)&0xff)+'@', msp->rev2&0x1f);
-
- msp->opmode = opmode;
- if (OPMODE_AUTO == msp->opmode) {
- if (HAVE_SIMPLER(msp))
- msp->opmode = OPMODE_SIMPLER;
- else if (HAVE_SIMPLE(msp))
- msp->opmode = OPMODE_SIMPLE;
- else
- msp->opmode = OPMODE_MANUAL;
- }
-
- /* hello world :-) */
- msp3400_info("chip=%s", client->name);
- if (HAVE_NICAM(msp))
- printk(" +nicam");
- if (HAVE_SIMPLE(msp))
- printk(" +simple");
- if (HAVE_SIMPLER(msp))
- printk(" +simpler");
- if (HAVE_RADIO(msp))
- printk(" +radio");
-
- /* version-specific initialization */
- switch (msp->opmode) {
- case OPMODE_MANUAL:
- printk(" mode=manual");
- thread_func = msp3400c_thread;
- break;
- case OPMODE_SIMPLE:
- printk(" mode=simple");
- thread_func = msp3410d_thread;
- break;
- case OPMODE_SIMPLER:
- printk(" mode=simpler");
- thread_func = msp34xxg_thread;
- break;
- }
- printk("\n");
-
- /* startup control thread if needed */
- if (thread_func) {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
- msp->kthread = kthread_run(thread_func, client, "msp34xx");
-
- if (NULL == msp->kthread)
- msp3400_warn("kernel_thread() failed\n");
-#else
- /*FIXME: Not sure if this will work */
-
- msp->kthread = NULL;
- kernel_thread (thread_func, client, 0);
-#endif
- msp_wake_thread(client);
- }
-
- /* done */
- i2c_attach_client(client);
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- MOD_INC_USE_COUNT;
-#endif
- /* update our own array */
- for (i = 0; i < MSP3400_MAX; i++) {
- if (NULL == msps[i]) {
- msps[i] = client;
- break;
- }
- }
-
- return 0;
-}
-
-static int msp_detach(struct i2c_client *client)
-{
- struct msp3400c *msp = i2c_get_clientdata(client);
- int i;
-
- /* shutdown control thread */
- if (msp->kthread) {
- msp->restart = 1;
- kthread_stop(msp->kthread);
- }
- msp3400c_reset(client);
-
- /* update our own array */
- for (i = 0; i < MSP3400_MAX; i++) {
- if (client == msps[i]) {
- msps[i] = NULL;
- break;
- }
- }
-
- i2c_detach_client(client);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- MOD_DEC_USE_COUNT;
-#endif
-
- kfree(msp);
- kfree(client);
- return 0;
-}
-
-static int msp_probe(struct i2c_adapter *adap)
-{
-#ifdef I2C_CLASS_TV_ANALOG
- if (adap->class & I2C_CLASS_TV_ANALOG)
- return i2c_probe(adap, &addr_data, msp_attach);
- return 0;
-#else
- return i2c_probe(adap, &addr_data, msp_attach);
-#endif
-}
-
/* ----------------------------------------------------------------------- */
static int mode_v4l2_to_v4l1(int rxsubchans)
@@ -2246,6 +2060,9 @@ static int msp_resume(struct device * dev, u32 level)
#endif /* LINUX_VERSION_CODE */
/* ----------------------------------------------------------------------- */
+static int msp_probe(struct i2c_adapter *adap);
+static int msp_detach(struct i2c_client *client);
+
static struct i2c_driver driver = {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,54)
.owner = THIS_MODULE,
@@ -2271,6 +2088,189 @@ static struct i2c_client client_template =
.driver = &driver,
};
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+static int msp_attach(struct i2c_adapter *adap, int addr, int kind)
+#else
+static int msp_attach(struct i2c_adapter *adap, int addr, unsigned short flags, int kind)
+#endif
+{
+ struct msp3400c *msp;
+ struct i2c_client *client = &client_template;
+ int (*thread_func)(void *data) = NULL;
+ int i;
+
+ client_template.adapter = adap;
+ client_template.addr = addr;
+
+ if (-1 == msp3400c_reset(&client_template)) {
+ msp3400_dbg("no chip found\n");
+ return -1;
+ }
+
+ if (NULL == (client = kmalloc(sizeof(struct i2c_client),GFP_KERNEL)))
+ return -ENOMEM;
+ memcpy(client,&client_template,sizeof(struct i2c_client));
+ if (NULL == (msp = kmalloc(sizeof(struct msp3400c),GFP_KERNEL))) {
+ kfree(client);
+ return -ENOMEM;
+ }
+
+ memset(msp,0,sizeof(struct msp3400c));
+ msp->norm = VIDEO_MODE_NTSC;
+ msp->left = 58880; /* 0db gain */
+ msp->right = 58880; /* 0db gain */
+ msp->bass = 32768;
+ msp->treble = 32768;
+ msp->input = -1;
+ msp->muted = 0;
+ msp->i2s_mode = 0;
+ for (i = 0; i < DFP_COUNT; i++)
+ msp->dfp_regs[i] = -1;
+
+ i2c_set_clientdata(client, msp);
+ init_waitqueue_head(&msp->wq);
+
+ if (-1 == msp3400c_reset(client)) {
+ kfree(msp);
+ kfree(client);
+ msp3400_dbg("no chip found\n");
+ return -1;
+ }
+
+ msp->rev1 = msp3400c_read(client, I2C_MSP3400C_DFP, 0x1e);
+ if (-1 != msp->rev1)
+ msp->rev2 = msp3400c_read(client, I2C_MSP3400C_DFP, 0x1f);
+ if ((-1 == msp->rev1) || (0 == msp->rev1 && 0 == msp->rev2)) {
+ kfree(msp);
+ kfree(client);
+ msp3400_dbg("error while reading chip version\n");
+ return -1;
+ }
+ msp3400_dbg("rev1=0x%04x, rev2=0x%04x\n", msp->rev1, msp->rev2);
+
+#if 0
+ /* this will turn on a 1kHz beep - might be useful for debugging... */
+ msp3400c_write(client,I2C_MSP3400C_DFP, 0x0014, 0x1040);
+#endif
+ msp3400c_setvolume(client, msp->muted, msp->left, msp->right);
+
+ snprintf(client->name, sizeof(client->name), "MSP%c4%02d%c-%c%d",
+ ((msp->rev1>>4)&0x0f) + '3',
+ (msp->rev2>>8)&0xff, (msp->rev1&0x0f)+'@',
+ ((msp->rev1>>8)&0xff)+'@', msp->rev2&0x1f);
+
+ msp->opmode = opmode;
+ if (OPMODE_AUTO == msp->opmode) {
+ if (HAVE_SIMPLER(msp))
+ msp->opmode = OPMODE_SIMPLER;
+ else if (HAVE_SIMPLE(msp))
+ msp->opmode = OPMODE_SIMPLE;
+ else
+ msp->opmode = OPMODE_MANUAL;
+ }
+
+ /* hello world :-) */
+ msp3400_info("chip=%s", client->name);
+ if (HAVE_NICAM(msp))
+ printk(" +nicam");
+ if (HAVE_SIMPLE(msp))
+ printk(" +simple");
+ if (HAVE_SIMPLER(msp))
+ printk(" +simpler");
+ if (HAVE_RADIO(msp))
+ printk(" +radio");
+
+ /* version-specific initialization */
+ switch (msp->opmode) {
+ case OPMODE_MANUAL:
+ printk(" mode=manual");
+ thread_func = msp3400c_thread;
+ break;
+ case OPMODE_SIMPLE:
+ printk(" mode=simple");
+ thread_func = msp3410d_thread;
+ break;
+ case OPMODE_SIMPLER:
+ printk(" mode=simpler");
+ thread_func = msp34xxg_thread;
+ break;
+ }
+ printk("\n");
+
+ /* startup control thread if needed */
+ if (thread_func) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+ msp->kthread = kthread_run(thread_func, client, "msp34xx");
+
+ if (NULL == msp->kthread)
+ msp3400_warn("kernel_thread() failed\n");
+#else
+ /*FIXME: Not sure if this will work */
+
+ msp->kthread = NULL;
+ kernel_thread (thread_func, client, 0);
+#endif
+ msp_wake_thread(client);
+ }
+
+ /* done */
+ i2c_attach_client(client);
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+ MOD_INC_USE_COUNT;
+#endif
+ /* update our own array */
+ for (i = 0; i < MSP3400_MAX; i++) {
+ if (NULL == msps[i]) {
+ msps[i] = client;
+ break;
+ }
+ }
+
+ return 0;
+}
+
+static int msp_detach(struct i2c_client *client)
+{
+ struct msp3400c *msp = i2c_get_clientdata(client);
+ int i;
+
+ /* shutdown control thread */
+ if (msp->kthread) {
+ msp->restart = 1;
+ kthread_stop(msp->kthread);
+ }
+ msp3400c_reset(client);
+
+ /* update our own array */
+ for (i = 0; i < MSP3400_MAX; i++) {
+ if (client == msps[i]) {
+ msps[i] = NULL;
+ break;
+ }
+ }
+
+ i2c_detach_client(client);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+ MOD_DEC_USE_COUNT;
+#endif
+
+ kfree(msp);
+ kfree(client);
+ return 0;
+}
+
+static int msp_probe(struct i2c_adapter *adap)
+{
+#ifdef I2C_CLASS_TV_ANALOG
+ if (adap->class & I2C_CLASS_TV_ANALOG)
+ return i2c_probe(adap, &addr_data, msp_attach);
+ return 0;
+#else
+ return i2c_probe(adap, &addr_data, msp_attach);
+#endif
+}
+
static int __init msp3400_init_module(void)
{
return i2c_add_driver(&driver);