linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Kumar Gala <galak@kernel.crashing.org>
To: Greg KH <greg@kroah.com>
Cc: linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] powerpc: implement arch_setup_pdev_archdata
Date: Wed, 22 Jun 2011 07:02:55 -0500	[thread overview]
Message-ID: <1308744176-24491-2-git-send-email-galak@kernel.crashing.org> (raw)
In-Reply-To: <1308744176-24491-1-git-send-email-galak@kernel.crashing.org>

We have a long standing issues with platform devices not have a valid
dma_mask pointer.  This hasn't been an issue to date as no platform
device has tried to set its dma_mask value to a non-default value.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 arch/powerpc/include/asm/platform_device.h |   17 ++++++++++++++++-
 arch/powerpc/kernel/setup-common.c         |   27 ---------------------------
 drivers/of/platform.c                      |    5 +++--
 3 files changed, 19 insertions(+), 30 deletions(-)

diff --git a/arch/powerpc/include/asm/platform_device.h b/arch/powerpc/include/asm/platform_device.h
index 01452c3..137b183 100644
--- a/arch/powerpc/include/asm/platform_device.h
+++ b/arch/powerpc/include/asm/platform_device.h
@@ -1 +1,16 @@
-#include <asm-generic/platform_device.h>
+#ifndef __ASM_PLATFORM_DEVICE_H_
+#define __ASM_PLATFORM_DEVICE_H_
+
+#include <linux/platform_device.h>
+#include <asm/dma-mapping.h>
+
+#define ARCH_HAS_PDEV_ARCHDATA_SETUP
+
+static inline void arch_setup_pdev_archdata(struct platform_device *pdev)
+{
+	pdev->archdata.dma_mask = DMA_BIT_MASK(32);
+	pdev->dev.dma_mask = &pdev->archdata.dma_mask;
+ 	set_dma_ops(&pdev->dev, &dma_direct_ops);
+}
+
+#endif /* __ASM_GENERIC_PLATFORM_DEVICE_H_ */
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 79fca26..eb5229e 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -703,30 +703,3 @@ static int powerpc_debugfs_init(void)
 }
 arch_initcall(powerpc_debugfs_init);
 #endif
-
-static int ppc_dflt_bus_notify(struct notifier_block *nb,
-				unsigned long action, void *data)
-{
-	struct device *dev = data;
-
-	/* We are only intereted in device addition */
-	if (action != BUS_NOTIFY_ADD_DEVICE)
-		return 0;
-
-	set_dma_ops(dev, &dma_direct_ops);
-
-	return NOTIFY_DONE;
-}
-
-static struct notifier_block ppc_dflt_plat_bus_notifier = {
-	.notifier_call = ppc_dflt_bus_notify,
-	.priority = INT_MAX,
-};
-
-static int __init setup_bus_notifier(void)
-{
-	bus_register_notifier(&platform_bus_type, &ppc_dflt_plat_bus_notifier);
-	return 0;
-}
-
-arch_initcall(setup_bus_notifier);
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 63d3cb7..5ba8f48 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -21,6 +21,7 @@
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
+#include <asm/platform_device.h>
 
 static int of_dev_node_match(struct device *dev, void *data)
 {
@@ -153,7 +154,7 @@ struct platform_device *of_device_alloc(struct device_node *np,
 	}
 
 	dev->dev.of_node = of_node_get(np);
-#if defined(CONFIG_PPC) || defined(CONFIG_MICROBLAZE)
+#if defined(CONFIG_MICROBLAZE)
 	dev->dev.dma_mask = &dev->archdata.dma_mask;
 #endif
 	dev->dev.parent = parent;
@@ -189,7 +190,7 @@ struct platform_device *of_platform_device_create(struct device_node *np,
 	if (!dev)
 		return NULL;
 
-#if defined(CONFIG_PPC) || defined(CONFIG_MICROBLAZE)
+#if defined(CONFIG_MICROBLAZE)
 	dev->archdata.dma_mask = 0xffffffffUL;
 #endif
 	dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
-- 
1.7.3.4

  reply	other threads:[~2011-06-22 12:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-22 12:02 [PATCH 1/3] driver core: Add ability for arch code to setup pdev_archdata Kumar Gala
2011-06-22 12:02 ` Kumar Gala [this message]
2011-06-22 12:02   ` [PATCH 3/3] powerpc: Dont require a dma_ops struct to set dma mask Kumar Gala
2011-06-22 17:53     ` Scott Wood
2011-06-22 14:37 ` [PATCH 1/3] driver core: Add ability for arch code to setup pdev_archdata Mike Frysinger
2011-06-22 15:09 ` [PATCH v2 " Kumar Gala
2011-06-22 17:52   ` Scott Wood
2011-06-23 11:33 ` [PATCH v3 " Kumar Gala
2011-06-23 11:33   ` [PATCH v3 2/3] powerpc: implement arch_setup_pdev_archdata Kumar Gala
2011-06-23 11:33     ` [PATCH v3 3/3] powerpc: Dont require a dma_ops struct to set dma mask Kumar Gala
2011-07-01 22:09   ` [PATCH v3 1/3] driver core: Add ability for arch code to setup pdev_archdata Greg KH
2011-07-07 13:55     ` Kumar Gala
2011-07-07 14:11       ` Greg KH
2011-07-08  4:03         ` Kumar Gala
  -- strict thread matches above, loose matches on Subject: below --
2010-08-05 15:15 [PATCH 0/3] " Kumar Gala
2010-08-05 15:15 ` [PATCH 1/3] " Kumar Gala
2010-08-05 15:15   ` [PATCH 2/3] powerpc: implement arch_setup_pdev_archdata Kumar Gala
2010-08-05 15:44     ` Stephen Rothwell
2010-08-05 16:14       ` Kumar Gala

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=1308744176-24491-2-git-send-email-galak@kernel.crashing.org \
    --to=galak@kernel.crashing.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).