Skip to content

Commit

Permalink
extcon: Redefine the unique id of supported external connectors witho…
Browse files Browse the repository at this point in the history
…ut 'enum extcon' type

This patch just redefine the unique id of supported external connectors without
'enum extcon' type. Because unique id would be used on devictree file(*.dts) to
indicate the specific external connectors like key number of input framework.
So, I have the plan to move this definitions to following header file which
includes the unique id of supported external connectors.
- include/dt-bindings/extcon/extcon.h

Fixes: 2a9de9c ("extcon: Use the unique id for external connector instead of string")
Signed-off-by: Chanwoo Choi <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
chanwoochoi authored and gregkh committed Jun 13, 2015
1 parent 03cb050 commit 73b6ecd
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 77 deletions.
2 changes: 1 addition & 1 deletion drivers/extcon/extcon-adc-jack.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
struct adc_jack_data {
struct extcon_dev *edev;

const char **cable_names;
const unsigned int **cable_names;
struct adc_jack_cond *adc_conditions;
int num_conditions;

Expand Down
4 changes: 2 additions & 2 deletions drivers/extcon/extcon-arizona.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static const int arizona_micd_levels[] = {
1257,
};

static const enum extcon arizona_cable[] = {
static const unsigned int arizona_cable[] = {
EXTCON_MECHANICAL,
EXTCON_MICROPHONE,
EXTCON_HEADPHONE,
Expand Down Expand Up @@ -552,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;
enum extcon report = EXTCON_HEADPHONE;
unsigned int report = EXTCON_HEADPHONE;
int ret, reading;
bool mic = false;

Expand Down
4 changes: 2 additions & 2 deletions drivers/extcon/extcon-axp288.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ enum axp288_extcon_irq {
EXTCON_IRQ_END,
};

static const enum extcon axp288_extcon_cables[] = {
static const unsigned int axp288_extcon_cables[] = {
EXTCON_SLOW_CHARGER,
EXTCON_CHARGE_DOWNSTREAM,
EXTCON_FAST_CHARGER,
Expand Down Expand Up @@ -157,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 enum extcon cable;
static unsigned int cable;
int ret, stat, cfg, pwr_stat;
u8 chrg_type;
bool vbus_attach = false;
Expand Down
2 changes: 1 addition & 1 deletion drivers/extcon/extcon-max14577.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ enum max14577_muic_acc_type {
MAX14577_MUIC_ADC_OPEN,
};

static const enum extcon max14577_extcon_cable[] = {
static const unsigned int max14577_extcon_cable[] = {
EXTCON_USB,
EXTCON_TA,
EXTCON_FAST_CHARGER,
Expand Down
4 changes: 2 additions & 2 deletions drivers/extcon/extcon-max77693.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ enum max77693_muic_acc_type {
/*
* MAX77693 MUIC device support below list of accessories(external connector)
*/
static const enum extcon max77693_extcon_cable[] = {
static const unsigned int max77693_extcon_cable[] = {
EXTCON_USB,
EXTCON_USB_HOST,
EXTCON_TA,
Expand Down Expand Up @@ -457,7 +457,7 @@ static int max77693_muic_dock_handler(struct max77693_muic_info *info,
int ret = 0;
int vbvolt;
bool cable_attached;
enum extcon dock_id;
unsigned int dock_id;

dev_info(info->dev,
"external connector is %s (adc:0x%02x)\n",
Expand Down
2 changes: 1 addition & 1 deletion drivers/extcon/extcon-max77843.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ enum max77843_muic_charger_type {
MAX77843_MUIC_CHG_GND,
};

static const enum extcon max77843_extcon_cable[] = {
static const unsigned int max77843_extcon_cable[] = {
EXTCON_USB,
EXTCON_USB_HOST,
EXTCON_TA,
Expand Down
2 changes: 1 addition & 1 deletion drivers/extcon/extcon-max8997.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ struct max8997_muic_info {
int path_uart;
};

static const enum extcon max8997_extcon_cable[] = {
static const unsigned int max8997_extcon_cable[] = {
EXTCON_USB,
EXTCON_USB_HOST,
EXTCON_TA,
Expand Down
2 changes: 1 addition & 1 deletion drivers/extcon/extcon-palmas.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <linux/of.h>
#include <linux/of_platform.h>

static const enum extcon palmas_extcon_cable[] = {
static const unsigned int palmas_extcon_cable[] = {
EXTCON_USB,
EXTCON_USB_HOST,
EXTCON_NONE,
Expand Down
4 changes: 2 additions & 2 deletions drivers/extcon/extcon-rt8973a.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static struct reg_data rt8973a_reg_data[] = {
};

/* List of detectable cables */
static const enum extcon rt8973a_extcon_cable[] = {
static const unsigned int rt8973a_extcon_cable[] = {
EXTCON_USB,
EXTCON_USB_HOST,
EXTCON_TA,
Expand Down Expand Up @@ -300,7 +300,7 @@ static int rt8973a_muic_cable_handler(struct rt8973a_muic_info *info,
static unsigned int prev_cable_type;
unsigned int con_sw = DM_DP_SWITCH_UART;
int ret, cable_type;
enum extcon id;
unsigned int id;
bool attached = false;

switch (event) {
Expand Down
4 changes: 2 additions & 2 deletions drivers/extcon/extcon-sm5502.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static struct reg_data sm5502_reg_data[] = {
};

/* List of detectable cables */
static const enum extcon sm5502_extcon_cable[] = {
static const unsigned int sm5502_extcon_cable[] = {
EXTCON_USB,
EXTCON_USB_HOST,
EXTCON_TA,
Expand Down Expand Up @@ -372,7 +372,7 @@ static int sm5502_muic_cable_handler(struct sm5502_muic_info *info,
unsigned int cable_type = SM5502_MUIC_ADC_GROUND;
unsigned int con_sw = DM_DP_SWITCH_OPEN;
unsigned int vbus_sw = VBUSIN_SWITCH_OPEN;
enum extcon id;
unsigned int id;
int ret;

/* Get the type of attached or detached cable */
Expand Down
2 changes: 1 addition & 1 deletion drivers/extcon/extcon-usb-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct usb_extcon_info {
struct delayed_work wq_detcable;
};

static const enum extcon usb_extcon_cable[] = {
static const unsigned int usb_extcon_cable[] = {
EXTCON_USB,
EXTCON_USB_HOST,
EXTCON_NONE,
Expand Down
24 changes: 12 additions & 12 deletions drivers/extcon/extcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
#define CABLE_NAME_MAX 30

static const char *extcon_name[] = {
[EXTCON_NONE] = "NONE",

/* USB external connector */
[EXTCON_USB] = "USB",
[EXTCON_USB_HOST] = "USB-HOST",
Expand Down Expand Up @@ -109,7 +111,7 @@ static int check_mutually_exclusive(struct extcon_dev *edev, u32 new_state)
return 0;
}

static int find_cable_index_by_id(struct extcon_dev *edev, const enum extcon id)
static int find_cable_index_by_id(struct extcon_dev *edev, const unsigned int id)
{
int i;

Expand All @@ -124,16 +126,14 @@ static int find_cable_index_by_id(struct extcon_dev *edev, const enum extcon id)

static int find_cable_index_by_name(struct extcon_dev *edev, const char *name)
{
enum extcon id = EXTCON_NONE;
int i;
unsigned int id = EXTCON_NONE;
int i = 0;

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;
while (extcon_name[i]) {
if (!strncmp(extcon_name[i], name, CABLE_NAME_MAX)) {
id = i;
break;
Expand Down Expand Up @@ -337,7 +337,7 @@ EXPORT_SYMBOL_GPL(extcon_set_state);
* @edev: the extcon device that has the cable.
* @id: the unique id of each external connector in extcon enumeration.
*/
int extcon_get_cable_state_(struct extcon_dev *edev, const enum extcon id)
int extcon_get_cable_state_(struct extcon_dev *edev, const unsigned int id)
{
int index;

Expand Down Expand Up @@ -374,7 +374,7 @@ EXPORT_SYMBOL_GPL(extcon_get_cable_state);
* @state: the new cable status. The default semantics is
* true: attached / false: detached.
*/
int extcon_set_cable_state_(struct extcon_dev *edev, enum extcon id,
int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id,
bool cable_state)
{
u32 state;
Expand Down Expand Up @@ -539,7 +539,7 @@ EXPORT_SYMBOL_GPL(extcon_unregister_interest);
* "old_state", not the current state. The current state can be retrieved
* by looking at the third pameter (edev pointer)'s state value.
*/
int extcon_register_notifier(struct extcon_dev *edev, enum extcon id,
int extcon_register_notifier(struct extcon_dev *edev, unsigned int id,
struct notifier_block *nb)
{
unsigned long flags;
Expand All @@ -561,7 +561,7 @@ EXPORT_SYMBOL_GPL(extcon_register_notifier);
* @id: the unique id of each external connector in extcon enumeration.
* @nb: a notifier block to be registered.
*/
int extcon_unregister_notifier(struct extcon_dev *edev, enum extcon id,
int extcon_unregister_notifier(struct extcon_dev *edev, unsigned int id,
struct notifier_block *nb)
{
unsigned long flags;
Expand Down Expand Up @@ -623,7 +623,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 enum extcon *supported_cable)
struct extcon_dev *extcon_dev_allocate(const unsigned int *supported_cable)
{
struct extcon_dev *edev;

Expand Down Expand Up @@ -677,7 +677,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 enum extcon *supported_cable)
const unsigned int *supported_cable)
{
struct extcon_dev **ptr, *edev;

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/phy/phy-tahvo.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct tahvo_usb {
struct extcon_dev extcon;
};

static const enum extcon tahvo_cable[] = {
static const unsigned int tahvo_cable[] = {
EXTCON_USB,
EXTCON_USB_HOST,

Expand Down
Loading

0 comments on commit 73b6ecd

Please sign in to comment.