summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Pham <jackp@codeaurora.org>2016-03-16 17:57:35 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 21:25:46 -0700
commit1cd15196ad8a70f68549e4a879521711ac63f48d (patch)
tree254a6591c2de77abc3f8fa5727ff35ffa064de12
parent05df40ec56378e59842105a83c1bd65af1e3f386 (diff)
extcon: Don't register switch class if CONFIG_SWITCH is enabled
On downstream kernels CONFIG_SWITCH may still be enabled providing the Android switch class functionality. Although extcon was intended to be the spiritual successor, allow them to coexist for now, at least until the client drivers have all migrated. Signed-off-by: Jack Pham <jackp@codeaurora.org>
-rw-r--r--drivers/extcon/extcon.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 21a123cadf78..6366f65d059b 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -78,7 +78,7 @@ static const char *extcon_name[] = {
};
static struct class *extcon_class;
-#if defined(CONFIG_ANDROID)
+#if defined(CONFIG_ANDROID) && !IS_ENABLED(CONFIG_SWITCH)
static struct class_compat *switch_class;
#endif /* CONFIG_ANDROID */
@@ -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) && !IS_ENABLED(CONFIG_SWITCH)
switch_class = class_compat_register("switch");
if (WARN(!switch_class, "cannot allocate"))
return -ENOMEM;
@@ -921,7 +921,7 @@ int extcon_dev_register(struct extcon_dev *edev)
put_device(&edev->dev);
goto err_dev;
}
-#if defined(CONFIG_ANDROID)
+#if defined(CONFIG_ANDROID) && !IS_ENABLED(CONFIG_SWITCH)
if (switch_class)
ret = class_compat_create_link(switch_class, &edev->dev, NULL);
#endif /* CONFIG_ANDROID */
@@ -1010,7 +1010,7 @@ void extcon_dev_unregister(struct extcon_dev *edev)
kfree(edev->cables);
}
-#if defined(CONFIG_ANDROID)
+#if defined(CONFIG_ANDROID) && !IS_ENABLED(CONFIG_SWITCH)
if (switch_class)
class_compat_remove_link(switch_class, &edev->dev, NULL);
#endif
@@ -1139,7 +1139,7 @@ module_init(extcon_class_init);
static void __exit extcon_class_exit(void)
{
-#if defined(CONFIG_ANDROID)
+#if defined(CONFIG_ANDROID) && !IS_ENABLED(CONFIG_SWITCH)
class_compat_unregister(switch_class);
#endif
class_destroy(extcon_class);