mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Willy TARREAU <willy@w.ods.org>
To: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
Cc: linux-kernel@vger.kernel.org, jhartmann@precisioninsight.com
Subject: [PATCH-2.4.26] AGPGART cleanup
Date: Sun, 28 Mar 2004 15:38:17 +0200	[thread overview]
Message-ID: <20040328133817.GI24421@pcw.home.local> (raw)
In-Reply-To: <20040328042608.GA17969@logos.cnet>

Hi Marcelo, Jeff,

drivers/char/agp/agpgart_be.c defines several agp_generic_*
functions for chipsets which do not need a specific one.
Unfortunately, a lot of chipsets don't use them all, so in
most cases, some of them are defined but not used. This makes
gcc print warnings and adds useless code. This afternoon, I
felt brave and added all the #ifdef needed depending on what
the chipsets use. I did it carefully, so I think I did not
miss any, but a second check might be useful. An interesting
side effect is that it reduced the driver by about 2 kB for a
VIA chipset.

Here is the patch against 2.4.26-rc1. I don't know if it's
too late for 2.4.26, but at least it could be reviewed.

Cheers,
Willy


--- ./drivers/char/agp/agpgart_be.c.orig	Sun Mar 28 11:48:47 2004
+++ ./drivers/char/agp/agpgart_be.c	Sun Mar 28 15:28:29 2004
@@ -398,6 +398,8 @@
 
 /* Generic Agp routines - Start */
 
+#if CONFIG_AGP_I460 || CONFIG_AGP_INTEL || CONFIG_AGP_VIA || CONFIG_AGP_SIS \
+ || CONFIG_AGP_AMD || CONFIG_AGP_ALI || CONFIG_AGP_NVIDIA || CONFIG_AGP_ATI
 static void agp_generic_agp_enable(u32 mode)
 {
 	struct pci_dev *device = NULL;
@@ -490,7 +492,10 @@
 			pci_write_config_dword(device, cap_ptr + 8, command);
 	}
 }
+#endif /* CONFIG_AGP_* */
 
+#if CONFIG_AGP_I810 || CONFIG_AGP_INTEL || CONFIG_AGP_VIA || CONFIG_AGP_SIS \
+ || CONFIG_AGP_AMD_K8 || CONFIG_AGP_ALI || CONFIG_AGP_NVIDIA
 static int agp_generic_create_gatt_table(void)
 {
 	char *table;
@@ -614,7 +619,11 @@
 
 	return 0;
 }
+#endif /* CONFIG_AGP_* */
 
