diff options
author | Trent Piepho <xyzzy@speakeasy.org> | 2007-10-13 22:52:17 -0700 |
---|---|---|
committer | Trent Piepho <xyzzy@speakeasy.org> | 2007-10-13 22:52:17 -0700 |
commit | 8acc33b86c1347822d4ec6dcbc39c2d9e4b07a54 (patch) | |
tree | a0789105e1c8e12a7cda9b67863ca915ac443512 /linux/drivers/media/video/cx88/cx88.h | |
parent | 9f65c5d8edfc6c6fa30a61b3e2b29b479b0fb6fe (diff) | |
download | mediapointer-dvb-s2-8acc33b86c1347822d4ec6dcbc39c2d9e4b07a54.tar.gz mediapointer-dvb-s2-8acc33b86c1347822d4ec6dcbc39c2d9e4b07a54.tar.bz2 |
cx88: Change (struct cx8802_dev)->drvlist to a list_head and fix bugs
From: Trent Piepho <xyzzy@speakeasy.org>
It was a struct cx8802_driver for no apparent reason. Nothing uses a
cx8802_driver in the cx8802_dev struct. The only field that was used was
devlist, a list_head.
The code in cx8802_remove() that removed any loaded sub-drivers was broken.
It would delete the current list entry, but didn't use list_for_each_safe. It
also called list_del() on the list _head_ inside the list_for_each loop? It
would crash if it was run, which I don't think can ever happen.
Since the cx8802 sub-drivers use the cx8802 driver, they have to be unloaded
first. So there isn't any way for a sub-driver to still be loaded when
cx8802_remove() is called... Except maybe with PCI hot-plug, if one removes
the PCI card while the drivers are loaded?
So I left some code in to handle that if it's actually possible. It will
remove the sub-drivers from the device cx8802_remove() was called on, and only
that device. If one has two DVB cards and unplugs one, there is no reason to
unload the DVB drivers for both cards. I have no way to test this, but it
can't be worse than what was there before.
cx8802_get_driver() is passed a cx8802_dev pointer and looks for the requested
driver on that device. It first loops over the cx8802 device list looking for
the device it was passed, which is pointless. It doesn't need to find the
device pointer in the list, as it already has the pointer.
The list_head in the cx8802_driver struct, which joins all the _drivers_
attached to a device, was named devlist. Changed that to drvlist, since the
devlist is used for a list of _devices_ in other cx8802 structs.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Reviewed-by: Michael Krufky <mkrufky@linuxtv.org>
Diffstat (limited to 'linux/drivers/media/video/cx88/cx88.h')
-rw-r--r-- | linux/drivers/media/video/cx88/cx88.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/linux/drivers/media/video/cx88/cx88.h b/linux/drivers/media/video/cx88/cx88.h index 9abe3064f..4ed19fb37 100644 --- a/linux/drivers/media/video/cx88/cx88.h +++ b/linux/drivers/media/video/cx88/cx88.h @@ -441,7 +441,9 @@ struct cx8802_suspend_state { struct cx8802_driver { struct cx88_core *core; - struct list_head devlist; + + /* List of drivers attached to device */ + struct list_head drvlist; /* Type of driver and access required */ enum cx88_board_type type_id; @@ -511,8 +513,8 @@ struct cx8802_dev { unsigned char ts_gen_cntrl; /* List of attached drivers */ - struct cx8802_driver drvlist; - struct work_struct request_module_wk; + struct list_head drvlist; + struct work_struct request_module_wk; }; /* ----------------------------------------------------------- */ |