LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v3] powerpc: fix suspend states again
From: Johannes Berg @ 2007-05-01 14:16 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: Olof Johansson, linuxppc-dev
In-Reply-To: <1177933035.5102.33.camel@johannes.berg>

[-- Attachment #1: Type: text/plain, Size: 927 bytes --]

On Mon, 2007-04-30 at 13:37 +0200, Johannes Berg wrote:
> In commit 0fba3a1f39f8b0a50b56c8b068fa52131cbc84c2 (a very long time ago,
> May 2006), I fixed a bug that caused powermacs to crash when you tried
> entering standby/mem suspend states.
> 
> As I'm now getting more familiar with the suspend code I notice a few
> more things:
[...]

Regardless of the follow-up pmu pm_ops patch you should really merge
this patch since I changed the generic pm_ops infrastructure to be less
broken, and the current code in .21 may sometimes work due to the
breakage that is now no longer there; pm_ops will now not be invoked for
suspend to disk unless
 (1) the user has 'platform' in /sys/power/disk
 (2) pm_ops.pm_disk_mode is set to PM_DISK_PLATFORM

(1) can be changed by the user so even the old code was just correct in
case the user didn't change anything, and (2) isn't true in the current
tree.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

^ permalink raw reply

* Re: IEEE1588 Precision Time Protocol (PTP) driver for AMCC 405EZ
From: Robert Schwebel @ 2007-05-01 13:45 UTC (permalink / raw)
  To: Stefan Roese; +Cc: netdev, Jan Kiszka, linuxppc-dev
In-Reply-To: <200704301641.32686.sr@denx.de>

On Mon, Apr 30, 2007 at 04:41:32PM +0200, Stefan Roese wrote:
> I'm in the stage of integrating an IEEE1588 PTP driver for the AMCC 405EZ PPC 
> and looking for the correct location to place this driver in the Linux source 
> tree. The driver is a character-driver that enables the user space 
> applications to configure the time stamping unit and to read/write the 
> timestamps.

Could you elaborate your overall concept for this class of drivers? I
assume it makes no sense to write an IEEE1588 driver especially for the
AMCC chip, because there will probably be a need to support it on any
capable hardware; for example the netX has 1588 support for precise
timestamping as well and so do others.

I'd prefer to discuss the needed functionality first, then find a common
set of lowlevel APIs and move most of the IEEE1588 related stuff into
userspace. It might also be a good idea to involve the RTnet in this
discusson.

> Is "drivers/net/ptp" or "drivers/net/ieee1588" a good solution? Or
> should it go to "drivers/char/ptp" because of the chrdev nature of the
> driver?

Please start with discussing the concept, not the names. It might end
being a part of the network drivers, without any special directory.

Robert
-- 
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
     Hannoversche Str. 2, 31134 Hildesheim, Germany
   Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9

^ permalink raw reply

* Re: Anyone using mpc832x_mds & freescale's GIT repo?
From: Alex Zeffertt @ 2007-05-01 14:05 UTC (permalink / raw)
  To: Kim Phillips; +Cc: linuxppc-embedded
In-Reply-To: <20070501090006.4c9f5723.kim.phillips@freescale.com>

Kim Phillips wrote:
> On Tue, 01 May 2007 10:34:09 +0100
> Alex Zeffertt <ajz@cambridgebroadband.com> wrote:
> 
>> mention above.  Do you know which *linux* repository is the most
>> current for the MPC8323E-MDS-PB board?
> 
> yes, linux..normally I'd say paulus' powerpc.git tree on kernel.org, but
> today, 832x-MDS is broken there.  You might want to checkout the v2.6.21
> tag until the pending patches (to support the ucc phylib) are applied and
> merged.
> 

Thanks again for your reply.  I know this is going to sound like I'm repeating
myself, but I want to be sure....

Would you recommend using powerpc.git v2.6.21 in preference to the 2.6.11
kernel that comes with the latest Freescale BSP (MPC832xE_MDS_K26_20070130-LTIB.iso)?

TIA,

Alex

^ permalink raw reply

* Re: Anyone using mpc832x_mds & freescale's GIT repo?
From: Kim Phillips @ 2007-05-01 14:00 UTC (permalink / raw)
  To: Alex Zeffertt; +Cc: linuxppc-embedded
In-Reply-To: <46370991.3010802@cambridgebroadband.com>

On Tue, 01 May 2007 10:34:09 +0100
Alex Zeffertt <ajz@cambridgebroadband.com> wrote:

> 
> mention above.  Do you know which *linux* repository is the most
> current for the MPC8323E-MDS-PB board?

yes, linux..normally I'd say paulus' powerpc.git tree on kernel.org, but
today, 832x-MDS is broken there.  You might want to checkout the v2.6.21
tag until the pending patches (to support the ucc phylib) are applied and
merged.

Kim

^ permalink raw reply

* Re: vm changes from linux-2.6.14 to linux-2.6.15
From: Mark Fortescue @ 2007-05-01 13:58 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linux-mm, wli, linuxppc-dev, andrea, sparclinux, akpm,
	David Miller
In-Reply-To: <1177985136.24962.8.camel@localhost.localdomain>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 772 bytes --]



On Tue, 1 May 2007, Benjamin Herrenschmidt wrote:

>
>> At present, update_mmu_cache() and lazy_mmu_prot_update() are always
>> called when ptep_set_access_flags() is called so why not move them into
>> ptep_set_access_flags() and change ptep_set_access_flags() to have an
>> additional boolean parameter (__update) that would when set, cause
>> update_mmu_cache() and lazy_mmu_prot_update() to be called.
>
> Well, ptep_set_access_flags() is a low level arch hook, I'd rather not
> start hiding update_mmu_cache() calls in it ...
>
> Ben.
>
>

I have attached a patch (so pine does not mangle it) for linux-2.6.20.9.
Is this what you had in mind?

For linux-2.6.21, more work will be needed as it has more code calling 
ptep_set_access_flags.

Regards
 	Mark Fortescue.

[-- Attachment #2: Type: TEXT/PLAIN, Size: 10987 bytes --]

diff -ruNpd linux-2.6.20.9/include/asm-generic/pgtable.h linux-test/include/asm-generic/pgtable.h
--- linux-2.6.20.9/include/asm-generic/pgtable.h	2007-05-01 12:57:56.000000000 +0100
+++ linux-test/include/asm-generic/pgtable.h	2007-05-01 14:20:05.000000000 +0100
@@ -29,11 +29,16 @@ do {				  					\
  * to a "more permissive" setting, which allows most architectures
  * to optimize this.
  */
-#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
-do {				  					  \
-	set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry);	  \
-	flush_tlb_page(__vma, __address);				  \
-} while (0)
+#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty, __update) \
+({										    \
+	if (__update) {				  				    \
+		set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry);	    \
+		flush_tlb_page(__vma, __address);				    \
+	} else if (__dirty) {							    \
+		flush_tlb_page(__vma, __address);				    \
+	}									    \
+	__update;								    \
+})
 #endif
 
 #ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
diff -ruNpd linux-2.6.20.9/include/asm-i386/pgtable.h linux-test/include/asm-i386/pgtable.h
--- linux-2.6.20.9/include/asm-i386/pgtable.h	2007-05-01 12:57:56.000000000 +0100
+++ linux-test/include/asm-i386/pgtable.h	2007-05-01 13:43:38.000000000 +0100
@@ -273,14 +273,17 @@ static inline pte_t pte_mkhuge(pte_t pte
  * bit at the same time.
  */
 #define  __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
-#define ptep_set_access_flags(vma, address, ptep, entry, dirty)		\
-do {									\
-	if (dirty) {							\
-		(ptep)->pte_low = (entry).pte_low;			\
-		pte_update_defer((vma)->vm_mm, (address), (ptep));	\
-		flush_tlb_page(vma, address);				\
-	}								\
-} while (0)
+#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty, __update)	\
+({											\
+	if (__dirty) {									\
+		if (__update) {								\
+			(__ptep)->pte_low = (__entry).pte_low;				\
+			pte_update_defer((__vma)->vm_mm, (__address), (__ptep));	\
+		}									\
+		flush_tlb_page(__vma, __address);					\
+	}										\
+	__update;									\
+})
 
 /*
  * We don't actually have these, but we want to advertise them so that
diff -ruNpd linux-2.6.20.9/include/asm-ia64/pgtable.h linux-test/include/asm-ia64/pgtable.h
--- linux-2.6.20.9/include/asm-ia64/pgtable.h	2007-04-30 19:04:59.000000000 +0100
+++ linux-test/include/asm-ia64/pgtable.h	2007-05-01 13:48:07.000000000 +0100
@@ -537,16 +537,25 @@ extern void lazy_mmu_prot_update (pte_t 
  * daccess_bit in ivt.S).
  */
 #ifdef CONFIG_SMP
-# define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __safely_writable)	\
-do {											\
-	if (__safely_writable) {							\
-		set_pte(__ptep, __entry);						\
+# define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __dirty, __update)	\
+({											\
+	if (__dirty) {									\
+		if (__update)								\
+			set_pte(__ptep, __entry);					\
 		flush_tlb_page(__vma, __addr);						\
 	}										\
-} while (0)
+	__update;									\
+})
 #else
-# define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __safely_writable)	\
-	ptep_establish(__vma, __addr, __ptep, __entry)
+# define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __dirty, __update)	\
+({											\
+	if (__update)									\
+		ptep_establish(__vma, __addr, __ptep, __entry);				\
+	else if (__dirty)								\
+		flush_tlb_page(__vma, __addr);						\
+	}										\
+	__update;									\
+})
 #endif
 
 #  ifdef CONFIG_VIRTUAL_MEM_MAP
diff -ruNpd linux-2.6.20.9/include/asm-powerpc/pgtable.h linux-test/include/asm-powerpc/pgtable.h
--- linux-2.6.20.9/include/asm-powerpc/pgtable.h	2007-05-01 12:57:56.000000000 +0100
+++ linux-test/include/asm-powerpc/pgtable.h	2007-05-01 13:58:56.000000000 +0100
@@ -437,11 +437,15 @@ static inline void __ptep_set_access_fla
 	:"r" (bits), "r" (ptep), "m" (*ptep), "i" (_PAGE_BUSY)
 	:"cc");
 }
-#define  ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
-	do {								   \
-		__ptep_set_access_flags(__ptep, __entry, __dirty);	   \
-		flush_tlb_page_nohash(__vma, __address);	       	   \
-	} while(0)
+#define  ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty, __update) \
+({										     \
+	if (__update) {								     \
+		__ptep_set_access_flags(__ptep, __entry, __dirty);		     \
+		flush_tlb_page_nohash(__vma, __address);			     \
+	} else if (__dirty)							     \
+		flush_tlb_page(__vma, __address);				     \
+	__update;								     \
+})
 
 /*
  * Macro to mark a page protection value as "uncacheable".
diff -ruNpd linux-2.6.20.9/include/asm-ppc/pgtable.h linux-test/include/asm-ppc/pgtable.h
--- linux-2.6.20.9/include/asm-ppc/pgtable.h	2007-04-30 19:05:00.000000000 +0100
+++ linux-test/include/asm-ppc/pgtable.h	2007-05-01 13:50:30.000000000 +0100
@@ -693,11 +693,15 @@ static inline void __ptep_set_access_fla
 	pte_update(ptep, 0, bits);
 }
 
-#define  ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
-	do {								   \
-		__ptep_set_access_flags(__ptep, __entry, __dirty);	   \
-		flush_tlb_page_nohash(__vma, __address);	       	   \
-	} while(0)
+#define  ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty, __update) \
+({										     \
+	if (__update) {								     \
+		__ptep_set_access_flags(__ptep, __entry, __dirty);		     \
+		flush_tlb_page_nohash(__vma, __address);			     \
+	} else if (__dirty)							     \
+		flush_tlb_page(__vma, __address);				     \
+	__update;								     \
+})
 
 /*
  * Macro to mark a page protection value as "uncacheable".
diff -ruNpd linux-2.6.20.9/include/asm-s390/pgtable.h linux-test/include/asm-s390/pgtable.h
--- linux-2.6.20.9/include/asm-s390/pgtable.h	2007-05-01 12:57:56.000000000 +0100
+++ linux-test/include/asm-s390/pgtable.h	2007-05-01 14:23:24.000000000 +0100
@@ -628,8 +628,14 @@ ptep_establish(struct vm_area_struct *vm
 	set_pte(ptep, entry);
 }
 
-#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
-	ptep_establish(__vma, __address, __ptep, __entry)
+#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty, __update) \
+	({									    \
+		if (__update)							    \
+			ptep_establish(__vma, __address, __ptep, __entry);	    \
+		else if (__dirty)						    \
+			flush_tlb_page(__vma, __address);			    \
+		__update;							    \
+	})
 
 /*
  * Test and clear dirty bit in storage key.
diff -ruNpd linux-2.6.20.9/include/asm-sparc/pgtable.h linux-test/include/asm-sparc/pgtable.h
--- linux-2.6.20.9/include/asm-sparc/pgtable.h	2007-04-30 19:05:01.000000000 +0100
+++ linux-test/include/asm-sparc/pgtable.h	2007-05-01 14:32:35.000000000 +0100
@@ -446,6 +446,27 @@ extern int io_remap_pfn_range(struct vm_
 #define GET_IOSPACE(pfn)		(pfn >> (BITS_PER_LONG - 4))
 #define GET_PFN(pfn)			(pfn & 0x0fffffffUL)
 
+#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
+#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty, __update) \
+({										    \
+	int __ret;								    \
+										    \
+	if (sparc_cpu_model == sun4c) {						    \
+		set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry);	    \
+		flush_tlb_page(__vma, __address);				    \
+		__ret = 1;							    \
+	} else {								    \
+		if (__update) {			  				    \
+			set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry);   \
+			flush_tlb_page(__vma, __address);			    \
+		} else if (__dirty) {						    \
+			flush_tlb_page(__vma, __address);			    \
+		}								    \
+		__ret = __update;						    \
+	}									    \
+	__ret;									    \
+})
+
 #include <asm-generic/pgtable.h>
 
 #endif /* !(__ASSEMBLY__) */
