Re: PATCH: maestro ported to 2.4 PCI API

2001-05-21 Thread Marcus Meissner

> > @@ -3406,7 +3429,7 @@
> > if(card == NULL)
> > {
> > printk(KERN_WARNING "maestro: out of memory\n");
> > -   return 0;
> > +   return -ENOMEM;
> 
> request_region is unbalanced in this return path.

Thanks! 

Fixed patch below.

Ciao, Marcus

Index: drivers/sound/maestro.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/maestro.c,v
retrieving revision 1.7
diff -u -r1.7 maestro.c
--- drivers/sound/maestro.c 2001/05/18 08:06:38 1.7
+++ drivers/sound/maestro.c 2001/05/21 21:06:55
@@ -115,6 +115,10 @@
  * themselves, but we'll see.  
  * 
  * History
+ *  v0.15 - May 21 2001 - Marcus Meissner <[EMAIL PROTECTED]>
+ *  Ported to Linux 2.4 PCI API. Some clean ups, global devs list
+ *  removed (now using pci device driver data).
+ *  PM needs to be polished still. Bumped version.
  *  (still kind of v0.14) May 13 2001 - Ben Pfaff <[EMAIL PROTECTED]>
  *  Add support for 978 docking and basic hardware volume control
  *  (still kind of v0.14) Nov 23 - Alan Cox <[EMAIL PROTECTED]>
@@ -206,28 +210,6 @@
 #include 
 #include 
 #include 
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
-
- #define DECLARE_WAITQUEUE(QUEUE,INIT) struct wait_queue QUEUE = {INIT, NULL}
- #define wait_queue_head_t struct wait_queue *
- #define SILLY_PCI_BASE_ADDRESS(PCIDEV) (PCIDEV->base_address[0] & 
PCI_BASE_ADDRESS_IO_MASK)
- #define SILLY_INIT_SEM(SEM) SEM=MUTEX;
- #define init_waitqueue_head init_waitqueue
- #define SILLY_MAKE_INIT(FUNC) __initfunc(FUNC)
- #define SILLY_OFFSET(VMA) ((VMA)->vm_offset)
-
-
-#else
-
- #define SILLY_PCI_BASE_ADDRESS(PCIDEV) (PCIDEV->resource[0].start)
- #define SILLY_INIT_SEM(SEM) init_MUTEX()
- #define SILLY_MAKE_INIT(FUNC) __init FUNC
- #define SILLY_OFFSET(VMA) ((VMA)->vm_pgoff)
-
-
-#endif
-
 #include 
 #include 
 #include 
@@ -251,6 +233,8 @@
 
 #include "maestro.h"
 
+static struct pci_driver maestro_pci_driver;
+
 /* - */
 
 #define M_DEBUG 1
@@ -271,8 +255,17 @@

 static int clocking=48000;
 
+MODULE_AUTHOR("Zach Brown <[EMAIL PROTECTED]>, Alan Cox <[EMAIL PROTECTED]>");
+MODULE_DESCRIPTION("ESS Maestro Driver");
+#ifdef M_DEBUG
+MODULE_PARM(debug,"i");
+#endif
+MODULE_PARM(dsps_order,"i");
+MODULE_PARM(use_pm,"i");
+MODULE_PARM(clocking, "i");
+
 /* - */
-#define DRIVER_VERSION "0.14"
+#define DRIVER_VERSION "0.15"
 
 #ifndef PCI_VENDOR_ESS
 #define PCI_VENDOR_ESS 0x125D
@@ -354,6 +347,11 @@
[ACPI_D3] = ACPI_NONE
 };
 
+static char version[] __devinitdata =
+KERN_INFO "maestro: version " DRIVER_VERSION " time " __TIME__ " " __DATE__ "\n";
+
+
+
 static const unsigned sample_size[] = { 1, 2, 2, 4 };
 static const unsigned sample_shift[] = { 0, 1, 1, 2 };
 
