Hi Micheal,

Attached you'll find my suggestions to your current tree.

Patrick.

On Tue, 26 Sep 2006, Michael Krufky wrote:

> Patrick,
> 
> Could you look over the changesets in this tree and let me know whether
> or not you approve of this?
> 
> Aapo,
> 
> After you sent your patch in to the linux-dvb mailing list, Patrick had
> some comments and requests for certain things to be cleaned up.  I have
> not seen any response from you about those requests.
> 
> In an effort to move things along, I have taken it upon myself to clean
> up your patch.  I've updated it to comply with some of the recent
> changes in the dvb-usb structure, and to use the new dvb_attach() method.
> 
> I have also separated the qt1010 tuner code into a separate header file.
>  It has come to my attention, thanks to Markus Rechberger, that there
> may be more fixing to do with regards to the qt1010 stuff... but that
> can be done later, in a separate patch.
> 
> I'd like it if you could test the updated tree and confirm that it works
> as expected with your device.  Please clone the following tree:
> 
> http://linuxtv.org/hg/~mkrufky/m920x
> 
> You will notice that I have decided to rename the driver from megasky to
> m920x -- I did this for a few reasons:
> 
> 1) There are probably other devices out there based on the m9205, m9206
> and m9207 chipsets ... Adding support for those devices will probably be
> a matter of updating the code in this driver, in which case, the name
> 'megasky' may be inappropriate.
> 
> 2) There is another device out there, called "MSI Megasky 580", based on
> the gl861 chipset, using the same exact usb id as your device based on
> the m9206 chipset.  This means that MSI released two completely
> different devices, each with the same exact name and USB ID!
> 
> 3) We should name the driver based on the chipset it uses, rather than
> the Vendor's retail name of the product.
> 
> Please let me know what happens.
> 
> Regards,
> 
> Michael Krufky
> 
diff -r f955dadfe5bc linux/drivers/media/dvb/dvb-usb/m920x.c
--- a/linux/drivers/media/dvb/dvb-usb/m920x.c   Sat Sep 23 19:40:20 2006 -0400
+++ b/linux/drivers/media/dvb/dvb-usb/m920x.c   Wed Sep 27 13:14:03 2006 +0200
@@ -9,16 +9,19 @@
  * see Documentation/dvb/README.dvb-usb for more information
  */
 
-#include "m920x.h"
+#define DVB_USB_LOG_PREFIX "m920x"
+#include "dvb-usb.h"
 
 #include "mt352.h"
-#include "mt352_priv.h"
+#include "mt352_priv.h" /* really?? there is priv in the name, I thought it 
means private :) */
 #include "qt1010.h"
 
 /* debug */
-int dvb_usb_m920x_debug;
+static int dvb_usb_m920x_debug;
 module_param_named(debug,dvb_usb_m920x_debug, int, 0644);
 MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." 
