ARM: omap: resolve nebulous 'Error setting wl12xx data'
authorRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 7 Feb 2012 11:03:23 +0000 (11:03 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 13 Feb 2012 10:00:39 +0000 (10:00 +0000)
It's useful to print the error code when a called function fails so a
diagnosis of why it failed is possible.  In this case, it fails because
we try to register some data for the wl12xx driver, but as the driver
is not configured, a stub function is used which simply returns -ENOSYS.

Let's do the simple thing for -rc and print the error code.

Also, the return code from platform_register_device() at each of these
sites was not being checked.  Add some checking, and again print the
error code.

This should be fixed properly for the next merge window so we don't
issue error messages merely because a driver is not configured.

Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-omap2/board-4430sdp.c
arch/arm/mach-omap2/board-omap3evm.c
arch/arm/mach-omap2/board-omap4panda.c
arch/arm/mach-omap2/board-zoom-peripherals.c

index 50d2412ff395450beb013dd501ea1da31a88038e..4e9071589bfb60ac3bfb5a222eefcfebc700bd03 100644 (file)
@@ -878,12 +878,17 @@ static struct wl12xx_platform_data omap4_sdp4430_wlan_data __initdata = {
        .board_tcxo_clock = WL12XX_TCXOCLOCK_26,
 };
 
-static void omap4_sdp4430_wifi_init(void)
+static void __init omap4_sdp4430_wifi_init(void)
 {
+       int ret;
+
        omap4_sdp4430_wifi_mux_init();
-       if (wl12xx_set_platform_data(&omap4_sdp4430_wlan_data))
-               pr_err("Error setting wl12xx data\n");
-       platform_device_register(&omap_vwlan_device);
+       ret = wl12xx_set_platform_data(&omap4_sdp4430_wlan_data);
+       if (ret)
+               pr_err("Error setting wl12xx data: %d\n", ret);
+       ret = platform_device_register(&omap_vwlan_device);
+       if (ret)
+               pr_err("Error registering wl12xx device: %d\n", ret);
 }
 
 static void __init omap_4430sdp_init(void)
index 003fe34c934311251452ba4af1efc20382dbbdb6..c775bead1497c3f487e22696bee4b59c6c46eeed 100644 (file)
@@ -617,6 +617,21 @@ static struct gpio omap3_evm_ehci_gpios[] __initdata = {
        { OMAP3_EVM_EHCI_SELECT, GPIOF_OUT_INIT_LOW,   "select EHCI port" },
 };
 
+static void __init omap3_evm_wl12xx_init(void)
+{
+#ifdef CONFIG_WL12XX_PLATFORM_DATA
+       int ret;
+
+       /* WL12xx WLAN Init */
+       ret = wl12xx_set_platform_data(&omap3evm_wlan_data);
+       if (ret)
+               pr_err("error setting wl12xx data: %d\n", ret);
+       ret = platform_device_register(&omap3evm_wlan_regulator);
+       if (ret)
+               pr_err("error registering wl12xx device: %d\n", ret);
+#endif
+}
+
 static void __init omap3_evm_init(void)
 {
        omap3_evm_get_revision();
@@ -665,13 +680,7 @@ static void __init omap3_evm_init(void)
        omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL);
        omap3evm_init_smsc911x();
        omap3_evm_display_init();
-
-#ifdef CONFIG_WL12XX_PLATFORM_DATA
-       /* WL12xx WLAN Init */
-       if (wl12xx_set_platform_data(&omap3evm_wlan_data))
-               pr_err("error setting wl12xx data\n");
-       platform_device_register(&omap3evm_wlan_regulator);
-#endif
+       omap3_evm_wl12xx_init();
 }
 
 MACHINE_START(OMAP3EVM, "OMAP3 EVM")
index b7779c206a90af0d9747f71a3d6d5f8963a90362..28fc271f70316510b5268c2a212adcac3718fce1 100644 (file)
@@ -488,13 +488,15 @@ void omap4_panda_display_init(void)
 static void __init omap4_panda_init(void)
 {
        int package = OMAP_PACKAGE_CBS;
+       int ret;
 
        if (omap_rev() == OMAP4430_REV_ES1_0)
                package = OMAP_PACKAGE_CBL;
        omap4_mux_init(board_mux, NULL, package);
 
-       if (wl12xx_set_platform_data(&omap_panda_wlan_data))
-               pr_err("error setting wl12xx data\n");
+       ret = wl12xx_set_platform_data(&omap_panda_wlan_data);
+       if (ret)
+               pr_err("error setting wl12xx data: %d\n", ret);
 
        omap4_panda_i2c_init();
        platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices));
index 8d7ce11cfeaf14b34d18c5ac4945a855b51f0d2d..c126461836ac5d2134314b82c80dae0eb41fcf60 100644 (file)
@@ -296,8 +296,10 @@ static void enable_board_wakeup_source(void)
 
 void __init zoom_peripherals_init(void)
 {
-       if (wl12xx_set_platform_data(&omap_zoom_wlan_data))
-               pr_err("error setting wl12xx data\n");
+       int ret = wl12xx_set_platform_data(&omap_zoom_wlan_data);
+
+       if (ret)
+               pr_err("error setting wl12xx data: %d\n", ret);
 
        omap_i2c_init();
        platform_device_register(&omap_vwlan_device);