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>
This commit is contained in:
parent
05df40ec56
commit
1cd15196ad
1 changed files with 5 additions and 5 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue