Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] [patch] dvb-core / skystar2 modules use count



Content-Transfer-Encoding: 7bit

Hello,

I have made a patch to correct the use count misbehaviour in dvb-core
1.1.1 when using the net character device and the network devices (I
have posted an email last month about it).

The only one driver that makes use of the changes is skystar2. If you
want a driver to take advantaje of the changes, you have to make in it
the same modification I made in skystar2 (just one line ;-). I did not
make the change in the rest of the drivers because I have no access to
those cards, so I could not test them.
It is not mandatory, however, to change the rest of the drivers to start
using the patch, but those drivers are not goint to benefit from the
changes.

I also have the patch for dvb vers. 1.1.0, and a document explaining the
changes. I'll send them just to Holger, in order to not send a huge mail
to the list ;-)

This is it:

diff -ru linuxtv-dvb-1.1.1/linux/drivers/media/dvb/b2c2/skystar2.c linuxtv-dvb-1.1.1.patched/linux/drivers/media/dvb/b2c2/skystar2.c
--- linuxtv-dvb-1.1.1/linux/drivers/media/dvb/b2c2/skystar2.c Tue Jan 27 13:20:11 2004
+++ linuxtv-dvb-1.1.1.patched/linux/drivers/media/dvb/b2c2/skystar2.c Thu Mar 18 11:59:34 2004
@@ -2253,6 +2253,8 @@
return -ENODEV;
}

+ dvb_adapter->reg_mod = THIS_MODULE;
+
adapter = (struct adapter *) pci_get_drvdata(pdev);

adapter->dvb_adapter = dvb_adapter;
diff -ru linuxtv-dvb-1.1.1/linux/drivers/media/dvb/dvb-core/dvb_net.c linuxtv-dvb-1.1.1.patched/linux/drivers/media/dvb/dvb-core/dvb_net.c
--- linuxtv-dvb-1.1.1/linux/drivers/media/dvb/dvb-core/dvb_net.c Mon Feb 23 16:08:36 2004
+++ linuxtv-dvb-1.1.1.patched/linux/drivers/media/dvb/dvb-core/dvb_net.c Thu Mar 18 11:59:34 2004
@@ -59,6 +59,8 @@
#define RX_MODE_PROMISC 3
struct work_struct set_multicast_list_wq;
struct work_struct restart_net_feed_wq;
+
+ struct module *reg_mod;
};


@@ -469,6 +471,8 @@
static void dvb_net_setup(struct net_device *dev)
#endif
{
+ struct dvb_net_priv *priv = dev->priv;
+
ether_setup(dev);

dev->open = dvb_net_open;
@@ -482,6 +486,9 @@
dev->mc_count = 0;
dev->hard_header_cache = NULL;

+ if (priv->reg_mod)
+ dev->owner = priv->reg_mod;
+
dev->flags |= IFF_NOARP;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
return 0;
@@ -536,6 +543,7 @@
priv->demux = demux;
priv->pid = pid;
priv->rx_mode = RX_MODE_UNI;
+ priv->reg_mod = dvbnet->dvbdev->adapter->reg_mod;

INIT_WORK(&priv->set_multicast_list_wq, wq_set_multicast_list, net);
INIT_WORK(&priv->restart_net_feed_wq, wq_restart_net_feed, net);
@@ -575,6 +583,7 @@
priv->demux = dvbnet->demux;
priv->pid = pid;
priv->rx_mode = RX_MODE_UNI;
+ priv->reg_mod = dvbnet->dvbdev->adapter->reg_mod;

INIT_WORK(&priv->set_multicast_list_wq, wq_set_multicast_list, net);
INIT_WORK(&priv->restart_net_feed_wq, wq_restart_net_feed, net);
diff -ru linuxtv-dvb-1.1.1/linux/drivers/media/dvb/dvb-core/dvbdev.c linuxtv-dvb-1.1.1.patched/linux/drivers/media/dvb/dvb-core/dvbdev.c
--- linuxtv-dvb-1.1.1/linux/drivers/media/dvb/dvb-core/dvbdev.c Wed Oct 15 07:58:07 2003
+++ linuxtv-dvb-1.1.1.patched/linux/drivers/media/dvb/dvb-core/dvbdev.c Thu Mar 18 11:59:34 2004
@@ -220,6 +220,9 @@
dvbdev->adapter = adap;
dvbdev->priv = priv;

+ if (adap->reg_mod && dvbdev->fops)
+ dvbdev->fops->owner = adap->reg_mod;
+
list_add_tail (&dvbdev->list_head, &adap->device_list);

#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
diff -ru linuxtv-dvb-1.1.1/linux/drivers/media/dvb/dvb-core/dvbdev.h linuxtv-dvb-1.1.1.patched/linux/drivers/media/dvb/dvb-core/dvbdev.h
--- linuxtv-dvb-1.1.1/linux/drivers/media/dvb/dvb-core/dvbdev.h Tue Oct 14 05:11:03 2003
+++ linuxtv-dvb-1.1.1.patched/linux/drivers/media/dvb/dvb-core/dvbdev.h Thu Mar 18 11:59:34 2004
@@ -52,6 +52,10 @@
struct list_head device_list;
const char *name;
u8 proposed_mac [6];
+
+ /* registering module, used to increment the
+ use count of the correct module */
+ struct module *reg_mod;
};



Regards,

Hernan.




--
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe linux-dvb" as subject.



Home | Main Index | Thread Index