Hi,
I did some more cleanups:
- changed PM to 2.4 pci module style
- removed global list of devices, now using pci device data.
I tried to add a pci_set_power_state(dev,3) in _remove, but this apparently
has no effect (amplifier stays switched on), so I did not submit this part.
Tested on IBM ThinkPad 390E.
Ciao, Marcus
Index: drivers/sound/esssolo1.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/esssolo1.c,v
retrieving revision 1.12
diff -u -r1.12 esssolo1.c
--- drivers/sound/esssolo1.c2001/05/18 08:06:38 1.12
+++ drivers/sound/esssolo1.c2001/05/22 12:28:54
@@ -79,6 +79,9 @@
* for abs. Bug report by Andrew Morton <[EMAIL PROTECTED]>
*15.05.2001 pci_enable_device moved, return values in probe cleaned
* up. Marcus Meissner <[EMAIL PROTECTED]>
+ *22.05.2001 0.19 more cleanups, changed PM to PCI 2.4 style, got rid
+ * of global list of devices, using pci device data.
+ * Marcus Meissner <[EMAIL PROTECTED]>
*/
/*/
@@ -94,7 +97,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -161,15 +163,14 @@
#define FMODE_DMFM 0x10
+static struct pci_driver solo1_driver;
+
/* - */
struct solo1_state {
/* magic */
unsigned int magic;
- /* list of esssolo1 devices */
- struct list_head devs;
-
/* the corresponding pci_dev structure */
struct pci_dev *dev;
@@ -244,10 +245,6 @@
/* - */
-static LIST_HEAD(devs);
-
-/* - */
-
extern inline void write_seq(struct solo1_state *s, unsigned char data)
{
int i;
@@ -939,16 +936,22 @@
static int solo1_open_mixdev(struct inode *inode, struct file *file)
{
int minor = MINOR(inode->i_rdev);
- struct list_head *list;
- struct solo1_state *s;
+ struct solo1_state *s = NULL;
+ struct pci_dev *pci_dev;
- for (list = devs.next; ; list = list->next) {
- if (list == &devs)
- return -ENODEV;
- s = list_entry(list, struct solo1_state, devs);
+ pci_for_each_dev(pci_dev) {
+ struct pci_driver *drvr;
+ drvr = pci_dev_driver (pci_dev);
+ if (drvr != &solo1_driver)
+ continue;
+ s = (struct solo1_state*)pci_get_drvdata(pci_dev);
+ if (!s)
+ continue;
if (s->dev_mixer == minor)
break;
}
+ if (!s)
+ return -ENODEV;
VALIDATE_STATE(s);
file->private_data = s;
return 0;
@@ -1611,16 +1614,23 @@
{
int minor = MINOR(inode->i_rdev);
DECLARE_WAITQUEUE(wait, current);
- struct list_head *list;
- struct solo1_state *s;
+ struct solo1_state *s = NULL;
+ struct pci_dev *pci_dev;
- for (list = devs.next; ; list = list->next) {
- if (list == &devs)
- return -ENODEV;
- s = list_entry(list, struct solo1_state, devs);
+ pci_for_each_dev(pci_dev) {
+ struct pci_driver *drvr;
+
+ drvr = pci_dev_driver(pci_dev);
+ if (drvr != &solo1_driver)
+ continue;
+ s = (struct solo1_state*)pci_get_drvdata(pci_dev);
+ if (!s)
+ continue;
if (!((s->dev_audio ^ minor) & ~0xf))
break;
}
+ if (!s)
+ return -ENODEV;
VALIDATE_STATE(s);
file->private_data = s;
/* wait for device to become free */
@@ -1894,16 +1904,23 @@
int minor = MINOR(inode->i_rdev);
DECLARE_WAITQUEUE(wait, current);
unsigned long flags;
- struct list_head *list;
- struct solo1_state *s;
+ struct solo1_state *s = NULL;
+ struct pci_dev *pci_dev;
+
+ pci_for_each_dev(pci_dev) {
+ struct pci_driver *drvr;
- for (list = devs.next; ; list = list->next) {
- if (list == &devs)
- return -ENODEV;
- s = list_entry(list, struct solo1_state, devs);
+ drvr = pci_dev_driver(pci_dev);
+ if (drvr != &solo1_driver)
+ continue;
+ s = (struct solo1_state*)pci_get_drvdata(pci_dev);
+ if (!s)
+ continue;
if (s->dev_midi == minor)
break;
}
+ if (!s)
+ return -ENODEV;