[PATCH 3/5] m68k/atari: EtherNAT - register EtherNAT platform devices only when probed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Hi All,

Part 3 in the EtherNAT series - only register platform devices if the card is present.

Signed-off-by: Michael Schmitz <schmitz@xxxxxxxxxx>

--
arch/m68k/atari/config.c |   13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index 12a76ab..92bf83a 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -752,7 +752,18 @@ static struct platform_device *atari_platform_devices[] __initdata = {

int __init atari_platform_init(void)
{
- return platform_add_devices(atari_platform_devices, ARRAY_SIZE(atari_platform_devices));
+       int rv = -ENODEV;
+       unsigned char *enatc_virt;
+
+       if (!MACH_IS_ATARI)
+               return -ENODEV;
+
+ enatc_virt = (unsigned char *)ioremap((ATARI_ETHERNAT_PHYS_ADDR+0x23), 0xf);
+       if (hwreg_present(enatc_virt))
+ rv = platform_add_devices(atari_platform_devices, ARRAY_SIZE(atari_platform_devices));
+       iounmap(enatc_virt);
+
+ return rv; }

arch_initcall(atari_platform_init);

--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Video for Linux]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Video Projectors]     [Linux Kernel]     [Linux SCSI]     [XFree86]

Add to Google Powered by Linux