@@ -522,8 +520,6 @@
 
 static void check_suspend(struct ess_card *card);
 
-static struct ess_card *devs = NULL;
-
 /* - */
 
 
@@ -2133,17 +2129,25 @@
 }
 
 /* - */
-
 static int ess_open_mixdev(struct inode *inode, struct file *file)
 {
int minor = MINOR(inode->i_rdev);
-   struct ess_card *card = devs;
-
-   while (card && card->dev_mixer != minor)
-   card = card->next;
+   struct ess_card *card = NULL;
+   struct pci_dev *pdev;
+   struct pci_driver *drvr;
+
+   pci_for_each_dev(pdev) {
+   drvr = pci_dev_driver (pdev);
+   if (drvr == _pci_driver) {
+   card = (struct ess_card*)pci_get_drvdata (pdev);
+   if (!card)
+   continue;
+   if (card->dev_mixer == minor)
+   break;
+   }
+   }
if (!card)
return -ENODEV;
-
file->private_data = card;
return 0;
 }
@@ -2505,7 +2509,7 @@
 #endif
goto out;
ret = -EINVAL;
-   if (SILLY_OFFSET(vma) != 0)
+   if (vma->vm_pgoff != 0)
goto out;
size = vma->vm_end - vma->vm_start;
if (size > (PAGE_SIZE << db->buforder))
@@ -2969,33 +2973,40 @@
 ess_open(struct inode *inode, struct file *file)
 {
int minor = MINOR(inode->i_rdev);
-   struct ess_card *c = devs;
-   struct ess_state *s = NULL, *sp;
-   int i;
+   struct ess_state *s = NULL;
unsigned char fmtm = ~0, fmts = 0;
-
+   struct pci_dev *pdev;
/*
 *  Scan the cards and find the channel. We only
 *  do this at open time so it is ok
 */
-
-   while (c!=NULL)
-   {
-   for(i=0;ichannels[i];
-   if(sp->dev_audio < 0)
-   continue;
-   

Re: PATCH: maestro ported to 2.4 PCI API

2001-05-21 Thread Zach Brown

> Its useful to have version ids. So it would be better people used them more

I wasn't sure, so am happy leaving them in as well :)

I suppose they're an easier way to sync dmesg with code version than
knowing what is in which kernel version.

-- 
 zach
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: PATCH: maestro ported to 2.4 PCI API

2001-05-21 Thread Zach Brown

>   - ported to Linux 2.4 PCI API, PCI module based, cleaned up
> return values. (taking into account all the hints Jeff has given
> me ;)

cool :)

>   - did NOT change any power management support, since I don't know
> anything about power management.

someone else (in .de, it appears to be the source of maestro hacking
nowadays :)) is cleaning up the power management.

>   - bumped version.

we might as well just stop using these, they don't mean much of anything
anymore.

- z
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: PATCH: maestro ported to 2.4 PCI API

2001-05-21 Thread Alan Cox

> > - bumped version.
> 
> we might as well just stop using these, they don't mean much of anything
> anymore.

Its useful to have version ids. So it would be better people used them more
> Please read the FAQ at  http://www.tux.org/lkml/
> 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: PATCH: maestro ported to 2.4 PCI API

2001-05-21 Thread Francois Romieu

Marcus Meissner <[EMAIL PROTECTED]> ecrit :
[...]
>   if( request_region(iobase, 256, card_names[card_type]) == NULL )
>   {
>   printk(KERN_WARNING "maestro: can't allocate 256 bytes I/O at 
>0x%4.4x\n", iobase);
> - return 0;
> - }
> -
> - /* this was tripping up some machines */
> - if(pcidev->irq == 0) {
> - printk(KERN_WARNING "maestro: pci subsystem reports irq 0, this might 
>not be correct.\n");
> + return -EBUSY;
>   }
>  
>   /* just to be sure */
> @@ -3406,7 +3429,7 @@
>   if(card == NULL)
>   {
>   printk(KERN_WARNING "maestro: out of memory\n");
> - return 0;
> + return -ENOMEM;

request_region is unbalanced in this return path.

-- 
Ueimor
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



PATCH: maestro ported to 2.4 PCI API

2001-05-21 Thread Marcus Meissner

Hi,

I did following changes to maestro.c:
- ported to Linux 2.4 PCI API, PCI module based, cleaned up
  return values. (taking into account all the hints Jeff has given
  me ;)
- removed compat macros.
- removed global devs list, now using PCI driver data.
- did NOT change any power management support, since I don't know
  anything about power management.
- bumped version.

Tested with maestro chipset (Maestro 2E) on Toshiba Satellite 4080CXT laptop.

Ciao, Marcus

Index: drivers/sound/maestro.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/maestro.c,v
retrieving revision 1.7
diff -u -r1.7 maestro.c
--- drivers/sound/maestro.c 2001/05/18 08:06:38 1.7
+++ drivers/sound/maestro.c 2001/05/21 15:12:17
@@ -115,6 +115,10 @@
  * themselves, but we'll see.  
  * 
  * History
+ *  v0.15 - May 21 2001 - Marcus Meissner <[EMAIL PROTECTED]>
+ *  Ported to Linux 2.4 PCI API. Some clean ups, global devs list
+ *  removed (now using pci device driver data).
+ *  PM needs to be polished still. Bumped version.
  *  (still kind of v0.14) May 13 2001 - Ben Pfaff <[EMAIL PROTECTED]>
  *  Add support for 978 docking and basic hardware volume control
  *  (still kind of v0.14) Nov 23 - Alan Cox <[EMAIL PROTECTED]>
@@ -206,28 +210,6 @@
 #include 
 #include 
 #include 
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
-
- #define DECLARE_WAITQUEUE(QUEUE,INIT) struct wait_queue QUEUE = {INIT, NULL}
- #define wait_queue_head_t struct wait_queue *
- #define SILLY_PCI_BASE_ADDRESS(PCIDEV) (PCIDEV->base_address[0] & 
PCI_BASE_ADDRESS_IO_MASK)
- #define SILLY_INIT_SEM(SEM) SEM=MUTEX;
- #define init_waitqueue_head init_waitqueue
- #define SILLY_MAKE_INIT(FUNC) __initfunc(FUNC)
- #define SILLY_OFFSET(VMA) ((VMA)->vm_offset)
-
-
-#else
-
- #define SILLY_PCI_BASE_ADDRESS(PCIDEV) (PCIDEV->resource[0].start)
- #define SILLY_INIT_SEM(SEM) init_MUTEX()
- #define SILLY_MAKE_INIT(FUNC) __init FUNC
- #define SILLY_OFFSET(VMA) ((VMA)->vm_pgoff)
-
-
-#endif
-
 #include 
 #include 
 #include 
@@ -251,6 +233,8 @@
 
 #include "maestro.h"
 
+static struct pci_driver maestro_pci_driver;
+
 /* - */
 
 #define M_DEBUG 1
@@ -271,8 +255,17 @@

 static int clocking=48000;
 
+MODULE_AUTHOR("Zach Brown <[EMAIL PROTECTED]>, Alan Cox <[EMAIL PROTECTED]>");
+MODULE_DESCRIPTION("ESS Maestro Driver");
+#ifdef M_DEBUG
+MODULE_PARM(debug,"i");
+#endif
+MODULE_PARM(dsps_order,"i");
+MODULE_PARM(use_pm,"i");
+MODULE_PARM(clocking, "i");
+
 /* - */
-#define DRIVER_VERSION "0.14"
+#define DRIVER_VERSION "0.15"
 
 #ifndef PCI_VENDOR_ESS
 #define PCI_VENDOR_ESS 0x125D
@@ -354,6 +347,11 @@
[ACPI_D3] = ACPI_NONE
 };
 
+static char version[] __devinitdata =
+KERN_INFO "maestro: version " DRIVER_VERSION " time " __TIME__ " " __DATE__ "\n";
+
+
+
 static const unsigned sample_size[] = { 1, 2, 2, 4 };
 static const unsigned sample_shift[] = { 0, 1, 1, 2 };
 
@@ -522,8 +520,6 @@
 
 static void check_suspend(struct ess_card *card);
 
-static struct ess_card *devs = NULL;
-
 /* - */
 
 
@@ -2133,17 +2129,25 @@
 }
 
 /* - */
-
 static int ess_open_mixdev(struct inode *inode, struct file *file)
 {
int minor = MINOR(inode->i_rdev);
-   struct ess_card *card = devs;
-
-   while (card && card->dev_mixer != minor)
-   card = card->next;
+   struct ess_card *card = NULL;
+   struct pci_dev *pdev;
+   struct pci_driver *drvr;
+
+   pci_for_each_dev(pdev) {
+   drvr = pci_dev_driver (pdev);
+   if (drvr == _pci_driver) {
+   card = (struct ess_card*)pci_get_drvdata (pdev);
+   if (!card)
+   continue;
+   if (card->dev_mixer == minor)
+   break;
+   }
+   }
if (!card)
return -ENODEV;
-
file->private_data = card;
return 0;
 }
@@ -2505,7 +2509,7 @@
 #endif
goto out;
ret = -EINVAL;
-   if (SILLY_OFFSET(vma) != 0)
+   if (vma->vm_pgoff != 0)
goto out;
size = vma->vm_end - vma->vm_start;
if (size > (PAGE_SIZE << db->buforder))
@@ -2969,33 +2973,40 @@
 ess_open(struct inode *inode, struct file *file)
 {
int minor = MINOR(inode->i_rdev);
-   struct ess_card *c = devs;
-   struct ess_state *s = NULL, *sp;
-   int i;
+   struct ess_state *s = NULL;
unsigned char fmtm = ~0, fmts = 0;
-
+   struct pci_dev *pdev;
/*
 *  Scan the cards and find the channel. We only
   

Re: PATCH: maestro ported to 2.4 PCI API

2001-05-21 Thread Francois Romieu

Marcus Meissner [EMAIL PROTECTED] ecrit :
[...]
   if( request_region(iobase, 256, card_names[card_type]) == NULL )
   {
   printk(KERN_WARNING maestro: can't allocate 256 bytes I/O at 
0x%4.4x\n, iobase);
 - return 0;
 - }
 -
 - /* this was tripping up some machines */
 - if(pcidev-irq == 0) {
 - printk(KERN_WARNING maestro: pci subsystem reports irq 0, this might 
not be correct.\n);
 + return -EBUSY;
   }
  
   /* just to be sure */
 @@ -3406,7 +3429,7 @@
   if(card == NULL)
   {
   printk(KERN_WARNING maestro: out of memory\n);
 - return 0;
 + return -ENOMEM;

request_region is unbalanced in this return path.

-- 
Ueimor
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: PATCH: maestro ported to 2.4 PCI API

2001-05-21 Thread Zach Brown

   - ported to Linux 2.4 PCI API, PCI module based, cleaned up
 return values. (taking into account all the hints Jeff has given
 me ;)

cool :)

   - did NOT change any power management support, since I don't know
 anything about power management.

someone else (in .de, it appears to be the source of maestro hacking
nowadays :)) is cleaning up the power management.

   - bumped version.

we might as well just stop using these, they don't mean much of anything
anymore.

- z
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



PATCH: maestro ported to 2.4 PCI API

2001-05-21 Thread Marcus Meissner

Hi,

I did following changes to maestro.c:
- ported to Linux 2.4 PCI API, PCI module based, cleaned up
  return values. (taking into account all the hints Jeff has given
  me ;)
- removed compat macros.
- removed global devs list, now using PCI driver data.
- did NOT change any power management support, since I don't know
  anything about power management.
- bumped version.

Tested with maestro chipset (Maestro 2E) on Toshiba Satellite 4080CXT laptop.

Ciao, Marcus

Index: drivers/sound/maestro.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/maestro.c,v
retrieving revision 1.7
diff -u -r1.7 maestro.c
--- drivers/sound/maestro.c 2001/05/18 08:06:38 1.7
+++ drivers/sound/maestro.c 2001/05/21 15:12:17
@@ -115,6 +115,10 @@
  * themselves, but we'll see.  
  * 
  * History
+ *  v0.15 - May 21 2001 - Marcus Meissner [EMAIL PROTECTED]
+ *  Ported to Linux 2.4 PCI API. Some clean ups, global devs list
+ *  removed (now using pci device driver data).
+ *  PM needs to be polished still. Bumped version.
  *  (still kind of v0.14) May 13 2001 - Ben Pfaff [EMAIL PROTECTED]
  *  Add support for 978 docking and basic hardware volume control
  *  (still kind of v0.14) Nov 23 - Alan Cox [EMAIL PROTECTED]
@@ -206,28 +210,6 @@
 #include linux/sched.h
 #include linux/smp_lock.h
 #include linux/wrapper.h
-
-#if LINUX_VERSION_CODE  KERNEL_VERSION(2,3,0)
-
- #define DECLARE_WAITQUEUE(QUEUE,INIT) struct wait_queue QUEUE = {INIT, NULL}
- #define wait_queue_head_t struct wait_queue *
- #define SILLY_PCI_BASE_ADDRESS(PCIDEV) (PCIDEV-base_address[0]  
PCI_BASE_ADDRESS_IO_MASK)
- #define SILLY_INIT_SEM(SEM) SEM=MUTEX;
- #define init_waitqueue_head init_waitqueue
- #define SILLY_MAKE_INIT(FUNC) __initfunc(FUNC)
- #define SILLY_OFFSET(VMA) ((VMA)-vm_offset)
-
-
-#else
-
- #define SILLY_PCI_BASE_ADDRESS(PCIDEV) (PCIDEV-resource[0].start)
- #define SILLY_INIT_SEM(SEM) init_MUTEX(SEM)
- #define SILLY_MAKE_INIT(FUNC) __init FUNC
- #define SILLY_OFFSET(VMA) ((VMA)-vm_pgoff)
-
-
-#endif
-
 #include linux/string.h
 #include linux/ctype.h
 #include linux/ioport.h