+#if CONFIG_AGP_I810 || CONFIG_AGP_I460 || CONFIG_AGP_INTEL || CONFIG_AGP_VIA \
+ || CONFIG_AGP_SIS || CONFIG_AGP_AMD || CONFIG_AGP_AMD_K8 || CONFIG_AGP_ALI \
+ || CONFIG_AGP_SWORKS || CONFIG_AGP_NVIDIA || CONFIG_AGP_ATI
 static int agp_generic_suspend(void)
 {
 	return 0;
@@ -624,7 +633,10 @@
 {
 	return;
 }
+#endif /* CONFIG_AGP_* */
 
+#if CONFIG_AGP_I810 || CONFIG_AGP_INTEL || CONFIG_AGP_VIA || CONFIG_AGP_SIS \
+ || CONFIG_AGP_AMD_K8 || CONFIG_AGP_ALI || CONFIG_AGP_NVIDIA
 static int agp_generic_free_gatt_table(void)
 {
 	int page_order;
@@ -675,7 +687,9 @@
 	free_pages((unsigned long) agp_bridge.gatt_table_real, page_order);
 	return 0;
 }
+#endif /* CONFIG_AGP_* */
 
+#if CONFIG_AGP_INTEL || CONFIG_AGP_VIA || CONFIG_AGP_SIS || CONFIG_AGP_ALI
 static int agp_generic_insert_memory(agp_memory * mem,
 				     off_t pg_start, int type)
 {
@@ -737,7 +751,11 @@
 	agp_bridge.tlb_flush(mem);
 	return 0;
 }
+#endif /* CONFIG_AGP_* */
 
+
+#if CONFIG_AGP_INTEL || CONFIG_AGP_VIA || CONFIG_AGP_SIS || CONFIG_AMD_K8 \
+ || CONFIG_AGP_ALI
 static int agp_generic_remove_memory(agp_memory * mem, off_t pg_start,
 				     int type)
 {
@@ -755,7 +773,12 @@
 	agp_bridge.tlb_flush(mem);
 	return 0;
 }
+#endif /* CONFIG_AGP_* */
+
 
+#if CONFIG_AGP_I460 || CONFIG_AGP_INTEL || CONFIG_AGP_VIA || CONFIG_AGP_SIS \
+ || CONFIG_AGP_AMD || CONFIG_AGP_AMD_K8 || CONFIG_AGP_ALI || CONFIG_AGP_SWORKS \
+ || CONFIG_AGP_NVIDIA || CONFIG_AGP_HP_ZX1 ||  CONFIG_AGP_ATI
 static agp_memory *agp_generic_alloc_by_type(size_t page_count, int type)
 {
 	return NULL;
@@ -769,6 +792,7 @@
 	agp_free_key(curr->key);
 	kfree(curr);
 }
+#endif /* CONFIG_AGP_* */
 
 /* 
  * Basic Page Allocation Routines -
@@ -779,6 +803,9 @@
  * against a maximum value.
  */
 
+#if CONFIG_AGP_I810 || CONFIG_AGP_INTEL || CONFIG_AGP_VIA || CONFIG_AGP_SIS \
+ || CONFIG_AGP_AMD || CONFIG_AGP_AMD_K8 || CONFIG_AGP_ALI || CONFIG_AGP_SWORKS \
+ || CONFIG_AGP_NVIDIA || CONFIG_AGP_HP_ZX1 ||  CONFIG_AGP_ATI
 static unsigned long agp_generic_alloc_page(void)
 {
 	struct page * page;
@@ -798,7 +825,11 @@
 	atomic_inc(&agp_bridge.current_memory_agp);
 	return (unsigned long)page_address(page);
 }
+#endif /* CONFIG_AGP_* */
 
+#if CONFIG_AGP_I810 || CONFIG_AGP_INTEL || CONFIG_AGP_VIA || CONFIG_AGP_SIS \
+ || CONFIG_AGP_AMD || CONFIG_AGP_AMD_K8 || CONFIG_AGP_SWORKS \
+ || CONFIG_AGP_NVIDIA || CONFIG_AGP_HP_ZX1 ||  CONFIG_AGP_ATI
 static void agp_generic_destroy_page(unsigned long addr)
 {
 	void *pt = (void *) addr;
@@ -817,6 +848,7 @@
 	free_page((unsigned long) pt);
 	atomic_dec(&agp_bridge.current_memory_agp);
 }
+#endif /* CONFIG_AGP_* */
 
 /* End Basic Page Allocation Routines */
 

  parent reply	other threads:[~2004-03-28 13:38 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-28  4:26 Linux 2.4.26-rc1 Marcelo Tosatti
2004-03-28 11:47 ` Willy TARREAU
2004-03-28 11:54 ` [PATCH-2.4.26] ip6tables cleanup Willy TARREAU
2004-03-28 19:27   ` Peter Osterlund
2004-03-28 20:09     ` Willy TARREAU
2004-03-28 20:33       ` David S. Miller
2004-03-28 22:38         ` Willy TARREAU
2004-03-28 23:00           ` David S. Miller
2004-03-28 20:16     ` David S. Miller
2004-03-28 11:57 ` [PATCH-2.4.26] cmpci cleanup Willy TARREAU
2004-03-29 12:19   ` Marcelo Tosatti
2004-03-28 12:12 ` [PATCH-2.4.26] smbfs cleanup Willy TARREAU
2004-03-28 12:15 ` [PATCH-2.4.26] sddr09 cleanup Willy TARREAU
2004-03-28 12:18   ` Willy TARREAU
2004-03-28 12:21 ` [PATCH-2.4.26] drm/radeon_mem cleanup Willy TARREAU
2004-03-28 12:24 ` [PATCH-2.4.26] cardbus cleanup Willy TARREAU
2004-03-28 12:40 ` Linux 2.4.26-rc1 => Alpha warnings Willy TARREAU
2004-03-28 16:34   ` Ivan Kokshaysky
2004-03-28 12:58 ` [PATCH-2.4.26] ATM cleanup Willy TARREAU
2004-03-28 13:03   ` Chris Wedgwood
2004-03-28 13:08     ` Willy TARREAU
2004-03-30 17:44       ` chas williams (contractor)
2004-03-31  3:18         ` David S. Miller
2004-03-28 13:38 ` Willy TARREAU [this message]
2004-03-28 15:24 ` Linux 2.4.26-rc1 Arkadiusz Miskiewicz
2004-03-28 19:11 ` Peter Osterlund
2004-03-28 20:41   ` Frédéric L. W. Meunier
2004-04-01  0:47   ` Linux 2.4.26-rc1 - SCTP 'make xconfig' issue Sridhar Samudrala
2004-04-01  5:24     ` Peter Osterlund
2004-04-01  7:05     ` David S. Miller
2004-04-01  7:29       ` Sridhar Samudrala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040328133817.GI24421@pcw.home.local \
    --to=willy@w.ods.org \
    --cc=jhartmann@precisioninsight.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®