diff options
Diffstat (limited to 'drivers/char/agp/sworks-agp.c')
-rw-r--r-- | drivers/char/agp/sworks-agp.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/drivers/char/agp/sworks-agp.c b/drivers/char/agp/sworks-agp.c index 71ea59a1dbeb..5a5392dd1254 100644 --- a/drivers/char/agp/sworks-agp.c +++ b/drivers/char/agp/sworks-agp.c | |||
@@ -102,19 +102,17 @@ static int serverworks_create_gatt_pages(int nr_tables) | |||
102 | int retval = 0; | 102 | int retval = 0; |
103 | int i; | 103 | int i; |
104 | 104 | ||
105 | tables = kmalloc((nr_tables + 1) * sizeof(struct serverworks_page_map *), | 105 | tables = kzalloc((nr_tables + 1) * sizeof(struct serverworks_page_map *), |
106 | GFP_KERNEL); | 106 | GFP_KERNEL); |
107 | if (tables == NULL) { | 107 | if (tables == NULL) |
108 | return -ENOMEM; | 108 | return -ENOMEM; |
109 | } | 109 | |
110 | memset(tables, 0, sizeof(struct serverworks_page_map *) * (nr_tables + 1)); | ||
111 | for (i = 0; i < nr_tables; i++) { | 110 | for (i = 0; i < nr_tables; i++) { |
112 | entry = kmalloc(sizeof(struct serverworks_page_map), GFP_KERNEL); | 111 | entry = kzalloc(sizeof(struct serverworks_page_map), GFP_KERNEL); |
113 | if (entry == NULL) { | 112 | if (entry == NULL) { |
114 | retval = -ENOMEM; | 113 | retval = -ENOMEM; |
115 | break; | 114 | break; |
116 | } | 115 | } |
117 | memset(entry, 0, sizeof(struct serverworks_page_map)); | ||
118 | tables[i] = entry; | 116 | tables[i] = entry; |
119 | retval = serverworks_create_page_map(entry); | 117 | retval = serverworks_create_page_map(entry); |
120 | if (retval != 0) break; | 118 | if (retval != 0) break; |
@@ -244,13 +242,27 @@ static int serverworks_fetch_size(void) | |||
244 | */ | 242 | */ |
245 | static void serverworks_tlbflush(struct agp_memory *temp) | 243 | static void serverworks_tlbflush(struct agp_memory *temp) |
246 | { | 244 | { |
245 | unsigned long timeout; | ||
246 | |||
247 | writeb(1, serverworks_private.registers+SVWRKS_POSTFLUSH); | 247 | writeb(1, serverworks_private.registers+SVWRKS_POSTFLUSH); |
248 | while (readb(serverworks_private.registers+SVWRKS_POSTFLUSH) == 1) | 248 | timeout = jiffies + 3*HZ; |
249 | while (readb(serverworks_private.registers+SVWRKS_POSTFLUSH) == 1) { | ||
249 | cpu_relax(); | 250 | cpu_relax(); |
251 | if (time_after(jiffies, timeout)) { | ||
252 | printk(KERN_ERR PFX "TLB post flush took more than 3 seconds\n"); | ||
253 | break; | ||
254 | } | ||
255 | } | ||
250 | 256 | ||
251 | writel(1, serverworks_private.registers+SVWRKS_DIRFLUSH); | 257 | writel(1, serverworks_private.registers+SVWRKS_DIRFLUSH); |
252 | while(readl(serverworks_private.registers+SVWRKS_DIRFLUSH) == 1) | 258 | timeout = jiffies + 3*HZ; |
259 | while (readl(serverworks_private.registers+SVWRKS_DIRFLUSH) == 1) { | ||
253 | cpu_relax(); | 260 | cpu_relax(); |
261 | if (time_after(jiffies, timeout)) { | ||
262 | printk(KERN_ERR PFX "TLB Dir flush took more than 3 seconds\n"); | ||
263 | break; | ||
264 | } | ||
265 | } | ||
254 | } | 266 | } |
255 | 267 | ||
256 | static int serverworks_configure(void) | 268 | static int serverworks_configure(void) |
@@ -533,6 +545,7 @@ static struct pci_device_id agp_serverworks_pci_table[] = { | |||
533 | MODULE_DEVICE_TABLE(pci, agp_serverworks_pci_table); | 545 | MODULE_DEVICE_TABLE(pci, agp_serverworks_pci_table); |
534 | 546 | ||
535 | static struct pci_driver agp_serverworks_pci_driver = { | 547 | static struct pci_driver agp_serverworks_pci_driver = { |
548 | .owner = THIS_MODULE, | ||
536 | .name = "agpgart-serverworks", | 549 | .name = "agpgart-serverworks", |
537 | .id_table = agp_serverworks_pci_table, | 550 | .id_table = agp_serverworks_pci_table, |
538 | .probe = agp_serverworks_probe, | 551 | .probe = agp_serverworks_probe, |