@@ -251,6 +233,8 @@
 
 #include maestro.h
 
+static struct pci_driver maestro_pci_driver;
+
 /* - */
 
 #define M_DEBUG 1
@@ -271,8 +255,17 @@

 static int clocking=48000;
 
+MODULE_AUTHOR(Zach Brown [EMAIL PROTECTED], Alan Cox [EMAIL PROTECTED]);
+MODULE_DESCRIPTION(ESS Maestro Driver);
+#ifdef M_DEBUG
+MODULE_PARM(debug,i);
+#endif
+MODULE_PARM(dsps_order,i);
+MODULE_PARM(use_pm,i);
+MODULE_PARM(clocking, i);
+
 /* - */
-#define DRIVER_VERSION 0.14
+#define DRIVER_VERSION 0.15
 
 #ifndef PCI_VENDOR_ESS
 #define PCI_VENDOR_ESS 0x125D
@@ -354,6 +347,11 @@
[ACPI_D3] = ACPI_NONE
 };
 
+static char version[] __devinitdata =
+KERN_INFO maestro: version  DRIVER_VERSION  time  __TIME__   __DATE__ \n;
+
+
+
 static const unsigned sample_size[] = { 1, 2, 2, 4 };
 static const unsigned sample_shift[] = { 0, 1, 1, 2 };
 
