From 44c10138fd4bbc4b6d6bff0873c24902f2a9da65 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Fri, 8 Jun 2007 15:46:36 -0700 Subject: PCI: Change all drivers to use pci_device->revision Instead of all drivers reading pci config space to get the revision ID, they can now use the pci_device->revision member. This exposes some issues where drivers where reading a word or a dword for the revision number, and adding useless error-handling around the read. Some drivers even just read it for no purpose of all. In devices where the revision ID is being copied over and used in what appears to be the equivalent of hotpath, I have left the copy code and the cached copy as not to influence the driver's performance. Compile tested with make all{yes,mod}config on x86_64 and i386. Signed-off-by: Auke Kok Acked-by: Dave Jones Signed-off-by: Greg Kroah-Hartman --- sound/pci/via82xx.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'sound/pci/via82xx.c') diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index a28992269f5..50c9f92cfd1 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c @@ -2431,7 +2431,6 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci, { struct snd_card *card; struct via82xx *chip; - unsigned char revision; int chip_type = 0, card_type; unsigned int i; int err; @@ -2441,18 +2440,17 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci, return -ENOMEM; card_type = pci_id->driver_data; - pci_read_config_byte(pci, PCI_REVISION_ID, &revision); switch (card_type) { case TYPE_CARD_VIA686: strcpy(card->driver, "VIA686A"); - sprintf(card->shortname, "VIA 82C686A/B rev%x", revision); + sprintf(card->shortname, "VIA 82C686A/B rev%x", pci->revision); chip_type = TYPE_VIA686; break; case TYPE_CARD_VIA8233: chip_type = TYPE_VIA8233; - sprintf(card->shortname, "VIA 823x rev%x", revision); + sprintf(card->shortname, "VIA 823x rev%x", pci->revision); for (i = 0; i < ARRAY_SIZE(via823x_cards); i++) { - if (revision == via823x_cards[i].revision) { + if (pci->revision == via823x_cards[i].revision) { chip_type = via823x_cards[i].type; strcpy(card->shortname, via823x_cards[i].name); break; @@ -2460,7 +2458,7 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci, } if (chip_type != TYPE_VIA8233A) { if (dxs_support == VIA_DXS_AUTO) - dxs_support = check_dxs_list(pci, revision); + dxs_support = check_dxs_list(pci, pci->revision); /* force to use VIA8233 or 8233A model according to * dxs_support module option */ @@ -2471,7 +2469,7 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci, } if (chip_type == TYPE_VIA8233A) strcpy(card->driver, "VIA8233A"); - else if (revision >= VIA_REV_8237) + else if (pci->revision >= VIA_REV_8237) strcpy(card->driver, "VIA8237"); /* no slog assignment */ else strcpy(card->driver, "VIA8233"); @@ -2482,7 +2480,7 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci, goto __error; } - if ((err = snd_via82xx_create(card, pci, chip_type, revision, + if ((err = snd_via82xx_create(card, pci, chip_type, pci->revision, ac97_clock, &chip)) < 0) goto __error; card->private_data = chip; -- cgit v1.2.3-70-g09d2 From e65365de5ba280e058bd6b8b80c8790253268887 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 25 Jun 2007 12:09:32 +0200 Subject: [ALSA] Fix invalid schedule_timeout_interruptible() Fixed the invalid use of schedule_timeout_interruptible() without checking pending signals. Simply replaced with schedule_timeout(). Suggestions thanks to Jeff Garzik. Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- sound/core/seq/seq_instr.c | 6 +++--- sound/isa/ad1848/ad1848_lib.c | 4 ++-- sound/isa/sscape.c | 4 ++-- sound/isa/wavefront/wavefront_synth.c | 2 +- sound/pci/hda/hda_intel.c | 2 +- sound/pci/via82xx.c | 4 ++-- sound/pci/via82xx_modem.c | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) (limited to 'sound/pci/via82xx.c') diff --git a/sound/core/seq/seq_instr.c b/sound/core/seq/seq_instr.c index f30d171b6d9..5efe6523a58 100644 --- a/sound/core/seq/seq_instr.c +++ b/sound/core/seq/seq_instr.c @@ -109,7 +109,7 @@ void snd_seq_instr_list_free(struct snd_seq_kinstr_list **list_ptr) spin_lock_irqsave(&list->lock, flags); while (instr->use) { spin_unlock_irqrestore(&list->lock, flags); - schedule_timeout_interruptible(1); + schedule_timeout(1); spin_lock_irqsave(&list->lock, flags); } spin_unlock_irqrestore(&list->lock, flags); @@ -199,7 +199,7 @@ int snd_seq_instr_list_free_cond(struct snd_seq_kinstr_list *list, instr = flist; flist = instr->next; while (instr->use) - schedule_timeout_interruptible(1); + schedule_timeout(1); if (snd_seq_instr_free(instr, atomic)<0) snd_printk(KERN_WARNING "instrument free problem\n"); instr = next; @@ -555,7 +555,7 @@ static int instr_free(struct snd_seq_kinstr_ops *ops, SNDRV_SEQ_INSTR_NOTIFY_REMOVE); while (instr->use) { spin_unlock_irqrestore(&list->lock, flags); - schedule_timeout_interruptible(1); + schedule_timeout(1); spin_lock_irqsave(&list->lock, flags); } spin_unlock_irqrestore(&list->lock, flags); diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c index 8094282c2ae..1bc2e3fd572 100644 --- a/sound/isa/ad1848/ad1848_lib.c +++ b/sound/isa/ad1848/ad1848_lib.c @@ -245,7 +245,7 @@ static void snd_ad1848_mce_down(struct snd_ad1848 *chip) snd_printk(KERN_ERR "mce_down - auto calibration time out (2)\n"); return; } - time = schedule_timeout_interruptible(time); + time = schedule_timeout(time); spin_lock_irqsave(&chip->reg_lock, flags); } #if 0 @@ -258,7 +258,7 @@ static void snd_ad1848_mce_down(struct snd_ad1848 *chip) snd_printk(KERN_ERR "mce_down - auto calibration time out (3)\n"); return; } - time = schedule_timeout_interruptible(time); + time = schedule_timeout(time); spin_lock_irqsave(&chip->reg_lock, flags); } spin_unlock_irqrestore(&chip->reg_lock, flags); diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 9ea417bcf3e..cbad2a51cba 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c @@ -382,7 +382,7 @@ static int obp_startup_ack(struct soundscape *s, unsigned timeout) unsigned long flags; unsigned char x; - schedule_timeout_interruptible(1); + schedule_timeout(1); spin_lock_irqsave(&s->lock, flags); x = inb(HOST_DATA_IO(s->io_base)); @@ -409,7 +409,7 @@ static int host_startup_ack(struct soundscape *s, unsigned timeout) unsigned long flags; unsigned char x; - schedule_timeout_interruptible(1); + schedule_timeout(1); spin_lock_irqsave(&s->lock, flags); x = inb(HOST_DATA_IO(s->io_base)); diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c index 78020d832e0..bacc51c8658 100644 --- a/sound/isa/wavefront/wavefront_synth.c +++ b/sound/isa/wavefront/wavefront_synth.c @@ -1780,7 +1780,7 @@ wavefront_should_cause_interrupt (snd_wavefront_t *dev, outb (val,port); spin_unlock_irq(&dev->irq_lock); while (1) { - if ((timeout = schedule_timeout_interruptible(timeout)) == 0) + if ((timeout = schedule_timeout(timeout)) == 0) return; if (dev->irq_ok) return; diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 74e5593a58e..c78ff901a57 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -538,7 +538,7 @@ static unsigned int azx_rirb_get_response(struct hda_codec *codec) } if (! chip->rirb.cmds) return chip->rirb.res; /* the last value */ - schedule_timeout_interruptible(1); + schedule_timeout(1); } while (time_after_eq(timeout, jiffies)); if (chip->msi) { diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index 50c9f92cfd1..6ea09df0c73 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c @@ -2098,7 +2098,7 @@ static int snd_via82xx_chip_init(struct via82xx *chip) pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval); if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */ break; - schedule_timeout_uninterruptible(1); + schedule_timeout(1); } while (time_before(jiffies, end_time)); if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY) @@ -2117,7 +2117,7 @@ static int snd_via82xx_chip_init(struct via82xx *chip) chip->ac97_secondary = 1; goto __ac97_ok2; } - schedule_timeout_interruptible(1); + schedule_timeout(1); } while (time_before(jiffies, end_time)); /* This is ok, the most of motherboards have only one codec */ diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c index 8cbf8eba4ae..72425e73aba 100644 --- a/sound/pci/via82xx_modem.c +++ b/sound/pci/via82xx_modem.c @@ -983,7 +983,7 @@ static int snd_via82xx_chip_init(struct via82xx_modem *chip) pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval); if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */ break; - schedule_timeout_uninterruptible(1); + schedule_timeout(1); } while (time_before(jiffies, end_time)); if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY) @@ -1001,7 +1001,7 @@ static int snd_via82xx_chip_init(struct via82xx_modem *chip) chip->ac97_secondary = 1; goto __ac97_ok2; } - schedule_timeout_interruptible(1); + schedule_timeout(1); } while (time_before(jiffies, end_time)); /* This is ok, the most of motherboards have only one codec */ -- cgit v1.2.3-70-g09d2