Commit 8ada2c7f authored by John W. Linville's avatar John W. Linville Committed by Jeff Garzik

[sound/oss i810] misc small changes

Attached is a second patch to account for (most of) Herbert Xu's
comments.

I have left-out the part about changing state->card to a
local variable where it is used a lot.  Unfortunately, that usage is
somewhat pervasive and I would prefer to make those changes in a separate
patch -- after I have had a chance to do some testing.

If you'd prefer one patch to account for the original plus these
changes, let me know and I'll be happy to provide it.
parent d1d60dbd
...@@ -453,8 +453,10 @@ struct i810_card { ...@@ -453,8 +453,10 @@ struct i810_card {
#define I810_IOREAD(size, type, card, off) \ #define I810_IOREAD(size, type, card, off) \
({ \ ({ \
type val; \ type val; \
if (card->use_mmio) val=read##size(card->iobase_mmio+off); \ if (card->use_mmio) \
else val=in##size(card->iobase+off); \ val=read##size(card->iobase_mmio+off); \
else \
val=in##size(card->iobase+off); \
val; \ val; \
}) })
...@@ -464,8 +466,10 @@ struct i810_card { ...@@ -464,8 +466,10 @@ struct i810_card {
#define I810_IOWRITE(size, val, card, off) \ #define I810_IOWRITE(size, val, card, off) \
({ \ ({ \
if (card->use_mmio) write##size(val, card->iobase_mmio+off); \ if (card->use_mmio) \
else out##size(val, card->iobase+off); \ write##size(val, card->iobase_mmio+off); \
else \
out##size(val, card->iobase+off); \
}) })
#define I810_IOWRITEL(val, card, off) I810_IOWRITE(l, val, card, off) #define I810_IOWRITEL(val, card, off) I810_IOWRITE(l, val, card, off)
...@@ -2816,9 +2820,11 @@ static int i810_ac97_power_up_bus(struct i810_card *card) ...@@ -2816,9 +2820,11 @@ static int i810_ac97_power_up_bus(struct i810_card *card)
* See if the primary codec comes ready. This must happen * See if the primary codec comes ready. This must happen
* before we start doing DMA stuff * before we start doing DMA stuff
*/ */
/* see i810_ac97_init for the next 7 lines (jsaw) */ /* see i810_ac97_init for the next 10 lines (jsaw) */
if (card->use_mmio) readw(card->ac97base_mmio); if (card->use_mmio)
else inw(card->ac97base); readw(card->ac97base_mmio);
else
inw(card->ac97base);
if (ich_use_mmio(card)) { if (ich_use_mmio(card)) {
primary_codec_id = (int) readl(card->iobase_mmio + SDM) & 0x3; primary_codec_id = (int) readl(card->iobase_mmio + SDM) & 0x3;
printk(KERN_INFO "i810_audio: Primary codec has ID %d\n", printk(KERN_INFO "i810_audio: Primary codec has ID %d\n",
...@@ -2836,8 +2842,10 @@ static int i810_ac97_power_up_bus(struct i810_card *card) ...@@ -2836,8 +2842,10 @@ static int i810_ac97_power_up_bus(struct i810_card *card)
else else
printk("no response.\n"); printk("no response.\n");
} }
if (card->use_mmio) readw(card->ac97base_mmio); if (card->use_mmio)
else inw(card->ac97base); readw(card->ac97base_mmio);
else
inw(card->ac97base);
return 1; return 1;
} }
...@@ -2881,8 +2889,10 @@ static int __devinit i810_ac97_init(struct i810_card *card) ...@@ -2881,8 +2889,10 @@ static int __devinit i810_ac97_init(struct i810_card *card)
for (num_ac97 = 0; num_ac97 < nr_ac97_max; num_ac97++) { for (num_ac97 = 0; num_ac97 < nr_ac97_max; num_ac97++) {
/* codec reset */ /* codec reset */
printk(KERN_INFO "i810_audio: Resetting connection %d\n", num_ac97); printk(KERN_INFO "i810_audio: Resetting connection %d\n", num_ac97);
if (card->use_mmio) readw(card->ac97base_mmio + 0x80*num_ac97); if (card->use_mmio)
else inw(card->ac97base + 0x80*num_ac97); readw(card->ac97base_mmio + 0x80*num_ac97);
else
inw(card->ac97base + 0x80*num_ac97);
/* If we have the SDATA_IN Map Register, as on ICH4, we /* If we have the SDATA_IN Map Register, as on ICH4, we
do not loop thru all possible codec IDs but thru all do not loop thru all possible codec IDs but thru all
...@@ -3160,7 +3170,7 @@ static int __devinit i810_probe(struct pci_dev *pci_dev, const struct pci_device ...@@ -3160,7 +3170,7 @@ static int __devinit i810_probe(struct pci_dev *pci_dev, const struct pci_device
} }
} }
if (!(card->use_mmio) && !(card->iobase)) { if (!(card->use_mmio) && (!(card->iobase) || !(card->ac97base))) {
printk(KERN_ERR "i810_audio: No I/O resources available.\n"); printk(KERN_ERR "i810_audio: No I/O resources available.\n");
goto out_mem; goto out_mem;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment