lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 15 May 2015 15:57:46 +0000
From:	"Pallala, Ramakrishna" <ramakrishna.pallala@...el.com>
To:	Chanwoo Choi <cw00.choi@...sung.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC:	"myungjoo.ham@...sung.com" <myungjoo.ham@...sung.com>,
	"k.kozlowski@...sung.com" <k.kozlowski@...sung.com>,
	"ckeepax@...nsource.wolfsonmicro.com" 
	<ckeepax@...nsource.wolfsonmicro.com>,
	"gg@...mlogic.co.uk" <gg@...mlogic.co.uk>,
	"kishon@...com" <kishon@...com>,
	"jaewon02.kim@...sung.com" <jaewon02.kim@...sung.com>,
	"rogerq@...com" <rogerq@...com>,
	"george.cherian@...com" <george.cherian@...com>,
	"balbi@...com" <balbi@...com>,
	"aaro.koskinen@....fi" <aaro.koskinen@....fi>
Subject: RE: [PATCH 1/2] extcon: Use the unique id for external connector
 instead of string

> This patch uses the unique id to identify the type of external connector instead
> of string name. The string name have the many potential issues. So, this patch
> defines the 'extcon' enumeration which includes all supported external
> connector
> on EXTCON subsystem. If new external connector is necessary, the unique id of
> new connector have to be added in 'extcon' enumeration. There are current
> supported external connector in 'enum extcon' as following:
> 
> enum extcon {
> 	EXTCON_NONE		= 0x0,	/* NONE */
> 
> 	/* USB external connector */
> 	EXTCON_USB		= 0x1,	/* USB */
> 	EXTCON_USB_HOST		= 0x2,	/* USB-HOST */
> 
> 	/* Charger external connector */
> 	EXTCON_TA		= 0x10,	/* TA */
> 	EXTCON_FAST_CHARGER	= 0x11,	/* FAST-CHARGER */
> 	EXTCON_SLOW_CHARGER	= 0x12,	/* SLOW-CHARGER */
> 	EXTCON_CHARGE_DOWNSTREAM= 0x13,	/* CHARGE-
> DOWNSTREAM */
> 
> 	/* Audio and video external connector */
> 	EXTCON_LINE_IN		= 0x20,	/* LINE-IN */
> 	EXTCON_LINE_OUT		= 0x21,	/* LINE-OUT */
> 	EXTCON_MICROPHONE	= 0x22,	/* MICROPHONE */
> 	EXTCON_HEADPHONE	= 0x23,	/* HEADPHONE */
> 
> 	EXTCON_HDMI		= 0x30,	/* HDMI */
> 	EXTCON_MHL		= 0x31,	/* MHL */
> 	EXTCON_DVI		= 0x32,	/* DVI */
> 	EXTCON_VGA		= 0x33,	/* VGA */
> 	EXTCON_SPDIF_IN		= 0x34,	/* SPDIF-IN */
> 	EXTCON_SPDIF_OUT	= 0x35,	/* SPDIF-OUT */
> 	EXTCON_VIDEO_IN		= 0x36,	/* VIDEO-IN */
> 	EXTCON_VIDEO_OUT	= 0x37,	/* VIDEO-OUT */
> 
> 	/* Miscellaneous external connector */
> 	EXTCON_DOCK		= 0x50,	/* DOCK */
> 	EXTCON_JIG		= 0x51,	/* JIG */
> 	EXTCON_MECHANICAL	= 0x52,	/* MECHANICAL */
> 
> 	__EXTCON_END,
> };
> 
> For exmaple in extcon-arizoan.c:
> To use unique id removes the potential issue about handling
> the inconsistent name of external connector with string.
> - Previously, use the string to register the type of arizona jack connector
> static const char *arizona_cable[] = {
> 	"Mechanical",
> 	"Microphone",
> 	"Headphone",
> 	"Line-out",
> };
> - Newly, use the unique id to register the type of arizona jack connector
> static const enum extcon arizona_cable[] = {
> 	EXTCON_MECHANICAL,
> 	EXTCON_MICROPHONE,
> 	EXTCON_HEADPHONE,
> 	EXTCON_LINE_OUT,
> 
> 	EXTCON_NONE,
> };
> 
> And this patch modify the prototype of extcon_{get|set}_cable_state_() which
> uses the 'enum extcon id' instead of 'cable_index'. Because although one more
> extcon drivers support USB cable, each extcon driver might has the differnt
> 'cable_index' for USB cable. All extcon drivers can use the unique id number
> for same external connector with modified extcon_{get|set}_cable_state_().
> 
> - Previously, use 'cable_index' on these functions:
> extcon_get_cable_state_(struct extcon_dev*, int cable_index)
> extcon_set_cable_state_(struct extcon_dev*, int cable_index, bool state)
> 
> -Newly, use 'enum extcon id' on these functions:
> extcon_get_cable_state_(struct extcon_dev*, enum extcon id)
> extcon_set_cable_state_(struct extcon_dev*, enum extcon id, bool state)
> 
> Signed-off-by: Chanwoo Choi <cw00.choi@...sung.com>
> Cc: MyungJoo Ham <myungjoo.ham@...sung.com>
> Cc: Krzysztof Kozlowski <k.kozlowski@...sung.com>
> Cc: Charles Keepax <ckeepax@...nsource.wolfsonmicro.com>
> Cc: Graeme Gregory <gg@...mlogic.co.uk>
> Cc: Kishon Vijay Abraham I <kishon@...com>
> Cc: Jaewon Kim <jaewon02.kim@...sung.com>
> Cc: Roger Quadros <rogerq@...com>
> Cc: Ramakrishna Pallala <ramakrishna.pallala@...el.com>

For drivers/extcon/extcon-axp288.c
Acked-by: Ramakrishna Pallala <ramakrishna.pallala@...el.com>

Thanks,
Ram

