All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: anton@samba.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] cleanups hpte_init_native, kill warning for !PSERIES builds
Date: Sun, 24 Oct 2004 15:04:28 +0200	[thread overview]
Message-ID: <20041024130428.GA19391@lst.de> (raw)

this splits out a small helper that checks whether tlb batching should
be enabled from hpte_init_native, thus cleaning up the ifdef hell and
killing a warning for pmac builds.


--- 1.19/arch/ppc64/mm/hash_native.c	2004-09-30 07:34:39 +02:00
+++ edited/arch/ppc64/mm/hash_native.c	2004-10-24 11:56:10 +02:00
@@ -387,33 +387,37 @@
 	local_irq_restore(flags);
 }
 
-void hpte_init_native(void)
-{
 #ifdef CONFIG_PPC_PSERIES
-	struct device_node *root;
-	const char *model;
-#endif /* CONFIG_PPC_PSERIES */
+/* Disable TLB batching on nighthawk */
+static inline int tlb_batching_enabled(void)
+{
+	struct device_node *root = of_find_node_by_path("/");
+	int enabled = 1;
+
+	if (root) {
+		const char *model = get_property(root, "model", NULL);
+		if (!strcmp(model, "CHRP IBM,9076-N81"))
+			enabled = 0;
+		of_node_put(root);
+	}
+
+	return enabled;
+}
+#else
+static inline int tlb_batching_enabled(void)
+{
+	return 1;
+}
+#endif
 
+void hpte_init_native(void)
+{
 	ppc_md.hpte_invalidate	= native_hpte_invalidate;
 	ppc_md.hpte_updatepp	= native_hpte_updatepp;
 	ppc_md.hpte_updateboltedpp = native_hpte_updateboltedpp;
 	ppc_md.hpte_insert	= native_hpte_insert;
 	ppc_md.hpte_remove     	= native_hpte_remove;
-
-#ifdef CONFIG_PPC_PSERIES
-	/* Disable TLB batching on nighthawk */
-	root = of_find_node_by_path("/");
-	if (root) {
-		model = get_property(root, "model", NULL);
-		if (!strcmp(model, "CHRP IBM,9076-N81")) {
-			of_node_put(root);
-			goto bail;
-		}
-		of_node_put(root);
-	}
-#endif /* CONFIG_PPC_PSERIES */
-
-	ppc_md.flush_hash_range = native_flush_hash_range;
- bail:
+	if (tlb_batching_enabled())
+		ppc_md.flush_hash_range = native_flush_hash_range;
 	htab_finish_init();
 }

                 reply	other threads:[~2004-10-24 13:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20041024130428.GA19391@lst.de \
    --to=hch@lst.de \
    --cc=anton@samba.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.