diff options
author | Auke Kok <auke-jan.h.kok@intel.com> | 2007-06-08 18:46:36 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-11 19:02:10 -0400 |
commit | 44c10138fd4bbc4b6d6bff0873c24902f2a9da65 (patch) | |
tree | 6e16d3ec80c87490dc743f72da086356f2906ace /drivers/atm/idt77252.c | |
parent | b8a3a5214d7cc115f1ca3a3967b7229d97c46f4a (diff) |
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 <auke-jan.h.kok@intel.com>
Acked-by: Dave Jones <davej@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/atm/idt77252.c')
-rw-r--r-- | drivers/atm/idt77252.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c index 3800bc0cb2ef..8f995ce8d73b 100644 --- a/drivers/atm/idt77252.c +++ b/drivers/atm/idt77252.c | |||
@@ -3679,7 +3679,6 @@ idt77252_init_one(struct pci_dev *pcidev, const struct pci_device_id *id) | |||
3679 | unsigned long membase, srambase; | 3679 | unsigned long membase, srambase; |
3680 | struct idt77252_dev *card; | 3680 | struct idt77252_dev *card; |
3681 | struct atm_dev *dev; | 3681 | struct atm_dev *dev; |
3682 | ushort revision = 0; | ||
3683 | int i, err; | 3682 | int i, err; |
3684 | 3683 | ||
3685 | 3684 | ||
@@ -3688,19 +3687,13 @@ idt77252_init_one(struct pci_dev *pcidev, const struct pci_device_id *id) | |||
3688 | return err; | 3687 | return err; |
3689 | } | 3688 | } |
3690 | 3689 | ||
3691 | if (pci_read_config_word(pcidev, PCI_REVISION_ID, &revision)) { | ||
3692 | printk("idt77252-%d: can't read PCI_REVISION_ID\n", index); | ||
3693 | err = -ENODEV; | ||
3694 | goto err_out_disable_pdev; | ||
3695 | } | ||
3696 | |||
3697 | card = kzalloc(sizeof(struct idt77252_dev), GFP_KERNEL); | 3690 | card = kzalloc(sizeof(struct idt77252_dev), GFP_KERNEL); |
3698 | if (!card) { | 3691 | if (!card) { |
3699 | printk("idt77252-%d: can't allocate private data\n", index); | 3692 | printk("idt77252-%d: can't allocate private data\n", index); |
3700 | err = -ENOMEM; | 3693 | err = -ENOMEM; |
3701 | goto err_out_disable_pdev; | 3694 | goto err_out_disable_pdev; |
3702 | } | 3695 | } |
3703 | card->revision = revision; | 3696 | card->revision = pcidev->revision; |
3704 | card->index = index; | 3697 | card->index = index; |
3705 | card->pcidev = pcidev; | 3698 | card->pcidev = pcidev; |
3706 | sprintf(card->name, "idt77252-%d", card->index); | 3699 | sprintf(card->name, "idt77252-%d", card->index); |
@@ -3762,8 +3755,8 @@ idt77252_init_one(struct pci_dev *pcidev, const struct pci_device_id *id) | |||
3762 | } | 3755 | } |
3763 | 3756 | ||
3764 | printk("%s: ABR SAR (Rev %c): MEM %08lx SRAM %08lx [%u KB]\n", | 3757 | printk("%s: ABR SAR (Rev %c): MEM %08lx SRAM %08lx [%u KB]\n", |
3765 | card->name, ((revision > 1) && (revision < 25)) ? | 3758 | card->name, ((card->revision > 1) && (card->revision < 25)) ? |
3766 | 'A' + revision - 1 : '?', membase, srambase, | 3759 | 'A' + card->revision - 1 : '?', membase, srambase, |
3767 | card->sramsize / 1024); | 3760 | card->sramsize / 1024); |
3768 | 3761 | ||
3769 | if (init_card(dev)) { | 3762 | if (init_card(dev)) { |