public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
From: Michael Schmitz <schmitzmic@googlemail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 05/11] m68k/atari: Add missing platform check before registering platform devices
Date: Sun, 25 Mar 2012 16:46:22 +1300	[thread overview]
Message-ID: <4F6E950E.30809__49208.1553362825$1332647650$gmane$org@gmail.com> (raw)
In-Reply-To: <1332323515-7314-5-git-send-email-geert@linux-m68k.org>

Geert,
> On multi-platform kernels, the Atari platform devices should be registered
> when running on Atari only. Else it may crash later.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
>  arch/m68k/atari/config.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
> index af78731..35fb81d 100644
> --- a/arch/m68k/atari/config.c
> +++ b/arch/m68k/atari/config.c
> @@ -693,6 +693,9 @@ static struct platform_device *atari_platform_devices[] __initdata = {
>  
>  int __init atari_platform_init(void)
>  {
> +	if (!MACH_IS_ATARI)
> +		return -ENODEV;
> +
>  	return platform_add_devices(atari_platform_devices, ARRAY_SIZE(atari_platform_devices));
>  }
>  
>   

How about this instead - probe for the EtherNAT config register, and 
register devices only if found?

(may apply with a bit of fuzz)

Otherwise, Acked-by: Michael Schmitz <schmitz@debian.org>.

--- arch/m68k/atari/config.c.org    2012-03-25 16:02:12.000000000 +1300
+++ arch/m68k/atari/config.c    2012-03-25 13:37:21.000000000 +1300
@@ -753,7 +753,19 @@
 
 int __init atari_platform_init(void)
 {
-    return platform_add_devices(atari_platform_devices, 
ARRAY_SIZE(atari_platform_devices));
+    if (MACH_IS_ATARI) {
+        u8 ethernat_cr;
+        unsigned long enatc_phys = 0x80000023;
+        unsigned char *enatc_virt;
+       
+        enatc_virt = (unsigned char *)ioremap(enatc_phys, 0xf);
+        if (hwreg_present(enatc_virt)) {
+            iounmap(enatc_virt);
+            return platform_add_devices(atari_platform_devices, 
ARRAY_SIZE(atari_platform_devices));
+        }
+        iounmap(enatc_virt);
+    }
+    return -ENODEV;   
 }
 
 arch_initcall(atari_platform_init);

  parent reply	other threads:[~2012-03-25  3:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-21  9:51 [PATCH 01/11] m68k: Remove unused MAX_NOINT_IPL definition Geert Uytterhoeven
2012-03-21  9:51 ` [PATCH 02/11] m68k/amiga: Mark z_dev_present() __init Geert Uytterhoeven
2012-03-21  9:51 ` [PATCH 03/11] m68k/amiga: Add error checks when registering platform devices Geert Uytterhoeven
2012-03-21  9:51 ` [PATCH 04/11] m68k/amiga: Use arch_initcall() for " Geert Uytterhoeven
2012-03-21  9:51 ` [PATCH 05/11] m68k/atari: Add missing platform check before " Geert Uytterhoeven
2012-03-21  9:51 ` [PATCH 06/11] m68k/atari: Change VME irq numbers from unsigned long to unsigned int Geert Uytterhoeven
2012-03-21  9:51 ` [PATCH 07/11] m68k/mac: Add missing platform check before registering platform devices Geert Uytterhoeven
2012-03-21  9:51 ` [PATCH 08/11] input/amijoy: Add missing platform check Geert Uytterhoeven
2012-03-21  9:51 ` [PATCH 09/11] net/ariadne: Improve debug prints Geert Uytterhoeven
2012-03-21  9:51 ` [PATCH 10/11] scsi/atari: Revive "atascsi=" setup option Geert Uytterhoeven
2012-03-21  9:51 ` [PATCH 11/11] scsi/atari: Make more functions static Geert Uytterhoeven
     [not found] ` <1332323515-7314-9-git-send-email-geert@linux-m68k.org>
2012-03-22  2:16   ` [PATCH 09/11] net/ariadne: Improve debug prints David Miller
     [not found] ` <1332323515-7314-5-git-send-email-geert@linux-m68k.org>
2012-03-25  3:46   ` Michael Schmitz [this message]
     [not found]   ` <4F6E950E.30809@gmail.com>
2012-03-25  8:01     ` [PATCH 05/11] m68k/atari: Add missing platform check before registering platform devices Geert Uytterhoeven
2012-03-25 18:53       ` Michael Schmitz
     [not found] ` <1332323515-7314-8-git-send-email-geert@linux-m68k.org>
2012-03-26  6:29   ` [PATCH 08/11] input/amijoy: Add missing platform check Dmitry Torokhov

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to='4F6E950E.30809__49208.1553362825$1332647650$gmane$org@gmail.com' \
    --to=schmitzmic@googlemail.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    /path/to/YOUR_REPLY

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

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