diff -ruNpd linux-2.6.20.9/include/asm-x86_64/pgtable.h linux-test/include/asm-x86_64/pgtable.h
--- linux-2.6.20.9/include/asm-x86_64/pgtable.h	2007-05-01 12:57:57.000000000 +0100
+++ linux-test/include/asm-x86_64/pgtable.h	2007-05-01 13:37:08.000000000 +0100
@@ -396,13 +396,15 @@ static inline pte_t pte_modify(pte_t pte
  * race with other CPU's that might be updating the dirty
  * bit at the same time. */
 #define  __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
-#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
-	do {								  \
-		if (__dirty) {						  \
-			set_pte(__ptep, __entry);			  \
-			flush_tlb_page(__vma, __address);		  \
-		}							  \
-	} while (0)
+#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty, __update) \
+	({									    \
+		if (__dirty) {							    \
+			if (__update)						    \
+				set_pte(__ptep, __entry);			    \
+			flush_tlb_page(__vma, __address);			    \
+		}								    \
+		__update;							    \
+	})
 
 /* Encode and de-code a swap entry */
 #define __swp_type(x)			(((x).val >> 1) & 0x3f)
diff -ruNpd linux-2.6.20.9/mm/hugetlb.c linux-test/mm/hugetlb.c
--- linux-2.6.20.9/mm/hugetlb.c	2007-05-01 13:01:10.000000000 +0100
+++ linux-test/mm/hugetlb.c	2007-05-01 13:17:26.000000000 +0100
@@ -313,9 +313,10 @@ static void set_huge_ptep_writable(struc
 	pte_t entry;
 
 	entry = pte_mkwrite(pte_mkdirty(*ptep));
-	ptep_set_access_flags(vma, address, ptep, entry, 1);
-	update_mmu_cache(vma, address, entry);
-	lazy_mmu_prot_update(entry);
+	if (ptep_set_access_flags(vma, address, ptep, entry, 1, 1)) {
+		update_mmu_cache(vma, address, entry);
+		lazy_mmu_prot_update(entry);
+	}
 }
 
 
diff -ruNpd linux-2.6.20.9/mm/memory.c linux-test/mm/memory.c
--- linux-2.6.20.9/mm/memory.c	2007-05-01 12:57:57.000000000 +0100
+++ linux-test/mm/memory.c	2007-05-01 14:26:38.000000000 +0100
@@ -1553,9 +1553,11 @@ static int do_wp_page(struct mm_struct *
 		flush_cache_page(vma, address, pte_pfn(orig_pte));
 		entry = pte_mkyoung(orig_pte);
 		entry = maybe_mkwrite(pte_mkdirty(entry), vma);
-		ptep_set_access_flags(vma, address, page_table, entry, 1);
-		update_mmu_cache(vma, address, entry);
-		lazy_mmu_prot_update(entry);
+		if (ptep_set_access_flags(vma, address, page_table,
+					  entry, 1, 1)) {
+			update_mmu_cache(vma, address, entry);
+			lazy_mmu_prot_update(entry);
+		}
 		ret |= VM_FAULT_WRITE;
 		goto unlock;
 	}
@@ -2423,19 +2425,10 @@ static inline int handle_pte_fault(struc
 		entry = pte_mkdirty(entry);
 	}
 	entry = pte_mkyoung(entry);
-	if (!pte_same(old_entry, entry)) {
-		ptep_set_access_flags(vma, address, pte, entry, write_access);
+	if (ptep_set_access_flags(vma, address, pte, entry, write_access,
+				  !pte_same(old_entry, entry))) {
 		update_mmu_cache(vma, address, entry);
 		lazy_mmu_prot_update(entry);
-	} else {
-		/*
-		 * This is needed only for protection faults but the arch code
-		 * is not yet telling us if this is a protection fault or not.
-		 * This still avoids useless tlb flushes for .text page faults
-		 * with threads.
-		 */
-		if (write_access)
-			flush_tlb_page(vma, address);
 	}
 unlock:
 	pte_unmap_unlock(pte, ptl);

^ permalink raw reply

* Correct location for ADC/DAC drivers
From: Stefan Roese @ 2007-05-01 12:35 UTC (permalink / raw)
  To: linuxppc-dev, linux-kernel

Hi all,

I'm in the stage of integrating some ADC and DAC drivers for the AMCC 405EZ 
PPC and looking for the correct location to place these drivers in the Linux 
source tree. The drivers are basically character-drivers, so my first thought 
is to put them in "drivers/char/adc/foo.c" or "drivers/char/adc_foo.c". Is 
this a good solution?

Any suggestions welcome (could be that I missed an already existing example).

BTW: I am aware of the hwmon subsystem, but I don't think it fits my needs in 
this case.

Best regards,
Stefan

^ permalink raw reply

* Re: [PATCH] powermac: proper sleep management
From: Johannes Berg @ 2007-05-01 12:24 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <17975.12087.73762.795635@cargo.ozlabs.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 230 bytes --]

On Tue, 2007-05-01 at 22:14 +1000, Paul Mackerras wrote:

> Bottom line is I'm not going to apply a patch that makes pmu_ioctl
> call pm_suspend.

Alright, I'll drop the patch. What about suspend to disk for G5?

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

^ permalink raw reply

* Re: [PATCH] powermac: proper sleep management
From: Paul Mackerras @ 2007-05-01 12:14 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linuxppc-dev
In-Reply-To: <1177934887.5102.65.camel@johannes.berg>

Johannes Berg writes:

> I disagree with that, it'll get us no closer to keeping the generic code
> working for us. It does in fact work now, I've been using it for a long
> time and a few other people have also tried on older powerbooks. It's
> also very hard to convince anybody that we need changes in the generic
> code if at the same time we do our own stuff because "the generic code
> (you wrote) is not good enough for us anyway."

I think that once we have /sys/power/state working the distros will
start using it.  I want the old way to keep doing what it was doing
while the new way is tested and the bugs are shaken out.

Bottom line is I'm not going to apply a patch that makes pmu_ioctl
call pm_suspend.

Paul.

^ permalink raw reply

* Re: Status of snd-powermac?
From: Johannes Berg @ 2007-05-01 11:35 UTC (permalink / raw)
  To: anders.gudmundsson; +Cc: linuxppc-dev
In-Reply-To: <1178013086.7194.24.camel@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 612 bytes --]

On Tue, 2007-05-01 at 11:51 +0200, Anders Gudmundsson wrote:

> Is the snd-powermac driver to be phased out for the snd-aoa, and is
> support planned for older cards (PB IV, G3 iBooks etc.) in snd-aoa?

The structure in snd-aoa allows you to define additional fabrics and
additional sound busses. Hence, it ought to be fairly simple to write
support for older cards if you have the hardware and a bit of know-how.

However, I have neither the hardware nor time to do that. Hence, while
support for those old cards should be possible without much problem, it
is not planned at the moment.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

^ permalink raw reply

* Re: [PATCH 0/11] Consolidation of Open Firmware routines
From: Jan Engelhardt @ 2007-05-01 11:17 UTC (permalink / raw)
  To: David Miller; +Cc: sparclinux, sfr, paulus, linuxppc-dev
In-Reply-To: <20070501.015125.93211061.davem@davemloft.net>


On May 1 2007 01:51, David Miller wrote:
>From: Jan Engelhardt <jengelh@linux01.gwdg.de>
>Date: Tue, 1 May 2007 10:30:02 +0200 (MEST)
>
>> but i'd kinda want drivers/openfirmware, even if it's a bit longer.
>
>So much for the unix sense of elegance in short names.
>I think there is zero confusion about what "of" is.

A prepositional word in the English language, as
http://en.wiktionary.org/wiki/of tells me. And it's used quite often placed
2nd.
Just see http://ask.slashdot.org/article.pl?sid=07/03/03/028258
If it ___really___ ought to be short worded, at least have it OFW.
(Or make it drivers/ieee1275 so it can make friends with ieee1394)
But I still discourage of. The next thing people want for their
not-so-open firmware is drivers/f.



Jan
-- 

^ permalink raw reply

* Status of snd-powermac?
From: Anders Gudmundsson @ 2007-05-01  9:51 UTC (permalink / raw)
  To: linuxppc-dev

I hope this is the right forum for this question...
A number of TiBook/iBook users running post 2.6.20 kernels has been
affected by a bug related to the snd-powermac driver for Pmac Snapper
cards:
Ubuntu bug:
https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.20/+bug/87652
Thread on ubuntuforums:
http://ubuntuforums.org/showthread.php?t=412151

Short summary:
snd-powermac loads (specified in /etc/modules)
Sound is produced for a randomly short period never exceeding 5 seconds,
then stops. No errors are given (even if the drivers are configured with
debug), the application hangs and blocks the sound device.
No matter what versions of alsa-libs or alsa-drivers used, the bug
persists. (Only booting a pre 2.6.20 kernel helps - or using the old oss
dmasound_pmac driver) 

My question:
Is the snd-powermac driver to be phased out for the snd-aoa, and is
support planned for older cards (PB IV, G3 iBooks etc.) in snd-aoa?

Regards!
Anders

^ permalink raw reply

* hello all
From: 崔峰 @ 2007-05-01  9:49 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 114 bytes --]

hello my dear frends  can anyone tell me how to list the questions in the net ,other than by mail system.thanks   

[-- Attachment #2: Type: text/html, Size: 493 bytes --]

^ permalink raw reply

* Re: Anyone using mpc832x_mds & freescale's GIT repo?
From: Alex Zeffertt @ 2007-05-01  9:34 UTC (permalink / raw)
  To: Kim Phillips; +Cc: linuxppc-embedded
In-Reply-To: <20070430135200.23bb6bbf.kim.phillips@freescale.com>

Kim Phillips wrote:
> On Mon, 30 Apr 2007 16:15:41 +0100
> Alex Zeffertt <ajz@cambridgebroadband.com> wrote:
> 
>> Hi list,
>>
>> I've got an MPC8323E-MDS-PB development board, which is
>> running a year-old BSP from freescale.  I wanted to track
>> the most current developments so I cloned
>>
>> 	http://opensource.freescale.com/pub/scm/linux-2.6-83xx.git
>>
> that tree is obsolete; I'll label it so to avoid confusion.
> 
>> and rebuilt with ARCH=powerpc and using the mpc832x_mds_defconfig.
>>
>> I now don't get any serial console output after u-boot has
>> started the kernel.
>>
>> My questions are:
>>
>> 1.	Is anyone else using this GIT repo with this board?
>>
> please use the mpc83xx custodian tree on denx.de:
> 
> {git-,cg-}{clone,pull} git://www.denx.de/git/u-boot-mpc83xx.git
> 


Hi Kim,

Thanks for your reply.  I am already using the *u-boot* repo you
mention above.  Do you know which *linux* repository is the most
current for the MPC8323E-MDS-PB board?

Best regards,

Alex

^ permalink raw reply

* Re: patches for 2.6.22
From: Johannes Berg @ 2007-05-01  9:06 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <17969.56735.644629.328360@cargo.ozlabs.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 540 bytes --]

On Fri, 2007-04-27 at 21:25 +1000, Paul Mackerras wrote:

> If anyone has patches that I haven't picked up yet which they think
> should go into 2.6.22

Oh another thing is my suspend-to-disk work. Most of the patches to
drivers have been reviewed by various people around, but afaik nobody
has given the core code much of a look. It's a new feature and could be
marked EXPERIMENTAL or such, so it can't introduce regressions. I can
repost for consideration but since I never received much comments I
never bothered.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

^ permalink raw reply

* Re: [PATCH v3] powermac: proper sleep management
From: Johannes Berg @ 2007-05-01  8:55 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev, David Woodhouse
In-Reply-To: <1177933488.5102.41.camel@johannes.berg>