@@ -522,8 +520,6 @@
 
 static void check_suspend(struct ess_card *card);
 
-static struct ess_card *devs = NULL;
-
 /* - */
 
 
@@ -2133,17 +2129,25 @@
 }
 
 /* - */
-
 static int ess_open_mixdev(struct inode *inode, struct file *file)
 {
int minor = MINOR(inode-i_rdev);
-   struct ess_card *card = devs;
-
-   while (card  card-dev_mixer != minor)
-   card = card-next;
+   struct ess_card *card = NULL;
+   struct pci_dev *pdev;
+   struct pci_driver *drvr;
+
+   pci_for_each_dev(pdev) {
+   drvr = pci_dev_driver (pdev);
+   if (drvr == maestro_pci_driver) {
+   card = (struct ess_card*)pci_get_drvdata (pdev);
+   if (!card)
+   continue;
+   if (card-dev_mixer == minor)
+   break;
+   }
+   }
if (!card)
return -ENODEV;
-
file-private_data = card;
return 0;
 }
@@ -2505,7 +2509,7 @@
 #endif
goto out;
ret = -EINVAL;
-   if (SILLY_OFFSET(vma) != 0)
+   if (vma-vm_pgoff != 0)
goto out;
size = vma-vm_end - vma-vm_start;
if (size  (PAGE_SIZE  db-buforder))
@@ -2969,33 +2973,40 @@
 ess_open(struct inode *inode, struct file *file)
 {
int minor = MINOR(inode-i_rdev);
-   struct ess_card *c = devs;
-   struct ess_state *s = NULL, *sp;
-   int i;
+   struct ess_state *s = NULL;
unsigned char fmtm = ~0, fmts = 0;
-
+   struct pci_dev *pdev;
/*
 *  Scan the 

Re: PATCH: maestro ported to 2.4 PCI API

2001-05-21 Thread Marcus Meissner

  @@ -3406,7 +3429,7 @@
  if(card == NULL)
  {
  printk(KERN_WARNING maestro: out of memory\n);
  -   return 0;
  +   return -ENOMEM;
 
 request_region is unbalanced in this return path.

Thanks! 

Fixed patch below.

Ciao, Marcus

Index: drivers/sound/maestro.c
===
RCS file: /build/mm/work/repository/linux-mm/drivers/sound/maestro.c,v
retrieving revision 1.7
diff -u -r1.7 maestro.c
--- drivers/sound/maestro.c 2001/05/18 08:06:38 1.7
+++ drivers/sound/maestro.c 2001/05/21 21:06:55
@@ -115,6 +115,10 @@
  * themselves, but we'll see.  
  * 
  * History
+ *  v0.15 - May 21 2001 - Marcus Meissner [EMAIL PROTECTED]
+ *  Ported to Linux 2.4 PCI API. Some clean ups, global devs list
+ *  removed (now using pci device driver data).
+ *  PM needs to be polished still. Bumped version.
  *  (still kind of v0.14) May 13 2001 - Ben Pfaff [EMAIL PROTECTED]
  *  Add support for 978 docking and basic hardware volume control
  *  (still kind of v0.14) Nov 23 - Alan Cox [EMAIL PROTECTED]
@@ -206,28 +210,6 @@
 #include linux/sched.h
 #include linux/smp_lock.h
 #include linux/wrapper.h
-
-#if LINUX_VERSION_CODE  KERNEL_VERSION(2,3,0)
-
- #define DECLARE_WAITQUEUE(QUEUE,INIT) struct wait_queue QUEUE = {INIT, NULL}
- #define wait_queue_head_t struct wait_queue *
- #define SILLY_PCI_BASE_ADDRESS(PCIDEV) (PCIDEV-base_address[0]  
PCI_BASE_ADDRESS_IO_MASK)
- #define SILLY_INIT_SEM(SEM) SEM=MUTEX;
- #define init_waitqueue_head init_waitqueue
- #define SILLY_MAKE_INIT(FUNC) __initfunc(FUNC)
- #define SILLY_OFFSET(VMA) ((VMA)-vm_offset)
-
-
-#else
-
- #define SILLY_PCI_BASE_ADDRESS(PCIDEV) (PCIDEV-resource[0].start)
- #define SILLY_INIT_SEM(SEM) init_MUTEX(SEM)
- #define SILLY_MAKE_INIT(FUNC) __init FUNC
- #define SILLY_OFFSET(VMA) ((VMA)-vm_pgoff)
-
-
-#endif
-
 #include linux/string.h
 #include linux/ctype.h
 #include linux/ioport.h
@@ -251,6 +233,8 @@
 
 #include maestro.h
 
+static struct pci_driver maestro_pci_driver;
+
 /* - */
 
 #define M_DEBUG 1
@@ -271,8 +255,17 @@

 static int clocking=48000;
 
+MODULE_AUTHOR(Zach Brown [EMAIL PROTECTED], Alan Cox [EMAIL PROTECTED]);
+MODULE_DESCRIPTION(ESS Maestro Driver);
+#ifdef M_DEBUG
+MODULE_PARM(debug,i);
+#endif
+MODULE_PARM(dsps_order,i);
+MODULE_PARM(use_pm,i);
+MODULE_PARM(clocking, i);
+
 /* - */
-#define DRIVER_VERSION 0.14
+#define DRIVER_VERSION 0.15
 
 #ifndef PCI_VENDOR_ESS
 #define PCI_VENDOR_ESS 0x125D
@@ -354,6 +347,11 @@
[ACPI_D3] = ACPI_NONE
 };
 