DVB_USB_DEBUG_STATUS);
+
+#define deb_rc(args...)   dprintk(dvb_usb_m920x_debug,0x01,args)
 
 static struct dvb_usb_rc_key megasky_rc_keys [] = {
        { 0x0, 0x12, KEY_POWER },
@@ -72,7 +75,7 @@ static int m9206_rc_query(struct dvb_usb
        int i, ret = 0;
        u8 rc_state[2];
 
-       if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
+       if (mutex_lock_interruptible(&d->i2c_mutex) < 0) /* I'm not sure about 
using the i2c_mutex here is a good idea - maybe it is better to create 
m920x_state and put a device-specific mutex or use the usb_mutex from 
dvb_usb_device */
                return -EAGAIN;
 
        if ((ret = m9206_read(d->udev, 0x22, 0x0, 0xff51, rc_state, 1)) != 0)
@@ -141,7 +144,7 @@ static int m9206_i2c_xfer(struct i2c_ada
                        goto unlock;
 
                if (i + 1 < num && msg[i + 1].flags & I2C_M_RD) {
-                       if (msg[i].addr == 0x1e)
+                       if (msg[i].addr == 0x1e) // This screams for a comment 
or for another solution.
                                w_len = 0x1f;
                        else
                                w_len = 0xc5;
@@ -225,8 +228,6 @@ static int megasky_mt352_demod_init(stru
        return 0;
 }
 
-struct mt352_state;
-
 static struct mt352_config megasky_mt352_config = {
        .demod_address = 0x1e,
        .demod_init = megasky_mt352_demod_init,
@@ -243,47 +244,7 @@ static int megasky_frontend_attach(struc
        return -EIO;
 }
 
-/* DVB USB Driver stuff */
-static struct dvb_usb_device_properties megasky_properties;
-
-static int m920x_probe(struct usb_interface *intf, const struct usb_device_id 
*id)
-{
-       struct dvb_usb_device *d;
-       struct usb_host_interface *alt;
-       int ret;
-
-       if ((ret = dvb_usb_device_init(intf, &megasky_properties, THIS_MODULE, 
&d)) == 0) {
-               deb_rc("probed!\n");
-
-               alt = usb_altnum_to_altsetting(intf, 1);
-               if (alt == NULL) {
-                       deb_rc("not alt found!\n");
-                       return -ENODEV;
-               }
-
-               ret = usb_set_interface(d->udev, alt->desc.bInterfaceNumber, 
alt->desc.bAlternateSetting);
-               if (ret < 0)
-                       return ret;
-
-               deb_rc("Changed to alternate setting!\n");
-
-               /* Remote controller init. */
-               if ((ret = m9206_write(d->udev, 0x22, 0xa8, 0xff55)) != 0)
-                       return ret;
-
-               if ((ret = m9206_write(d->udev, 0x22, 0x51, 0xff54)) != 0)
-                       return ret;
-       }
-       return ret;
-}
-
-static struct usb_device_id m920x_table [] = {
-               { USB_DEVICE(USB_VID_MSI, USB_PID_MSI_MEGASKY580) },
-               { }             /* Terminating entry */
-};
-MODULE_DEVICE_TABLE (usb, m920x_table);
-
-static int set_filter(struct dvb_usb_adapter *adap, int type, int idx, int pid)
+static int m9206_set_filter(struct dvb_usb_adapter *adap, int type, int idx, 
int pid)
 {
        int ret = 0;
 
@@ -310,10 +271,10 @@ static int m9206_pid_filter_ctrl(struct 
 
        deb_rc("filtering %s\n", onoff ? "on" : "off");
        if (onoff == 0) {
-               if ((ret = set_filter(adap, 0x81, 1, 0x00)) != 0)
+               if ((ret = m9206_set_filter(adap, 0x81, 1, 0x00)) != 0)
                        goto unlock;
 
-               if ((ret = set_filter(adap, 0x82, 0, 0x02f5)) != 0)
+               if ((ret = m9206_set_filter(adap, 0x82, 0, 0x02f5)) != 0)
                        goto unlock;
        }
        unlock:
@@ -326,7 +287,7 @@ static int m9206_pid_filter(struct dvb_u
 {
        int ret = 0;
 
-       if (pid == 8192)
+       if (pid == 8192) /* handling this special PID should be in dvb-usb-dvb 
and should call the pid_filter_ctrl-ops */
                return m9206_pid_filter_ctrl(adap, !onoff);
 
        if (mutex_lock_interruptible(&adap->dev->i2c_mutex) < 0)
@@ -336,13 +297,13 @@ static int m9206_pid_filter(struct dvb_u
        if (onoff == 0)
                pid = 0;
 
-       if ((ret = set_filter(adap, 0x81, 1, 0x01)) != 0)
-               goto unlock;
-
-       if ((ret = set_filter(adap, 0x81, index + 2, pid)) != 0)
-               goto unlock;
-
-       if ((ret = set_filter(adap, 0x82, 0, 0x02f5)) != 0)
+       if ((ret = m9206_set_filter(adap, 0x81, 1, 0x01)) != 0)
+               goto unlock;
+
+       if ((ret = m9206_set_filter(adap, 0x81, index + 2, pid)) != 0)
+               goto unlock;
+
+       if ((ret = m9206_set_filter(adap, 0x82, 0, 0x02f5)) != 0)
                goto unlock;
 
        unlock:
@@ -412,6 +373,47 @@ static int m9206_firmware_download(struc
        return ret;
 }
 
+/* DVB USB Driver stuff */
+static struct dvb_usb_device_properties megasky_properties;
+
+static int m920x_probe(struct usb_interface *intf, const struct usb_device_id 
*id)
+{
+       struct dvb_usb_device *d;
+       struct usb_host_interface *alt;
+       int ret;
+
+       if ((ret = dvb_usb_device_init(intf, &megasky_properties, THIS_MODULE, 
&d)) == 0) {
+               deb_rc("probed!\n");
+
+               alt = usb_altnum_to_altsetting(intf, 1);
+               if (alt == NULL) {
+                       deb_rc("not alt found!\n");
+                       return -ENODEV;
+               }
+
+               ret = usb_set_interface(d->udev, alt->desc.bInterfaceNumber, 
alt->desc.bAlternateSetting);
+               if (ret < 0)
+                       return ret;
+
+               deb_rc("Changed to alternate setting!\n");
+
+               /* Remote controller init. */
+               if ((ret = m9206_write(d->udev, 0x22, 0xa8, 0xff55)) != 0)
+                       return ret;
+
+               if ((ret = m9206_write(d->udev, 0x22, 0x51, 0xff54)) != 0)
+                       return ret;
+       }
+       return ret;
+}
+
+static struct usb_device_id m920x_table [] = {
+               { USB_DEVICE(USB_VID_MSI, USB_PID_MSI_MEGASKY580) },
+               { 0 } /* Terminating entry */
+};
+MODULE_DEVICE_TABLE (usb, m920x_table);
+
+
 static struct dvb_usb_device_properties megasky_properties = {
        .usb_ctrl = DEVICE_SPECIFIC,
        .firmware = "dvb-usb-megasky-02.fw",
@@ -428,8 +430,7 @@ static struct dvb_usb_device_properties 
        .num_adapters = 1,
        .adapter = {{
                .caps = DVB_USB_IS_AN_I2C_ADAPTER | DVB_USB_ADAP_HAS_PID_FILTER 
|
-                       DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF |
-                       DVB_USB_ADAP_NEED_PID_FILTERING,
+                       DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
                .pid_filter_count = 8,
                .pid_filter       = m9206_pid_filter,
                .pid_filter_ctrl  = m9206_pid_filter_ctrl,
@@ -449,8 +450,6 @@ static struct dvb_usb_device_properties 
        }},
        .i2c_algo         = &m9206_i2c_algo,
 
-       .generic_bulk_ctrl_endpoint = 0x01,
-
        .num_device_descs = 1,
        .devices = {
                {   "MSI Mega Sky 580 DVB-T USB2.0",
diff -r f955dadfe5bc linux/drivers/media/dvb/dvb-usb/m920x.h
--- a/linux/drivers/media/dvb/dvb-usb/m920x.h   Sat Sep 23 19:40:20 2006 -0400
+++ b/linux/drivers/media/dvb/dvb-usb/m920x.h   Wed Sep 27 13:14:03 2006 +0200
@@ -1,10 +1,1 @@
-#ifndef _DVB_USB_M920X_H_
-#define _DVB_USB_M920X_H_
 
-#define DVB_USB_LOG_PREFIX "m920x"
-#include "dvb-usb.h"
-
-extern int dvb_usb_m920x_debug;
-#define deb_rc(args...)   dprintk(dvb_usb_m920x_debug,0x01,args)
-
-#endif
_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

Reply via email to