extcon: fix duplicate create switch class
authorWu Liang feng <wulf@rock-chips.com>
Wed, 6 Jul 2016 02:08:56 +0000 (10:08 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Wed, 6 Jul 2016 05:59:23 +0000 (13:59 +0800)
If "CONFIG_ANDROID" and "CONFIG_SWITCH" are enabled,
/sys/class/switch/* are created in switch classe driver,
so we can't create switch class again in extcon.

Change-Id: Ida627cfdbb3ecb6f0aa40af146a66897edafd2fe
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
drivers/extcon/extcon.c

index 21a123cadf78278947e551aaaa1772a60728969a..a101db469857c053507c86570e22c4c2f6bc5fd9 100644 (file)
@@ -635,7 +635,7 @@ static int create_extcon_class(void)
                        return PTR_ERR(extcon_class);
                extcon_class->dev_groups = extcon_groups;
 
-#if defined(CONFIG_ANDROID)
+#if defined(CONFIG_ANDROID) && !defined(CONFIG_SWITCH)
                switch_class = class_compat_register("switch");
                if (WARN(!switch_class, "cannot allocate"))
                        return -ENOMEM;