+static char version[] __devinitdata =
+KERN_INFO maestro: version  DRIVER_VERSION  time  __TIME__   __DATE__ \n;
+
+
+
 static const unsigned sample_size[] = { 1, 2, 2, 4 };
 static const unsigned sample_shift[] = { 0, 1, 1, 2 };
 
@@ -522,8 +520,6 @@
 
 static void check_suspend(struct ess_card *card);
 
-static struct ess_card *devs = NULL;
-
 /* - */
 
 
@@ -2133,17 +2129,25 @@
 }
 
 /* - */
-
 static int ess_open_mixdev(struct inode *inode, struct file *file)
 {
int minor = MINOR(inode-i_rdev);
-   struct ess_card *card = devs;
-
-   while (card  card-dev_mixer != minor)
-   card = card-next;
+   struct ess_card *card = NULL;
+   struct pci_dev *pdev;
+   struct pci_driver *drvr;
+
+   pci_for_each_dev(pdev) {
+   drvr = pci_dev_driver (pdev);
+   if (drvr == maestro_pci_driver) {
+   card = (struct ess_card*)pci_get_drvdata (pdev);
+   if (!card)
+   continue;
+   if (card-dev_mixer == minor)
+   break;
+   }
+   }
if (!card)
return -ENODEV;
-
file-private_data = card;
return 0;
 }
@@ -2505,7 +2509,7 @@
 #endif
goto out;
ret = -EINVAL;
-   if (SILLY_OFFSET(vma) != 0)
+   if (vma-vm_pgoff != 0)
goto out;
size = vma-vm_end - vma-vm_start;
if (size  (PAGE_SIZE  db-buforder))
@@ -2969,33 +2973,40 @@
 ess_open(struct inode *inode, struct file *file)
 {
int minor = MINOR(inode-i_rdev);
-   struct ess_card *c = devs;
-   struct ess_state *s = NULL, *sp;
-   int i;
+   struct ess_state *s = NULL;
unsigned char fmtm = ~0, fmts = 0;
-
+   struct pci_dev *pdev;
/*
 *  Scan the cards and find the channel. We only
 *  do this at open time so it is ok
 */
-
-   while (c!=NULL)
-   {
-   for(i=0;iNR_DSPS;i++)
-   {
-   sp=c-channels[i];
-   

Re: PATCH: maestro ported to 2.4 PCI API

2001-05-21 Thread Alan Cox

  - bumped version.
 
 we might as well just stop using these, they don't mean much of anything
 anymore.

Its useful to have version ids. So it would be better people used them more
 Please read the FAQ at  http://www.tux.org/lkml/
 

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/