[PATCH] mad16 C924 detection

2001-03-05 Thread Pavel Rabel


Patch is replacing 7 levels of nested ifs with something
readable. Against 2.4 kernels. I have posted this one already once,
trying again.

The driver doesn't support C924 in both PnP and non-PnP modes as it
claims. It looks like part of the code got lost or was not finished. This
patch makes it more clear what's going on. There are many places in the
driver with two different paths for C924, only one is ever used.

Pavel Rabel

--- drivers/sound/mad16.c.old   Wed Nov 15 20:18:57 2000
+++ drivers/sound/mad16.c   Thu Nov 16 23:07:44 2000
@@ -462,72 +462,80 @@
 
DDB(printk("Detect using password = 0xE5\n"));

-   if (!detect_mad16())/* No luck. Try different model */
-   {
-   board_type = C928;
+   if (detect_mad16()) {
+   return 1;
+   }
+   
+   board_type = C928;
 
-   DDB(printk("Detect using password = 0xE2\n"));
+   DDB(printk("Detect using password = 0xE2\n"));
 
-   if (!detect_mad16())
-   {
-   board_type = C929;
-
-   DDB(printk("Detect using password = 0xE3\n"));
-
-   if (!detect_mad16())
-   {
-   if (inb(PASSWD_REG) != 0xff)
-   return 0;
-
-   /*
-* First relocate MC# registers to 0xe0e/0xe0f, 
disable password 
-*/
-
-   outb((0xE4), PASSWD_REG);
-   outb((0x80), PASSWD_REG);
-
-   board_type = C930;
-
-   DDB(printk("Detect using password = 0xE4\n"));
-
-   for (i = 0xf8d; i <= 0xf93; i++)
-   DDB(printk("port %03x = %02x\n", i, 
mad_read(i)));
-if(!detect_mad16()) {
-
- /* The C931 has the password reg at F8D */
- outb((0xE4), 0xF8D);
- outb((0x80), 0xF8D);
- DDB(printk("Detect using password = 0xE4 for 
C931\n"));
-
- if (!detect_mad16()) {
-   board_type = C924;
-   c924pnp++;
-   DDB(printk("Detect using password = 0xE5 (again), 
port offset -0x80\n"));
-   if (!detect_mad16()) {
- c924pnp=0;
- return 0;
-   }
- 
-   DDB(printk("mad16.c: 82C924 PnP detected\n"));
- }
-   }
-   else
- DDB(printk("mad16.c: 82C930 detected\n"));
-   } else
-   DDB(printk("mad16.c: 82C929 detected\n"));
-   } else {
-   unsigned char model;
+   if (detect_mad16())
+   {
+   unsigned char model;
 
-   if (((model = mad_read(MC3_PORT)) & 0x03) == 0x03) {
-   DDB(printk("mad16.c: Mozart detected\n"));
-   board_type = MOZART;
-   } else {
-   DDB(printk("mad16.c: 82C928 detected???\n"));
-   board_type = C928;
-   }
+   if (((model = mad_read(MC3_PORT)) & 0x03) == 0x03) {
+   DDB(printk("mad16.c: Mozart detected\n"));
+   board_type = MOZART;
+   } else {
+   DDB(printk("mad16.c: 82C928 detected???\n"));
+   board_type = C928;
}
+   return 1;
+   }
+
+   board_type = C929;
+
+   DDB(printk("Detect using password = 0xE3\n"));
+
+   if (detect_mad16())
+   {
+   DDB(printk("mad16.c: 82C929 detected\n"));
+   return 1;
+   }
+
+   if (inb(PASSWD_REG) != 0xff)
+   return 0;
+
+   /*
+* First relocate MC# registers to 0xe0e/0xe0f, disable password 
+*/
+
+   outb((0xE4), PASSWD_REG);
+   outb((0x80), PASSWD_REG);
+
+   board_type = C930;
+
+   DDB(printk("Detect using password = 0xE4\n"));
+
+   for (i = 0xf8d; i <= 0xf93; i++)
+   DDB(printk("port %03x = %02x\n", i, mad_read(i)));
+
+if(detect_mad16()) {
+   DDB(printk("mad16.c: 82C930 detected\n"))

[PATCH] ide config order

2001-01-28 Thread Pavel Rabel


Please reorder config to group DMA options together. In 2.4.0

Pavel Rabel


--- drivers/ide/Config.in.old   Tue Nov 28 22:22:49 2000
+++ drivers/ide/Config.in   Tue Nov 28 22:24:19 2000
@@ -42,8 +42,8 @@
 bool '  Generic PCI IDE chipset support' CONFIG_BLK_DEV_IDEPCI
 if [ "$CONFIG_BLK_DEV_IDEPCI" = "y" ]; then
bool 'Sharing PCI IDE interrupts support' CONFIG_IDEPCI_SHARE_IRQ
-   bool 'Generic PCI bus-master DMA support' CONFIG_BLK_DEV_IDEDMA_PCI
bool 'Boot off-board chipsets first support' CONFIG_BLK_DEV_OFFBOARD
+   bool 'Generic PCI bus-master DMA support' CONFIG_BLK_DEV_IDEDMA_PCI
dep_bool '  Use PCI DMA by default when available' 
CONFIG_IDEDMA_PCI_AUTO $CONFIG_BLK_DEV_IDEDMA_PCI
define_bool CONFIG_BLK_DEV_IDEDMA $CONFIG_BLK_DEV_IDEDMA_PCI
dep_bool '  ATA Work(s) In Progress (EXPERIMENTAL)' 
CONFIG_IDEDMA_PCI_WIP $CONFIG_BLK_DEV_IDEDMA_PCI $CONFIG_EXPERIMENTAL


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



[PATCH] pritk.c oneliner

2001-01-08 Thread Pavel Rabel

error is initialised twice

Pavel Rabel


--- kernel/printk.c.old Mon Jan  8 19:16:12 2001
+++ kernel/printk.c Mon Jan  8 19:17:54 2001
@@ -125,9 +125,8 @@
unsigned long i, j, limit, count;
int do_clear = 0;
char c;
-   int error = -EPERM;
+   int error = 0;
 
-   error = 0;
switch (type) {
case 0: /* Close log */
break;

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



[PATCH] mdacon.c cleanup in 2.2.19

2000-12-17 Thread Pavel Rabel


Patch is removing few ifdefs.
Both MODULE_PARM and __initfunc are removed by preprocessor if compiled
as module.

Pavel Rabel

--- drivers/video/mdacon.c.old  Sun Dec 17 18:53:18 2000
+++ drivers/video/mdacon.c  Sun Dec 17 18:54:55 2000
@@ -75,14 +75,10 @@
 
 static struct vc_data  *mda_display_fg = NULL;
 
-#ifdef MODULE_PARM
 MODULE_PARM(mda_first_vc, "1-255i");
 MODULE_PARM(mda_last_vc,  "1-255i");
-#endif
-
 
-/* MDA register values
- */
+/* MDA register values */
 
 #define MDA_CURSOR_BLINKING0x00
 #define MDA_CURSOR_OFF 0x20
@@ -200,11 +196,7 @@
 }
 #endif
 
-#ifdef MODULE
-static int mda_detect(void)
-#else
 __initfunc(static int mda_detect(void))
-#endif
 {
int count=0;
u16 *p, p_save;
@@ -287,11 +279,7 @@
return 1;
 }
 
-#ifdef MODULE
-static void mda_initialize(void)
-#else
 __initfunc(static void mda_initialize(void))
-#endif
 {
write_mda_b(97, 0x00);  /* horizontal total */
write_mda_b(80, 0x01);  /* horizontal displayed */
@@ -316,11 +304,7 @@
outb_p(0x00, mda_gfx_port);
 }
 
-#ifdef MODULE
-static const char *mdacon_startup(void)
-#else
 __initfunc(static const char *mdacon_startup(void))
-#endif
 {
mda_num_columns = 80;
mda_num_lines   = 25;
@@ -606,11 +590,7 @@
mdacon_invert_region,   /* con_invert_region */
 };
 
-#ifdef MODULE
-void mda_console_init(void)
-#else
 __initfunc(void mda_console_init(void))
-#endif
 {
if (mda_first_vc > mda_last_vc)
return;

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



[PATCH] sim710.c compiler warning

2000-12-17 Thread Pavel Rabel


Patch fixes compiler warning for 2.4.0-test12

sim710.c: In function `sim710_detect':
sim710.c:1452: warning: comparison between pointer and integer

Pavel Rabel

--- drivers/scsi/sim710.c.old   Tue Dec  5 15:34:00 2000
+++ drivers/scsi/sim710.c   Tue Dec  5 15:37:18 2000
@@ -1449,7 +1449,7 @@
 
 for(indx = 0; indx < no_of_boards; indx++) {
 unsigned long page = __get_free_pages(GFP_ATOMIC, order);
-if(page == NULL)
+if( !page )
 {
printk(KERN_WARNING "sim710: out of memory registering board %d.\n", 
indx);
break;


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



[PATCH] timer.h obsolete comments

2000-12-12 Thread Pavel Rabel


Hi Linus,

Are the old static timers gone completely?
Some comments are either obsolete or out of place.

Pavel Rabel

--- include/linux/timer.h.old   Tue Dec 12 22:07:35 2000
+++ include/linux/timer.h   Tue Dec 12 22:09:28 2000
@@ -5,13 +5,9 @@
 #include 
 
 /*
- * This is completely separate from the above, and is the
+ * Old-style "hardcoded" timers are gone, this is the
  * "new and improved" way of handling timers more dynamically.
  * Hopefully efficient and general enough for most things.
- *
- * The "hardcoded" timers above are still useful for well-
- * defined problems, but the timer-list is probably better
- * when you need multiple outstanding timers or similar.
  *
  * The "data" field is in case you want to use the same
  * timeout function for several timeouts. You can use this

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



Re: [PATCH] mdacon.c cleanup

2000-12-12 Thread Pavel Rabel


On Tue, 12 Dec 2000, David Woodhouse wrote:

> [EMAIL PROTECTED] said:
> > Both MODULE_PARM and __init are removed by precompiler when not
> > compiler as module, so no need for ifdefs.  2.4.0-test12pre8
> 
> -#ifdef MODULE_PARM
>  MODULE_PARM(mda_first_vc, "1-255i");
>  MODULE_PARM(mda_last_vc,  "1-255i");
> -#endif
> 
> That was #ifdef MODULE_PARM not #ifdef MODULE. Probably there for 
> compatibility with older kernels. Although I'm not sure it's even required 
> in 2.2.

MODULE_PARM is removed by precompiler, in both 2.2 and 2.4. For sure.
 
Pavel

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



[PATCH] mdacon.c cleanup

2000-12-10 Thread Pavel Rabel

Both MODULE_PARM and __init are removed by precompiler when not compiler
as module, so no need for ifdefs. 
2.4.0-test12pre8

Pavel Rabel

--- mdacon.c.oldSun Dec 10 21:00:20 2000
+++ mdacon.cSun Dec 10 21:04:32 2000
@@ -77,10 +77,8 @@
 
 static struct vc_data  *mda_display_fg = NULL;
 
-#ifdef MODULE_PARM
 MODULE_PARM(mda_first_vc, "1-255i");
 MODULE_PARM(mda_last_vc,  "1-255i");
-#endif
 
 /* MDA register values
  */
@@ -200,11 +198,7 @@
 }
 #endif
 
-#ifdef MODULE
-static int mda_detect(void)
-#else
 static int __init mda_detect(void)
-#endif
 {
int count=0;
u16 *p, p_save;
@@ -287,11 +281,7 @@
return 1;
 }
 
-#ifdef MODULE
-static void mda_initialize(void)
-#else
 static void __init mda_initialize(void)
-#endif
 {
write_mda_b(97, 0x00);  /* horizontal total */
write_mda_b(80, 0x01);  /* horizontal displayed */
@@ -316,11 +306,7 @@
outb_p(0x00, mda_gfx_port);
 }
 
-#ifdef MODULE
-static const char *mdacon_startup(void)
-#else
 static const char __init *mdacon_startup(void)
-#endif
 {
mda_num_columns = 80;
mda_num_lines   = 25;
@@ -605,11 +591,7 @@
con_invert_region:  mdacon_invert_region,
 };
 
-#ifdef MODULE
-void mda_console_init(void)
-#else
 void __init mda_console_init(void)
-#endif
 {
if (mda_first_vc > mda_last_vc)
return;

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



[PATCH] sim710.c compiler warning

2000-12-05 Thread Pavel Rabel


sim710.c: In function `sim710_detect':
sim710.c:1452: warning: comparison between pointer and integer


--- drivers/scsi/sim710.c.old   Tue Dec  5 15:34:00 2000
+++ drivers/scsi/sim710.c   Tue Dec  5 15:37:18 2000
@@ -1449,7 +1449,7 @@
 
 for(indx = 0; indx < no_of_boards; indx++) {
 unsigned long page = __get_free_pages(GFP_ATOMIC, order);
-if(page == NULL)
+if( !page )
 {
printk(KERN_WARNING "sim710: out of memory registering board %d.\n", 
indx);
break;

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



[PATCH] ide config order

2000-11-28 Thread Pavel Rabel


2.4.0test12-pre2
Please reorder config to group DMA options together.

Pavel Rabel


--- drivers/ide/Config.in.old   Tue Nov 28 22:22:49 2000
+++ drivers/ide/Config.in   Tue Nov 28 22:24:19 2000
@@ -42,8 +42,8 @@
 bool '  Generic PCI IDE chipset support' CONFIG_BLK_DEV_IDEPCI
 if [ "$CONFIG_BLK_DEV_IDEPCI" = "y" ]; then
bool 'Sharing PCI IDE interrupts support' CONFIG_IDEPCI_SHARE_IRQ
-   bool 'Generic PCI bus-master DMA support' CONFIG_BLK_DEV_IDEDMA_PCI
bool 'Boot off-board chipsets first support' CONFIG_BLK_DEV_OFFBOARD
+   bool 'Generic PCI bus-master DMA support' CONFIG_BLK_DEV_IDEDMA_PCI
dep_bool '  Use PCI DMA by default when available' 
CONFIG_IDEDMA_PCI_AUTO $CONFIG_BLK_DEV_IDEDMA_PCI
define_bool CONFIG_BLK_DEV_IDEDMA $CONFIG_BLK_DEV_IDEDMA_PCI
dep_bool '  ATA Work(s) In Progress (EXPERIMENTAL)' 
CONFIG_IDEDMA_PCI_WIP $CONFIG_BLK_DEV_IDEDMA_PCI $CONFIG_EXPERIMENTAL

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



[PATCH] mad16 old OSS config

2000-11-28 Thread Pavel Rabel


Following patch is removing old config stuff which probably survived from
OSS.

Pavel Rabel

--- linux/drivers/sound/mad16.c.old Tue Nov 28 20:34:52 2000
+++ linux/drivers/sound/mad16.c Tue Nov 28 20:47:05 2000
@@ -20,38 +20,6 @@
  * issues of the card, using the OTI-605 chip, have an MPU-401 compatable Midi
  * port. This port is configured differently to that of the OPTi audio chips.
  *
- * NOTE! If you want to set CD-ROM address and/or joystick enable, define
- *   MAD16_CONF in local.h as combination of the following bits:
- *
- *  0x01- joystick disabled
- *
- *  CD-ROM type selection (select just one):
- *  0x00- none
- *  0x02- Sony 31A
- *  0x04- Mitsumi
- *  0x06- Panasonic (type "LaserMate", not "Sound Blaster")
- *  0x08- Secondary IDE (address 0x170)
- *  0x0a- Primary IDE (address 0x1F0)
- *  
- *  For example Mitsumi with joystick disabled = 0x04|0x01 = 0x05
- *  For example LaserMate (for use with sbpcd) plus joystick = 0x06
- *  
- *MAD16_CDSEL:
- *  This defaults to CD I/O 0x340, no IRQ and DMA3 
- *  (DMA5 with Mitsumi or IDE). If you like to change these, define
- *  MAD16_CDSEL with the following bits:
- *
- *  CD-ROM port: 0x00=340, 0x40=330, 0x80=360 or 0xc0=320
- *  OPL4 select: 0x20=OPL4, 0x00=OPL3
- *  CD-ROM irq: 0x00=disabled, 0x04=IRQ5, 0x08=IRQ7, 0x0c=IRQ3, 0x10=IRQ9,
- *  0x14=IRQ10 and 0x18=IRQ11.
- *
- *  CD-ROM DMA (Sony or Panasonic): 0x00=DMA3, 0x01=DMA2, 0x02=DMA1 or 
0x03=disabled
- *   or
- *  CD-ROM DMA (Mitsumi or IDE):0x00=DMA5, 0x01=DMA6, 0x02=DMA7 or 
0x03=disabled
- *
- *  For use with sbpcd, address 0x340, set MAD16_CDSEL to 0x03 or 0x23.
- *
  * Changes
  * 
  * Alan CoxClean up, added module selections.
@@ -67,6 +35,8 @@
  * 25-Nov-1999
  * Christoph Hellwig   Adapted to module_init/module_exit.
  * Arnaldo C. de Melo  got rid of attach_uart401   21-Sep-2000
+ *
+ * Pavel Rabel Clean up   Nov-2000
  */
 
 #include 
@@ -395,10 +365,6 @@
 {
unsigned char cfg = 0;
 
-#ifdef MAD16_CONF
-   cfg |= (0x0f & MAD16_CONF);
-#endif
-
if(c931_detected)
{
/* Bit 0 has reversd meaning. Bits 1 and 2 sese
@@ -435,14 +401,9 @@
/* bit 2 of MC4 reverses it's meaning between the C930
   and the C931. */
cfg = c931_detected ? 0x04 : 0x00;
-#ifdef MAD16_CDSEL
-   if(MAD16_CDSEL & 0x20)
-   mad_write(MC4_PORT, 0x62|cfg);  /* opl4 */
-   else
-   mad_write(MC4_PORT, 0x52|cfg);  /* opl3 */
-#else
+
mad_write(MC4_PORT, 0x52|cfg);
-#endif
+
mad_write(MC5_PORT, 0x3C);  /* Init it into mode2 */
mad_write(MC6_PORT, 0x02);  /* Enable WSS, Disable MPU and SB */
mad_write(MC7_PORT, 0xCB);
@@ -590,20 +551,9 @@
 */
 
tmp &= ~0x0f;
-#if defined(MAD16_CONF)
-   tmp |= ((MAD16_CONF) & 0x0f);   /* CD-ROM and joystick bits */
-#endif
mad_write(MC1_PORT, tmp);
 
-#if defined(MAD16_CONF) && defined(MAD16_CDSEL)
-   tmp = MAD16_CDSEL;
-#else
tmp = mad_read(MC2_PORT);
-#endif
-
-#ifdef MAD16_OPL4
-   tmp |= 0x20;/* Enable OPL4 access */
-#endif
 
mad_write(MC2_PORT, tmp);
mad_write(MC3_PORT, 0xf0);  /* Disable SB */

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



[PATCH] mad16 C924 detection

2000-11-24 Thread Pavel Rabel


Patch is replacing 7 levels of nested ifs with something
readable. Against 2.4test kernels. I have posted this one already once,
trying again.

The driver doesn't support C924 in both PnP and non-PnP modes as it
claims. It looks like part of the code got lost or was not finished. This
patch makes it more clear what's going on. There are many places in the
driver with two different paths for C924, only one is ever used.

Pavel Rabel

--- drivers/sound/mad16.c.old   Wed Nov 15 20:18:57 2000
+++ drivers/sound/mad16.c   Thu Nov 16 23:07:44 2000
@@ -462,72 +462,80 @@
 
DDB(printk("Detect using password = 0xE5\n"));

-   if (!detect_mad16())/* No luck. Try different model */
-   {
-   board_type = C928;
+   if (detect_mad16()) {
+   return 1;
+   }
+   
+   board_type = C928;
 
-   DDB(printk("Detect using password = 0xE2\n"));
+   DDB(printk("Detect using password = 0xE2\n"));
 
-   if (!detect_mad16())
-   {
-   board_type = C929;
-
-   DDB(printk("Detect using password = 0xE3\n"));
-
-   if (!detect_mad16())
-   {
-   if (inb(PASSWD_REG) != 0xff)
-   return 0;
-
-   /*
-* First relocate MC# registers to 0xe0e/0xe0f, 
disable password 
-*/
-
-   outb((0xE4), PASSWD_REG);
-   outb((0x80), PASSWD_REG);
-
-   board_type = C930;
-
-   DDB(printk("Detect using password = 0xE4\n"));
-
-   for (i = 0xf8d; i <= 0xf93; i++)
-   DDB(printk("port %03x = %02x\n", i, 
mad_read(i)));
-if(!detect_mad16()) {
-
- /* The C931 has the password reg at F8D */
- outb((0xE4), 0xF8D);
- outb((0x80), 0xF8D);
- DDB(printk("Detect using password = 0xE4 for 
C931\n"));
-
- if (!detect_mad16()) {
-   board_type = C924;
-   c924pnp++;
-   DDB(printk("Detect using password = 0xE5 (again), 
port offset -0x80\n"));
-   if (!detect_mad16()) {
- c924pnp=0;
- return 0;
-   }
- 
-   DDB(printk("mad16.c: 82C924 PnP detected\n"));
- }
-   }
-   else
- DDB(printk("mad16.c: 82C930 detected\n"));
-   } else
-   DDB(printk("mad16.c: 82C929 detected\n"));
-   } else {
-   unsigned char model;
+   if (detect_mad16())
+   {
+   unsigned char model;
 
-   if (((model = mad_read(MC3_PORT)) & 0x03) == 0x03) {
-   DDB(printk("mad16.c: Mozart detected\n"));
-   board_type = MOZART;
-   } else {
-   DDB(printk("mad16.c: 82C928 detected???\n"));
-   board_type = C928;
-   }
+   if (((model = mad_read(MC3_PORT)) & 0x03) == 0x03) {
+   DDB(printk("mad16.c: Mozart detected\n"));
+   board_type = MOZART;
+   } else {
+   DDB(printk("mad16.c: 82C928 detected???\n"));
+   board_type = C928;
}
+   return 1;
+   }
+
+   board_type = C929;
+
+   DDB(printk("Detect using password = 0xE3\n"));
+
+   if (detect_mad16())
+   {
+   DDB(printk("mad16.c: 82C929 detected\n"));
+   return 1;
+   }
+
+   if (inb(PASSWD_REG) != 0xff)
+   return 0;
+
+   /*
+* First relocate MC# registers to 0xe0e/0xe0f, disable password 
+*/
+
+   outb((0xE4), PASSWD_REG);
+   outb((0x80), PASSWD_REG);
+
+   board_type = C930;
+
+   DDB(printk("Detect using password = 0xE4\n"));
+
+   for (i = 0xf8d; i <= 0xf93; i++)
+   DDB(printk("port %03x = %02x\n", i, mad_read(i)));
+
+if(detect_mad16()) {
+   DDB(printk("mad16.c: 82C930 detected\n&qu

[PATCH] mad16 MPU probing

2000-11-23 Thread Pavel Rabel


Small cleanup in mad16.c MPU probing code. Against any 2.4 kernel.
Replacing mad loops with readable switches. Removing unnecessary array
declarations. Removing variable 'with secret power'. Removing double
declaration (tmp).

Is there a maintainer for this stuff? 
Whom to feed with this kind of cleanup patches? 

Pavel Rabel


--- drivers/sound/mad16.c.old   Wed Sep 27 20:53:56 2000
+++ drivers/sound/mad16.c   Thu Nov 23 11:00:47 2000
@@ -718,13 +718,7 @@
 static int __init probe_mad16_mpu(struct address_info *hw_config)
 {
static int mpu_attached = 0;
-   static int valid_ports[] = {
-   0x330, 0x320, 0x310, 0x300
-   };
-   
-   static short valid_irqs[] = {9, 10, 5, 7};
unsigned char tmp;
-   int i;  /* A variable with secret power */
 
if (!already_initialized)   /* The MSS port must be initialized first */
return 0;
@@ -737,7 +731,6 @@
{
 
 #ifdef CONFIG_MAD16_OLDCARD
-   unsigned char   tmp;
 
tmp = mad_read(MC3_PORT);
 
@@ -787,9 +780,6 @@
 * to set MPU register. TODO - add probing
 */
 
-   
-   unsigned char tmp;
-
tmp = mad_read(MC8_PORT);
 
switch (hw_config->irq)
@@ -840,42 +830,50 @@
tmp = mad_read(MC6_PORT) & 0x83;
tmp |= 0x80;/* MPU-401 enable */
 
-/*
- * Set the MPU base bits
- */
+   /* Set the MPU base bits */
 
-   for (i = 0; i < 5; i++)
+   switch (hw_config->io_base)
{
-   if (i > 3)  /* Out of array bounds */
-   {
-   printk(KERN_ERR "MAD16 / Mozart: Invalid MIDI port 0x%x\n", 
hw_config->io_base);
-   return 0;
-   }
-   if (valid_ports[i] == hw_config->io_base)
-   {
-   tmp |= i << 5;
+   case 0x300:
+   tmp |= 0x60;
break;
-   }
+   case 0x310:
+   tmp |= 0x40;
+   break;
+   case 0x320:
+   tmp |= 0x20;
+   break;
+   case 0x330:
+   tmp |= 0x00;
+   break;
+   default:
+   printk(KERN_ERR "MAD16: Invalid MIDI port 0x%x\n", 
+hw_config->io_base);
+   return 0;
}
 
-/*
- * Set the MPU IRQ bits
- */
+   /* Set the MPU IRQ bits */
 
-   for (i = 0; i < 5; i++)
+   switch (hw_config->irq)
{
-   if (i > 3)  /* Out of array bounds */
-   {
-   printk(KERN_ERR "MAD16 / Mozart: Invalid MIDI IRQ %d\n", 
hw_config->irq);
-   return 0;
-   }
-   if (valid_irqs[i] == hw_config->irq)
-   {
-   tmp |= i << 3;
+   case 5:
+   tmp |= 0x10;
+   break;
+   case 7:
+   tmp |= 0x18;
+   break;
+   case 9:
+   tmp |= 0x00;
+   break;
+   case 10:
+   tmp |= 0x08;
+   break;
+   default:
+   printk(KERN_ERR "MAD16: Invalid MIDI IRQ %d\n", 
+hw_config->irq);
break;
-   }
}
+   
mad_write(MC6_PORT, tmp);   /* Write MPU401 config */
+
 #ifndef CONFIG_MAD16_OLDCARD
 probe_401:
 #endif

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



Re: "No IRQ known for interrupt pin A..." error message

2000-11-19 Thread Pavel Rabel

> During boot, I get the message:
> 
> PCI: No IRQ known for interrupt pin A of device 00:00.1. Please try
> using pci=biosirq.

It is related to VGA card (at least on my system).
Enabling 'Assign IRQ for VGA' in BIOS causes the message to disapear.

Pavel


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



[PATCH] MAD16 madness

2000-11-16 Thread Pavel Rabel

Hi,

When I saw the mad16.c driver, I just couldn't resist.
There were 7 (seven) levels of nested ifs.
It looks like more cleaning can be done, but this patch is just
reorganising the code without any functionality change and makes the 
questionable logic more readable. 

Patch against latest 2.4test, similar patch can be
written for 2.2, it's just using older API.

Pavel

--- drivers/sound/mad16.c.old   Wed Nov 15 20:18:57 2000
+++ drivers/sound/mad16.c   Thu Nov 16 23:07:44 2000
@@ -462,72 +462,80 @@
 
DDB(printk("Detect using password = 0xE5\n"));

-   if (!detect_mad16())/* No luck. Try different model */
-   {
-   board_type = C928;
+   if (detect_mad16()) {
+   return 1;
+   }
+   
+   board_type = C928;
 
-   DDB(printk("Detect using password = 0xE2\n"));
+   DDB(printk("Detect using password = 0xE2\n"));
 
-   if (!detect_mad16())
-   {
-   board_type = C929;
-
-   DDB(printk("Detect using password = 0xE3\n"));
-
-   if (!detect_mad16())
-   {
-   if (inb(PASSWD_REG) != 0xff)
-   return 0;
-
-   /*
-* First relocate MC# registers to 0xe0e/0xe0f, 
disable password 
-*/
-
-   outb((0xE4), PASSWD_REG);
-   outb((0x80), PASSWD_REG);
-
-   board_type = C930;
-
-   DDB(printk("Detect using password = 0xE4\n"));
-
-   for (i = 0xf8d; i <= 0xf93; i++)
-   DDB(printk("port %03x = %02x\n", i, 
mad_read(i)));
-if(!detect_mad16()) {
-
- /* The C931 has the password reg at F8D */
- outb((0xE4), 0xF8D);
- outb((0x80), 0xF8D);
- DDB(printk("Detect using password = 0xE4 for 
C931\n"));
-
- if (!detect_mad16()) {
-   board_type = C924;
-   c924pnp++;
-   DDB(printk("Detect using password = 0xE5 (again), 
port offset -0x80\n"));
-   if (!detect_mad16()) {
- c924pnp=0;
- return 0;
-   }
- 
-   DDB(printk("mad16.c: 82C924 PnP detected\n"));
- }
-   }
-   else
- DDB(printk("mad16.c: 82C930 detected\n"));
-   } else
-   DDB(printk("mad16.c: 82C929 detected\n"));
-   } else {
-   unsigned char model;
+   if (detect_mad16())
+   {
+   unsigned char model;
 
-   if (((model = mad_read(MC3_PORT)) & 0x03) == 0x03) {
-   DDB(printk("mad16.c: Mozart detected\n"));
-   board_type = MOZART;
-   } else {
-   DDB(printk("mad16.c: 82C928 detected???\n"));
-   board_type = C928;
-   }
+   if (((model = mad_read(MC3_PORT)) & 0x03) == 0x03) {
+   DDB(printk("mad16.c: Mozart detected\n"));
+   board_type = MOZART;
+   } else {
+   DDB(printk("mad16.c: 82C928 detected???\n"));
+   board_type = C928;
}
+   return 1;
+   }
+
+   board_type = C929;
+
+   DDB(printk("Detect using password = 0xE3\n"));
+
+   if (detect_mad16())
+   {
+   DDB(printk("mad16.c: 82C929 detected\n"));
+   return 1;
+   }
+
+   if (inb(PASSWD_REG) != 0xff)
+   return 0;
+
+   /*
+* First relocate MC# registers to 0xe0e/0xe0f, disable password 
+*/
+
+   outb((0xE4), PASSWD_REG);
+   outb((0x80), PASSWD_REG);
+
+   board_type = C930;
+
+   DDB(printk("Detect using password = 0xE4\n"));
+
+   for (i = 0xf8d; i <= 0xf93; i++)
+   DDB(printk("port %03x = %02x\n", i, mad_read(i)));
+
+if(detect_mad16()) {
+   DDB(printk("mad16.c: 82C930 detected\n"));
+   return 1;
}
-   return 1;
+
+   /* The C931 has the password reg at F8D */
+   outb((0xE4), 0xF8D);
+   outb((0x80), 0xF8D);
+   DDB(printk("Detect using password = 0xE4 for C931\n"));
+
+   if (detect_mad16()) {
+   retur

[patch] CONFIG_SOUND_MAD16 help

2000-11-14 Thread Pavel Rabel


The mentioned file drivers/sound/README.C931 doesn't exist.
Is the README file somewhere else?

Pavel Rabel


--- Configure.help.old  Tue Nov 14 16:49:34 2000
+++ Configure.help  Tue Nov 14 16:52:08 2000
@@ -14045,8 +14045,7 @@
 Support for OPTi MAD16 and/or Mozart based cards
 CONFIG_SOUND_MAD16
   Answer Y if your card has a Mozart (OAK OTI-601) or MAD16 (OPTi
-  82C928 or 82C929 or 82C931) audio interface chip. For the 82C931,
-  please read drivers/sound/README.C931. These chips are currently
+  82C928 or 82C929 or 82C931) audio interface chip. These chips are 
   quite common so it's possible that many no-name cards have one of
   them. In addition the MAD16 chip is used in some cards made by known
   manufacturers such as Turtle Beach (Tropez), Reveal (some models)

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



[patch] matroxfb.txt

2000-11-10 Thread Pavel Rabel

Typo in Documentation/fb/matroxfb.txt

Pavel Rabel

--- matroxfb.txt.oldFri Nov 10 20:39:39 2000
+++ matroxfb.txtFri Nov 10 20:40:11 2000
@@ -253,7 +253,7 @@
`vesa'.
 
 If you know capabilities of your monitor, you can specify some (or all) of
-`pixclk', `fh' and `fv'. In this case, `pixclock' is computed so that
+`maxclk', `fh' and `fv'. In this case, `pixclock' is computed so that
 pixclock <= maxclk, real_fh <= fh and real_fv <= fv.
 
 maxclk:X - maximum dotclock. X can be specified in MHz, kHz or Hz. Default is

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



Re: [patch] NE2000

2000-10-30 Thread pavel rabel



On Mon, 30 Oct 2000, Paul Gortmaker wrote:

> There is no urgency in trying to squeeze a patch like this in the back
> door of a 2.4.0 release.  For example, there are people out there now
> who are using the ne.c driver to run both ISA and PCI cards in the same 
> box without having to use 2 different drivers.  We can wait until 2.5.0
> to break their .config file.

I am not quite sure how it will work when you try to use both ne.c and
ne2k-pci drivers in the same box. Which driver will be used for PCI card?
Maybe people with both cards are forced to use inferior driver for PCI
card.

Pavel Rabel


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