intel-agp: introduce IS_I915 and do some cleanups..

Add a new IS_I915 and also do some checkpatch whitespace cleanups.

Signed-off-by: Dave Airlie <airlied@linux.ie>

+57 -61
+57 -61
drivers/char/agp/intel-agp.c
··· 35 35 #define PCI_DEVICE_ID_INTEL_IGD_HB 0x2A40 36 36 #define PCI_DEVICE_ID_INTEL_IGD_IG 0x2A42 37 37 38 + /* cover 915 and 945 variants */ 39 + #define IS_I915 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_E7221_HB || \ 40 + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || \ 41 + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || \ 42 + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB || \ 43 + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB || \ 44 + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GME_HB) 45 + 38 46 #define IS_I965 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82946GZ_HB || \ 39 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82G35_HB || \ 40 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965Q_HB || \ 41 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB || \ 42 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GM_HB || \ 47 + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82G35_HB || \ 48 + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965Q_HB || \ 49 + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB || \ 50 + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GM_HB || \ 43 51 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GME_HB || \ 44 52 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGD_HB) 45 53 ··· 224 216 /* Exists to support ARGB cursors */ 225 217 static void *i8xx_alloc_pages(void) 226 218 { 227 - struct page * page; 219 + struct page *page; 228 220 229 221 page = alloc_pages(GFP_KERNEL | GFP_DMA32, 2); 230 222 if (page == NULL) ··· 453 445 static const int ddt[4] = { 0, 16, 32, 64 }; 454 446 int size; /* reserved space (in kb) at the top of stolen memory */ 455 447 456 - pci_read_config_word(agp_bridge->dev,I830_GMCH_CTRL,&gmch_ctrl); 448 + pci_read_config_word(agp_bridge->dev, I830_GMCH_CTRL, &gmch_ctrl); 457 449 458 450 if (IS_I965) { 459 451 u32 pgetbl_ctl; ··· 552 544 break; 553 545 case I915_GMCH_GMS_STOLEN_48M: 554 546 /* Check it's really I915G */ 555 - if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_E7221_HB || 556 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || 557 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || 558 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB || 559 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB || 560 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GME_HB || 561 - IS_I965 || IS_G33) 547 + if (IS_I915 || IS_I965 || IS_G33) 562 548 gtt_entries = MB(48) - KB(size); 563 549 else 564 550 gtt_entries = 0; 565 551 break; 566 552 case I915_GMCH_GMS_STOLEN_64M: 567 553 /* Check it's really I915G */ 568 - if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_E7221_HB || 569 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || 570 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || 571 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB || 572 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB || 573 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GME_HB || 574 - IS_I965 || IS_G33) 554 + if (IS_I915 || IS_I965 || IS_G33) 575 555 gtt_entries = MB(64) - KB(size); 576 556 else 577 557 gtt_entries = 0; ··· 610 614 return; 611 615 612 616 intel_private.i8xx_page = alloc_page(GFP_KERNEL | __GFP_ZERO | GFP_DMA32); 613 - if (!intel_private.i8xx_page) { 617 + if (!intel_private.i8xx_page) 614 618 return; 615 - } 616 619 617 620 /* make page uncached */ 618 621 map_page_into_agp(intel_private.i8xx_page); ··· 627 632 unsigned int *pg = intel_private.i8xx_flush_page; 628 633 int i; 629 634 630 - for (i = 0; i < 256; i+=2) 635 + for (i = 0; i < 256; i += 2) 631 636 *(pg + i) = i; 632 - 637 + 633 638 wmb(); 634 639 } 635 640 ··· 648 653 num_entries = size->num_entries; 649 654 agp_bridge->gatt_table_real = NULL; 650 655 651 - pci_read_config_dword(intel_private.pcidev,I810_MMADDR,&temp); 656 + pci_read_config_dword(intel_private.pcidev, I810_MMADDR, &temp); 652 657 temp &= 0xfff80000; 653 658 654 - intel_private.registers = ioremap(temp,128 * 4096); 659 + intel_private.registers = ioremap(temp, 128 * 4096); 655 660 if (!intel_private.registers) 656 661 return -ENOMEM; 657 662 ··· 691 696 return values[0].size; 692 697 } 693 698 694 - pci_read_config_word(agp_bridge->dev,I830_GMCH_CTRL,&gmch_ctrl); 699 + pci_read_config_word(agp_bridge->dev, I830_GMCH_CTRL, &gmch_ctrl); 695 700 696 701 if ((gmch_ctrl & I830_GMCH_MEM_MASK) == I830_GMCH_MEM_128M) { 697 702 agp_bridge->previous_size = agp_bridge->current_size = (void *) values; ··· 715 720 716 721 current_size = A_SIZE_FIX(agp_bridge->current_size); 717 722 718 - pci_read_config_dword(intel_private.pcidev,I810_GMADDR,&temp); 723 + pci_read_config_dword(intel_private.pcidev, I810_GMADDR, &temp); 719 724 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); 720 725 721 - pci_read_config_word(agp_bridge->dev,I830_GMCH_CTRL,&gmch_ctrl); 726 + pci_read_config_word(agp_bridge->dev, I830_GMCH_CTRL, &gmch_ctrl); 722 727 gmch_ctrl |= I830_GMCH_ENABLED; 723 - pci_write_config_word(agp_bridge->dev,I830_GMCH_CTRL,gmch_ctrl); 728 + pci_write_config_word(agp_bridge->dev, I830_GMCH_CTRL, gmch_ctrl); 724 729 725 730 writel(agp_bridge->gatt_bus_addr|I810_PGETBL_ENABLED, intel_private.registers+I810_PGETBL_CTL); 726 731 readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */ ··· 743 748 iounmap(intel_private.registers); 744 749 } 745 750 746 - static int intel_i830_insert_entries(struct agp_memory *mem,off_t pg_start, int type) 751 + static int intel_i830_insert_entries(struct agp_memory *mem, off_t pg_start, 752 + int type) 747 753 { 748 - int i,j,num_entries; 754 + int i, j, num_entries; 749 755 void *temp; 750 756 int ret = -EINVAL; 751 757 int mask_type; ··· 758 762 num_entries = A_SIZE_FIX(temp)->num_entries; 759 763 760 764 if (pg_start < intel_private.gtt_entries) { 761 - printk (KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_private.gtt_entries == 0x%.8x\n", 762 - pg_start,intel_private.gtt_entries); 765 + printk(KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_private.gtt_entries == 0x%.8x\n", 766 + pg_start, intel_private.gtt_entries); 763 767 764 - printk (KERN_INFO PFX "Trying to insert into local/stolen memory\n"); 768 + printk(KERN_INFO PFX "Trying to insert into local/stolen memory\n"); 765 769 goto out_err; 766 770 } 767 771 ··· 799 803 return ret; 800 804 } 801 805 802 - static int intel_i830_remove_entries(struct agp_memory *mem,off_t pg_start, 803 - int type) 806 + static int intel_i830_remove_entries(struct agp_memory *mem, off_t pg_start, 807 + int type) 804 808 { 805 809 int i; 806 810 ··· 808 812 return 0; 809 813 810 814 if (pg_start < intel_private.gtt_entries) { 811 - printk (KERN_INFO PFX "Trying to disable local/stolen memory\n"); 815 + printk(KERN_INFO PFX "Trying to disable local/stolen memory\n"); 812 816 return -EINVAL; 813 817 } 814 818 ··· 821 825 return 0; 822 826 } 823 827 824 - static struct agp_memory *intel_i830_alloc_by_type(size_t pg_count,int type) 828 + static struct agp_memory *intel_i830_alloc_by_type(size_t pg_count, int type) 825 829 { 826 830 if (type == AGP_PHYS_MEMORY) 827 831 return alloc_agpphysmem_i8xx(pg_count, type); ··· 880 884 pci_write_config_dword(agp_bridge->dev, I965_IFPADDR, (intel_private.ifp_resource.start & 0xffffffff) | 0x1); 881 885 } else { 882 886 u64 l64; 883 - 887 + 884 888 temp_lo &= ~0x1; 885 889 l64 = ((u64)temp_hi << 32) | temp_lo; 886 890 ··· 914 918 if (intel_private.ifp_resource.start) { 915 919 intel_private.i9xx_flush_page = ioremap_nocache(intel_private.ifp_resource.start, PAGE_SIZE); 916 920 if (!intel_private.i9xx_flush_page) 917 - printk("unable to ioremap flush page - no chipset flushing"); 921 + printk(KERN_INFO "unable to ioremap flush page - no chipset flushing"); 918 922 } 919 923 } 920 924 ··· 931 935 932 936 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); 933 937 934 - pci_read_config_word(agp_bridge->dev,I830_GMCH_CTRL,&gmch_ctrl); 938 + pci_read_config_word(agp_bridge->dev, I830_GMCH_CTRL, &gmch_ctrl); 935 939 gmch_ctrl |= I830_GMCH_ENABLED; 936 - pci_write_config_word(agp_bridge->dev,I830_GMCH_CTRL,gmch_ctrl); 940 + pci_write_config_word(agp_bridge->dev, I830_GMCH_CTRL, gmch_ctrl); 937 941 938 942 writel(agp_bridge->gatt_bus_addr|I810_PGETBL_ENABLED, intel_private.registers+I810_PGETBL_CTL); 939 943 readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */ ··· 948 952 global_cache_flush(); 949 953 950 954 intel_i9xx_setup_flush(); 951 - 955 + 952 956 return 0; 953 957 } 954 958 ··· 970 974 writel(1, intel_private.i9xx_flush_page); 971 975 } 972 976 973 - static int intel_i915_insert_entries(struct agp_memory *mem,off_t pg_start, 974 - int type) 977 + static int intel_i915_insert_entries(struct agp_memory *mem, off_t pg_start, 978 + int type) 975 979 { 976 - int i,j,num_entries; 980 + int i, j, num_entries; 977 981 void *temp; 978 982 int ret = -EINVAL; 979 983 int mask_type; ··· 985 989 num_entries = A_SIZE_FIX(temp)->num_entries; 986 990 987 991 if (pg_start < intel_private.gtt_entries) { 988 - printk (KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_private.gtt_entries == 0x%.8x\n", 989 - pg_start,intel_private.gtt_entries); 992 + printk(KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_private.gtt_entries == 0x%.8x\n", 993 + pg_start, intel_private.gtt_entries); 990 994 991 - printk (KERN_INFO PFX "Trying to insert into local/stolen memory\n"); 995 + printk(KERN_INFO PFX "Trying to insert into local/stolen memory\n"); 992 996 goto out_err; 993 997 } 994 998 ··· 1026 1030 return ret; 1027 1031 } 1028 1032 1029 - static int intel_i915_remove_entries(struct agp_memory *mem,off_t pg_start, 1030 - int type) 1033 + static int intel_i915_remove_entries(struct agp_memory *mem, off_t pg_start, 1034 + int type) 1031 1035 { 1032 1036 int i; 1033 1037 ··· 1035 1039 return 0; 1036 1040 1037 1041 if (pg_start < intel_private.gtt_entries) { 1038 - printk (KERN_INFO PFX "Trying to disable local/stolen memory\n"); 1042 + printk(KERN_INFO PFX "Trying to disable local/stolen memory\n"); 1039 1043 return -EINVAL; 1040 1044 } 1041 1045 1042 - for (i = pg_start; i < (mem->page_count + pg_start); i++) { 1046 + for (i = pg_start; i < (mem->page_count + pg_start); i++) 1043 1047 writel(agp_bridge->scratch_page, intel_private.gtt+i); 1044 - } 1048 + 1045 1049 readl(intel_private.gtt+i-1); 1046 1050 1047 1051 agp_bridge->driver->tlb_flush(mem); ··· 1088 1092 agp_bridge->gatt_table_real = NULL; 1089 1093 1090 1094 pci_read_config_dword(intel_private.pcidev, I915_MMADDR, &temp); 1091 - pci_read_config_dword(intel_private.pcidev, I915_PTEADDR,&temp2); 1095 + pci_read_config_dword(intel_private.pcidev, I915_PTEADDR, &temp2); 1092 1096 1093 1097 if (IS_G33) 1094 1098 gtt_map_size = 1024 * 1024; /* 1M on G33 */ ··· 1098 1102 1099 1103 temp &= 0xfff80000; 1100 1104 1101 - intel_private.registers = ioremap(temp,128 * 4096); 1105 + intel_private.registers = ioremap(temp, 128 * 4096); 1102 1106 if (!intel_private.registers) { 1103 1107 iounmap(intel_private.gtt); 1104 1108 return -ENOMEM; ··· 1325 1329 /* the Intel 815 chipset spec. says that bits 29-31 in the 1326 1330 * ATTBASE register are reserved -> try not to write them */ 1327 1331 if (agp_bridge->gatt_bus_addr & INTEL_815_ATTBASE_MASK) { 1328 - printk (KERN_EMERG PFX "gatt bus addr too high"); 1332 + printk(KERN_EMERG PFX "gatt bus addr too high"); 1329 1333 return -EINVAL; 1330 1334 } 1331 1335 ··· 1982 1986 gmch_device = pci_get_device(PCI_VENDOR_ID_INTEL, device, NULL); 1983 1987 if (gmch_device && PCI_FUNC(gmch_device->devfn) != 0) { 1984 1988 gmch_device = pci_get_device(PCI_VENDOR_ID_INTEL, 1985 - device, gmch_device); 1989 + device, gmch_device); 1986 1990 } 1987 1991 1988 1992 if (!gmch_device) ··· 2104 2108 if (intel_agp_chipsets[i].name == NULL) { 2105 2109 if (cap_ptr) 2106 2110 printk(KERN_WARNING PFX "Unsupported Intel chipset" 2107 - "(device id: %04x)\n", pdev->device); 2111 + "(device id: %04x)\n", pdev->device); 2108 2112 agp_put_bridge(bridge); 2109 2113 return -ENODEV; 2110 2114 } ··· 2117 2121 intel_agp_chipsets[i].gmch_chip_id); 2118 2122 agp_put_bridge(bridge); 2119 2123 return -ENODEV; 2120 - } 2124 + } 2121 2125 2122 2126 bridge->dev = pdev; 2123 2127 bridge->capndx = cap_ptr;