diff options
author | Aaro Koskinen <aaro.koskinen@iki.fi> | 2011-10-11 18:47:16 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-10-12 15:51:45 (GMT) |
commit | 6048d761d23958218ea0e67decafdfac81aed663 (patch) | |
tree | e6382110975e1652ac6efab035d37fba4103d50d /drivers/staging/xgifb | |
parent | c62f2e466f875a5eedb4d4f52115c3e7d1cb52f6 (diff) | |
download | linux-fsl-qoriq-6048d761d23958218ea0e67decafdfac81aed663.tar.xz |
staging: xgifb: inline XGIfb_query_VGA_config_space()
XGIfb_query_VGA_config_space() is used only once during the init and
can be replaced with a single PCI configuration space read.
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/xgifb')
-rw-r--r-- | drivers/staging/xgifb/XGI_main_26.c | 44 | ||||
-rw-r--r-- | drivers/staging/xgifb/vb_init.c | 15 | ||||
-rw-r--r-- | drivers/staging/xgifb/vb_init.h | 2 | ||||
-rw-r--r-- | drivers/staging/xgifb/vgatypes.h | 4 |
4 files changed, 11 insertions, 54 deletions
diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 20ddf3a..09aea30 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -387,44 +387,6 @@ static void XGIRegInit(struct vb_device_info *XGI_Pr, unsigned long BaseAddr) } -/* ------------ Interface for init & mode switching code ------------- */ - -static unsigned char XGIfb_query_VGA_config_space( - struct xgi_hw_device_info *pXGIhw_ext, unsigned long offset, - unsigned long set, unsigned long *value) -{ - static struct pci_dev *pdev; - static unsigned char init, valid_pdev; - - if (!set) - DPRINTK("XGIfb: Get VGA offset 0x%lx\n", offset); - else - DPRINTK("XGIfb: Set offset 0x%lx to 0x%lx\n", offset, *value); - - if (!init) { - init = 1; - pdev = pci_get_device(PCI_VENDOR_ID_XG, xgi_video_info.chip_id, - pdev); - if (pdev) { - valid_pdev = 1; - pci_dev_put(pdev); - } - } - - if (!valid_pdev) { - printk(KERN_DEBUG "XGIfb: Can't find XGI %d VGA device.\n", - xgi_video_info.chip_id); - return 0; - } - - if (set == 0) - pci_read_config_dword(pdev, offset, (u32 *) value); - else - pci_write_config_dword(pdev, offset, (u32)(*value)); - - return 1; -} - /* ------------------ Internal helper routines ----------------- */ static int XGIfb_GetXG21DefaultLVDSModeIdx(void) @@ -2078,7 +2040,6 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, hw_info->pjVirtualRomBase = NULL; printk(KERN_INFO "XGIfb: Video ROM usage disabled\n"); } - hw_info->pQueryVGAConfigSpace = &XGIfb_query_VGA_config_space; if (XGIfb_get_dram_size()) { printk(KERN_INFO "XGIfb: Fatal error: Unable to determine RAM size.\n"); @@ -2128,7 +2089,8 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, xgi_video_info.mmio_base, xgi_video_info.mmio_vbase, xgi_video_info.mmio_size / 1024); printk("XGIfb: XGIInitNew() ..."); - if (XGIInitNew(hw_info)) + pci_set_drvdata(pdev, &xgi_video_info); + if (XGIInitNew(pdev)) printk("OK\n"); else printk("Fail\n"); @@ -2419,8 +2381,6 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, goto error_mtrr; } - pci_set_drvdata(pdev, &xgi_video_info); - dumpVGAReg(); return 0; diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c index ce5bf68..b6178b4 100644 --- a/drivers/staging/xgifb/vb_init.c +++ b/drivers/staging/xgifb/vb_init.c @@ -1,5 +1,7 @@ #include <linux/types.h> #include <linux/delay.h> /* udelay */ +#include <linux/pci.h> + #include "vgatypes.h" #include "XGIfb.h" @@ -1427,8 +1429,10 @@ static unsigned char GetXG27FPBits(struct vb_device_info *pVBInfo) return temp; } -unsigned char XGIInitNew(struct xgi_hw_device_info *HwDeviceExtension) +unsigned char XGIInitNew(struct pci_dev *pdev) { + struct video_info *xgifb_info = pci_get_drvdata(pdev); + struct xgi_hw_device_info *HwDeviceExtension = &xgifb_info->hw_info; struct vb_device_info VBINF; struct vb_device_info *pVBInfo = &VBINF; unsigned char i, temp = 0, temp1; @@ -1437,8 +1441,6 @@ unsigned char XGIInitNew(struct xgi_hw_device_info *HwDeviceExtension) /* unsigned long j, k; */ - unsigned long Temp; - pVBInfo->ROMAddr = HwDeviceExtension->pjVirtualRomBase; pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress; @@ -1578,6 +1580,8 @@ unsigned char XGIInitNew(struct xgi_hw_device_info *HwDeviceExtension) printk("12"); if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */ + u32 Temp; + /* Set AGP Rate */ /* temp1 = xgifb_reg_get(pVBInfo->P3c4, 0x3B); @@ -1644,10 +1648,7 @@ unsigned char XGIInitNew(struct xgi_hw_device_info *HwDeviceExtension) /* if (ChipsetID == 0x25308086) */ /* xgifb_reg_set(pVBInfo->P3d4, 0x77, 0xF0); */ - HwDeviceExtension->pQueryVGAConfigSpace(HwDeviceExtension, - 0x50, - 0, - &Temp); /* Get */ + pci_read_config_dword(pdev, 0x50, &Temp); Temp >>= 20; Temp &= 0xF; diff --git a/drivers/staging/xgifb/vb_init.h b/drivers/staging/xgifb/vb_init.h index 6b77230..a27b4fe 100644 --- a/drivers/staging/xgifb/vb_init.h +++ b/drivers/staging/xgifb/vb_init.h @@ -1,6 +1,6 @@ #ifndef _VBINIT_ #define _VBINIT_ -extern unsigned char XGIInitNew(struct xgi_hw_device_info *HwDeviceExtension); +extern unsigned char XGIInitNew(struct pci_dev *pdev); extern struct XGI21_LVDSCapStruct XGI21_LCDCapList[13]; #endif diff --git a/drivers/staging/xgifb/vgatypes.h b/drivers/staging/xgifb/vgatypes.h index 76e2d81..9b939b7 100644 --- a/drivers/staging/xgifb/vgatypes.h +++ b/drivers/staging/xgifb/vgatypes.h @@ -73,10 +73,6 @@ struct xgi_hw_device_info { /* "XGI_VB_CHIP_TYPE" */ unsigned long ulCRT2LCDType; /* defined in the data structure type */ - - unsigned char(*pQueryVGAConfigSpace)(struct xgi_hw_device_info *, - unsigned long, unsigned long, - unsigned long *); }; /* Additional IOCTL for communication xgifb <> X driver */ |