On Sun, Feb 5, 2012 at 10:51 PM, Tony Lindgren <tony@xxxxxxxxxxx> wrote: > Hmm I see. Ohad, care to take a look this one? All worthy comments, and indeed there's no point in registering the fixed regulator device in case wl12xx_set_platform_data() fails. I cooked up something (using wl12xx_set_platform_data()'s -ENOSYS to avoid ifdef'ing the code) - see below (and attached). Russell, Tony, please tell me if you want me to cook something similar for all the other platforms, or would rather use your existing patch(es). Thanks, Ohad. >From 6bc46ed359c8399a53a9e02bbf8f47b2831dfe0e Mon Sep 17 00:00:00 2001 From: Ohad Ben-Cohen <ohad@xxxxxxxxxx> Date: Mon, 6 Feb 2012 11:53:17 +0200 Subject: [PATCH] ARM: OMAP4: panda: clean up/fix wlan init path 1. Stop intimidating users with scary wlan error messages in case wl12xx support wasn't even built. 2. When a wlan init error does happen, provide users with helpful information regarding the nature of the failure. 3. Don't bother registering wl12xx's fixed regulator device in case wl12xx_set_platform_data() failed. While we're at it, extract the wlan init code to a dedicated function to make omap4_panda_init() look a bit nicer. Reported-by: Russell King <linux@xxxxxxxxxxxxxxxx> Signed-off-by: Ohad Ben-Cohen <ohad@xxxxxxxxxx> Cc: Tony Lindgren <tony@xxxxxxxxxxx> --- arch/arm/mach-omap2/board-omap4panda.c | 26 ++++++++++++++++++++++---- 1 files changed, 22 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c index 30ad40d..c801e7e 100644 --- a/arch/arm/mach-omap2/board-omap4panda.c +++ b/arch/arm/mach-omap2/board-omap4panda.c @@ -475,6 +475,27 @@ void omap4_panda_display_init(void) omap_hdmi_init(0); } +static void __init omap4_panda_wlan_init(void) +{ + int ret; + + ret = wl12xx_set_platform_data(&omap_panda_wlan_data); + + /* bail out silently in case wl12xx isn't configured */ + if (ret == -ENOSYS) + return; + + /* bail out verbosely on any other error */ + if (ret) { + pr_err("error setting wl12xx data: %d\n", ret); + return; + } + + ret = platform_device_register(&omap_vwlan_device); + if (ret) + pr_err("error registering wl12xx's fixed regulator: %d\n", ret); +} + static void __init omap4_panda_init(void) { int package = OMAP_PACKAGE_CBS; @@ -483,12 +504,9 @@ static void __init omap4_panda_init(void) 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"); - + omap4_panda_wlan_init(); omap4_panda_i2c_init(); platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices)); - platform_device_register(&omap_vwlan_device); omap_serial_init(); omap_sdrc_init(NULL, NULL); omap4_twl6030_hsmmc_init(mmc); -- 1.7.5.4
From 6bc46ed359c8399a53a9e02bbf8f47b2831dfe0e Mon Sep 17 00:00:00 2001 From: Ohad Ben-Cohen <ohad@xxxxxxxxxx> Date: Mon, 6 Feb 2012 11:53:17 +0200 Subject: [PATCH] ARM: OMAP4: panda: clean up/fix wlan init path 1. Stop intimidating users with scary wlan error messages in case wl12xx support wasn't even built. 2. When a wlan init error does happen, provide users with helpful information regarding the nature of the failure. 3. Don't bother registering wl12xx's fixed regulator device in case wl12xx_set_platform_data() failed. While we're at it, extract the wlan init code to a dedicated function to make omap4_panda_init() look a bit nicer. Reported-by: Russell King <linux@xxxxxxxxxxxxxxxx> Signed-off-by: Ohad Ben-Cohen <ohad@xxxxxxxxxx> Cc: Tony Lindgren <tony@xxxxxxxxxxx> --- arch/arm/mach-omap2/board-omap4panda.c | 26 ++++++++++++++++++++++---- 1 files changed, 22 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c index 30ad40d..c801e7e 100644 --- a/arch/arm/mach-omap2/board-omap4panda.c +++ b/arch/arm/mach-omap2/board-omap4panda.c @@ -475,6 +475,27 @@ void omap4_panda_display_init(void) omap_hdmi_init(0); } +static void __init omap4_panda_wlan_init(void) +{ + int ret; + + ret = wl12xx_set_platform_data(&omap_panda_wlan_data); + + /* bail out silently in case wl12xx isn't configured */ + if (ret == -ENOSYS) + return; + + /* bail out verbosely on any other error */ + if (ret) { + pr_err("error setting wl12xx data: %d\n", ret); + return; + } + + ret = platform_device_register(&omap_vwlan_device); + if (ret) + pr_err("error registering wl12xx's fixed regulator: %d\n", ret); +} + static void __init omap4_panda_init(void) { int package = OMAP_PACKAGE_CBS; @@ -483,12 +504,9 @@ static void __init omap4_panda_init(void) 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"); - + omap4_panda_wlan_init(); omap4_panda_i2c_init(); platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices)); - platform_device_register(&omap_vwlan_device); omap_serial_init(); omap_sdrc_init(NULL, NULL); omap4_twl6030_hsmmc_init(mmc); -- 1.7.5.4