[-- Attachment #1: Type: text/plain, Size: 328 bytes --]

On Mon, 2007-04-30 at 13:44 +0200, Johannes Berg wrote:

>  and will break suspend to disk until
> "rework-pm_ops-pm_disk_mode-kill-misuse.patch" from -mm is merged
> (which
> should be soon, I asked akpm to send it early if possible.)

This has now happened, commit fe0c935a6cbf25d72a27c7a345df8a2151de0b74

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

^ permalink raw reply

* Re: [PATCH 0/11] Consolidation of Open Firmware routines
From: David Miller @ 2007-05-01  8:51 UTC (permalink / raw)
  To: jengelh; +Cc: sparclinux, sfr, paulus, linuxppc-dev
In-Reply-To: <Pine.LNX.4.61.0705011028090.18504@yvahk01.tjqt.qr>

From: Jan Engelhardt <jengelh@linux01.gwdg.de>
Date: Tue, 1 May 2007 10:30:02 +0200 (MEST)

> but i'd kinda want drivers/openfirmware, even if it's a bit longer.

So much for the unix sense of elegance in short names.

I think there is zero confusion about what "of" is.

^ permalink raw reply

* Re: [PATCH 0/11] Consolidation of Open Firmware routines
From: Jan Engelhardt @ 2007-05-01  8:30 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: sparclinux, ppc-dev, paulus, David S. Miller
In-Reply-To: <20070501172250.80707fb8.sfr@canb.auug.org.au>


On May 1 2007 17:22, Stephen Rothwell wrote:
>
>Just thought I would show you all where I am up to.  I have moved from
>openfw.h, drivers/openf and CONFIG_OPENFW to of.h, drivers/of and
>CONFIG_OF - if this offends anyone please scream soon so I can change
>that back.

/me screams. There was already talk about abbreviations [
http://lkml.org/lkml/2006/12/5/7 and replies ], and thank god
"drivers/fw" did not made it (fw: firmware, firewall, firewire...)

>The current diffstat looks like below, so some progress has been made:
>
> arch/powerpc/Kconfig              |    3 +
> arch/powerpc/kernel/of_device.c   |  122 +----------------
> arch/powerpc/kernel/prom.c        |  249 +---------------------------------
> arch/sparc/Kconfig                |    3 +
> arch/sparc/kernel/of_device.c     |  151 +++-----------------
> arch/sparc/kernel/prom.c          |  173 +-----------------------
> arch/sparc/kernel/time.c          |    2 +-
> arch/sparc64/Kconfig              |    3 +
> arch/sparc64/kernel/auxio.c       |    2 +-
> arch/sparc64/kernel/of_device.c   |  164 ++++------------------
> arch/sparc64/kernel/power.c       |    2 +-
> arch/sparc64/kernel/prom.c        |  173 +-----------------------
> arch/sparc64/kernel/time.c        |    2 +-

should be ok,

> drivers/Kconfig                   |    2 +
> drivers/Makefile                  |    1 +
> drivers/of/Kconfig                |    3 +
> drivers/of/Makefile               |    2 +
> drivers/of/base.c                 |  274 +++++++++++++++++++++++++++++++++++++
> drivers/of/device.c               |  131 ++++++++++++++++++

but i'd kinda want drivers/openfirmware, even if it's a bit longer.

> include/asm-powerpc/of_device.h   |   22 +---
> include/asm-powerpc/of_platform.h |   38 +-----
> include/asm-powerpc/prom.h        |   47 ++-----
> include/asm-sparc/of_device.h     |   49 +------
> include/asm-sparc/of_platform.h   |   32 +++++
> include/asm-sparc/prom.h          |   65 +++------
> include/asm-sparc64/of_device.h   |   50 +------
> include/asm-sparc64/of_platform.h |   33 +++++
> include/asm-sparc64/prom.h        |   65 +++------
> include/linux/of.h                |   60 ++++++++
> include/linux/of_device.h         |   26 ++++
> include/linux/of_platform.h       |   55 ++++++++
>
>The battle continues :-)
>--
>Cheers,
>Stephen Rothwell                    sfr@canb.auug.org.au
>http://www.canb.auug.org.au/~sfr/
>

Jan
-- 

^ permalink raw reply

* [PATCH 11/11] Create linux/of_platorm.h
From: Stephen Rothwell @ 2007-05-01  7:34 UTC (permalink / raw)
  To: David S. Miller, paulus; +Cc: sparclinux, ppc-dev
In-Reply-To: <20070501172250.80707fb8.sfr@canb.auug.org.au>

Move common stuff from asm-powerpc/of_platform.h to here and
move the common bits from asm-sparc*/of_device.h here as well.

Create asm-sparc*/of_platform.h and move appropriate parts of
of_device.h to them.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 include/asm-powerpc/of_platform.h |   38 ++++---------------------
 include/asm-sparc/of_device.h     |   39 +-------------------------
 include/asm-sparc/of_platform.h   |   32 +++++++++++++++++++++
 include/asm-sparc64/of_device.h   |   40 +-------------------------
 include/asm-sparc64/of_platform.h |   33 ++++++++++++++++++++++
 include/linux/of_platform.h       |   55 +++++++++++++++++++++++++++++++++++++
 6 files changed, 130 insertions(+), 107 deletions(-)
 create mode 100644 include/asm-sparc/of_platform.h
 create mode 100644 include/asm-sparc64/of_platform.h
 create mode 100644 include/linux/of_platform.h

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/include/asm-powerpc/of_platform.h b/include/asm-powerpc/of_platform.h
index 217eafb..80e6fad 100644
--- a/include/asm-powerpc/of_platform.h
+++ b/include/asm-powerpc/of_platform.h
@@ -1,3 +1,5 @@
+#ifndef _ASM_POWERPC_OF_PLATFORM_H
+#define _ASM_POWERPC_OF_PLATFORM_H
 /*
  *    Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
  *			 <benh@kernel.crashing.org>
@@ -9,37 +11,8 @@
  *
  */
 
-#include <asm/of_device.h>
-
-/*
- * The of_platform_bus_type is a bus type used by drivers that do not
- * attach to a macio or similar bus but still use OF probing
- * mechanism
- */
-extern struct bus_type of_platform_bus_type;
-
-/*
- * An of_platform_driver driver is attached to a basic of_device on
- * the "platform bus" (of_platform_bus_type)
- */
-struct of_platform_driver
-{
-	char			*name;
-	struct of_device_id	*match_table;
-	struct module		*owner;
-
-	int	(*probe)(struct of_device* dev,
-			 const struct of_device_id *match);
-	int	(*remove)(struct of_device* dev);
-
-	int	(*suspend)(struct of_device* dev, pm_message_t state);
-	int	(*resume)(struct of_device* dev);
-	int	(*shutdown)(struct of_device* dev);
-
-	struct device_driver	driver;
-};
-#define	to_of_platform_driver(drv) \
-	container_of(drv,struct of_platform_driver, driver)
+/* This is just here during the transition */
+#include <linux/of_platform.h>
 
 /* Platform drivers register/unregister */
 extern int of_register_platform_driver(struct of_platform_driver *drv);
@@ -56,5 +29,6 @@ extern int of_platform_bus_probe(struct device_node *root,
 				 struct of_device_id *matches,
 				 struct device *parent);
 
-extern struct of_device *of_find_device_by_node(struct device_node *np);
 extern struct of_device *of_find_device_by_phandle(phandle ph);
+
+#endif	/* _ASM_POWERPC_OF_PLATFORM_H */
diff --git a/include/asm-sparc/of_device.h b/include/asm-sparc/of_device.h
index fd8e957..e5f5aed 100644
--- a/include/asm-sparc/of_device.h
+++ b/include/asm-sparc/of_device.h
@@ -7,11 +7,6 @@
 #include <linux/mod_devicetable.h>
 #include <asm/openprom.h>
 
-extern struct bus_type ebus_bus_type;
-extern struct bus_type sbus_bus_type;
-extern struct bus_type of_platform_bus_type;
-#define of_bus_type	of_platform_bus_type	/* for compatibility */
-
 /*
  * The of_device is a kind of "base class" that is a superset of
  * struct device for use by devices attached to an OF node and
@@ -35,39 +30,9 @@ struct of_device
 extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
 extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size);
 
-extern struct of_device *of_find_device_by_node(struct device_node *);
-
-/*
- * An of_platform_driver driver is attached to a basic of_device on
- * the ISA, EBUS, and SBUS busses on sparc64.
- */
-struct of_platform_driver
-{
-	char			*name;
-	struct of_device_id	*match_table;
-	struct module		*owner;
-
-	int	(*probe)(struct of_device* dev, const struct of_device_id *match);
-	int	(*remove)(struct of_device* dev);
-
-	int	(*suspend)(struct of_device* dev, pm_message_t state);
-	int	(*resume)(struct of_device* dev);
-	int	(*shutdown)(struct of_device* dev);
-
-	struct device_driver	driver;
-};
-#define	to_of_platform_driver(drv) container_of(drv,struct of_platform_driver, driver)
-
-extern int of_register_driver(struct of_platform_driver *drv,
-			      struct bus_type *bus);
-extern void of_unregister_driver(struct of_platform_driver *drv);
-extern struct of_device *of_platform_device_create(struct device_node *np,
-						   const char *bus_id,
-						   struct device *parent,
-						   struct bus_type *bus);
-
-/* This is just here during the transition */
+/* These are just here during the transition */
 #include <linux/of_device.h>
+#include <linux/of_platform.h>
 
 #endif /* __KERNEL__ */
 #endif /* _ASM_SPARC_OF_DEVICE_H */
diff --git a/include/asm-sparc/of_platform.h b/include/asm-sparc/of_platform.h
new file mode 100644
index 0000000..64a2300
--- /dev/null
+++ b/include/asm-sparc/of_platform.h
@@ -0,0 +1,32 @@
+#ifndef _ASM_SPARC_OF_PLATFORM_H
+#define _ASM_SPARC_OF_PLATFORM_H
+/*
+ *    Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
+ *			 <benh@kernel.crashing.org>
+ *    Modified for Sparc by merging parts of asm-sparc/of_device.h
+ *		by Stephen Rothwell
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; either version
+ *  2 of the License, or (at your option) any later version.
+ *
+ */
+
+/* This is just here during the transition */
+#include <linux/of_platform.h>
+
+extern struct bus_type ebus_bus_type;
+extern struct bus_type sbus_bus_type;
+extern struct bus_type of_platform_bus_type;
+#define of_bus_type	of_platform_bus_type	/* for compatibility */
+
+extern int of_register_driver(struct of_platform_driver *drv,
+			      struct bus_type *bus);
+extern void of_unregister_driver(struct of_platform_driver *drv);
+extern struct of_device *of_platform_device_create(struct device_node *np,
+						   const char *bus_id,
+						   struct device *parent,
+						   struct bus_type *bus);
+
+#endif	/* _ASM_SPARC_OF_PLATFORM_H */
diff --git a/include/asm-sparc64/of_device.h b/include/asm-sparc64/of_device.h
index daf36eb..46d69b3 100644
--- a/include/asm-sparc64/of_device.h
+++ b/include/asm-sparc64/of_device.h
@@ -7,12 +7,6 @@
 #include <linux/mod_devicetable.h>
 #include <asm/openprom.h>
 
-extern struct bus_type isa_bus_type;
-extern struct bus_type ebus_bus_type;
-extern struct bus_type sbus_bus_type;
-extern struct bus_type of_platform_bus_type;
-#define of_bus_type	of_platform_bus_type	/* for compatibility */
-
 /*
  * The of_device is a kind of "base class" that is a superset of
  * struct device for use by devices attached to an OF node and
@@ -36,39 +30,9 @@ struct of_device
 extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
 extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size);
 
-extern struct of_device *of_find_device_by_node(struct device_node *);
-
-/*
- * An of_platform_driver driver is attached to a basic of_device on
- * the ISA, EBUS, and SBUS busses on sparc64.
- */
-struct of_platform_driver
-{
-	char			*name;
-	struct of_device_id	*match_table;
-	struct module		*owner;
-
-	int	(*probe)(struct of_device* dev, const struct of_device_id *match);
-	int	(*remove)(struct of_device* dev);
-
-	int	(*suspend)(struct of_device* dev, pm_message_t state);
-	int	(*resume)(struct of_device* dev);
-	int	(*shutdown)(struct of_device* dev);
-
-	struct device_driver	driver;
-};
-#define	to_of_platform_driver(drv) container_of(drv,struct of_platform_driver, driver)
-
-extern int of_register_driver(struct of_platform_driver *drv,
-			      struct bus_type *bus);
-extern void of_unregister_driver(struct of_platform_driver *drv);
-extern struct of_device *of_platform_device_create(struct device_node *np,
-						   const char *bus_id,
-						   struct device *parent,
-						   struct bus_type *bus);
-
-/* This is just here during the transition */
+/* These are just here during the transition */
 #include <linux/of_device.h>
+#include <linux/of_platform.h>
 
 #endif /* __KERNEL__ */
 #endif /* _ASM_SPARC64_OF_DEVICE_H */
diff --git a/include/asm-sparc64/of_platform.h b/include/asm-sparc64/of_platform.h
new file mode 100644
index 0000000..f7c1f17
--- /dev/null
+++ b/include/asm-sparc64/of_platform.h
@@ -0,0 +1,33 @@
+#ifndef _ASM_SPARC64_OF_PLATFORM_H
+#define _ASM_SPARC64_OF_PLATFORM_H
+/*
+ *    Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
+ *			 <benh@kernel.crashing.org>
+ *    Modified for Sparc by merging parts of asm-sparc/of_device.h
+ *		by Stephen Rothwell
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; either version
+ *  2 of the License, or (at your option) any later version.
+ *
+ */
+
+/* This is just here during the transition */
+#include <linux/of_platform.h>
+
+extern struct bus_type isa_bus_type;
+extern struct bus_type ebus_bus_type;
+extern struct bus_type sbus_bus_type;
+extern struct bus_type of_platform_bus_type;
+#define of_bus_type	of_platform_bus_type	/* for compatibility */
+
+extern int of_register_driver(struct of_platform_driver *drv,
+			      struct bus_type *bus);
+extern void of_unregister_driver(struct of_platform_driver *drv);
+extern struct of_device *of_platform_device_create(struct device_node *np,
+						   const char *bus_id,
+						   struct device *parent,
+						   struct bus_type *bus);
+
+#endif	/* _ASM_SPARC64_OF_PLATFORM_H */
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
new file mode 100644
index 0000000..c85d0f8
--- /dev/null
+++ b/include/linux/of_platform.h
@@ -0,0 +1,55 @@
+#ifndef _LINUX_OF_PLATFORM_H
+#define _LINUX_OF_PLATFORM_H
+/*
+ *    Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
+ *			 <benh@kernel.crashing.org>
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; either version
+ *  2 of the License, or (at your option) any later version.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/mod_devicetable.h>
+#include <linux/pm.h>
+#include <linux/of_device.h>
+
+/*
+ * The of_platform_bus_type is a bus type used by drivers that do not
+ * attach to a macio or similar bus but still use OF probing
+ * mechanism
+ */
+extern struct bus_type of_platform_bus_type;
+
+/*
+ * An of_platform_driver driver is attached to a basic of_device on
+ * the "platform bus" (of_platform_bus_type) (or ISA, EBUS and SBUS
+ * busses on sparc).
+ */
+struct of_platform_driver
+{
+	char			*name;
+	struct of_device_id	*match_table;
+	struct module		*owner;
+
+	int	(*probe)(struct of_device* dev,
+			 const struct of_device_id *match);
+	int	(*remove)(struct of_device* dev);
+
+	int	(*suspend)(struct of_device* dev, pm_message_t state);
+	int	(*resume)(struct of_device* dev);
+	int	(*shutdown)(struct of_device* dev);
+
+	struct device_driver	driver;
+};
+#define	to_of_platform_driver(drv) \
+	container_of(drv,struct of_platform_driver, driver)
+
+#include <asm/of_platform.h>
+
+extern struct of_device *of_find_device_by_node(struct device_node *np);
+
+#endif	/* _LINUX_OF_PLATFORM_H */
-- 
1.5.1.2

^ permalink raw reply related

* [PATCH 10/11] [SPARC/64] Rename some functions like PowerPC
From: Stephen Rothwell @ 2007-05-01  7:33 UTC (permalink / raw)
  To: David S. Miller, paulus; +Cc: sparclinux, ppc-dev
In-Reply-To: <20070501172250.80707fb8.sfr@canb.auug.org.au>

This is to make the of merge easier.  Also rename of_bus_type.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/sparc/kernel/of_device.c   |   42 ++++++++++++++++----------------
 arch/sparc/kernel/time.c        |    2 +-
 arch/sparc64/kernel/auxio.c     |    2 +-
 arch/sparc64/kernel/of_device.c |   50 +++++++++++++++++++-------------------
 arch/sparc64/kernel/power.c     |    2 +-
 arch/sparc64/kernel/time.c      |    2 +-
 include/asm-sparc/of_device.h   |    3 +-
 include/asm-sparc64/of_device.h |    3 +-
 8 files changed, 54 insertions(+), 52 deletions(-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c
index 0760b81..cb21983 100644
--- a/arch/sparc/kernel/of_device.c
+++ b/arch/sparc/kernel/of_device.c
@@ -21,7 +21,7 @@ static int of_platform_bus_match(struct device *dev, struct device_driver *drv)
 	return of_match_device(matches, of_dev) != NULL;
 }
 
-static int of_device_probe(struct device *dev)
+static int of_platform_device_probe(struct device *dev)
 {
 	int error = -ENODEV;
 	struct of_platform_driver *drv;
@@ -45,7 +45,7 @@ static int of_device_probe(struct device *dev)
 	return error;
 }
 
-static int of_device_remove(struct device *dev)
+static int of_platform_device_remove(struct device *dev)
 {
 	struct of_device * of_dev = to_of_device(dev);
 	struct of_platform_driver * drv = to_of_platform_driver(dev->driver);
@@ -55,7 +55,7 @@ static int of_device_remove(struct device *dev)
 	return 0;
 }
 
-static int of_device_suspend(struct device *dev, pm_message_t state)
+static int of_platform_device_suspend(struct device *dev, pm_message_t state)
 {
 	struct of_device * of_dev = to_of_device(dev);
 	struct of_platform_driver * drv = to_of_platform_driver(dev->driver);
@@ -66,7 +66,7 @@ static int of_device_suspend(struct device *dev, pm_message_t state)
 	return error;
 }
 
-static int of_device_resume(struct device * dev)
+static int of_platform_device_resume(struct device * dev)
 {
 	struct of_device * of_dev = to_of_device(dev);
 	struct of_platform_driver * drv = to_of_platform_driver(dev->driver);
@@ -87,7 +87,7 @@ static int node_match(struct device *dev, void *data)
 
 struct of_device *of_find_device_by_node(struct device_node *dp)
 {
-	struct device *dev = bus_find_device(&of_bus_type, NULL,
+	struct device *dev = bus_find_device(&of_platform_bus_type, NULL,
 					     dp, node_match);
 
 	if (dev)
@@ -101,10 +101,10 @@ EXPORT_SYMBOL(of_find_device_by_node);
 struct bus_type ebus_bus_type = {
        .name	= "ebus",
        .match	= of_platform_bus_match,
-       .probe	= of_device_probe,
-       .remove	= of_device_remove,
-       .suspend	= of_device_suspend,
-       .resume	= of_device_resume,
+       .probe	= of_platform_device_probe,
+       .remove	= of_platform_device_remove,
+       .suspend	= of_platform_device_suspend,
+       .resume	= of_platform_device_resume,
 };
 EXPORT_SYMBOL(ebus_bus_type);
 #endif
@@ -113,23 +113,23 @@ EXPORT_SYMBOL(ebus_bus_type);
 struct bus_type sbus_bus_type = {
        .name	= "sbus",
        .match	= of_platform_bus_match,
-       .probe	= of_device_probe,
-       .remove	= of_device_remove,
-       .suspend	= of_device_suspend,
-       .resume	= of_device_resume,
+       .probe	= of_platform_device_probe,
+       .remove	= of_platform_device_remove,
+       .suspend	= of_platform_device_suspend,
+       .resume	= of_platform_device_resume,
 };
 EXPORT_SYMBOL(sbus_bus_type);
 #endif
 
-struct bus_type of_bus_type = {
+struct bus_type of_platform_bus_type = {
        .name	= "of",
        .match	= of_platform_bus_match,
-       .probe	= of_device_probe,
-       .remove	= of_device_remove,
-       .suspend	= of_device_suspend,
-       .resume	= of_device_resume,
+       .probe	= of_platform_device_probe,
+       .remove	= of_platform_device_remove,
+       .suspend	= of_platform_device_suspend,
+       .resume	= of_platform_device_resume,
 };
-EXPORT_SYMBOL(of_bus_type);
+EXPORT_SYMBOL(of_platform_bus_type);
 
 static inline u64 of_read_addr(const u32 *cell, int size)
 {
@@ -595,7 +595,7 @@ build_resources:
 	build_device_resources(op, parent);
 
 	op->dev.parent = parent;
-	op->dev.bus = &of_bus_type;
+	op->dev.bus = &of_platform_bus_type;
 	if (!parent)
 		strcpy(op->dev.bus_id, "root");
 	else
@@ -639,7 +639,7 @@ static int __init of_bus_driver_init(void)
 {
 	int err;
 
-	err = bus_register(&of_bus_type);
+	err = bus_register(&of_platform_bus_type);
 #ifdef CONFIG_PCI
 	if (!err)
 		err = bus_register(&ebus_bus_type);
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c
index f1401b5..c44eb70 100644
--- a/arch/sparc/kernel/time.c
+++ b/arch/sparc/kernel/time.c
@@ -354,7 +354,7 @@ static struct of_platform_driver clock_driver = {
 /* Probe for the mostek real time clock chip. */
 static int __init clock_init(void)
 {
-	return of_register_driver(&clock_driver, &of_bus_type);
+	return of_register_driver(&clock_driver, &of_platform_bus_type);
 }
 
 /* Must be after subsys_initcall() so that busses are probed.  Must
diff --git a/arch/sparc64/kernel/auxio.c b/arch/sparc64/kernel/auxio.c
index 826118e..7b37976 100644
--- a/arch/sparc64/kernel/auxio.c
+++ b/arch/sparc64/kernel/auxio.c
@@ -155,7 +155,7 @@ static struct of_platform_driver auxio_driver = {
 
 static int __init auxio_init(void)
 {
-	return of_register_driver(&auxio_driver, &of_bus_type);
+	return of_register_driver(&auxio_driver, &of_platform_bus_type);
 }
 
 /* Must be after subsys_initcall() so that busses are probed.  Must
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
index f22ef58..95b167a 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -21,7 +21,7 @@ static int of_platform_bus_match(struct device *dev, struct device_driver *drv)
 	return of_match_device(matches, of_dev) != NULL;
 }
 
-static int of_device_probe(struct device *dev)
+static int of_platform_device_probe(struct device *dev)
 {
 	int error = -ENODEV;
 	struct of_platform_driver *drv;
@@ -45,7 +45,7 @@ static int of_device_probe(struct device *dev)
 	return error;
 }
 
-static int of_device_remove(struct device *dev)
+static int of_platform_device_remove(struct device *dev)
 {
 	struct of_device * of_dev = to_of_device(dev);
 	struct of_platform_driver * drv = to_of_platform_driver(dev->driver);
@@ -55,7 +55,7 @@ static int of_device_remove(struct device *dev)
 	return 0;
 }
 
-static int of_device_suspend(struct device *dev, pm_message_t state)
+static int of_platform_device_suspend(struct device *dev, pm_message_t state)
 {
 	struct of_device * of_dev = to_of_device(dev);
 	struct of_platform_driver * drv = to_of_platform_driver(dev->driver);
@@ -66,7 +66,7 @@ static int of_device_suspend(struct device *dev, pm_message_t state)
 	return error;
 }
 
-static int of_device_resume(struct device * dev)
+static int of_platform_device_resume(struct device * dev)
 {
 	struct of_device * of_dev = to_of_device(dev);
 	struct of_platform_driver * drv = to_of_platform_driver(dev->driver);
@@ -112,7 +112,7 @@ static int node_match(struct device *dev, void *data)
 
 struct of_device *of_find_device_by_node(struct device_node *dp)
 {
-	struct device *dev = bus_find_device(&of_bus_type, NULL,
+	struct device *dev = bus_find_device(&of_platform_bus_type, NULL,
 					     dp, node_match);
 
 	if (dev)
@@ -126,20 +126,20 @@ EXPORT_SYMBOL(of_find_device_by_node);
 struct bus_type isa_bus_type = {
        .name	= "isa",
        .match	= of_platform_bus_match,
-       .probe	= of_device_probe,
-       .remove	= of_device_remove,
-       .suspend	= of_device_suspend,
-       .resume	= of_device_resume,
+       .probe	= of_platform_device_probe,
+       .remove	= of_platform_device_remove,
+       .suspend	= of_platform_device_suspend,
+       .resume	= of_platform_device_resume,
 };
 EXPORT_SYMBOL(isa_bus_type);
 
 struct bus_type ebus_bus_type = {
        .name	= "ebus",
        .match	= of_platform_bus_match,
-       .probe	= of_device_probe,
-       .remove	= of_device_remove,
-       .suspend	= of_device_suspend,
-       .resume	= of_device_resume,
+       .probe	= of_platform_device_probe,
+       .remove	= of_platform_device_remove,
+       .suspend	= of_platform_device_suspend,
+       .resume	= of_platform_device_resume,
 };
 EXPORT_SYMBOL(ebus_bus_type);
 #endif
@@ -148,23 +148,23 @@ EXPORT_SYMBOL(ebus_bus_type);
 struct bus_type sbus_bus_type = {
        .name	= "sbus",
        .match	= of_platform_bus_match,
-       .probe	= of_device_probe,
-       .remove	= of_device_remove,
-       .suspend	= of_device_suspend,
-       .resume	= of_device_resume,
+       .probe	= of_platform_device_probe,
+       .remove	= of_platform_device_remove,
+       .suspend	= of_platform_device_suspend,
+       .resume	= of_platform_device_resume,
 };
 EXPORT_SYMBOL(sbus_bus_type);
 #endif
 
-struct bus_type of_bus_type = {
+struct bus_type of_platform_bus_type = {
        .name	= "of",
        .match	= of_platform_bus_match,
-       .probe	= of_device_probe,
-       .remove	= of_device_remove,
-       .suspend	= of_device_suspend,
-       .resume	= of_device_resume,
+       .probe	= of_platform_device_probe,
+       .remove	= of_platform_device_remove,
+       .suspend	= of_platform_device_suspend,
+       .resume	= of_platform_device_resume,
 };
-EXPORT_SYMBOL(of_bus_type);
+EXPORT_SYMBOL(of_platform_bus_type);
 
 static inline u64 of_read_addr(const u32 *cell, int size)
 {
@@ -866,7 +866,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
 		op->irqs[i] = build_one_device_irq(op, parent, op->irqs[i]);
 
 	op->dev.parent = parent;
-	op->dev.bus = &of_bus_type;
+	op->dev.bus = &of_platform_bus_type;
 	if (!parent)
 		strcpy(op->dev.bus_id, "root");
 	else
@@ -910,7 +910,7 @@ static int __init of_bus_driver_init(void)
 {
 	int err;
 
-	err = bus_register(&of_bus_type);
+	err = bus_register(&of_platform_bus_type);
 #ifdef CONFIG_PCI
 	if (!err)
 		err = bus_register(&isa_bus_type);
diff --git a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c
index 699b24b..a90e989 100644
--- a/arch/sparc64/kernel/power.c
+++ b/arch/sparc64/kernel/power.c
@@ -159,7 +159,7 @@ static struct of_platform_driver power_driver = {
 
 void __init power_init(void)
 {
-	of_register_driver(&power_driver, &of_bus_type);
+	of_register_driver(&power_driver, &of_platform_bus_type);
 	return;
 }
 #endif /* CONFIG_PCI */
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index 259063f..b8cb636 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -812,7 +812,7 @@ static int __init clock_init(void)
 		return 0;
 	}
 
-	return of_register_driver(&clock_driver, &of_bus_type);
+	return of_register_driver(&clock_driver, &of_platform_bus_type);
 }
 
 /* Must be after subsys_initcall() so that busses are probed.  Must
diff --git a/include/asm-sparc/of_device.h b/include/asm-sparc/of_device.h
index b625261..fd8e957 100644
--- a/include/asm-sparc/of_device.h
+++ b/include/asm-sparc/of_device.h
@@ -9,7 +9,8 @@
 
 extern struct bus_type ebus_bus_type;
 extern struct bus_type sbus_bus_type;
-extern struct bus_type of_bus_type;
+extern struct bus_type of_platform_bus_type;
+#define of_bus_type	of_platform_bus_type	/* for compatibility */
 
 /*
  * The of_device is a kind of "base class" that is a superset of
diff --git a/include/asm-sparc64/of_device.h b/include/asm-sparc64/of_device.h
index 68048cb..daf36eb 100644
--- a/include/asm-sparc64/of_device.h
+++ b/include/asm-sparc64/of_device.h
@@ -10,7 +10,8 @@
 extern struct bus_type isa_bus_type;
 extern struct bus_type ebus_bus_type;
 extern struct bus_type sbus_bus_type;
-extern struct bus_type of_bus_type;
+extern struct bus_type of_platform_bus_type;
+#define of_bus_type	of_platform_bus_type	/* for compatibility */
 
 /*
  * The of_device is a kind of "base class" that is a superset of
-- 
1.5.1.2

^ permalink raw reply related

* [PATCH 09/11] Begin consolidation of of_device.h
From: Stephen Rothwell @ 2007-05-01  7:32 UTC (permalink / raw)
  To: David S. Miller, paulus; +Cc: sparclinux, ppc-dev
In-Reply-To: <20070501172250.80707fb8.sfr@canb.auug.org.au>

This just moves the common stuff from the arch of_device.h files to
linux/of_device.h.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 drivers/of/device.c             |    2 +-
 include/asm-powerpc/of_device.h |   22 +++++-----------------
 include/asm-sparc/of_device.h   |   15 ++++-----------
 include/asm-sparc64/of_device.h |   15 ++++-----------
 include/linux/of_device.h       |   26 ++++++++++++++++++++++++++
 5 files changed, 40 insertions(+), 40 deletions(-)
 create mode 100644 include/linux/of_device.h

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/drivers/of/device.c b/drivers/of/device.c
index 7f233d7..6245f06 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -1,13 +1,13 @@
 #include <linux/string.h>
 #include <linux/kernel.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/mod_devicetable.h>
 #include <linux/slab.h>
 
 #include <asm/errno.h>
-#include <asm/of_device.h>
 
 /**
  * of_match_node - Tell if an device_node has a matching of_match structure
diff --git a/include/asm-powerpc/of_device.h b/include/asm-powerpc/of_device.h
index 4f1aabe..1d88275 100644
--- a/include/asm-powerpc/of_device.h
+++ b/include/asm-powerpc/of_device.h
@@ -3,14 +3,12 @@
 #ifdef __KERNEL__
 
 #include <linux/device.h>
-#include <linux/mod_devicetable.h>
-#include <asm/prom.h>
-
+#include <linux/of.h>
 
 /*
  * The of_device is a kind of "base class" that is a superset of
  * struct device for use by devices attached to an OF node and
- * probed using OF properties
+ * probed using OF properties.
  */
 struct of_device
 {
@@ -18,22 +16,12 @@ struct of_device
 	u64			dma_mask;	/* DMA mask */
 	struct device		dev;		/* Generic device interface */
 };
-#define	to_of_device(d) container_of(d, struct of_device, dev)
-
-extern const struct of_device_id *of_match_node(
-	const struct of_device_id *matches, const struct device_node *node);
-extern const struct of_device_id *of_match_device(
-	const struct of_device_id *matches, const struct of_device *dev);
-
-extern struct of_device *of_dev_get(struct of_device *dev);
-extern void of_dev_put(struct of_device *dev);
-
-extern int of_device_register(struct of_device *ofdev);
-extern void of_device_unregister(struct of_device *ofdev);
-extern void of_release_dev(struct device *dev);
 
 extern int of_device_uevent(struct device *dev,
 	char **envp, int num_envp, char *buffer, int buffer_size);
 
+/* This is just here during the transition */
+#include <linux/of_device.h>
+
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_OF_DEVICE_H */
diff --git a/include/asm-sparc/of_device.h b/include/asm-sparc/of_device.h
index 7cb00c1..b625261 100644
--- a/include/asm-sparc/of_device.h
+++ b/include/asm-sparc/of_device.h
@@ -3,9 +3,9 @@
 #ifdef __KERNEL__
 
 #include <linux/device.h>
+#include <linux/of.h>
 #include <linux/mod_devicetable.h>
 #include <asm/openprom.h>
-#include <asm/prom.h>
 
 extern struct bus_type ebus_bus_type;
 extern struct bus_type sbus_bus_type;
@@ -30,19 +30,12 @@ struct of_device
 	int				portid;
 	int				clock_freq;
 };
-#define	to_of_device(d) container_of(d, struct of_device, dev)
 
 extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
 extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size);
 
 extern struct of_device *of_find_device_by_node(struct device_node *);
 
-extern const struct of_device_id *of_match_device(
-	const struct of_device_id *matches, const struct of_device *dev);
-
-extern struct of_device *of_dev_get(struct of_device *dev);
-extern void of_dev_put(struct of_device *dev);
-
 /*
  * An of_platform_driver driver is attached to a basic of_device on
  * the ISA, EBUS, and SBUS busses on sparc64.
@@ -67,13 +60,13 @@ struct of_platform_driver
 extern int of_register_driver(struct of_platform_driver *drv,
 			      struct bus_type *bus);
 extern void of_unregister_driver(struct of_platform_driver *drv);
-extern int of_device_register(struct of_device *ofdev);
-extern void of_device_unregister(struct of_device *ofdev);
 extern struct of_device *of_platform_device_create(struct device_node *np,
 						   const char *bus_id,
 						   struct device *parent,
 						   struct bus_type *bus);
-extern void of_release_dev(struct device *dev);
+
+/* This is just here during the transition */
+#include <linux/of_device.h>
 
 #endif /* __KERNEL__ */
 #endif /* _ASM_SPARC_OF_DEVICE_H */
diff --git a/include/asm-sparc64/of_device.h b/include/asm-sparc64/of_device.h
index 60e9173..68048cb 100644
--- a/include/asm-sparc64/of_device.h
+++ b/include/asm-sparc64/of_device.h
@@ -3,9 +3,9 @@
 #ifdef __KERNEL__
 
 #include <linux/device.h>
+#include <linux/of.h>
 #include <linux/mod_devicetable.h>
 #include <asm/openprom.h>
-#include <asm/prom.h>
 
 extern struct bus_type isa_bus_type;
 extern struct bus_type ebus_bus_type;
@@ -31,19 +31,12 @@ struct of_device
 	int				portid;
 	int				clock_freq;
 };
-#define	to_of_device(d) container_of(d, struct of_device, dev)
 
 extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
 extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size);
 
 extern struct of_device *of_find_device_by_node(struct device_node *);
 
-extern const struct of_device_id *of_match_device(
-	const struct of_device_id *matches, const struct of_device *dev);
-
-extern struct of_device *of_dev_get(struct of_device *dev);
-extern void of_dev_put(struct of_device *dev);
-
 /*
  * An of_platform_driver driver is attached to a basic of_device on
  * the ISA, EBUS, and SBUS busses on sparc64.
@@ -68,13 +61,13 @@ struct of_platform_driver
 extern int of_register_driver(struct of_platform_driver *drv,
 			      struct bus_type *bus);
 extern void of_unregister_driver(struct of_platform_driver *drv);
-extern int of_device_register(struct of_device *ofdev);
-extern void of_device_unregister(struct of_device *ofdev);
 extern struct of_device *of_platform_device_create(struct device_node *np,
 						   const char *bus_id,
 						   struct device *parent,
 						   struct bus_type *bus);
-extern void of_release_dev(struct device *dev);
+
+/* This is just here during the transition */
+#include <linux/of_device.h>
 
 #endif /* __KERNEL__ */
 #endif /* _ASM_SPARC64_OF_DEVICE_H */
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
new file mode 100644
index 0000000..91bf84b
--- /dev/null
+++ b/include/linux/of_device.h
@@ -0,0 +1,26 @@
+#ifndef _LINUX_OF_DEVICE_H
+#define _LINUX_OF_DEVICE_H
+#ifdef __KERNEL__
+
+#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/mod_devicetable.h>
+
+#include <asm/of_device.h>
+
+#define	to_of_device(d) container_of(d, struct of_device, dev)
+
+extern const struct of_device_id *of_match_node(
+	const struct of_device_id *matches, const struct device_node *node);
+extern const struct of_device_id *of_match_device(
+	const struct of_device_id *matches, const struct of_device *dev);
+
+extern struct of_device *of_dev_get(struct of_device *dev);
+extern void of_dev_put(struct of_device *dev);
+
+extern int of_device_register(struct of_device *ofdev);
+extern void of_device_unregister(struct of_device *ofdev);
+extern void of_release_dev(struct device *dev);
+
+#endif /* __KERNEL__ */
+#endif /* _LINUX_OF_DEVICE_H */
-- 
1.5.1.2

^ permalink raw reply related

* [PATCH 08/11] Begin to consolidate of_device.c
From: Stephen Rothwell @ 2007-05-01  7:31 UTC (permalink / raw)
  To: David S. Miller, paulus; +Cc: sparclinux, ppc-dev
In-Reply-To: <20070501172250.80707fb8.sfr@canb.auug.org.au>

This moves all the common parts for the Sparc, Sparc64 and PowerPC
of_device.c files into drivers/openfw/device.c.

Apart from the simple move, Sparc gains of_match_node() and a call to
of_node_put in of_release_dev().  PowerPC gains better recovery if
device_create_file() fails in of_device_register().

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/kernel/of_device.c |  122 +------------------------------------
 arch/sparc/kernel/of_device.c   |  109 +--------------------------------
 arch/sparc64/kernel/of_device.c |  114 +---------------------------------
 drivers/Kconfig                 |    2 +
 drivers/of/Kconfig              |    3 +
 drivers/of/Makefile             |    1 +
 drivers/of/device.c             |  131 +++++++++++++++++++++++++++++++++++++++
 7 files changed, 142 insertions(+), 340 deletions(-)
 create mode 100644 drivers/of/Kconfig
 create mode 100644 drivers/of/device.c

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c
index 0c8ea76..e5ba264 100644
--- a/arch/powerpc/kernel/of_device.c
+++ b/arch/powerpc/kernel/of_device.c
@@ -1,5 +1,6 @@
 #include <linux/string.h>
 #include <linux/kernel.h>
+#include <linux/of.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/mod_devicetable.h>
@@ -8,118 +9,6 @@
 #include <asm/errno.h>
 #include <asm/of_device.h>
 
-/**
- * of_match_node - Tell if an device_node has a matching of_match structure
- * @ids: array of of device match structures to search in
- * @node: the of device structure to match against
- *
- * Low level utility function used by device matching.
- */
-const struct of_device_id *of_match_node(const struct of_device_id *matches,
-					 const struct device_node *node)
-{
-	while (matches->name[0] || matches->type[0] || matches->compatible[0]) {
-		int match = 1;
-		if (matches->name[0])
-			match &= node->name
-				&& !strcmp(matches->name, node->name);
-		if (matches->type[0])
-			match &= node->type
-				&& !strcmp(matches->type, node->type);
-		if (matches->compatible[0])
-			match &= device_is_compatible(node,
-						      matches->compatible);
-		if (match)
-			return matches;
-		matches++;
-	}
-	return NULL;
-}
-
-/**
- * of_match_device - Tell if an of_device structure has a matching
- * of_match structure
- * @ids: array of of device match structures to search in
- * @dev: the of device structure to match against
- *
- * Used by a driver to check whether an of_device present in the
- * system is in its list of supported devices.
- */
-const struct of_device_id *of_match_device(const struct of_device_id *matches,
-					const struct of_device *dev)
-{
-	if (!dev->node)
-		return NULL;
-	return of_match_node(matches, dev->node);
-}
-
-struct of_device *of_dev_get(struct of_device *dev)
-{
-	struct device *tmp;
-
-	if (!dev)
-		return NULL;
-	tmp = get_device(&dev->dev);
-	if (tmp)
-		return to_of_device(tmp);
-	else
-		return NULL;
-}
-
-void of_dev_put(struct of_device *dev)
-{
-	if (dev)
-		put_device(&dev->dev);
-}
-
-static ssize_t dev_show_devspec(struct device *dev,
-				struct device_attribute *attr, char *buf)
-{
-	struct of_device *ofdev;
-
-	ofdev = to_of_device(dev);
-	return sprintf(buf, "%s", ofdev->node->full_name);
-}
-
-static DEVICE_ATTR(devspec, S_IRUGO, dev_show_devspec, NULL);
-
-/**
- * of_release_dev - free an of device structure when all users of it are finished.
- * @dev: device that's been disconnected
- *
- * Will be called only by the device core when all users of this of device are
- * done.
- */
-void of_release_dev(struct device *dev)
-{
-	struct of_device *ofdev;
-
-        ofdev = to_of_device(dev);
-	of_node_put(ofdev->node);
-	kfree(ofdev);
-}
-
-int of_device_register(struct of_device *ofdev)
-{
-	int rc;
-
-	BUG_ON(ofdev->node == NULL);
-
-	rc = device_register(&ofdev->dev);
-	if (rc)
-		return rc;
-
-	return device_create_file(&ofdev->dev, &dev_attr_devspec);
-}
-
-void of_device_unregister(struct of_device *ofdev)
-{
-	device_remove_file(&ofdev->dev, &dev_attr_devspec);
-
-	device_unregister(&ofdev->dev);
-}
-
-
 static ssize_t of_device_get_modalias(struct of_device *ofdev,
 					char *str, ssize_t len)
 {
@@ -229,13 +118,4 @@ int of_device_uevent(struct device *dev,
 
 	return 0;
 }
-
-
-EXPORT_SYMBOL(of_match_node);
-EXPORT_SYMBOL(of_match_device);
-EXPORT_SYMBOL(of_device_register);
-EXPORT_SYMBOL(of_device_unregister);
-EXPORT_SYMBOL(of_dev_get);
-EXPORT_SYMBOL(of_dev_put);
-EXPORT_SYMBOL(of_release_dev);
 EXPORT_SYMBOL(of_device_uevent);
diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c
index fd7f8cb..0760b81 100644
--- a/arch/sparc/kernel/of_device.c
+++ b/arch/sparc/kernel/of_device.c
@@ -1,5 +1,6 @@
 #include <linux/string.h>
 #include <linux/kernel.h>
+#include <linux/of.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/mod_devicetable.h>
@@ -8,38 +9,6 @@
 #include <asm/errno.h>
 #include <asm/of_device.h>
 
-/**
- * of_match_device - Tell if an of_device structure has a matching
- * of_match structure
- * @ids: array of of device match structures to search in
- * @dev: the of device structure to match against
- *
- * Used by a driver to check whether an of_device present in the
- * system is in its list of supported devices.
- */
-const struct of_device_id *of_match_device(const struct of_device_id *matches,
-					const struct of_device *dev)
-{
-	if (!dev->node)
-		return NULL;
-	while (matches->name[0] || matches->type[0] || matches->compatible[0]) {
-		int match = 1;
-		if (matches->name[0])
-			match &= dev->node->name
-				&& !strcmp(matches->name, dev->node->name);
-		if (matches->type[0])
-			match &= dev->node->type
-				&& !strcmp(matches->type, dev->node->type);
-		if (matches->compatible[0])
-			match &= of_device_is_compatible(dev->node,
-							 matches->compatible);
-		if (match)
-			return matches;
-		matches++;
-	}
-	return NULL;
-}
-
 static int of_platform_bus_match(struct device *dev, struct device_driver *drv)
 {
 	struct of_device * of_dev = to_of_device(dev);
@@ -52,26 +21,6 @@ static int of_platform_bus_match(struct device *dev, struct device_driver *drv)
 	return of_match_device(matches, of_dev) != NULL;
 }
 
-struct of_device *of_dev_get(struct of_device *dev)
-{
-	struct device *tmp;
-
-	if (!dev)
-		return NULL;
-	tmp = get_device(&dev->dev);
-	if (tmp)
-		return to_of_device(tmp);
-	else
-		return NULL;
-}
-
-void of_dev_put(struct of_device *dev)
-{
-	if (dev)
-		put_device(&dev->dev);
-}
-
-
 static int of_device_probe(struct device *dev)
 {
 	int error = -ENODEV;
@@ -735,56 +684,6 @@ void of_unregister_driver(struct of_platform_driver *drv)
 	driver_unregister(&drv->driver);
 }
 
-
-static ssize_t dev_show_devspec(struct device *dev, struct device_attribute *attr, char *buf)
-{
-	struct of_device *ofdev;
-
-	ofdev = to_of_device(dev);
-	return sprintf(buf, "%s", ofdev->node->full_name);
-}
-
-static DEVICE_ATTR(devspec, S_IRUGO, dev_show_devspec, NULL);
-
-/**
- * of_release_dev - free an of device structure when all users of it are finished.
- * @dev: device that's been disconnected
- *
- * Will be called only by the device core when all users of this of device are
- * done.
- */
-void of_release_dev(struct device *dev)
-{
-	struct of_device *ofdev;
-
-        ofdev = to_of_device(dev);
-
-	kfree(ofdev);
-}
-
-int of_device_register(struct of_device *ofdev)
-{
-	int rc;
-
-	BUG_ON(ofdev->node == NULL);
-
-	rc = device_register(&ofdev->dev);
-	if (rc)
-		return rc;
-
-	rc = device_create_file(&ofdev->dev, &dev_attr_devspec);
-	if (rc)
-		device_unregister(&ofdev->dev);
-
-	return rc;
-}
-
-void of_device_unregister(struct of_device *ofdev)
-{
-	device_remove_file(&ofdev->dev, &dev_attr_devspec);
-	device_unregister(&ofdev->dev);
-}
-
 struct of_device* of_platform_device_create(struct device_node *np,
 					    const char *bus_id,
 					    struct device *parent,
@@ -810,12 +709,6 @@ struct of_device* of_platform_device_create(struct device_node *np,
 	return dev;
 }
 
-EXPORT_SYMBOL(of_match_device);
 EXPORT_SYMBOL(of_register_driver);
 EXPORT_SYMBOL(of_unregister_driver);
-EXPORT_SYMBOL(of_device_register);
-EXPORT_SYMBOL(of_device_unregister);
-EXPORT_SYMBOL(of_dev_get);
-EXPORT_SYMBOL(of_dev_put);
 EXPORT_SYMBOL(of_platform_device_create);
-EXPORT_SYMBOL(of_release_dev);
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
index 9ac9a30..f22ef58 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -1,5 +1,6 @@
 #include <linux/string.h>
 #include <linux/kernel.h>
+#include <linux/of.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/mod_devicetable.h>
@@ -8,38 +9,6 @@
 #include <asm/errno.h>
 #include <asm/of_device.h>
 
-/**
- * of_match_device - Tell if an of_device structure has a matching
- * of_match structure
- * @ids: array of of device match structures to search in
- * @dev: the of device structure to match against
- *
- * Used by a driver to check whether an of_device present in the
- * system is in its list of supported devices.
- */
-const struct of_device_id *of_match_device(const struct of_device_id *matches,
-					const struct of_device *dev)
-{
-	if (!dev->node)
-		return NULL;
-	while (matches->name[0] || matches->type[0] || matches->compatible[0]) {
-		int match = 1;
-		if (matches->name[0])
-			match &= dev->node->name
-				&& !strcmp(matches->name, dev->node->name);
-		if (matches->type[0])
-			match &= dev->node->type
-				&& !strcmp(matches->type, dev->node->type);
-		if (matches->compatible[0])
-			match &= of_device_is_compatible(dev->node,
-							 matches->compatible);
-		if (match)
-			return matches;
-		matches++;
-	}
-	return NULL;
-}
-
 static int of_platform_bus_match(struct device *dev, struct device_driver *drv)
 {
 	struct of_device * of_dev = to_of_device(dev);
@@ -52,26 +21,6 @@ static int of_platform_bus_match(struct device *dev, struct device_driver *drv)
 	return of_match_device(matches, of_dev) != NULL;
 }
 
-struct of_device *of_dev_get(struct of_device *dev)
-{
-	struct device *tmp;
-
-	if (!dev)
-		return NULL;
-	tmp = get_device(&dev->dev);
-	if (tmp)
-		return to_of_device(tmp);
-	else
-		return NULL;
-}
-
-void of_dev_put(struct of_device *dev)
-{
-	if (dev)
-		put_device(&dev->dev);
-}
-
-
 static int of_device_probe(struct device *dev)
 {
 	int error = -ENODEV;
@@ -1004,61 +953,13 @@ int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
 	/* register with core */
 	return driver_register(&drv->driver);
 }
+EXPORT_SYMBOL(of_register_driver);
 
 void of_unregister_driver(struct of_platform_driver *drv)
 {
 	driver_unregister(&drv->driver);
 }
-
-
-static ssize_t dev_show_devspec(struct device *dev, struct device_attribute *attr, char *buf)
-{
-	struct of_device *ofdev;
-
-	ofdev = to_of_device(dev);
-	return sprintf(buf, "%s", ofdev->node->full_name);
-}
-
-static DEVICE_ATTR(devspec, S_IRUGO, dev_show_devspec, NULL);
-
-/**
- * of_release_dev - free an of device structure when all users of it are finished.
- * @dev: device that's been disconnected
- *
- * Will be called only by the device core when all users of this of device are
- * done.
- */
-void of_release_dev(struct device *dev)
-{
-	struct of_device *ofdev;
-
-        ofdev = to_of_device(dev);
-
-	kfree(ofdev);
-}
-
-int of_device_register(struct of_device *ofdev)
-{
-	int rc;
-
-	BUG_ON(ofdev->node == NULL);
-
-	rc = device_register(&ofdev->dev);
-	if (rc)
-		return rc;
-
-	rc = device_create_file(&ofdev->dev, &dev_attr_devspec);
-	if (rc)
-		device_unregister(&ofdev->dev);
-
-	return rc;
-}
-
-void of_device_unregister(struct of_device *ofdev)
-{
-	device_remove_file(&ofdev->dev, &dev_attr_devspec);
-	device_unregister(&ofdev->dev);
-}
+EXPORT_SYMBOL(of_unregister_driver);
 
 struct of_device* of_platform_device_create(struct device_node *np,
 					    const char *bus_id,
@@ -1084,13 +985,4 @@ struct of_device* of_platform_device_create(struct device_node *np,
 
 	return dev;
 }
-
-EXPORT_SYMBOL(of_match_device);
-EXPORT_SYMBOL(of_register_driver);
-EXPORT_SYMBOL(of_unregister_driver);
-EXPORT_SYMBOL(of_device_register);
-EXPORT_SYMBOL(of_device_unregister);
-EXPORT_SYMBOL(of_dev_get);
-EXPORT_SYMBOL(of_dev_put);
 EXPORT_SYMBOL(of_platform_device_create);
-EXPORT_SYMBOL(of_release_dev);
diff --git a/drivers/Kconfig b/drivers/Kconfig
index 050323f..1608f52 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -8,6 +8,8 @@ source "drivers/connector/Kconfig"
 
 source "drivers/mtd/Kconfig"
 
+source "drivers/of/Kconfig"
+
 source "drivers/parport/Kconfig"
 
 source "drivers/pnp/Kconfig"
diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
new file mode 100644
index 0000000..c03072b
--- /dev/null
+++ b/drivers/of/Kconfig
@@ -0,0 +1,3 @@
+config OF_DEVICE
+	def_bool y
+	depends on OF && (SPARC || PPC_OF)
diff --git a/drivers/of/Makefile b/drivers/of/Makefile
index cddbe84..c46d998 100644
--- a/drivers/of/Makefile
+++ b/drivers/of/Makefile
@@ -1 +1,2 @@
 obj-y = base.o
+obj-$(CONFIG_OF_DEVICE) += device.o
diff --git a/drivers/of/device.c b/drivers/of/device.c
new file mode 100644
index 0000000..7f233d7
--- /dev/null
+++ b/drivers/of/device.c
@@ -0,0 +1,131 @@
+#include <linux/string.h>
+#include <linux/kernel.h>
+#include <linux/of.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/mod_devicetable.h>
+#include <linux/slab.h>
+
+#include <asm/errno.h>
+#include <asm/of_device.h>
+
+/**
+ * of_match_node - Tell if an device_node has a matching of_match structure
+ * @ids: array of of device match structures to search in
+ * @node: the of device structure to match against
+ *
+ * Low level utility function used by device matching.
+ */
+const struct of_device_id *of_match_node(const struct of_device_id *matches,
+					 const struct device_node *node)
+{
+	while (matches->name[0] || matches->type[0] || matches->compatible[0]) {
+		int match = 1;
+		if (matches->name[0])
+			match &= node->name
+				&& !strcmp(matches->name, node->name);
+		if (matches->type[0])
+			match &= node->type
+				&& !strcmp(matches->type, node->type);
+		if (matches->compatible[0])
+			match &= of_device_is_compatible(node,
+						matches->compatible);
+		if (match)
+			return matches;
+		matches++;
+	}
+	return NULL;
+}
+EXPORT_SYMBOL(of_match_node);
+
+/**
+ * of_match_device - Tell if an of_device structure has a matching
+ * of_match structure
+ * @ids: array of of device match structures to search in
+ * @dev: the of device structure to match against
+ *
+ * Used by a driver to check whether an of_device present in the
+ * system is in its list of supported devices.
+ */
+const struct of_device_id *of_match_device(const struct of_device_id *matches,
+					const struct of_device *dev)
+{
+	if (!dev->node)
+		return NULL;
+	return of_match_node(matches, dev->node);
+}
+EXPORT_SYMBOL(of_match_device);
+
+struct of_device *of_dev_get(struct of_device *dev)
+{
+	struct device *tmp;
+
+	if (!dev)
+		return NULL;
+	tmp = get_device(&dev->dev);
+	if (tmp)
+		return to_of_device(tmp);
+	else
+		return NULL;
+}
+EXPORT_SYMBOL(of_dev_get);
+
+void of_dev_put(struct of_device *dev)
+{
+	if (dev)
+		put_device(&dev->dev);
+}
+EXPORT_SYMBOL(of_dev_put);
+
+static ssize_t dev_show_devspec(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{
+	struct of_device *ofdev;
+
+	ofdev = to_of_device(dev);
+	return sprintf(buf, "%s", ofdev->node->full_name);
+}
+
+static DEVICE_ATTR(devspec, S_IRUGO, dev_show_devspec, NULL);
+
+/**
+ * of_release_dev - free an of device structure when all users of it are finished.
+ * @dev: device that's been disconnected
+ *
+ * Will be called only by the device core when all users of this of device are
+ * done.
+ */
+void of_release_dev(struct device *dev)
+{
+	struct of_device *ofdev;
+
+	ofdev = to_of_device(dev);
+	of_node_put(ofdev->node);
+	kfree(ofdev);
+}
+EXPORT_SYMBOL(of_release_dev);
+
+int of_device_register(struct of_device *ofdev)
+{
+	int rc;
+
+	BUG_ON(ofdev->node == NULL);
+
+	rc = device_register(&ofdev->dev);
+	if (rc)
+		return rc;
+
+	rc = device_create_file(&ofdev->dev, &dev_attr_devspec);
+	if (rc)
+		device_unregister(&ofdev->dev);
+
+	return rc;
+}
+EXPORT_SYMBOL(of_device_register);
+
+void of_device_unregister(struct of_device *ofdev)
+{
+	device_remove_file(&ofdev->dev, &dev_attr_devspec);
+	device_unregister(&ofdev->dev);
+}
+EXPORT_SYMBOL(of_device_unregister);
-- 
1.5.1.2

^ permalink raw reply related

* [PATCH 07/11] Consolidate of_find_node_by routines
From: Stephen Rothwell @ 2007-05-01  7:30 UTC (permalink / raw)
  To: David S. Miller, paulus; +Cc: sparclinux, ppc-dev
In-Reply-To: <20070501172250.80707fb8.sfr@canb.auug.org.au>

This consolidates the routines of_find_node_by_path, of_find_node_by_name,
of_find_node_by_type and of_find_compatible_device.  Again, the comparison
of strings are done differently by Sparc and PowerPC and also these add
read_locks around the iterations.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/kernel/prom.c |  113 +-------------------------------------------
 arch/sparc/kernel/prom.c   |   61 +-----------------------
 arch/sparc64/kernel/prom.c |   61 +-----------------------
 drivers/of/base.c          |  114 ++++++++++++++++++++++++++++++++++++++++++++
 include/asm-powerpc/prom.h |    1 +
 include/asm-sparc/prom.h   |    1 +
 include/asm-sparc64/prom.h |    1 +
 7 files changed, 120 insertions(+), 232 deletions(-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 90901e4..fc64bcb 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -77,7 +77,7 @@ static struct boot_param_header *initial_boot_params __initdata;
 struct boot_param_header *initial_boot_params;
 #endif
 
-static struct device_node *allnodes = NULL;
+extern struct device_node *allnodes;	/* temporary while merging */
 
 extern rwlock_t devtree_lock;	/* temporary while merging */
 
@@ -1068,117 +1068,6 @@ EXPORT_SYMBOL(machine_is_compatible);
  *
  *******/
 
-/**
- *	of_find_node_by_name - Find a node by its "name" property
- *	@from:	The node to start searching from or NULL, the node
- *		you pass will not be searched, only the next one
- *		will; typically, you pass what the previous call
- *		returned. of_node_put() will be called on it
- *	@name:	The name string to match against
- *
- *	Returns a node pointer with refcount incremented, use
- *	of_node_put() on it when done.
- */
-struct device_node *of_find_node_by_name(struct device_node *from,
-	const char *name)
-{
-	struct device_node *np;
-
-	read_lock(&devtree_lock);
-	np = from ? from->allnext : allnodes;
-	for (; np != NULL; np = np->allnext)
-		if (np->name != NULL && strcasecmp(np->name, name) == 0
-		    && of_node_get(np))
-			break;
-	of_node_put(from);
-	read_unlock(&devtree_lock);
-	return np;
-}
-EXPORT_SYMBOL(of_find_node_by_name);
-
-/**
- *	of_find_node_by_type - Find a node by its "device_type" property
- *	@from:	The node to start searching from or NULL, the node
- *		you pass will not be searched, only the next one
- *		will; typically, you pass what the previous call
- *		returned. of_node_put() will be called on it
- *	@name:	The type string to match against
- *
- *	Returns a node pointer with refcount incremented, use
- *	of_node_put() on it when done.
- */
-struct device_node *of_find_node_by_type(struct device_node *from,
-	const char *type)
-{
-	struct device_node *np;
-
-	read_lock(&devtree_lock);
-	np = from ? from->allnext : allnodes;
-	for (; np != 0; np = np->allnext)
-		if (np->type != 0 && strcasecmp(np->type, type) == 0
-		    && of_node_get(np))
-			break;
-	of_node_put(from);
-	read_unlock(&devtree_lock);
-	return np;
-}
-EXPORT_SYMBOL(of_find_node_by_type);
-
-/**
- *	of_find_compatible_node - Find a node based on type and one of the
- *                                tokens in its "compatible" property
- *	@from:		The node to start searching from or NULL, the node
- *			you pass will not be searched, only the next one
- *			will; typically, you pass what the previous call
- *			returned. of_node_put() will be called on it
- *	@type:		The type string to match "device_type" or NULL to ignore
- *	@compatible:	The string to match to one of the tokens in the device
- *			"compatible" list.
- *
- *	Returns a node pointer with refcount incremented, use
- *	of_node_put() on it when done.
- */
-struct device_node *of_find_compatible_node(struct device_node *from,
-	const char *type, const char *compatible)
-{
-	struct device_node *np;
-
-	read_lock(&devtree_lock);
-	np = from ? from->allnext : allnodes;
-	for (; np != 0; np = np->allnext) {
-		if (type != NULL
-		    && !(np->type != 0 && strcasecmp(np->type, type) == 0))
-			continue;
-		if (of_device_is_compatible(np, compatible) && of_node_get(np))
-			break;
-	}
-	of_node_put(from);
-	read_unlock(&devtree_lock);
-	return np;
-}
-EXPORT_SYMBOL(of_find_compatible_node);
-
-/**
- *	of_find_node_by_path - Find a node matching a full OF path
- *	@path:	The full path to match
- *
- *	Returns a node pointer with refcount incremented, use
- *	of_node_put() on it when done.
- */
-struct device_node *of_find_node_by_path(const char *path)
-{
-	struct device_node *np = allnodes;
-
-	read_lock(&devtree_lock);
-	for (; np != 0; np = np->allnext) {
-		if (np->full_name != 0 && strcasecmp(np->full_name, path) == 0
-		    && of_node_get(np))
-			break;
-	}
-	read_unlock(&devtree_lock);
-	return np;
-}
-EXPORT_SYMBOL(of_find_node_by_path);
 
 /**
  *	of_find_node_by_phandle - Find a node given a phandle
diff --git a/arch/sparc/kernel/prom.c b/arch/sparc/kernel/prom.c
index 3f8ccfa..012f983 100644
--- a/arch/sparc/kernel/prom.c
+++ b/arch/sparc/kernel/prom.c
@@ -25,23 +25,10 @@
 #include <asm/prom.h>
 #include <asm/oplib.h>
 
-static struct device_node *allnodes;
+extern struct device_node *allnodes;	/* temporary while merging */
 
 extern rwlock_t devtree_lock;	/* temporary while merging */
 
-struct device_node *of_find_node_by_path(const char *path)
-{
-	struct device_node *np = allnodes;
-
-	for (; np != 0; np = np->allnext) {
-		if (np->full_name != 0 && strcmp(np->full_name, path) == 0)
-			break;
-	}
-
-	return np;
-}
-EXPORT_SYMBOL(of_find_node_by_path);
-
 struct device_node *of_find_node_by_phandle(phandle handle)
 {
 	struct device_node *np;
@@ -54,52 +41,6 @@ struct device_node *of_find_node_by_phandle(phandle handle)
 }
 EXPORT_SYMBOL(of_find_node_by_phandle);
 
-struct device_node *of_find_node_by_name(struct device_node *from,
-	const char *name)
-{
-	struct device_node *np;
-
-	np = from ? from->allnext : allnodes;
-	for (; np != NULL; np = np->allnext)
-		if (np->name != NULL && strcmp(np->name, name) == 0)
-			break;
-
-	return np;
-}
-EXPORT_SYMBOL(of_find_node_by_name);
-
-struct device_node *of_find_node_by_type(struct device_node *from,
-	const char *type)
-{
-	struct device_node *np;
-
-	np = from ? from->allnext : allnodes;
-	for (; np != 0; np = np->allnext)
-		if (np->type != 0 && strcmp(np->type, type) == 0)
-			break;
-
-	return np;
-}
-EXPORT_SYMBOL(of_find_node_by_type);
-
-struct device_node *of_find_compatible_node(struct device_node *from,
-	const char *type, const char *compatible)
-{
-	struct device_node *np;
-
-	np = from ? from->allnext : allnodes;
-	for (; np != 0; np = np->allnext) {
-		if (type != NULL
-		    && !(np->type != 0 && strcmp(np->type, type) == 0))
-			continue;
-		if (of_device_is_compatible(np, compatible))
-			break;
-	}
-
-	return np;
-}
-EXPORT_SYMBOL(of_find_compatible_node);
-
 int of_getintprop_default(struct device_node *np, const char *name, int def)
 {
 	struct property *prop;
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index be3b958..ae2065c 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -29,23 +29,10 @@
 #include <asm/asi.h>
 #include <asm/upa.h>
 
-static struct device_node *allnodes;
+extern struct device_node *allnodes;	/* temporary while merging */
 
 extern rwlock_t devtree_lock;	/* temporary while merging */
 
-struct device_node *of_find_node_by_path(const char *path)
-{
-	struct device_node *np = allnodes;
-
-	for (; np != 0; np = np->allnext) {
-		if (np->full_name != 0 && strcmp(np->full_name, path) == 0)
-			break;
-	}
-
-	return np;
-}
-EXPORT_SYMBOL(of_find_node_by_path);
-
 struct device_node *of_find_node_by_phandle(phandle handle)
 {
 	struct device_node *np;
@@ -58,52 +45,6 @@ struct device_node *of_find_node_by_phandle(phandle handle)
 }
 EXPORT_SYMBOL(of_find_node_by_phandle);
 
-struct device_node *of_find_node_by_name(struct device_node *from,
-	const char *name)
-{
-	struct device_node *np;
-
-	np = from ? from->allnext : allnodes;
-	for (; np != NULL; np = np->allnext)
-		if (np->name != NULL && strcmp(np->name, name) == 0)
-			break;
-
-	return np;
-}
-EXPORT_SYMBOL(of_find_node_by_name);
-
-struct device_node *of_find_node_by_type(struct device_node *from,
-	const char *type)
-{
-	struct device_node *np;
-
-	np = from ? from->allnext : allnodes;
-	for (; np != 0; np = np->allnext)
-		if (np->type != 0 && strcmp(np->type, type) == 0)
-			break;
-
-	return np;
-}
-EXPORT_SYMBOL(of_find_node_by_type);
-
-struct device_node *of_find_compatible_node(struct device_node *from,
-	const char *type, const char *compatible)
-{
-	struct device_node *np;
-
-	np = from ? from->allnext : allnodes;
-	for (; np != 0; np = np->allnext) {
-		if (type != NULL
-		    && !(np->type != 0 && strcmp(np->type, type) == 0))
-			continue;
-		if (of_device_is_compatible(np, compatible))
-			break;
-	}
-
-	return np;
-}
-EXPORT_SYMBOL(of_find_compatible_node);
-
 int of_getintprop_default(struct device_node *np, const char *name, int def)
 {
 	struct property *prop;
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 6b6dfcc..589488c 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -20,6 +20,8 @@
 #include <linux/of.h>
 #include <linux/spinlock.h>
 
+struct device_node *allnodes;
+
 /* use when traversing tree through the allnext, child, sibling,
  * or parent members of struct device_node.
  */
@@ -158,3 +160,115 @@ struct device_node *of_get_next_child(const struct device_node *node,
 	return next;
 }
 EXPORT_SYMBOL(of_get_next_child);
+
+/**
+ *	of_find_node_by_path - Find a node matching a full OF path
+ *	@path:	The full path to match
+ *
+ *	Returns a node pointer with refcount incremented, use
+ *	of_node_put() on it when done.
+ */
+struct device_node *of_find_node_by_path(const char *path)
+{
+	struct device_node *np = allnodes;
+
+	read_lock(&devtree_lock);
+	for (; np; np = np->allnext) {
+		if (np->full_name && (of_node_cmp(np->full_name, path) == 0)
+		    && of_node_get(np))
+			break;
+	}
+	read_unlock(&devtree_lock);
+	return np;
+}
+EXPORT_SYMBOL(of_find_node_by_path);
+
+/**
+ *	of_find_node_by_name - Find a node by its "name" property
+ *	@from:	The node to start searching from or NULL, the node
+ *		you pass will not be searched, only the next one
+ *		will; typically, you pass what the previous call
+ *		returned. of_node_put() will be called on it
+ *	@name:	The name string to match against
+ *
+ *	Returns a node pointer with refcount incremented, use
+ *	of_node_put() on it when done.
+ */
+struct device_node *of_find_node_by_name(struct device_node *from,
+	const char *name)
+{
+	struct device_node *np;
+
+	read_lock(&devtree_lock);
+	np = from ? from->allnext : allnodes;
+	for (; np; np = np->allnext)
+		if (np->name && (of_node_cmp(np->name, name) == 0)
+		    && of_node_get(np))
+			break;
+	of_node_put(from);
+	read_unlock(&devtree_lock);
+	return np;
+}
+EXPORT_SYMBOL(of_find_node_by_name);
+
+/**
+ *	of_find_node_by_type - Find a node by its "device_type" property
+ *	@from:	The node to start searching from or NULL, the node
+ *		you pass will not be searched, only the next one
+ *		will; typically, you pass what the previous call
+ *		returned. of_node_put() will be called on it
+ *	@name:	The type string to match against
+ *
+ *	Returns a node pointer with refcount incremented, use
+ *	of_node_put() on it when done.
+ */
+struct device_node *of_find_node_by_type(struct device_node *from,
+	const char *type)
+{
+	struct device_node *np;
+
+	read_lock(&devtree_lock);
+	np = from ? from->allnext : allnodes;
+	for (; np; np = np->allnext)
+		if (np->type && (of_node_cmp(np->type, type) == 0)
+		    && of_node_get(np))
+			break;
+	of_node_put(from);
+	read_unlock(&devtree_lock);
+	return np;
+}
+EXPORT_SYMBOL(of_find_node_by_type);
+
+/**
+ *	of_find_compatible_node - Find a node based on type and one of the
+ *                                tokens in its "compatible" property
+ *	@from:		The node to start searching from or NULL, the node
+ *			you pass will not be searched, only the next one
+ *			will; typically, you pass what the previous call
+ *			returned. of_node_put() will be called on it
+ *	@type:		The type string to match "device_type" or NULL to ignore
+ *	@compatible:	The string to match to one of the tokens in the device
+ *			"compatible" list.
+ *
+ *	Returns a node pointer with refcount incremented, use
+ *	of_node_put() on it when done.
+ */
+struct device_node *of_find_compatible_node(struct device_node *from,
+	const char *type, const char *compatible)
+{
+	struct device_node *np;
+
+	read_lock(&devtree_lock);
+	np = from ? from->allnext : allnodes;
+	for (; np; np = np->allnext) {
+		if (type
+		    && !(np->type && (of_node_cmp(np->type, type) == 0)))
+			continue;
+		if (of_device_is_compatible(np, compatible) && of_node_get(np))
+			break;
+	}
+	of_node_put(from);
+	read_unlock(&devtree_lock);
+	return np;
+}
+EXPORT_SYMBOL(of_find_compatible_node);
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index f15c760..55d4bbb 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -27,6 +27,7 @@
 
 #define of_compat_cmp(s1, s2, l)	strncasecmp((s1), (s2), (l))
 #define of_prop_cmp(s1, s2)		strcmp((s1), (s2))
+#define of_node_cmp(s1, s2)		strcasecmp((s1), (s2))
 
 /* Definitions used by the flattened device tree */
 #define OF_DT_HEADER		0xd00dfeed	/* marker */
diff --git a/include/asm-sparc/prom.h b/include/asm-sparc/prom.h
index 5dc4c0e..fa92e30 100644
--- a/include/asm-sparc/prom.h
+++ b/include/asm-sparc/prom.h
@@ -25,6 +25,7 @@
 
 #define of_compat_cmp(s1, s2, l)	strncmp((s1), (s2), (l))
 #define of_prop_cmp(s1, s2)		strcasecmp((s1), (s2))
+#define of_node_cmp(s1, s2)		strcmp((s1), (s2))
 
 typedef u32 phandle;
 typedef u32 ihandle;
diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h
index afd707a..9b0c618 100644
--- a/include/asm-sparc64/prom.h
+++ b/include/asm-sparc64/prom.h
@@ -25,6 +25,7 @@
 
 #define of_compat_cmp(s1, s2, l)	strncmp((s1), (s2), (l))
 #define of_prop_cmp(s1, s2)		strcasecmp((s1), (s2))
+#define of_node_cmp(s1, s2)		strcmp((s1), (s2))
 
 typedef u32 phandle;
 typedef u32 ihandle;
-- 
1.5.1.2

^ permalink raw reply related

* [PATCH 06/11] Consolidate of_get_next_child
From: Stephen Rothwell @ 2007-05-01  7:29 UTC (permalink / raw)
  To: David S. Miller, paulus; +Cc: sparclinux, ppc-dev
In-Reply-To: <20070501172250.80707fb8.sfr@canb.auug.org.au>

This adds a read_lock around the child/next accesses on Sparc.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/kernel/prom.c |   24 ------------------------
 arch/sparc/kernel/prom.c   |   14 --------------
 arch/sparc64/kernel/prom.c |   14 --------------
 drivers/of/base.c          |   24 ++++++++++++++++++++++++
 4 files changed, 24 insertions(+), 52 deletions(-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 55e67ca..90901e4 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1225,30 +1225,6 @@ struct device_node *of_find_all_nodes(struct device_node *prev)
 EXPORT_SYMBOL(of_find_all_nodes);
 
 /**
- *	of_get_next_child - Iterate a node childs
- *	@node:	parent node
- *	@prev:	previous child of the parent node, or NULL to get first
- *
- *	Returns a node pointer with refcount incremented, use
- *	of_node_put() on it when done.
- */
-struct device_node *of_get_next_child(const struct device_node *node,
-	struct device_node *prev)
-{
-	struct device_node *next;
-
-	read_lock(&devtree_lock);
-	next = prev ? prev->sibling : node->child;
-	for (; next != 0; next = next->sibling)
-		if (of_node_get(next))
-			break;
-	of_node_put(prev);
-	read_unlock(&devtree_lock);
-	return next;
-}
-EXPORT_SYMBOL(of_get_next_child);
-
-/**
  *	of_node_get - Increment refcount of a node
  *	@node:	Node to inc refcount, NULL is supported to
  *		simplify writing of callers
diff --git a/arch/sparc/kernel/prom.c b/arch/sparc/kernel/prom.c
index b378715..3f8ccfa 100644
--- a/arch/sparc/kernel/prom.c
+++ b/arch/sparc/kernel/prom.c
@@ -29,20 +29,6 @@ static struct device_node *allnodes;
 
 extern rwlock_t devtree_lock;	/* temporary while merging */
 
-struct device_node *of_get_next_child(const struct device_node *node,
-	struct device_node *prev)
-{
-	struct device_node *next;
-
-	next = prev ? prev->sibling : node->child;
-	for (; next != 0; next = next->sibling) {
-		break;
-	}
-
-	return next;
-}
-EXPORT_SYMBOL(of_get_next_child);
-
 struct device_node *of_find_node_by_path(const char *path)
 {
 	struct device_node *np = allnodes;
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index f876079..be3b958 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -33,20 +33,6 @@ static struct device_node *allnodes;
 
 extern rwlock_t devtree_lock;	/* temporary while merging */
 
-struct device_node *of_get_next_child(const struct device_node *node,
-	struct device_node *prev)
-{
-	struct device_node *next;
-
-	next = prev ? prev->sibling : node->child;
-	for (; next != 0; next = next->sibling) {
-		break;
-	}
-
-	return next;
-}
-EXPORT_SYMBOL(of_get_next_child);
-
 struct device_node *of_find_node_by_path(const char *path)
 {
 	struct device_node *np = allnodes;
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 82bb786..6b6dfcc 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -134,3 +134,27 @@ struct device_node *of_get_parent(const struct device_node *node)
 	return np;
 }
 EXPORT_SYMBOL(of_get_parent);
+
+/**
+ *	of_get_next_child - Iterate a node childs
+ *	@node:	parent node
+ *	@prev:	previous child of the parent node, or NULL to get first
+ *
+ *	Returns a node pointer with refcount incremented, use
+ *	of_node_put() on it when done.
+ */
+struct device_node *of_get_next_child(const struct device_node *node,
+	struct device_node *prev)
+{
+	struct device_node *next;
+
+	read_lock(&devtree_lock);
+	next = prev ? prev->sibling : node->child;
+	for (; next; next = next->sibling)
+		if (of_node_get(next))
+			break;
+	of_node_put(prev);
+	read_unlock(&devtree_lock);
+	return next;
+}
+EXPORT_SYMBOL(of_get_next_child);
-- 
1.5.1.2

^ permalink raw reply related

* [PATCH 05/11] Consolidate of_get_parent
From: Stephen Rothwell @ 2007-05-01  7:28 UTC (permalink / raw)
  To: David S. Miller, paulus; +Cc: sparclinux, ppc-dev
In-Reply-To: <20070501172250.80707fb8.sfr@canb.auug.org.au>

This requires creating dummy of_node_{get,put} routines for sparc and
sparc64.  It also adds a read_lock around the parent accesses.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/kernel/prom.c |   21 ---------------------
 arch/sparc/kernel/prom.c   |   13 -------------
 arch/sparc64/kernel/prom.c |   13 -------------
 drivers/of/base.c          |   21 +++++++++++++++++++++
 include/asm-sparc/prom.h   |    9 +++++++++
 include/asm-sparc64/prom.h |    9 +++++++++
 6 files changed, 39 insertions(+), 47 deletions(-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 939d5e4..55e67ca 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1225,27 +1225,6 @@ struct device_node *of_find_all_nodes(struct device_node *prev)
 EXPORT_SYMBOL(of_find_all_nodes);
 
 /**
- *	of_get_parent - Get a node's parent if any
- *	@node:	Node to get parent
- *
- *	Returns a node pointer with refcount incremented, use
- *	of_node_put() on it when done.
- */
-struct device_node *of_get_parent(const struct device_node *node)
-{
-	struct device_node *np;
-
-	if (!node)
-		return NULL;
-
-	read_lock(&devtree_lock);
-	np = of_node_get(node->parent);
-	read_unlock(&devtree_lock);
-	return np;
-}
-EXPORT_SYMBOL(of_get_parent);
-
-/**
  *	of_get_next_child - Iterate a node childs
  *	@node:	parent node
  *	@prev:	previous child of the parent node, or NULL to get first
diff --git a/arch/sparc/kernel/prom.c b/arch/sparc/kernel/prom.c
index 0f5aab4..b378715 100644
--- a/arch/sparc/kernel/prom.c
+++ b/arch/sparc/kernel/prom.c
@@ -29,19 +29,6 @@ static struct device_node *allnodes;
 
 extern rwlock_t devtree_lock;	/* temporary while merging */
 
-struct device_node *of_get_parent(const struct device_node *node)
-{
-	struct device_node *np;
-
-	if (!node)
-		return NULL;
-
-	np = node->parent;
-
-	return np;
-}
-EXPORT_SYMBOL(of_get_parent);
-
 struct device_node *of_get_next_child(const struct device_node *node,
 	struct device_node *prev)
 {
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index c759660..f876079 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -33,19 +33,6 @@ static struct device_node *allnodes;
 
 extern rwlock_t devtree_lock;	/* temporary while merging */
 
-struct device_node *of_get_parent(const struct device_node *node)
-{
-	struct device_node *np;
-
-	if (!node)
-		return NULL;
-
-	np = node->parent;
-
-	return np;
-}
-EXPORT_SYMBOL(of_get_parent);
-
 struct device_node *of_get_next_child(const struct device_node *node,
 	struct device_node *prev)
 {
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 70b6084..82bb786 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -113,3 +113,24 @@ int of_device_is_compatible(const struct device_node *device,
 	return 0;
 }
 EXPORT_SYMBOL(of_device_is_compatible);
+
+/**
+ *	of_get_parent - Get a node's parent if any
+ *	@node:	Node to get parent
+ *
+ *	Returns a node pointer with refcount incremented, use
+ *	of_node_put() on it when done.
+ */
+struct device_node *of_get_parent(const struct device_node *node)
+{
+	struct device_node *np;
+
+	if (!node)
+		return NULL;
+
+	read_lock(&devtree_lock);
+	np = of_node_get(node->parent);
+	read_unlock(&devtree_lock);
+	return np;
+}
+EXPORT_SYMBOL(of_get_parent);
diff --git a/include/asm-sparc/prom.h b/include/asm-sparc/prom.h
index 22abc2a..5dc4c0e 100644
--- a/include/asm-sparc/prom.h
+++ b/include/asm-sparc/prom.h
@@ -66,6 +66,15 @@ extern int of_getintprop_default(struct device_node *np,
 
 extern void prom_build_devicetree(void);
 
+/* Dummy ref counting routines - to be implemented later */
+static inline struct device_node *of_node_get(struct device_node *node)
+{
+	return node;
+}
+static inline void of_node_put(struct device_node *node)
+{
+}
+
 /*
  * NB:  This is here while we transition from using asm/prom.h
  * to linux/of.h
diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h
index f88c412..afd707a 100644
--- a/include/asm-sparc64/prom.h
+++ b/include/asm-sparc64/prom.h
@@ -74,6 +74,15 @@ extern int of_getintprop_default(struct device_node *np,
 
 extern void prom_build_devicetree(void);
 
+/* Dummy ref counting routines - to be implemented later */
+static inline struct device_node *of_node_get(struct device_node *node)
+{
+	return node;
+}
+static inline void of_node_put(struct device_node *node)
+{
+}
+
 /*
  * NB:  This is here while we transition from using asm/prom.h
  * to linux/of.h
-- 
1.5.1.2

^ permalink raw reply related

* [PATCH 04/11] Consolidate of_find_property
From: Stephen Rothwell @ 2007-05-01  7:27 UTC (permalink / raw)
  To: David S. Miller, paulus; +Cc: sparclinux, ppc-dev
In-Reply-To: <20070501172250.80707fb8.sfr@canb.auug.org.au>

The only change here is that a readlock is taken while the property list
is being traversed on Sparc where it was not taken previously.

Also, Sparc uses strcasecmp to compare property names while PowerPC
uses strcmp.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/kernel/prom.c |   24 +-----------------------
 arch/sparc/kernel/prom.c   |   22 +---------------------
 arch/sparc64/kernel/prom.c |   22 +---------------------
 drivers/of/base.c          |   26 ++++++++++++++++++++++++++
 include/asm-powerpc/prom.h |    1 +
 include/asm-sparc/prom.h   |    1 +
 include/asm-sparc64/prom.h |    1 +
 7 files changed, 32 insertions(+), 65 deletions(-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 723df55..939d5e4 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -79,10 +79,7 @@ struct boot_param_header *initial_boot_params;
 
 static struct device_node *allnodes = NULL;
 
-/* use when traversing tree through the allnext, child, sibling,
- * or parent members of struct device_node.
- */
-static DEFINE_RWLOCK(devtree_lock);
+extern rwlock_t devtree_lock;	/* temporary while merging */
 
 /* export that to outside world */
 struct device_node *of_chosen;
@@ -1454,25 +1451,6 @@ static int __init prom_reconfig_setup(void)
 __initcall(prom_reconfig_setup);
 #endif
 
-struct property *of_find_property(const struct device_node *np,
-				  const char *name,
-				  int *lenp)
-{
-	struct property *pp;
-
-	read_lock(&devtree_lock);
-	for (pp = np->properties; pp != 0; pp = pp->next)
-		if (strcmp(pp->name, name) == 0) {
-			if (lenp != 0)
-				*lenp = pp->length;
-			break;
-		}
-	read_unlock(&devtree_lock);
-
-	return pp;
-}
-EXPORT_SYMBOL(of_find_property);
-
 /*
  * Add a property to a node
  */
diff --git a/arch/sparc/kernel/prom.c b/arch/sparc/kernel/prom.c
index f2ce0d4..0f5aab4 100644
--- a/arch/sparc/kernel/prom.c
+++ b/arch/sparc/kernel/prom.c
@@ -27,10 +27,7 @@
 
 static struct device_node *allnodes;
 
-/* use when traversing tree through the allnext, child, sibling,
- * or parent members of struct device_node.
- */
-static DEFINE_RWLOCK(devtree_lock);
+extern rwlock_t devtree_lock;	/* temporary while merging */
 
 struct device_node *of_get_parent(const struct device_node *node)
 {
@@ -130,23 +127,6 @@ struct device_node *of_find_compatible_node(struct device_node *from,
 }
 EXPORT_SYMBOL(of_find_compatible_node);
 
-struct property *of_find_property(const struct device_node *np,
-				  const char *name,
-				  int *lenp)
-{
-	struct property *pp;
-
-	for (pp = np->properties; pp != 0; pp = pp->next) {
-		if (strcasecmp(pp->name, name) == 0) {
-			if (lenp != 0)
-				*lenp = pp->length;
-			break;
-		}
-	}
-	return pp;
-}
-EXPORT_SYMBOL(of_find_property);
-
 int of_getintprop_default(struct device_node *np, const char *name, int def)
 {
 	struct property *prop;
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index d6dd972..c759660 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -31,10 +31,7 @@
 
 static struct device_node *allnodes;
 
-/* use when traversing tree through the allnext, child, sibling,
- * or parent members of struct device_node.
- */
-static DEFINE_RWLOCK(devtree_lock);
+extern rwlock_t devtree_lock;	/* temporary while merging */
 
 struct device_node *of_get_parent(const struct device_node *node)
 {
@@ -134,23 +131,6 @@ struct device_node *of_find_compatible_node(struct device_node *from,
 }
 EXPORT_SYMBOL(of_find_compatible_node);
 
-struct property *of_find_property(const struct device_node *np,
-				  const char *name,
-				  int *lenp)
-{
-	struct property *pp;
-
-	for (pp = np->properties; pp != 0; pp = pp->next) {
-		if (strcasecmp(pp->name, name) == 0) {
-			if (lenp != 0)
-				*lenp = pp->length;
-			break;
-		}
-	}
-	return pp;
-}
-EXPORT_SYMBOL(of_find_property);
-
 int of_getintprop_default(struct device_node *np, const char *name, int def)
 {
 	struct property *prop;
diff --git a/drivers/of/base.c b/drivers/of/base.c
index d6dc5e7..70b6084 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -18,6 +18,12 @@
  */
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/spinlock.h>
+
+/* use when traversing tree through the allnext, child, sibling,
+ * or parent members of struct device_node.
+ */
+DEFINE_RWLOCK(devtree_lock);
 
 int of_n_addr_cells(struct device_node *np)
 {
@@ -51,6 +57,26 @@ int of_n_size_cells(struct device_node *np)
 }
 EXPORT_SYMBOL(of_n_size_cells);
 
+struct property *of_find_property(const struct device_node *np,
+				  const char *name,
+				  int *lenp)
+{
+	struct property *pp;
+
+	read_lock(&devtree_lock);
+	for (pp = np->properties; pp != 0; pp = pp->next) {
+		if (of_prop_cmp(pp->name, name) == 0) {
+			if (lenp != 0)
+				*lenp = pp->length;
+			break;
+		}
+	}
+	read_unlock(&devtree_lock);
+
+	return pp;
+}
+EXPORT_SYMBOL(of_find_property);
+
 /*
  * Find a property with a given name for a given node
  * and return the value.
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index 1417dce..f15c760 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -26,6 +26,7 @@
 #define OF_ROOT_NODE_SIZE_CELLS_DEFAULT	1
 
 #define of_compat_cmp(s1, s2, l)	strncasecmp((s1), (s2), (l))
+#define of_prop_cmp(s1, s2)		strcmp((s1), (s2))
 
 /* Definitions used by the flattened device tree */
 #define OF_DT_HEADER		0xd00dfeed	/* marker */
diff --git a/include/asm-sparc/prom.h b/include/asm-sparc/prom.h
index f314ec6..22abc2a 100644
--- a/include/asm-sparc/prom.h
+++ b/include/asm-sparc/prom.h
@@ -24,6 +24,7 @@
 #define OF_ROOT_NODE_SIZE_CELLS_DEFAULT	1
 
 #define of_compat_cmp(s1, s2, l)	strncmp((s1), (s2), (l))
+#define of_prop_cmp(s1, s2)		strcasecmp((s1), (s2))
 
 typedef u32 phandle;
 typedef u32 ihandle;
diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h
index 06edb32..f88c412 100644
--- a/include/asm-sparc64/prom.h
+++ b/include/asm-sparc64/prom.h
@@ -24,6 +24,7 @@
 #define OF_ROOT_NODE_SIZE_CELLS_DEFAULT	1
 
 #define of_compat_cmp(s1, s2, l)	strncmp((s1), (s2), (l))
+#define of_prop_cmp(s1, s2)		strcasecmp((s1), (s2))
 
 typedef u32 phandle;
 typedef u32 ihandle;
-- 
1.5.1.2

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox