All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix ymfpci port parameter handling
@ 2003-10-23  7:37 Clemens Ladisch
  2003-10-27 11:10 ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Clemens Ladisch @ 2003-10-23  7:37 UTC (permalink / raw)
  To: alsa-devel


- fix detection of omitted (default) joystick_port parameter
- make fm_port and mpu_port handling consistent with joystick_port


Index: alsa-kernel/pci/ymfpci/ymfpci.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/ymfpci/ymfpci.c,v
retrieving revision 1.29
diff -u -r1.29 ymfpci.c
--- alsa-kernel/pci/ymfpci/ymfpci.c	14 Oct 2003 13:59:21 -0000	1.29
+++ alsa-kernel/pci/ymfpci/ymfpci.c	23 Oct 2003 07:14:43 -0000
@@ -44,10 +44,10 @@
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable this card */
-static long fm_port[SNDRV_CARDS];
-static long mpu_port[SNDRV_CARDS];
+static long fm_port[SNDRV_CARDS] = { [0 ... SNDRV_CARDS-1] = -1 };
+static long mpu_port[SNDRV_CARDS] = { [0 ... SNDRV_CARDS-1] = -1 };
 #ifdef SUPPORT_JOYSTICK
-static long joystick_port[SNDRV_CARDS];
+static long joystick_port[SNDRV_CARDS] = { [0 ... SNDRV_CARDS-1] = -1 };
 #endif
 static int rear_switch[SNDRV_CARDS];

@@ -128,18 +128,18 @@
 	legacy_ctrl2 = 0x0800;	/* SBEN = 0, SMOD = 01, LAD = 0 */

 	if (pci_id->device >= 0x0010) { /* YMF 744/754 */
-		if (fm_port[dev] <= 0) {
+		if (fm_port[dev] < 0) {
 			fm_port[dev] = pci_resource_start(pci, 1);
 		}
-		if (fm_port[dev] > 0 &&
+		if (fm_port[dev] >= 0 &&
 		    (fm_res = request_region(fm_port[dev], 4, "YMFPCI OPL3")) != NULL) {
 			legacy_ctrl |= YMFPCI_LEGACY_FMEN;
 			pci_write_config_word(pci, PCIR_DSXG_FMBASE, fm_port[dev]);
 		}
-		if (mpu_port[dev] <= 0) {
+		if (mpu_port[dev] < 0) {
 			mpu_port[dev] = pci_resource_start(pci, 1) + 0x20;
 		}
-		if (mpu_port[dev] > 0 &&
+		if (mpu_port[dev] >= 0 &&
 		    (mpu_res = request_region(mpu_port[dev], 2, "YMFPCI MPU401")) != NULL) {
 			legacy_ctrl |= YMFPCI_LEGACY_MEN;
 			pci_write_config_word(pci, PCIR_DSXG_MPU401BASE, mpu_port[dev]);




-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community?  Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fix ymfpci port parameter handling
  2003-10-23  7:37 [PATCH] fix ymfpci port parameter handling Clemens Ladisch
@ 2003-10-27 11:10 ` Takashi Iwai
  2003-10-27 11:34   ` Clemens Ladisch
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2003-10-27 11:10 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: perex, alsa-devel

At Thu, 23 Oct 2003 09:37:44 +0200 (METDST),
Clemens Ladisch wrote:
> 
> 
> - fix detection of omitted (default) joystick_port parameter
> - make fm_port and mpu_port handling consistent with joystick_port

i think it'd be better to check all *_port parameters of all modules
to use the consistent values.  so far, some drivers use the value 0 to
disable the device, some -1, and sometimes -1 is for the
auto-detection.

yes, it's cosmetic but important.  we need to define the standard
values before ALSA 1.0 is out.

the candidates are:

a) -1 = disable, 0 = auto-detect, others = manual
b) 0 = disable, -1 = auto-detect, others = manual
c) 0 = disable, 1 = auto-detect, others = manual
d) 0 = disable, -1 = auto-detect, others = manual

i like the case (c) or (d).
in theory, the value 1 might be invalid in (c).  but, these ports
parameters are anyway only for ISA devices, and 1 is never used as the
valid port address.


comments?


Takashi


-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community?  Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fix ymfpci port parameter handling
  2003-10-27 11:10 ` Takashi Iwai
@ 2003-10-27 11:34   ` Clemens Ladisch
  2003-10-28 11:30     ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Clemens Ladisch @ 2003-10-27 11:34 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: perex, alsa-devel

Takashi Iwai wrote:
> Clemens Ladisch wrote:
> > - fix detection of omitted (default) joystick_port parameter
> > - make fm_port and mpu_port handling consistent with joystick_port
>
> i think it'd be better to check all *_port parameters of all modules
> to use the consistent values.  so far, some drivers use the value 0 to
> disable the device, some -1, and sometimes -1 is for the
> auto-detection.
>
> yes, it's cosmetic but important.  we need to define the standard
> values before ALSA 1.0 is out.
>
> the candidates are:
>
> a) -1 = disable, 0 = auto-detect, others = manual
> b) 0 = disable, -1 = auto-detect, others = manual
> c) 0 = disable, 1 = auto-detect, others = manual
> d) 0 = disable, -1 = auto-detect, others = manual
>
> i like the case (c) or (d).

I'm for (c): When autodetection is available, the parameter can behave
like a boolean, so "1" would be the least suprising value for a
'generic enable'.

And you've already begun to implement (c) anyway.  :-)


Regards,
Clemens




-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community?  Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fix ymfpci port parameter handling
  2003-10-27 11:34   ` Clemens Ladisch
@ 2003-10-28 11:30     ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2003-10-28 11:30 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: perex, alsa-devel

At Mon, 27 Oct 2003 12:34:01 +0100 (MET),
Clemens Ladisch wrote:
> 
> Takashi Iwai wrote:
> > Clemens Ladisch wrote:
> > > - fix detection of omitted (default) joystick_port parameter
> > > - make fm_port and mpu_port handling consistent with joystick_port
> >
> > i think it'd be better to check all *_port parameters of all modules
> > to use the consistent values.  so far, some drivers use the value 0 to
> > disable the device, some -1, and sometimes -1 is for the
> > auto-detection.
> >
> > yes, it's cosmetic but important.  we need to define the standard
> > values before ALSA 1.0 is out.
> >
> > the candidates are:
> >
> > a) -1 = disable, 0 = auto-detect, others = manual
> > b) 0 = disable, -1 = auto-detect, others = manual
> > c) 0 = disable, 1 = auto-detect, others = manual
> > d) 0 = disable, -1 = auto-detect, others = manual
> >
> > i like the case (c) or (d).
> 
> I'm for (c): When autodetection is available, the parameter can behave
> like a boolean, so "1" would be the least suprising value for a
> 'generic enable'.
> 
> And you've already begun to implement (c) anyway.  :-)

yeah :)

now i changed the cvs code.  the affected drivers are:
als4000, azt3328, cmipci, ens1370, via82xx, ymfpci


Takashi


-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community?  Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-10-28 11:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-23  7:37 [PATCH] fix ymfpci port parameter handling Clemens Ladisch
2003-10-27 11:10 ` Takashi Iwai
2003-10-27 11:34   ` Clemens Ladisch
2003-10-28 11:30     ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.