> ---
>  drivers/extcon/extcon-arizona.c        |  38 +++-----
>  drivers/extcon/extcon-axp288.c         |  24 ++---
>  drivers/extcon/extcon-max14577.c       |  45 ++++-----
>  drivers/extcon/extcon-max77693.c       |  95 +++++++++----------
>  drivers/extcon/extcon-max77843.c       |  56 +++++------
>  drivers/extcon/extcon-max8997.c        |  59 +++++-------
>  drivers/extcon/extcon-palmas.c         |  22 +++--
>  drivers/extcon/extcon-rt8973a.c        |  40 +++-----
>  drivers/extcon/extcon-sm5502.c         |  32 ++-----
>  drivers/extcon/extcon-usb-gpio.c       |  32 ++-----
>  drivers/extcon/extcon.c                | 166 ++++++++++++++++++++-------------
>  include/linux/extcon.h                 |  92 +++++++++---------
>  include/linux/extcon/extcon-adc-jack.h |   5 +-
>  13 files changed, 326 insertions(+), 380 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
> index 1ec06b4..9262b45 100644
> --- a/drivers/extcon/extcon-arizona.c
> +++ b/drivers/extcon/extcon-arizona.c
> @@ -118,17 +118,12 @@ static const int arizona_micd_levels[] = {
>  	1257,
>  };
> 
> -#define ARIZONA_CABLE_MECHANICAL 0
> -#define ARIZONA_CABLE_MICROPHONE 1
> -#define ARIZONA_CABLE_HEADPHONE  2
> -#define ARIZONA_CABLE_LINEOUT    3
> -
> -static const char *arizona_cable[] = {
> -	"Mechanical",
> -	"Microphone",
> -	"Headphone",
> -	"Line-out",
> -	NULL,
> +static const enum extcon arizona_cable[] = {
> +	EXTCON_MECHANICAL,
> +	EXTCON_MICROPHONE,
> +	EXTCON_HEADPHONE,
> +	EXTCON_LINE_OUT,
> +	EXTCON_NONE,
>  };
> 
>  static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info);
> @@ -557,7 +552,7 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)
>  	struct arizona_extcon_info *info = data;
>  	struct arizona *arizona = info->arizona;
>  	int id_gpio = arizona->pdata.hpdet_id_gpio;
> -	int report = ARIZONA_CABLE_HEADPHONE;
> +	enum extcon report = EXTCON_HEADPHONE;
>  	int ret, reading;
>  	bool mic = false;
> 
> @@ -571,7 +566,7 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)
>  	}
> 
>  	/* If the cable was removed while measuring ignore the result */
> -	ret = extcon_get_cable_state_(info->edev,
> ARIZONA_CABLE_MECHANICAL);
> +	ret = extcon_get_cable_state_(info->edev, EXTCON_MECHANICAL);
>  	if (ret < 0) {
>  		dev_err(arizona->dev, "Failed to check cable state: %d\n",
>  			ret);
> @@ -602,9 +597,9 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)
> 
>  	/* Report high impedence cables as line outputs */
>  	if (reading >= 5000)
> -		report = ARIZONA_CABLE_LINEOUT;
> +		report = EXTCON_LINE_OUT;
>  	else
> -		report = ARIZONA_CABLE_HEADPHONE;
> +		report = EXTCON_HEADPHONE;
> 
>  	ret = extcon_set_cable_state_(info->edev, report, true);
>  	if (ret != 0)
> @@ -689,8 +684,7 @@ err:
>  			   ARIZONA_ACCDET_MODE_MASK,
> ARIZONA_ACCDET_MODE_MIC);
> 
>  	/* Just report headphone */
> -	ret = extcon_set_cable_state_(info->edev,
> -				      ARIZONA_CABLE_HEADPHONE, true);
> +	ret = extcon_set_cable_state_(info->edev, EXTCON_HEADPHONE, true);
>  	if (ret != 0)
>  		dev_err(arizona->dev, "Failed to report headphone: %d\n", ret);
> 
> @@ -747,8 +741,7 @@ err:
>  			   ARIZONA_ACCDET_MODE_MASK,
> ARIZONA_ACCDET_MODE_MIC);
> 
>  	/* Just report headphone */
> -	ret = extcon_set_cable_state_(info->edev,
> -				      ARIZONA_CABLE_HEADPHONE, true);
> +	ret = extcon_set_cable_state_(info->edev, EXTCON_HEADPHONE, true);
>  	if (ret != 0)
>  		dev_err(arizona->dev, "Failed to report headphone: %d\n", ret);
> 
> @@ -787,7 +780,7 @@ static void arizona_micd_detect(struct work_struct
> *work)
>  	mutex_lock(&info->lock);
> 
>  	/* If the cable was removed while measuring ignore the result */
> -	ret = extcon_get_cable_state_(info->edev,
> ARIZONA_CABLE_MECHANICAL);
> +	ret = extcon_get_cable_state_(info->edev, EXTCON_MECHANICAL);
>  	if (ret < 0) {
>  		dev_err(arizona->dev, "Failed to check cable state: %d\n",
>  				ret);
> @@ -836,8 +829,7 @@ static void arizona_micd_detect(struct work_struct
> *work)
>  		arizona_identify_headphone(info);
> 
>  		ret = extcon_set_cable_state_(info->edev,
> -					      ARIZONA_CABLE_MICROPHONE,
> true);
> -
> +					      EXTCON_MICROPHONE, true);
>  		if (ret != 0)
>  			dev_err(arizona->dev, "Headset report failed: %d\n",
>  				ret);
> @@ -1028,7 +1020,7 @@ static irqreturn_t arizona_jackdet(int irq, void *data)
>  	if (info->last_jackdet == present) {
>  		dev_dbg(arizona->dev, "Detected jack\n");
>  		ret = extcon_set_cable_state_(info->edev,
> -					      ARIZONA_CABLE_MECHANICAL,
> true);
> +					      EXTCON_MECHANICAL, true);
> 
>  		if (ret != 0)
>  			dev_err(arizona->dev, "Mechanical report failed:
> %d\n",
> diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
> index 8299adb..3605aa96 100644
> --- a/drivers/extcon/extcon-axp288.c
> +++ b/drivers/extcon/extcon-axp288.c
> @@ -77,10 +77,6 @@
>  /* IRQ enable-6 register */
>  #define BC12_IRQ_CFG_MASK		BIT(1)
> 
> -#define AXP288_EXTCON_SLOW_CHARGER		"SLOW-CHARGER"
> -#define AXP288_EXTCON_DOWNSTREAM_CHARGER	"CHARGE-
> DOWNSTREAM"
> -#define AXP288_EXTCON_FAST_CHARGER		"FAST-CHARGER"
> -
>  enum axp288_extcon_reg {
>  	AXP288_PS_STAT_REG		= 0x00,
>  	AXP288_PS_BOOT_REASON_REG	= 0x02,
> @@ -105,11 +101,11 @@ enum axp288_extcon_irq {
>  	EXTCON_IRQ_END,
>  };
> 
> -static const char *axp288_extcon_cables[] = {
> -	AXP288_EXTCON_SLOW_CHARGER,
> -	AXP288_EXTCON_DOWNSTREAM_CHARGER,
> -	AXP288_EXTCON_FAST_CHARGER,
> -	NULL,
> +static const enum extcon axp288_extcon_cables[] = {
> +	EXTCON_SLOW_CHARGER,
> +	EXTCON_CHARGE_DOWNSTREAM,
> +	EXTCON_FAST_CHARGER,
> +	EXTCON_NONE,
>  };
> 
>  struct axp288_extcon_info {
> @@ -161,7 +157,7 @@ static void axp288_extcon_log_rsi(struct
> axp288_extcon_info *info)
>  static int axp288_handle_chrg_det_event(struct axp288_extcon_info *info)
>  {
>  	static bool notify_otg, notify_charger;
> -	static char *cable;
> +	static enum extcon cable;
>  	int ret, stat, cfg, pwr_stat;
>  	u8 chrg_type;
>  	bool vbus_attach = false;
> @@ -196,18 +192,18 @@ static int axp288_handle_chrg_det_event(struct
> axp288_extcon_info *info)
>  		dev_dbg(info->dev, "sdp cable is connecetd\n");
>  		notify_otg = true;
>  		notify_charger = true;
> -		cable = AXP288_EXTCON_SLOW_CHARGER;
> +		cable = EXTCON_SLOW_CHARGER;
>  		break;
>  	case DET_STAT_CDP:
>  		dev_dbg(info->dev, "cdp cable is connecetd\n");
>  		notify_otg = true;
>  		notify_charger = true;
> -		cable = AXP288_EXTCON_DOWNSTREAM_CHARGER;
> +		cable = EXTCON_CHARGE_DOWNSTREAM;
>  		break;
>  	case DET_STAT_DCP:
>  		dev_dbg(info->dev, "dcp cable is connecetd\n");
>  		notify_charger = true;
> -		cable = AXP288_EXTCON_FAST_CHARGER;
> +		cable = EXTCON_FAST_CHARGER;
>  		break;
>  	default:
>  		dev_warn(info->dev,
> @@ -230,7 +226,7 @@ notify_otg:
>  	}
> 
>  	if (notify_charger)
> -		extcon_set_cable_state(info->edev, cable, vbus_attach);
> +		extcon_set_cable_state_(info->edev, cable, vbus_attach);
> 
>  	/* Clear the flags on disconnect event */
>  	if (!vbus_attach)
> diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-
> max14577.c
> index ad8f8dd..e7c3edb 100644
> --- a/drivers/extcon/extcon-max14577.c
> +++ b/drivers/extcon/extcon-max14577.c
> @@ -148,27 +148,14 @@ enum max14577_muic_acc_type {
>  	MAX14577_MUIC_ADC_OPEN,
>  };
> 
> -/* max14577 MUIC device support below list of accessories(external
> connector) */
> -enum {
> -	EXTCON_CABLE_USB = 0,
> -	EXTCON_CABLE_TA,
> -	EXTCON_CABLE_FAST_CHARGER,
> -	EXTCON_CABLE_SLOW_CHARGER,
> -	EXTCON_CABLE_CHARGE_DOWNSTREAM,
> -	EXTCON_CABLE_JIG,
> -
> -	_EXTCON_CABLE_NUM,
> -};
> -
> -static const char *max14577_extcon_cable[] = {
> -	[EXTCON_CABLE_USB]			= "USB",
> -	[EXTCON_CABLE_TA]			= "TA",
> -	[EXTCON_CABLE_FAST_CHARGER]		= "Fast-charger",
> -	[EXTCON_CABLE_SLOW_CHARGER]		= "Slow-charger",
> -	[EXTCON_CABLE_CHARGE_DOWNSTREAM]	= "Charge-
> downstream",
> -	[EXTCON_CABLE_JIG]			= "JIG",
> -
> -	NULL,
> +static const enum extcon max14577_extcon_cable[] = {
> +	EXTCON_USB,
> +	EXTCON_TA,
> +	EXTCON_FAST_CHARGER,
> +	EXTCON_SLOW_CHARGER,
> +	EXTCON_CHARGE_DOWNSTREAM,
> +	EXTCON_JIG,
> +	EXTCON_NONE,
>  };
> 
>  /*
> @@ -369,7 +356,7 @@ static int max14577_muic_jig_handler(struct
> max14577_muic_info *info,
>  	if (ret < 0)
>  		return ret;
> 
> -	extcon_set_cable_state(info->edev, "JIG", attached);
> +	extcon_set_cable_state_(info->edev, EXTCON_JIG, attached);
> 
>  	return 0;
>  }
> @@ -466,20 +453,22 @@ static int max14577_muic_chg_handler(struct
> max14577_muic_info *info)
>  		if (ret < 0)
>  			return ret;
> 
> -		extcon_set_cable_state(info->edev, "USB", attached);
> +		extcon_set_cable_state_(info->edev, EXTCON_USB, attached);
>  		break;
>  	case MAX14577_CHARGER_TYPE_DEDICATED_CHG:
> -		extcon_set_cable_state(info->edev, "TA", attached);
> +		extcon_set_cable_state_(info->edev, EXTCON_TA, attached);
>  		break;
>  	case MAX14577_CHARGER_TYPE_DOWNSTREAM_PORT:
> -		extcon_set_cable_state(info->edev,
> -				"Charge-downstream", attached);
> +		extcon_set_cable_state_(info->edev,
> EXTCON_CHARGE_DOWNSTREAM,
> +					attached);
>  		break;
>  	case MAX14577_CHARGER_TYPE_SPECIAL_500MA:
> -		extcon_set_cable_state(info->edev, "Slow-charger", attached);
> +		extcon_set_cable_state_(info->edev,
> EXTCON_SLOW_CHARGER,
> +					attached);
>  		break;
>  	case MAX14577_CHARGER_TYPE_SPECIAL_1A:
> -		extcon_set_cable_state(info->edev, "Fast-charger", attached);
> +		extcon_set_cable_state_(info->edev, EXTCON_FAST_CHARGER,
> +					attached);
>  		break;
>  	case MAX14577_CHARGER_TYPE_NONE:
>  	case MAX14577_CHARGER_TYPE_DEAD_BATTERY:
> diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-
> max77693.c
> index c274249..20e796e 100644
> --- a/drivers/extcon/extcon-max77693.c
> +++ b/drivers/extcon/extcon-max77693.c
> @@ -200,32 +200,17 @@ enum max77693_muic_acc_type {
>  /*
>   * MAX77693 MUIC device support below list of accessories(external connector)
>   */
> -enum {
> -	EXTCON_CABLE_USB = 0,
> -	EXTCON_CABLE_USB_HOST,
> -	EXTCON_CABLE_TA,
> -	EXTCON_CABLE_FAST_CHARGER,
> -	EXTCON_CABLE_SLOW_CHARGER,
> -	EXTCON_CABLE_CHARGE_DOWNSTREAM,
> -	EXTCON_CABLE_MHL,
> -	EXTCON_CABLE_JIG,
> -	EXTCON_CABLE_DOCK,
> -
> -	_EXTCON_CABLE_NUM,
> -};
> -
> -static const char *max77693_extcon_cable[] = {
> -	[EXTCON_CABLE_USB]			= "USB",
> -	[EXTCON_CABLE_USB_HOST]			= "USB-Host",
> -	[EXTCON_CABLE_TA]			= "TA",
> -	[EXTCON_CABLE_FAST_CHARGER]		= "Fast-charger",
> -	[EXTCON_CABLE_SLOW_CHARGER]		= "Slow-charger",
> -	[EXTCON_CABLE_CHARGE_DOWNSTREAM]	= "Charge-
> downstream",
> -	[EXTCON_CABLE_MHL]			= "MHL",
> -	[EXTCON_CABLE_JIG]			= "JIG",
> -	[EXTCON_CABLE_DOCK]			= "DOCK",
> -
> -	NULL,
> +static const enum extcon max77693_extcon_cable[] = {
> +	EXTCON_USB,
> +	EXTCON_USB_HOST,
> +	EXTCON_TA,
> +	EXTCON_FAST_CHARGER,
> +	EXTCON_SLOW_CHARGER,
> +	EXTCON_CHARGE_DOWNSTREAM,
> +	EXTCON_MHL,
> +	EXTCON_JIG,
> +	EXTCON_DOCK,
> +	EXTCON_NONE,
>  };
> 
>  /*
> @@ -472,7 +457,7 @@ static int max77693_muic_dock_handler(struct
> max77693_muic_info *info,
>  	int ret = 0;
>  	int vbvolt;
>  	bool cable_attached;
> -	char dock_name[CABLE_NAME_MAX];
> +	enum extcon dock_id;
> 
>  	dev_info(info->dev,
>  		"external connector is %s (adc:0x%02x)\n",
> @@ -517,16 +502,16 @@ static int max77693_muic_dock_handler(struct
> max77693_muic_info *info,
>  		if (ret < 0)
>  			return ret;
> 
> -		extcon_set_cable_state(info->edev, "DOCK", attached);
> -		extcon_set_cable_state(info->edev, "MHL", attached);
> +		extcon_set_cable_state_(info->edev, EXTCON_DOCK,
> attached);
> +		extcon_set_cable_state_(info->edev, EXTCON_MHL, attached);
>  		goto out;
>  	case MAX77693_MUIC_ADC_AUDIO_MODE_REMOTE:	/* Dock-Desk
> */
> -		strcpy(dock_name, "DOCK");
> +		dock_id = EXTCON_DOCK;
>  		break;
>  	case MAX77693_MUIC_ADC_AV_CABLE_NOLOAD:		/*
> Dock-Audio */
> -		strcpy(dock_name, "DOCK");
> +		dock_id = EXTCON_DOCK;
>  		if (!attached)
> -			extcon_set_cable_state(info->edev, "USB", false);
> +			extcon_set_cable_state_(info->edev, EXTCON_USB,
> false);
>  		break;
>  	default:
>  		dev_err(info->dev, "failed to detect %s dock device\n",
> @@ -538,7 +523,7 @@ static int max77693_muic_dock_handler(struct
> max77693_muic_info *info,
>  	ret = max77693_muic_set_path(info, CONTROL1_SW_AUDIO,
> attached);
>  	if (ret < 0)
>  		return ret;
> -	extcon_set_cable_state(info->edev, dock_name, attached);
> +	extcon_set_cable_state_(info->edev, dock_id, attached);
> 
>  out:
>  	return 0;
> @@ -603,20 +588,19 @@ static int
> max77693_muic_adc_ground_handler(struct max77693_muic_info *info)
>  		ret = max77693_muic_set_path(info, CONTROL1_SW_USB,
> attached);
>  		if (ret < 0)
>  			return ret;
> -		extcon_set_cable_state(info->edev, "USB-Host", attached);
> +		extcon_set_cable_state_(info->edev, EXTCON_USB_HOST,
> attached);
>  		break;
>  	case MAX77693_MUIC_GND_AV_CABLE_LOAD:
>  		/* Audio Video Cable with load, PATH:AUDIO */
>  		ret = max77693_muic_set_path(info, CONTROL1_SW_AUDIO,
> attached);
>  		if (ret < 0)
>  			return ret;
> -		extcon_set_cable_state(info->edev,
> -				"Audio-video-load", attached);
> +		extcon_set_cable_state_(info->edev, EXTCON_USB, attached);
>  		break;
>  	case MAX77693_MUIC_GND_MHL:
>  	case MAX77693_MUIC_GND_MHL_VB:
>  		/* MHL or MHL with USB/TA cable */
> -		extcon_set_cable_state(info->edev, "MHL", attached);
> +		extcon_set_cable_state_(info->edev, EXTCON_MHL, attached);
>  		break;
>  	default:
>  		dev_err(info->dev, "failed to detect %s cable of gnd type\n",
> @@ -658,7 +642,7 @@ static int max77693_muic_jig_handler(struct
> max77693_muic_info *info,
>  	if (ret < 0)
>  		return ret;
> 
> -	extcon_set_cable_state(info->edev, "JIG", attached);
> +	extcon_set_cable_state_(info->edev, EXTCON_JIG, attached);
> 
>  	return 0;
>  }
> @@ -812,10 +796,10 @@ static int max77693_muic_chg_handler(struct
> max77693_muic_info *info)
>  			 * - Support charging through micro-usb port without
>  			 *   data connection
>  			 */
> -			extcon_set_cable_state(info->edev, "TA", attached);
> +			extcon_set_cable_state_(info->edev, EXTCON_TA,
> attached);
>  			if (!cable_attached)
> -				extcon_set_cable_state(info->edev,
> -						      "MHL", cable_attached);
> +				extcon_set_cable_state_(info->edev,
> EXTCON_MHL,
> +							cable_attached);
>  			break;
>  		}
> 
> @@ -838,11 +822,12 @@ static int max77693_muic_chg_handler(struct
> max77693_muic_info *info)
>  			 * - Support charging through micro-usb port without
>  			 *   data connection.
>  			 */
> -			extcon_set_cable_state(info->edev, "USB", attached);
> +			extcon_set_cable_state_(info->edev, EXTCON_USB,
> +						attached);
> 
>  			if (!cable_attached)
> -				extcon_set_cable_state(info->edev, "DOCK",
> -						      cable_attached);
> +				extcon_set_cable_state_(info->edev,
> EXTCON_DOCK,
> +							cable_attached);
>  			break;
>  		case MAX77693_MUIC_ADC_RESERVED_ACC_3:		/*
> Dock-Smart */
>  			/*
> @@ -870,9 +855,10 @@ static int max77693_muic_chg_handler(struct
> max77693_muic_info *info)
>  			if (ret < 0)
>  				return ret;
> 
> -			extcon_set_cable_state(info->edev, "DOCK", attached);
> -			extcon_set_cable_state(info->edev, "MHL", attached);
> -
> +			extcon_set_cable_state_(info->edev, EXTCON_DOCK,
> +						attached);
> +			extcon_set_cable_state_(info->edev, EXTCON_MHL,
> +						attached);
>  			break;
>  		}
> 
> @@ -905,23 +891,26 @@ static int max77693_muic_chg_handler(struct
> max77693_muic_info *info)
>  			if (ret < 0)
>  				return ret;
> 
> -			extcon_set_cable_state(info->edev, "USB", attached);
> +			extcon_set_cable_state_(info->edev, EXTCON_USB,
> +						attached);
>  			break;
>  		case MAX77693_CHARGER_TYPE_DEDICATED_CHG:
>  			/* Only TA cable */
> -			extcon_set_cable_state(info->edev, "TA", attached);
> +			extcon_set_cable_state_(info->edev, EXTCON_TA,
> attached);
>  			break;
>  		}
>  		break;
>  	case MAX77693_CHARGER_TYPE_DOWNSTREAM_PORT:
> -		extcon_set_cable_state(info->edev,
> -				"Charge-downstream", attached);
> +		extcon_set_cable_state_(info->edev,
> EXTCON_CHARGE_DOWNSTREAM,
> +					attached);
>  		break;
>  	case MAX77693_CHARGER_TYPE_APPLE_500MA:
> -		extcon_set_cable_state(info->edev, "Slow-charger", attached);
> +		extcon_set_cable_state_(info->edev,
> EXTCON_SLOW_CHARGER,
> +					attached);
>  		break;
>  	case MAX77693_CHARGER_TYPE_APPLE_1A_2A:
> -		extcon_set_cable_state(info->edev, "Fast-charger", attached);
> +		extcon_set_cable_state_(info->edev, EXTCON_FAST_CHARGER,
> +					attached);
>  		break;
>  	case MAX77693_CHARGER_TYPE_DEAD_BATTERY:
>  		break;
> diff --git a/drivers/extcon/extcon-max77843.c b/drivers/extcon/extcon-
> max77843.c
> index 5746d7b..d78a64d 100644
> --- a/drivers/extcon/extcon-max77843.c
> +++ b/drivers/extcon/extcon-max77843.c
> @@ -118,28 +118,16 @@ enum max77843_muic_charger_type {
>  	MAX77843_MUIC_CHG_GND,
>  };
> 
> -enum {
> -	MAX77843_CABLE_USB = 0,
> -	MAX77843_CABLE_USB_HOST,
> -	MAX77843_CABLE_TA,
> -	MAX77843_CABLE_CHARGE_DOWNSTREAM,
> -	MAX77843_CABLE_FAST_CHARGER,
> -	MAX77843_CABLE_SLOW_CHARGER,
> -	MAX77843_CABLE_MHL,
> -	MAX77843_CABLE_JIG,
> -
> -	MAX77843_CABLE_NUM,
> -};
> -
> -static const char *max77843_extcon_cable[] = {
> -	[MAX77843_CABLE_USB]			= "USB",
> -	[MAX77843_CABLE_USB_HOST]		= "USB-HOST",
> -	[MAX77843_CABLE_TA]			= "TA",
> -	[MAX77843_CABLE_CHARGE_DOWNSTREAM]	= "CHARGER-
> DOWNSTREAM",
> -	[MAX77843_CABLE_FAST_CHARGER]		= "FAST-CHARGER",
> -	[MAX77843_CABLE_SLOW_CHARGER]		= "SLOW-CHARGER",
> -	[MAX77843_CABLE_MHL]			= "MHL",
> -	[MAX77843_CABLE_JIG]			= "JIG",
> +static const enum extcon max77843_extcon_cable[] = {
> +	EXTCON_USB,
> +	EXTCON_USB_HOST,
> +	EXTCON_TA,
> +	EXTCON_CHARGE_DOWNSTREAM,
> +	EXTCON_FAST_CHARGER,
> +	EXTCON_SLOW_CHARGER,
> +	EXTCON_MHL,
> +	EXTCON_JIG,
> +	EXTCON_NONE,
>  };
> 
>  struct max77843_muic_irq {
> @@ -354,7 +342,7 @@ static int max77843_muic_adc_gnd_handler(struct
> max77843_muic_info *info)
>  		if (ret < 0)
>  			return ret;
> 
> -		extcon_set_cable_state(info->edev, "USB-HOST", attached);
> +		extcon_set_cable_state_(info->edev, EXTCON_USB_HOST,
> attached);
>  		break;
>  	case MAX77843_MUIC_GND_MHL_VB:
>  	case MAX77843_MUIC_GND_MHL:
> @@ -362,7 +350,7 @@ static int max77843_muic_adc_gnd_handler(struct
> max77843_muic_info *info)
>  		if (ret < 0)
>  			return ret;
> 
> -		extcon_set_cable_state(info->edev, "MHL", attached);
> +		extcon_set_cable_state_(info->edev, EXTCON_MHL, attached);
>  		break;
>  	default:
>  		dev_err(info->dev, "failed to detect %s accessory(gnd:0x%x)\n",
> @@ -398,7 +386,7 @@ static int max77843_muic_jig_handler(struct
> max77843_muic_info *info,
>  	if (ret < 0)
>  		return ret;
> 
> -	extcon_set_cable_state(info->edev, "JIG", attached);
> +	extcon_set_cable_state_(info->edev, EXTCON_JIG, attached);
> 
>  	return 0;
>  }
> @@ -490,36 +478,38 @@ static int max77843_muic_chg_handler(struct
> max77843_muic_info *info)
>  		if (ret < 0)
>  			return ret;
> 
> -		extcon_set_cable_state(info->edev, "USB", attached);
> +		extcon_set_cable_state_(info->edev, EXTCON_USB, attached);
>  		break;
>  	case MAX77843_MUIC_CHG_DOWNSTREAM:
>  		ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN,
> attached);
>  		if (ret < 0)
>  			return ret;
> 
> -		extcon_set_cable_state(info->edev,
> -				"CHARGER-DOWNSTREAM", attached);
> +		extcon_set_cable_state_(info->edev,
> EXTCON_CHARGE_DOWNSTREAM,
> +					attached);
>  		break;
>  	case MAX77843_MUIC_CHG_DEDICATED:
>  		ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN,
> attached);
>  		if (ret < 0)
>  			return ret;
> 
> -		extcon_set_cable_state(info->edev, "TA", attached);
> +		extcon_set_cable_state_(info->edev, EXTCON_TA, attached);
>  		break;
>  	case MAX77843_MUIC_CHG_SPECIAL_500MA:
>  		ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN,
> attached);
>  		if (ret < 0)
>  			return ret;
> 
> -		extcon_set_cable_state(info->edev, "SLOW-CHAREGER",
> attached);
> +		extcon_set_cable_state_(info->edev,
> EXTCON_SLOW_CHARGER,
> +					attached);
>  		break;
>  	case MAX77843_MUIC_CHG_SPECIAL_1A:
>  		ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN,
> attached);
>  		if (ret < 0)
>  			return ret;
> 
> -		extcon_set_cable_state(info->edev, "FAST-CHARGER",
> attached);
> +		extcon_set_cable_state_(info->edev, EXTCON_FAST_CHARGER,
> +					attached);
>  		break;
>  	case MAX77843_MUIC_CHG_GND:
>  		gnd_type = max77843_muic_get_cable_type(info,
> @@ -527,9 +517,9 @@ static int max77843_muic_chg_handler(struct
> max77843_muic_info *info)
> 
>  		/* Charger cable on MHL accessory is attach or detach */
>  		if (gnd_type == MAX77843_MUIC_GND_MHL_VB)
> -			extcon_set_cable_state(info->edev, "TA", true);
> +			extcon_set_cable_state_(info->edev, EXTCON_TA,
> true);
>  		else if (gnd_type == MAX77843_MUIC_GND_MHL)
> -			extcon_set_cable_state(info->edev, "TA", false);
> +			extcon_set_cable_state_(info->edev, EXTCON_TA,
> false);
>  		break;
>  	case MAX77843_MUIC_CHG_NONE:
>  		break;
> diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-
> max8997.c
> index 33613c4..4d10949 100644
> --- a/drivers/extcon/extcon-max8997.c
> +++ b/drivers/extcon/extcon-max8997.c
> @@ -145,32 +145,17 @@ struct max8997_muic_info {
>  	int path_uart;
>  };
> 
> -enum {
> -	EXTCON_CABLE_USB = 0,
> -	EXTCON_CABLE_USB_HOST,
> -	EXTCON_CABLE_TA,
> -	EXTCON_CABLE_FAST_CHARGER,
> -	EXTCON_CABLE_SLOW_CHARGER,
> -	EXTCON_CABLE_CHARGE_DOWNSTREAM,
> -	EXTCON_CABLE_MHL,
> -	EXTCON_CABLE_DOCK,
> -	EXTCON_CABLE_JIG,
> -
> -	_EXTCON_CABLE_NUM,
> -};
> -
> -static const char *max8997_extcon_cable[] = {
> -	[EXTCON_CABLE_USB]			= "USB",
> -	[EXTCON_CABLE_USB_HOST]			= "USB-Host",
> -	[EXTCON_CABLE_TA]			= "TA",
> -	[EXTCON_CABLE_FAST_CHARGER]		= "Fast-charger",
> -	[EXTCON_CABLE_SLOW_CHARGER]		= "Slow-charger",
> -	[EXTCON_CABLE_CHARGE_DOWNSTREAM]	= "Charge-
> downstream",
> -	[EXTCON_CABLE_MHL]			= "MHL",
> -	[EXTCON_CABLE_DOCK]			= "DOCK",
> -	[EXTCON_CABLE_JIG]			= "JIG",
> -
> -	NULL,
> +static const enum extcon max8997_extcon_cable[] = {
> +	EXTCON_USB,
> +	EXTCON_USB_HOST,
> +	EXTCON_TA,
> +	EXTCON_FAST_CHARGER,
> +	EXTCON_SLOW_CHARGER,
> +	EXTCON_CHARGE_DOWNSTREAM,
> +	EXTCON_MHL,
> +	EXTCON_DOCK,
> +	EXTCON_JIG,
> +	EXTCON_NONE,
>  };
> 
>  /*
> @@ -345,10 +330,10 @@ static int max8997_muic_handle_usb(struct
> max8997_muic_info *info,
> 
>  	switch (usb_type) {
>  	case MAX8997_USB_HOST:
> -		extcon_set_cable_state(info->edev, "USB-Host", attached);
> +		extcon_set_cable_state_(info->edev, EXTCON_USB_HOST,
> attached);
>  		break;
>  	case MAX8997_USB_DEVICE:
> -		extcon_set_cable_state(info->edev, "USB", attached);
> +		extcon_set_cable_state_(info->edev, EXTCON_USB, attached);
>  		break;
>  	default:
>  		dev_err(info->dev, "failed to detect %s usb cable\n",
> @@ -373,7 +358,7 @@ static int max8997_muic_handle_dock(struct
> max8997_muic_info *info,
>  	switch (cable_type) {
>  	case MAX8997_MUIC_ADC_AV_CABLE_NOLOAD:
>  	case MAX8997_MUIC_ADC_FACTORY_MODE_UART_ON:
> -		extcon_set_cable_state(info->edev, "DOCK", attached);
> +		extcon_set_cable_state_(info->edev, EXTCON_DOCK,
> attached);
>  		break;
>  	default:
>  		dev_err(info->dev, "failed to detect %s dock device\n",
> @@ -396,7 +381,7 @@ static int max8997_muic_handle_jig_uart(struct
> max8997_muic_info *info,
>  		return ret;
>  	}
> 
> -	extcon_set_cable_state(info->edev, "JIG", attached);
> +	extcon_set_cable_state_(info->edev, EXTCON_JIG, attached);
> 
>  	return 0;
>  }
> @@ -418,7 +403,7 @@ static int max8997_muic_adc_handler(struct
> max8997_muic_info *info)
>  			return ret;
>  		break;
>  	case MAX8997_MUIC_ADC_MHL:
> -		extcon_set_cable_state(info->edev, "MHL", attached);
> +		extcon_set_cable_state_(info->edev, EXTCON_MHL, attached);
>  		break;
>  	case MAX8997_MUIC_ADC_FACTORY_MODE_USB_OFF:
>  	case MAX8997_MUIC_ADC_FACTORY_MODE_USB_ON:
> @@ -501,17 +486,19 @@ static int max8997_muic_chg_handler(struct
> max8997_muic_info *info)
>  		}
>  		break;
>  	case MAX8997_CHARGER_TYPE_DOWNSTREAM_PORT:
> -		extcon_set_cable_state(info->edev,
> -				      "Charge-downstream", attached);
> +		extcon_set_cable_state_(info->edev,
> EXTCON_CHARGE_DOWNSTREAM,
> +					attached);
>  		break;
>  	case MAX8997_CHARGER_TYPE_DEDICATED_CHG:
> -		extcon_set_cable_state(info->edev, "TA", attached);
> +		extcon_set_cable_state_(info->edev, EXTCON_TA, attached);
>  		break;
>  	case MAX8997_CHARGER_TYPE_500MA:
> -		extcon_set_cable_state(info->edev, "Slow-charger", attached);
> +		extcon_set_cable_state_(info->edev,
> EXTCON_SLOW_CHARGER,
> +					attached);
>  		break;
>  	case MAX8997_CHARGER_TYPE_1A:
> -		extcon_set_cable_state(info->edev, "Fast-charger", attached);
> +		extcon_set_cable_state_(info->edev, EXTCON_FAST_CHARGER,
> +					attached);
>  		break;
>  	default:
>  		dev_err(info->dev,
> diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c
> index 9c8943d..d689540 100644
> --- a/drivers/extcon/extcon-palmas.c
> +++ b/drivers/extcon/extcon-palmas.c
> @@ -29,10 +29,10 @@
>  #include <linux/of.h>
>  #include <linux/of_platform.h>
> 
> -static const char *palmas_extcon_cable[] = {
> -	[0] = "USB",
> -	[1] = "USB-HOST",
> -	NULL,
> +static const enum extcon palmas_extcon_cable[] = {
> +	EXTCON_USB,
> +	EXTCON_USB_HOST,
> +	EXTCON_NONE,
>  };
> 
>  static const int mutually_exclusive[] = {0x3, 0x0};
> @@ -49,6 +49,7 @@ static void palmas_usb_wakeup(struct palmas *palmas, int
> enable)
>  static irqreturn_t palmas_vbus_irq_handler(int irq, void *_palmas_usb)
>  {
>  	struct palmas_usb *palmas_usb = _palmas_usb;
> +	struct extcon_dev *edev = palmas_usb->edev;
>  	unsigned int vbus_line_state;
> 
>  	palmas_read(palmas_usb->palmas, PALMAS_INTERRUPT_BASE,
> @@ -57,7 +58,7 @@ static irqreturn_t palmas_vbus_irq_handler(int irq, void
> *_palmas_usb)
>  	if (vbus_line_state & PALMAS_INT3_LINE_STATE_VBUS) {
>  		if (palmas_usb->linkstat != PALMAS_USB_STATE_VBUS) {
>  			palmas_usb->linkstat = PALMAS_USB_STATE_VBUS;
> -			extcon_set_cable_state(palmas_usb->edev, "USB",
> true);
> +			extcon_set_cable_state_(edev, EXTCON_USB, true);
>  			dev_info(palmas_usb->dev, "USB cable is attached\n");
>  		} else {
>  			dev_dbg(palmas_usb->dev,
> @@ -66,7 +67,7 @@ static irqreturn_t palmas_vbus_irq_handler(int irq, void
> *_palmas_usb)
>  	} else if (!(vbus_line_state & PALMAS_INT3_LINE_STATE_VBUS)) {
>  		if (palmas_usb->linkstat == PALMAS_USB_STATE_VBUS) {
>  			palmas_usb->linkstat =
> PALMAS_USB_STATE_DISCONNECT;
> -			extcon_set_cable_state(palmas_usb->edev, "USB",
> false);
> +			extcon_set_cable_state_(edev, EXTCON_USB, false);
>  			dev_info(palmas_usb->dev, "USB cable is detached\n");
>  		} else {
>  			dev_dbg(palmas_usb->dev,
> @@ -81,6 +82,7 @@ static irqreturn_t palmas_id_irq_handler(int irq, void
> *_palmas_usb)
>  {
>  	unsigned int set, id_src;
>  	struct palmas_usb *palmas_usb = _palmas_usb;
> +	struct extcon_dev *edev = palmas_usb->edev;
> 
>  	palmas_read(palmas_usb->palmas, PALMAS_USB_OTG_BASE,
>  		PALMAS_USB_ID_INT_LATCH_SET, &set);
> @@ -93,7 +95,7 @@ static irqreturn_t palmas_id_irq_handler(int irq, void
> *_palmas_usb)
>  			PALMAS_USB_ID_INT_LATCH_CLR,
>  			PALMAS_USB_ID_INT_EN_HI_CLR_ID_GND);
>  		palmas_usb->linkstat = PALMAS_USB_STATE_ID;
> -		extcon_set_cable_state(palmas_usb->edev, "USB-HOST", true);
> +		extcon_set_cable_state_(edev, EXTCON_USB_HOST, true);
>  		dev_info(palmas_usb->dev, "USB-HOST cable is attached\n");
>  	} else if ((set & PALMAS_USB_ID_INT_SRC_ID_FLOAT) &&
>  				(id_src &
> PALMAS_USB_ID_INT_SRC_ID_FLOAT)) {
> @@ -101,17 +103,17 @@ static irqreturn_t palmas_id_irq_handler(int irq, void
> *_palmas_usb)
>  			PALMAS_USB_ID_INT_LATCH_CLR,
>  			PALMAS_USB_ID_INT_EN_HI_CLR_ID_FLOAT);
>  		palmas_usb->linkstat = PALMAS_USB_STATE_DISCONNECT;
> -		extcon_set_cable_state(palmas_usb->edev, "USB-HOST",
> false);
> +		extcon_set_cable_state_(edev, EXTCON_USB_HOST, false);
>  		dev_info(palmas_usb->dev, "USB-HOST cable is detached\n");
>  	} else if ((palmas_usb->linkstat == PALMAS_USB_STATE_ID) &&
>  				(!(set & PALMAS_USB_ID_INT_SRC_ID_GND))) {
>  		palmas_usb->linkstat = PALMAS_USB_STATE_DISCONNECT;
> -		extcon_set_cable_state(palmas_usb->edev, "USB-HOST",
> false);
> +		extcon_set_cable_state_(edev, EXTCON_USB_HOST, false);
>  		dev_info(palmas_usb->dev, "USB-HOST cable is detached\n");
>  	} else if ((palmas_usb->linkstat == PALMAS_USB_STATE_DISCONNECT)
> &&
>  				(id_src & PALMAS_USB_ID_INT_SRC_ID_GND))
> {
>  		palmas_usb->linkstat = PALMAS_USB_STATE_ID;
> -		extcon_set_cable_state(palmas_usb->edev, "USB-HOST", true);
> +		extcon_set_cable_state_(edev, EXTCON_USB_HOST, true);
>  		dev_info(palmas_usb->dev, " USB-HOST cable is attached\n");
>  	}
> 
> diff --git a/drivers/extcon/extcon-rt8973a.c b/drivers/extcon/extcon-rt8973a.c
> index 04447f3..f2a8672 100644
> --- a/drivers/extcon/extcon-rt8973a.c
> +++ b/drivers/extcon/extcon-rt8973a.c
> @@ -90,21 +90,12 @@ static struct reg_data rt8973a_reg_data[] = {
>  };
> 
>  /* List of detectable cables */
> -enum {
> -	EXTCON_CABLE_USB = 0,
> -	EXTCON_CABLE_USB_HOST,
> -	EXTCON_CABLE_TA,
> -	EXTCON_CABLE_JIG,
> -
> -	EXTCON_CABLE_END,
> -};
> -
> -static const char *rt8973a_extcon_cable[] = {
> -	[EXTCON_CABLE_USB]		= "USB",
> -	[EXTCON_CABLE_USB_HOST]		= "USB-Host",
> -	[EXTCON_CABLE_TA]		= "TA",
> -	[EXTCON_CABLE_JIG]		= "JIG",
> -	NULL,
> +static const enum extcon rt8973a_extcon_cable[] = {
> +	EXTCON_USB,
> +	EXTCON_USB_HOST,
> +	EXTCON_TA,
> +	EXTCON_JIG,
> +	EXTCON_NONE,
>  };
> 
>  /* Define OVP (Over Voltage Protection), OTP (Over Temperature Protection) */
> @@ -307,14 +298,11 @@ static int rt8973a_muic_cable_handler(struct
> rt8973a_muic_info *info,
>  					enum rt8973a_event_type event)
>  {
>  	static unsigned int prev_cable_type;
> -	const char **cable_names = info->edev->supported_cable;
>  	unsigned int con_sw = DM_DP_SWITCH_UART;
> -	int ret, idx = 0, cable_type;
> +	int ret, cable_type;
> +	enum extcon id;
>  	bool attached = false;
> 
> -	if (!cable_names)
> -		return 0;
> -
>  	switch (event) {
>  	case RT8973A_EVENT_ATTACH:
>  		cable_type = rt8973a_muic_get_cable_type(info);
> @@ -341,25 +329,25 @@ static int rt8973a_muic_cable_handler(struct
> rt8973a_muic_info *info,
> 
>  	switch (cable_type) {
>  	case RT8973A_MUIC_ADC_OTG:
> -		idx = EXTCON_CABLE_USB_HOST;
> +		id = EXTCON_USB_HOST;
>  		con_sw = DM_DP_SWITCH_USB;
>  		break;
>  	case RT8973A_MUIC_ADC_TA:
> -		idx = EXTCON_CABLE_TA;
> +		id = EXTCON_TA;
>  		con_sw = DM_DP_SWITCH_OPEN;
>  		break;
>  	case RT8973A_MUIC_ADC_FACTORY_MODE_BOOT_OFF_USB:
>  	case RT8973A_MUIC_ADC_FACTORY_MODE_BOOT_ON_USB:
> -		idx = EXTCON_CABLE_JIG;
> +		id = EXTCON_JIG;
>  		con_sw = DM_DP_SWITCH_USB;
>  		break;
>  	case RT8973A_MUIC_ADC_FACTORY_MODE_BOOT_OFF_UART:
>  	case RT8973A_MUIC_ADC_FACTORY_MODE_BOOT_ON_UART:
> -		idx = EXTCON_CABLE_JIG;
> +		id = EXTCON_JIG;
>  		con_sw = DM_DP_SWITCH_UART;
>  		break;
>  	case RT8973A_MUIC_ADC_USB:
> -		idx = EXTCON_CABLE_USB;
> +		id = EXTCON_USB;
>  		con_sw = DM_DP_SWITCH_USB;
>  		break;
>  	case RT8973A_MUIC_ADC_OPEN:
> @@ -409,7 +397,7 @@ static int rt8973a_muic_cable_handler(struct
> rt8973a_muic_info *info,
>  		return ret;
> 
>  	/* Change the state of external accessory */
> -	extcon_set_cable_state(info->edev, cable_names[idx], attached);
> +	extcon_set_cable_state_(info->edev, id, attached);
> 
>  	return 0;
>  }
> diff --git a/drivers/extcon/extcon-sm5502.c b/drivers/extcon/extcon-sm5502.c
> index 6f1d11f..520693d 100644
> --- a/drivers/extcon/extcon-sm5502.c
> +++ b/drivers/extcon/extcon-sm5502.c
> @@ -92,19 +92,11 @@ static struct reg_data sm5502_reg_data[] = {
>  };
> 
>  /* List of detectable cables */
> -enum {
> -	EXTCON_CABLE_USB = 0,
> -	EXTCON_CABLE_USB_HOST,
> -	EXTCON_CABLE_TA,
> -
> -	EXTCON_CABLE_END,
> -};
> -
> -static const char *sm5502_extcon_cable[] = {
> -	[EXTCON_CABLE_USB]	= "USB",
> -	[EXTCON_CABLE_USB_HOST]	= "USB-Host",
> -	[EXTCON_CABLE_TA]	= "TA",
> -	NULL,
> +static const enum extcon sm5502_extcon_cable[] = {
> +	EXTCON_USB,
> +	EXTCON_USB_HOST,
> +	EXTCON_TA,
> +	EXTCON_NONE,
>  };
> 
>  /* Define supported accessory type */
> @@ -377,16 +369,12 @@ static int sm5502_muic_cable_handler(struct
> sm5502_muic_info *info,
>  				     bool attached)
>  {
>  	static unsigned int prev_cable_type = SM5502_MUIC_ADC_GROUND;
> -	const char **cable_names = info->edev->supported_cable;
>  	unsigned int cable_type = SM5502_MUIC_ADC_GROUND;
>  	unsigned int con_sw = DM_DP_SWITCH_OPEN;
>  	unsigned int vbus_sw = VBUSIN_SWITCH_OPEN;
> -	unsigned int idx = 0;
> +	enum extcon id;
>  	int ret;
> 
> -	if (!cable_names)
> -		return 0;
> -
>  	/* Get the type of attached or detached cable */
>  	if (attached)
>  		cable_type = sm5502_muic_get_cable_type(info);
> @@ -396,17 +384,17 @@ static int sm5502_muic_cable_handler(struct
> sm5502_muic_info *info,
> 
>  	switch (cable_type) {
>  	case SM5502_MUIC_ADC_OPEN_USB:
> -		idx	= EXTCON_CABLE_USB;
> +		id	= EXTCON_USB;
>  		con_sw	= DM_DP_SWITCH_USB;
>  		vbus_sw	= VBUSIN_SWITCH_VBUSOUT_WITH_USB;
>  		break;
>  	case SM5502_MUIC_ADC_OPEN_TA:
> -		idx	= EXTCON_CABLE_TA;
> +		id	= EXTCON_TA;
>  		con_sw	= DM_DP_SWITCH_OPEN;
>  		vbus_sw	= VBUSIN_SWITCH_VBUSOUT;
>  		break;
>  	case SM5502_MUIC_ADC_OPEN_USB_OTG:
> -		idx	= EXTCON_CABLE_USB_HOST;
> +		id	= EXTCON_USB_HOST;
>  		con_sw	= DM_DP_SWITCH_USB;
>  		vbus_sw	= VBUSIN_SWITCH_OPEN;
>  		break;
> @@ -422,7 +410,7 @@ static int sm5502_muic_cable_handler(struct
> sm5502_muic_info *info,
>  		return ret;
> 
>  	/* Change the state of external accessory */
> -	extcon_set_cable_state(info->edev, cable_names[idx], attached);
> +	extcon_set_cable_state_(info->edev, id, attached);
> 
>  	return 0;
>  }
> diff --git a/drivers/extcon/extcon-usb-gpio.c b/drivers/extcon/extcon-usb-
> gpio.c
> index 160ec12..4cf4f19 100644
> --- a/drivers/extcon/extcon-usb-gpio.c
> +++ b/drivers/extcon/extcon-usb-gpio.c
> @@ -39,18 +39,10 @@ struct usb_extcon_info {
>  	struct delayed_work wq_detcable;
>  };
> 
> -/* List of detectable cables */
> -enum {
> -	EXTCON_CABLE_USB = 0,
> -	EXTCON_CABLE_USB_HOST,
> -
> -	EXTCON_CABLE_END,
> -};
> -
> -static const char *usb_extcon_cable[] = {
> -	[EXTCON_CABLE_USB] = "USB",
> -	[EXTCON_CABLE_USB_HOST] = "USB-HOST",
> -	NULL,
> +static const enum extcon usb_extcon_cable[] = {
> +	EXTCON_USB,
> +	EXTCON_USB_HOST,
> +	EXTCON_NONE,
>  };
> 
>  static void usb_extcon_detect_cable(struct work_struct *work)
> @@ -68,24 +60,16 @@ static void usb_extcon_detect_cable(struct work_struct
> *work)
>  		 * As we don't have event for USB peripheral cable attached,
>  		 * we simulate USB peripheral attach here.
>  		 */
> -		extcon_set_cable_state(info->edev,
> -
> usb_extcon_cable[EXTCON_CABLE_USB_HOST],
> -				       false);
> -		extcon_set_cable_state(info->edev,
> -				       usb_extcon_cable[EXTCON_CABLE_USB],
> -				       true);
> +		extcon_set_cable_state_(info->edev, EXTCON_USB_HOST,
> false);
> +		extcon_set_cable_state_(info->edev, EXTCON_USB, true);
>  	} else {
>  		/*
>  		 * ID = 0 means USB HOST cable attached.
>  		 * As we don't have event for USB peripheral cable detached,
>  		 * we simulate USB peripheral detach here.
>  		 */
> -		extcon_set_cable_state(info->edev,
> -				       usb_extcon_cable[EXTCON_CABLE_USB],
> -				       false);
> -		extcon_set_cable_state(info->edev,
> -
> usb_extcon_cable[EXTCON_CABLE_USB_HOST],
> -				       true);
> +		extcon_set_cable_state_(info->edev, EXTCON_USB, false);
> +		extcon_set_cable_state_(info->edev, EXTCON_USB_HOST,
> true);
>  	}
>  }
> 
> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
> index 2fb5f75..4aeb585 100644
> --- a/drivers/extcon/extcon.c
> +++ b/drivers/extcon/extcon.c
> @@ -3,6 +3,9 @@
>   *
>   *  External connector (extcon) class driver
>   *
> + * Copyright (C) 2015 Samsung Electronics
> + * Author: Chanwoo Choi <cw00.choi@...sung.com>
> + *
>   * Copyright (C) 2012 Samsung Electronics
>   * Author: Donggeun Kim <dg77.kim@...sung.com>
>   * Author: MyungJoo Ham <myungjoo.ham@...sung.com>
> @@ -32,36 +35,43 @@
>  #include <linux/slab.h>
>  #include <linux/sysfs.h>
> 
> -/*
> - * extcon_cable_name suggests the standard cable names for commonly used
> - * cable types.
> - *
> - * However, please do not use extcon_cable_name directly for extcon_dev
> - * struct's supported_cable pointer unless your device really supports
> - * every single port-type of the following cable names. Please choose cable
> - * names that are actually used in your extcon device.
> - */
> -const char extcon_cable_name[][CABLE_NAME_MAX + 1] = {
> +#define SUPPORTED_CABLE_MAX	32
> +#define CABLE_NAME_MAX		30
> +
> +static const char *extcon_name[] =  {
> +	[EXTCON_NONE]		= "NONE",
> +
> +	/* USB external connector */
>  	[EXTCON_USB]		= "USB",
> -	[EXTCON_USB_HOST]	= "USB-Host",
> +	[EXTCON_USB_HOST]	= "USB-HOST",
> +
> +	/* Charger external connector */
>  	[EXTCON_TA]		= "TA",
> -	[EXTCON_FAST_CHARGER]	= "Fast-charger",
> -	[EXTCON_SLOW_CHARGER]	= "Slow-charger",
> -	[EXTCON_CHARGE_DOWNSTREAM]	= "Charge-downstream",
> +	[EXTCON_FAST_CHARGER]	= "FAST-CHARGER",
> +	[EXTCON_SLOW_CHARGER]	= "SLOW-CHARGER",
> +	[EXTCON_CHARGE_DOWNSTREAM] = "CHARGE-DOWNSTREAM",
> +
> +	/* Audio/Video external connector */
> +	[EXTCON_LINE_IN]	= "LINE-IN",
> +	[EXTCON_LINE_OUT]	= "LINE-OUT",
> +	[EXTCON_MICROPHONE]	= "MICROPHONE",
> +	[EXTCON_HEADPHONE]	= "HEADPHONE",
> +
>  	[EXTCON_HDMI]		= "HDMI",
>  	[EXTCON_MHL]		= "MHL",
>  	[EXTCON_DVI]		= "DVI",
>  	[EXTCON_VGA]		= "VGA",
> -	[EXTCON_DOCK]		= "Dock",
> -	[EXTCON_LINE_IN]	= "Line-in",
> -	[EXTCON_LINE_OUT]	= "Line-out",
> -	[EXTCON_MIC_IN]		= "Microphone",
> -	[EXTCON_HEADPHONE_OUT]	= "Headphone",
> -	[EXTCON_SPDIF_IN]	= "SPDIF-in",
> -	[EXTCON_SPDIF_OUT]	= "SPDIF-out",
> -	[EXTCON_VIDEO_IN]	= "Video-in",
> -	[EXTCON_VIDEO_OUT]	= "Video-out",
> -	[EXTCON_MECHANICAL]	= "Mechanical",
> +	[EXTCON_SPDIF_IN]	= "SPDIF-IN",
> +	[EXTCON_SPDIF_OUT]	= "SPDIF-OUT",
> +	[EXTCON_VIDEO_IN]	= "VIDEO-IN",
> +	[EXTCON_VIDEO_OUT]	= "VIDEO-OUT",
> +
> +	/* Etc external connector */
> +	[EXTCON_DOCK]		= "DOCK",
> +	[EXTCON_JIG]		= "JIG",
> +	[EXTCON_MECHANICAL]	= "MECHANICAL",
> +
> +	NULL,
>  };
> 
>  static struct class *extcon_class;
> @@ -118,11 +128,9 @@ static ssize_t state_show(struct device *dev, struct
> device_attribute *attr,
>  	if (edev->max_supported == 0)
>  		return sprintf(buf, "%u\n", edev->state);
> 
> -	for (i = 0; i < SUPPORTED_CABLE_MAX; i++) {
> -		if (!edev->supported_cable[i])
> -			break;
> +	for (i = 0; i < edev->max_supported; i++) {
>  		count += sprintf(buf + count, "%s=%d\n",
> -				 edev->supported_cable[i],
> +				extcon_name[edev->supported_cable[i]],
>  				 !!(edev->state & (1 << i)));
>  	}
> 
> @@ -171,9 +179,10 @@ static ssize_t cable_name_show(struct device *dev,
>  {
>  	struct extcon_cable *cable = container_of(attr, struct extcon_cable,
>  						  attr_name);
> +	int i = cable->cable_index;
> 
>  	return sprintf(buf, "%s\n",
> -		       cable->edev->supported_cable[cable->cable_index]);
> +			extcon_name[cable->edev->supported_cable[i]]);
>  }
> 
>  static ssize_t cable_state_show(struct device *dev,
> @@ -282,39 +291,57 @@ int extcon_set_state(struct extcon_dev *edev, u32
> state)
>  }
>  EXPORT_SYMBOL_GPL(extcon_set_state);
> 
> -/**
> - * extcon_find_cable_index() - Get the cable index based on the cable name.
> - * @edev:	the extcon device that has the cable.
> - * @cable_name:	cable name to be searched.
> - *
> - * Note that accessing a cable state based on cable_index is faster than
> - * cable_name because using cable_name induces a loop with strncmp().
> - * Thus, when get/set_cable_state is repeatedly used, using cable_index
> - * is recommended.
> - */
> -int extcon_find_cable_index(struct extcon_dev *edev, const char *cable_name)
> +static int extcon_find_cable_index(struct extcon_dev *edev,
> +				   const char *cable_name)
>  {
> +	enum extcon id = EXTCON_NONE;
>  	int i;
> 
> -	if (edev->supported_cable) {
> -		for (i = 0; edev->supported_cable[i]; i++) {
> -			if (!strncmp(edev->supported_cable[i],
> -				cable_name, CABLE_NAME_MAX))
> -				return i;
> +	if (edev->max_supported == 0)
> +		return -EINVAL;
> +
> +	/* Find the the number of extcon cable */
> +	for (i = 0; i < __EXTCON_END; i++) {
> +		if (!extcon_name[i])
> +			continue;
> +		if (!strncmp(extcon_name[i], cable_name, CABLE_NAME_MAX))
> {
> +			id = i;
> +			break;
>  		}
>  	}
> 
> +	if (id == EXTCON_NONE)
> +		return -EINVAL;
> +
> +	/* Find the the index of extcon cable in edev->supported_cable */
> +	for (i = 0; i < edev->max_supported; i++) {
> +		if (edev->supported_cable[i] == id)
> +			return i;
> +	}
> +
>  	return -EINVAL;
>  }
> -EXPORT_SYMBOL_GPL(extcon_find_cable_index);
> 
>  /**
>   * extcon_get_cable_state_() - Get the status of a specific cable.
>   * @edev:	the extcon device that has the cable.
> - * @index:	cable index that can be retrieved by extcon_find_cable_index().
> + * @id:		the unique id of each external connector in extcon
> enumeration.
>   */
> -int extcon_get_cable_state_(struct extcon_dev *edev, int index)
> +int extcon_get_cable_state_(struct extcon_dev *edev, const enum extcon id)
>  {
> +	int i, index = -EINVAL;
> +
> +	/* Find the the index of extcon cable in edev->supported_cable */
> +	for (i = 0; edev->max_supported < i; i++) {
> +		if (edev->supported_cable[i] == id) {
> +			index = i;
> +			break;
> +		}
> +	}
> +
> +	if (i == edev->max_supported)
> +		return -EINVAL;
> +
>  	if (index < 0 || (edev->max_supported && edev->max_supported <=
> index))
>  		return -EINVAL;
> 
> @@ -339,15 +366,27 @@ EXPORT_SYMBOL_GPL(extcon_get_cable_state);
>  /**
>   * extcon_set_cable_state_() - Set the status of a specific cable.
>   * @edev:		the extcon device that has the cable.
> - * @index:		cable index that can be retrieved by
> - *			extcon_find_cable_index().
> - * @cable_state:	the new cable status. The default semantics is
> + * @id:			the unique id of each external connector
> + *			in extcon enumeration.
> + * @state:		the new cable status. The default semantics is
>   *			true: attached / false: detached.
>   */
> -int extcon_set_cable_state_(struct extcon_dev *edev,
> -			int index, bool cable_state)
> +int extcon_set_cable_state_(struct extcon_dev *edev, enum extcon id,
> +				bool cable_state)
>  {
>  	u32 state;
> +	int i, index = -EINVAL;
> +
> +	/* Find the the index of extcon cable in edev->supported_cable */
> +	for (i = 0; i < edev->max_supported; i++) {
> +		if (edev->supported_cable[i] == id) {
> +			index = i;
> +			break;
> +		}
> +	}
> +
> +	if (i == edev->max_supported)
> +		return -EINVAL;
> 
>  	if (index < 0 || (edev->max_supported && edev->max_supported <=
> index))
>  		return -EINVAL;
> @@ -605,7 +644,7 @@ static void dummy_sysfs_dev_release(struct device
> *dev)
>   *
>   * Return the pointer of extcon device if success or ERR_PTR(err) if fail
>   */
> -struct extcon_dev *extcon_dev_allocate(const char **supported_cable)
> +struct extcon_dev *extcon_dev_allocate(const enum extcon
> *supported_cable)
>  {
>  	struct extcon_dev *edev;
> 
> @@ -659,7 +698,7 @@ static void devm_extcon_dev_release(struct device
> *dev, void *res)
>   * or ERR_PTR(err) if fail
>   */
>  struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
> -					    const char **supported_cable)
> +					const enum extcon *supported_cable)
>  {
>  	struct extcon_dev **ptr, *edev;
> 
> @@ -709,17 +748,15 @@ int extcon_dev_register(struct extcon_dev *edev)
>  			return ret;
>  	}
> 
> -	if (edev->supported_cable) {
> -		/* Get size of array */
> -		for (index = 0; edev->supported_cable[index]; index++)
> -			;
> -		edev->max_supported = index;
> -	} else {
> -		edev->max_supported = 0;
> -	}
> +	if (!edev->supported_cable)
> +		return -EINVAL;
> 
> +	for (; edev->supported_cable[index] != EXTCON_NONE; index++);
> +
> +	edev->max_supported = index;
>  	if (index > SUPPORTED_CABLE_MAX) {
> -		dev_err(&edev->dev, "extcon: maximum number of supported
> cables exceeded.\n");
> +		dev_err(&edev->dev,
> +			"exceed the maximum number of supported cables\n");
>  		return -EINVAL;
>  	}
> 
> @@ -1070,6 +1107,7 @@ static void __exit extcon_class_exit(void)
>  }
>  module_exit(extcon_class_exit);
> 
> +MODULE_AUTHOR("Chanwoo Choi <cw00.choi@...sung.com>");
>  MODULE_AUTHOR("Mike Lockwood <lockwood@...roid.com>");
>  MODULE_AUTHOR("Donggeun Kim <dg77.kim@...sung.com>");
>  MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@...sung.com>");
> diff --git a/include/linux/extcon.h b/include/linux/extcon.h
> index 799474d9d..de158a1 100644
> --- a/include/linux/extcon.h
> +++ b/include/linux/extcon.h
> @@ -1,6 +1,9 @@
>  /*
>   *  External connector (extcon) class driver
>   *
> + * Copyright (C) 2015 Samsung Electronics
> + * Author: Chanwoo Choi <cw00.choi@...sung.com>
> + *
>   * Copyright (C) 2012 Samsung Electronics
>   * Author: Donggeun Kim <dg77.kim@...sung.com>
>   * Author: MyungJoo Ham <myungjoo.ham@...sung.com>
> @@ -27,8 +30,41 @@
>  #include <linux/notifier.h>
>  #include <linux/sysfs.h>
> 
> -#define SUPPORTED_CABLE_MAX	32
> -#define CABLE_NAME_MAX		30
> +enum extcon {
> +	EXTCON_NONE		= 0x0,	/* NONE */
> +
> +	/* USB external connector */
> +	EXTCON_USB		= 0x1,	/* USB */
> +	EXTCON_USB_HOST		= 0x2,	/* USB-HOST */
> +
> +	/* Charger external connector */
> +	EXTCON_TA		= 0x10,	/* TA */
> +	EXTCON_FAST_CHARGER	= 0x11,	/* FAST-CHARGER */
> +	EXTCON_SLOW_CHARGER	= 0x12,	/* SLOW-CHARGER */
> +	EXTCON_CHARGE_DOWNSTREAM= 0x13,	/* CHARGE-
> DOWNSTREAM */
> +
> +	/* Audio/Video external connector */
> +	EXTCON_LINE_IN		= 0x20,	/* LINE-IN */
> +	EXTCON_LINE_OUT		= 0x21,	/* LINE-OUT */
> +	EXTCON_MICROPHONE	= 0x22,	/* MICROPHONE */
> +	EXTCON_HEADPHONE	= 0x23,	/* HEADPHONE */
> +
> +	EXTCON_HDMI		= 0x30,	/* HDMI */
> +	EXTCON_MHL		= 0x31,	/* MHL */
> +	EXTCON_DVI		= 0x32,	/* DVI */
> +	EXTCON_VGA		= 0x33,	/* VGA */
> +	EXTCON_SPDIF_IN		= 0x34,	/* SPDIF-IN */
> +	EXTCON_SPDIF_OUT	= 0x35,	/* SPDIF-OUT */
> +	EXTCON_VIDEO_IN		= 0x36,	/* VIDEO-IN */
> +	EXTCON_VIDEO_OUT	= 0x37,	/* VIDEO-OUT */
> +
> +	/* Etc external connector */
> +	EXTCON_DOCK		= 0x50,	/* DOCK */
> +	EXTCON_JIG		= 0x51,	/* JIG */
> +	EXTCON_MECHANICAL	= 0x52,	/* MECHANICAL */
> +
> +	__EXTCON_END,
> +};
> 
>  /*
>   * The standard cable name is to help support general notifier
> @@ -48,29 +84,6 @@
>   * you don't need such convention. This convention is helpful when
>   * notifier can distinguish but notifiee cannot.
>   */
> -enum extcon_cable_name {
> -	EXTCON_USB = 0,
> -	EXTCON_USB_HOST,
> -	EXTCON_TA,			/* Travel Adaptor */
> -	EXTCON_FAST_CHARGER,
> -	EXTCON_SLOW_CHARGER,
> -	EXTCON_CHARGE_DOWNSTREAM,	/* Charging an external device
> */
> -	EXTCON_HDMI,
> -	EXTCON_MHL,
> -	EXTCON_DVI,
> -	EXTCON_VGA,
> -	EXTCON_DOCK,
> -	EXTCON_LINE_IN,
> -	EXTCON_LINE_OUT,
> -	EXTCON_MIC_IN,
> -	EXTCON_HEADPHONE_OUT,
> -	EXTCON_SPDIF_IN,
> -	EXTCON_SPDIF_OUT,
> -	EXTCON_VIDEO_IN,
> -	EXTCON_VIDEO_OUT,
> -	EXTCON_MECHANICAL,
> -};
> -extern const char extcon_cable_name[][CABLE_NAME_MAX + 1];
> 
>  struct extcon_cable;
> 
> @@ -113,7 +126,7 @@ struct extcon_cable;
>  struct extcon_dev {
>  	/* Optional user initializing data */
>  	const char *name;
> -	const char **supported_cable;
> +	const enum extcon *supported_cable;
>  	const u32 *mutually_exclusive;
> 
>  	/* Optional callbacks to override class functions */
> @@ -194,10 +207,10 @@ extern struct extcon_dev
> *extcon_get_extcon_dev(const char *extcon_name);
>  /*
>   * Following APIs control the memory of extcon device.
>   */
> -extern struct extcon_dev *extcon_dev_allocate(const char **cables);
> +extern struct extcon_dev *extcon_dev_allocate(const enum extcon *cable);
>  extern void extcon_dev_free(struct extcon_dev *edev);
>  extern struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
> -						   const char **cables);
> +						   const enum extcon *cable);
>  extern void devm_extcon_dev_free(struct device *dev, struct extcon_dev
> *edev);
> 
>  /*
> @@ -216,13 +229,10 @@ extern int extcon_update_state(struct extcon_dev
> *edev, u32 mask, u32 state);
> 
>  /*
>   * get/set_cable_state access each bit of the 32b encoded state value.
> - * They are used to access the status of each cable based on the cable_name
> - * or cable_index, which is retrieved by extcon_find_cable_index
> + * They are used to access the status of each cable based on the cable_name.
>   */
> -extern int extcon_find_cable_index(struct extcon_dev *sdev,
> -				   const char *cable_name);
> -extern int extcon_get_cable_state_(struct extcon_dev *edev, int cable_index);
> -extern int extcon_set_cable_state_(struct extcon_dev *edev, int cable_index,
> +extern int extcon_get_cable_state_(struct extcon_dev *edev, enum extcon id);
> +extern int extcon_set_cable_state_(struct extcon_dev *edev, enum extcon id,
>  				   bool cable_state);
> 
>  extern int extcon_get_cable_state(struct extcon_dev *edev,
> @@ -281,7 +291,7 @@ static inline int devm_extcon_dev_register(struct device
> *dev,
>  static inline void devm_extcon_dev_unregister(struct device *dev,
>  					      struct extcon_dev *edev) { }
> 
> -static inline struct extcon_dev *extcon_dev_allocate(const char **cables)
> +static inline struct extcon_dev *extcon_dev_allocate(const enum extcon
> *cable)
>  {
>  	return ERR_PTR(-ENOSYS);
>  }
> @@ -289,7 +299,7 @@ static inline struct extcon_dev
> *extcon_dev_allocate(const char **cables)
>  static inline void extcon_dev_free(struct extcon_dev *edev) { }
> 
>  static inline struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
> -							  const char **cables)
> +						const enum extcon *cable)
>  {
>  	return ERR_PTR(-ENOSYS);
>  }
> @@ -312,20 +322,14 @@ static inline int extcon_update_state(struct
> extcon_dev *edev, u32 mask,
>  	return 0;
>  }
> 
> -static inline int extcon_find_cable_index(struct extcon_dev *edev,
> -					  const char *cable_name)
> -{
> -	return 0;
> -}
> -
>  static inline int extcon_get_cable_state_(struct extcon_dev *edev,
> -					  int cable_index)
> +					  enum extcon id)
>  {
>  	return 0;
>  }
> 
>  static inline int extcon_set_cable_state_(struct extcon_dev *edev,
> -					  int cable_index, bool cable_state)
> +					  enum extcon id, bool cable_state)
>  {
>  	return 0;
>  }
> diff --git a/include/linux/extcon/extcon-adc-jack.h
> b/include/linux/extcon/extcon-adc-jack.h
> index 9ca958c..53c6080 100644
> --- a/include/linux/extcon/extcon-adc-jack.h
> +++ b/include/linux/extcon/extcon-adc-jack.h
> @@ -44,7 +44,7 @@ struct adc_jack_cond {
>   * @consumer_channel:	Unique name to identify the channel on the
> consumer
>   *			side. This typically describes the channels used within
>   *			the consumer. E.g. 'battery_voltage'
> - * @cable_names:	array of cable names ending with null.
> + * @cable_names:	array of extcon id for supported cables.
>   * @adc_contitions:	array of struct adc_jack_cond conditions ending
>   *			with .state = 0 entry. This describes how to decode
>   *			adc values into extcon state.
> @@ -58,8 +58,7 @@ struct adc_jack_pdata {
>  	const char *name;
>  	const char *consumer_channel;
> 
> -	/* The last entry should be NULL */
> -	const char **cable_names;
> +	const enum extcon *cable_names;
> 
>  	/* The last entry's state should be 0 */
>  	struct adc_jack_cond *adc_conditions;
> --
> 1.8.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