Skip to content

Commit

Permalink
extcon: Use the extcon_set_state_sync() instead of deprecated functions
Browse files Browse the repository at this point in the history
This patch alters the renamed extcon API to set the state of the external
connectors instead of deprecated extcon_set_cable_state_().

Because the patch[1] modifies the function name to maintain the function
naming pattern.
- extcon_set_cable_state_() -> extcon_set_state_sync()
- extcon_get_cable_state_() -> extcon_get_state()

[1] https://lkml.org/lkml/2016/8/4/729
- extcon: Rename the extcon_set/get_state() to maintain the function naming pattern

Signed-off-by: Chanwoo Choi <[email protected]>
Acked-by: Charles Keepax <[email protected]>
Acked-by: Roger Quadros <[email protected]>
  • Loading branch information
chanwoochoi committed Sep 13, 2016
1 parent 525867d commit 8670b45
Show file tree
Hide file tree
Showing 13 changed files with 83 additions and 83 deletions.
4 changes: 2 additions & 2 deletions drivers/extcon/extcon-adc-jack.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ static void adc_jack_handler(struct work_struct *work)
for (i = 0; i < data->num_conditions; i++) {
def = &data->adc_conditions[i];
if (def->min_adc <= adc_val && def->max_adc >= adc_val) {
extcon_set_cable_state_(data->edev, def->id, true);
extcon_set_state_sync(data->edev, def->id, true);
return;
}
}

/* Set the detached state if adc value is not included in the range */
for (i = 0; i < data->num_conditions; i++) {
def = &data->adc_conditions[i];
extcon_set_cable_state_(data->edev, def->id, false);
extcon_set_state_sync(data->edev, def->id, false);
}
}

Expand Down
16 changes: 8 additions & 8 deletions drivers/extcon/extcon-arizona.c
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,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, EXTCON_MECHANICAL);
ret = extcon_get_state(info->edev, EXTCON_MECHANICAL);
if (ret < 0) {
dev_err(arizona->dev, "Failed to check cable state: %d\n",
ret);
Expand Down Expand Up @@ -649,7 +649,7 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)
else
report = EXTCON_JACK_HEADPHONE;

ret = extcon_set_cable_state_(info->edev, report, true);
ret = extcon_set_state_sync(info->edev, report, true);
if (ret != 0)
dev_err(arizona->dev, "Failed to report HP/line: %d\n",
ret);
Expand Down Expand Up @@ -732,7 +732,7 @@ static void arizona_identify_headphone(struct arizona_extcon_info *info)
ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC);

/* Just report headphone */
ret = extcon_set_cable_state_(info->edev, EXTCON_JACK_HEADPHONE, true);
ret = extcon_set_state_sync(info->edev, EXTCON_JACK_HEADPHONE, true);
if (ret != 0)
dev_err(arizona->dev, "Failed to report headphone: %d\n", ret);

Expand Down Expand Up @@ -789,7 +789,7 @@ static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info)
ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC);

/* Just report headphone */
ret = extcon_set_cable_state_(info->edev, EXTCON_JACK_HEADPHONE, true);
ret = extcon_set_state_sync(info->edev, EXTCON_JACK_HEADPHONE, true);
if (ret != 0)
dev_err(arizona->dev, "Failed to report headphone: %d\n", ret);

Expand Down Expand Up @@ -829,7 +829,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, EXTCON_MECHANICAL);
ret = extcon_get_state(info->edev, EXTCON_MECHANICAL);
if (ret < 0) {
dev_err(arizona->dev, "Failed to check cable state: %d\n",
ret);
Expand Down Expand Up @@ -914,7 +914,7 @@ static void arizona_micd_detect(struct work_struct *work)

arizona_identify_headphone(info);

ret = extcon_set_cable_state_(info->edev,
ret = extcon_set_state_sync(info->edev,
EXTCON_JACK_MICROPHONE, true);
if (ret != 0)
dev_err(arizona->dev, "Headset report failed: %d\n",
Expand Down Expand Up @@ -1108,7 +1108,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,
ret = extcon_set_state_sync(info->edev,
EXTCON_MECHANICAL, true);

if (ret != 0)
Expand Down Expand Up @@ -1150,7 +1150,7 @@ static irqreturn_t arizona_jackdet(int irq, void *data)
input_sync(info->input);

for (i = 0; i < ARRAY_SIZE(arizona_cable) - 1; i++) {
ret = extcon_set_cable_state_(info->edev,
ret = extcon_set_state_sync(info->edev,
arizona_cable[i], false);
if (ret != 0)
dev_err(arizona->dev,
Expand Down
2 changes: 1 addition & 1 deletion drivers/extcon/extcon-axp288.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ static int axp288_handle_chrg_det_event(struct axp288_extcon_info *info)
}

if (notify_charger)
extcon_set_cable_state_(info->edev, cable, vbus_attach);
extcon_set_state_sync(info->edev, cable, vbus_attach);

/* Clear the flags on disconnect event */
if (!vbus_attach)
Expand Down
2 changes: 1 addition & 1 deletion drivers/extcon/extcon-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static void gpio_extcon_work(struct work_struct *work)
state = gpiod_get_value_cansleep(data->id_gpiod);
if (data->pdata->gpio_active_low)
state = !state;
extcon_set_cable_state_(data->edev, data->pdata->extcon_id, state);
extcon_set_state_sync(data->edev, data->pdata->extcon_id, state);
}

static irqreturn_t gpio_irq_handler(int irq, void *dev_id)
Expand Down
14 changes: 7 additions & 7 deletions drivers/extcon/extcon-max14577.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ static int max14577_muic_jig_handler(struct max14577_muic_info *info,
if (ret < 0)
return ret;

extcon_set_cable_state_(info->edev, EXTCON_JIG, attached);
extcon_set_state_sync(info->edev, EXTCON_JIG, attached);

return 0;
}
Expand Down Expand Up @@ -454,24 +454,24 @@ static int max14577_muic_chg_handler(struct max14577_muic_info *info)
if (ret < 0)
return ret;

extcon_set_cable_state_(info->edev, EXTCON_USB, attached);
extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
extcon_set_state_sync(info->edev, EXTCON_USB, attached);
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_SDP,
attached);
break;
case MAX14577_CHARGER_TYPE_DEDICATED_CHG:
extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP,
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_DCP,
attached);
break;
case MAX14577_CHARGER_TYPE_DOWNSTREAM_PORT:
extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_CDP,
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_CDP,
attached);
break;
case MAX14577_CHARGER_TYPE_SPECIAL_500MA:
extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SLOW,
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_SLOW,
attached);
break;
case MAX14577_CHARGER_TYPE_SPECIAL_1A:
extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_FAST,
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_FAST,
attached);
break;
case MAX14577_CHARGER_TYPE_NONE:
Expand Down
8 changes: 4 additions & 4 deletions drivers/extcon/extcon-max3355.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ static irqreturn_t max3355_id_irq(int irq, void *dev_id)
* As we don't have event for USB peripheral cable attached,
* we simulate USB peripheral attach here.
*/
extcon_set_cable_state_(data->edev, EXTCON_USB_HOST, false);
extcon_set_cable_state_(data->edev, EXTCON_USB, true);
extcon_set_state_sync(data->edev, EXTCON_USB_HOST, false);
extcon_set_state_sync(data->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_(data->edev, EXTCON_USB, false);
extcon_set_cable_state_(data->edev, EXTCON_USB_HOST, true);
extcon_set_state_sync(data->edev, EXTCON_USB, false);
extcon_set_state_sync(data->edev, EXTCON_USB_HOST, true);
}

return IRQ_HANDLED;
Expand Down
46 changes: 23 additions & 23 deletions drivers/extcon/extcon-max77693.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,17 +505,17 @@ static int max77693_muic_dock_handler(struct max77693_muic_info *info,
if (ret < 0)
return ret;

extcon_set_cable_state_(info->edev, EXTCON_DOCK, attached);
extcon_set_cable_state_(info->edev, EXTCON_DISP_MHL, attached);
extcon_set_state_sync(info->edev, EXTCON_DOCK, attached);
extcon_set_state_sync(info->edev, EXTCON_DISP_MHL, attached);
goto out;
case MAX77693_MUIC_ADC_AUDIO_MODE_REMOTE: /* Dock-Desk */
dock_id = EXTCON_DOCK;
break;
case MAX77693_MUIC_ADC_AV_CABLE_NOLOAD: /* Dock-Audio */
dock_id = EXTCON_DOCK;
if (!attached) {
extcon_set_cable_state_(info->edev, EXTCON_USB, false);
extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
extcon_set_state_sync(info->edev, EXTCON_USB, false);
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_SDP,
false);
}
break;
Expand All @@ -530,7 +530,7 @@ static int max77693_muic_dock_handler(struct max77693_muic_info *info,
attached);
if (ret < 0)
return ret;
extcon_set_cable_state_(info->edev, dock_id, attached);
extcon_set_state_sync(info->edev, dock_id, attached);

out:
return 0;
Expand Down Expand Up @@ -596,22 +596,22 @@ static int max77693_muic_adc_ground_handler(struct max77693_muic_info *info)
attached);
if (ret < 0)
return ret;
extcon_set_cable_state_(info->edev, EXTCON_USB_HOST, attached);
extcon_set_state_sync(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, MAX77693_CONTROL1_SW_AUDIO,
attached);
if (ret < 0)
return ret;
extcon_set_cable_state_(info->edev, EXTCON_USB, attached);
extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
extcon_set_state_sync(info->edev, EXTCON_USB, attached);
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_SDP,
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, EXTCON_DISP_MHL, attached);
extcon_set_state_sync(info->edev, EXTCON_DISP_MHL, attached);
break;
default:
dev_err(info->dev, "failed to detect %s cable of gnd type\n",
Expand Down Expand Up @@ -653,7 +653,7 @@ static int max77693_muic_jig_handler(struct max77693_muic_info *info,
if (ret < 0)
return ret;

extcon_set_cable_state_(info->edev, EXTCON_JIG, attached);
extcon_set_state_sync(info->edev, EXTCON_JIG, attached);

return 0;
}
Expand Down Expand Up @@ -807,10 +807,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, EXTCON_CHG_USB_DCP,
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_DCP,
attached);
if (!cable_attached)
extcon_set_cable_state_(info->edev,
extcon_set_state_sync(info->edev,
EXTCON_DISP_MHL, cable_attached);
break;
}
Expand All @@ -834,13 +834,13 @@ 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, EXTCON_USB,
extcon_set_state_sync(info->edev, EXTCON_USB,
attached);
extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_SDP,
attached);

if (!cable_attached)
extcon_set_cable_state_(info->edev, EXTCON_DOCK,
extcon_set_state_sync(info->edev, EXTCON_DOCK,
cable_attached);
break;
case MAX77693_MUIC_ADC_RESERVED_ACC_3: /* Dock-Smart */
Expand Down Expand Up @@ -869,9 +869,9 @@ static int max77693_muic_chg_handler(struct max77693_muic_info *info)
if (ret < 0)
return ret;

extcon_set_cable_state_(info->edev, EXTCON_DOCK,
extcon_set_state_sync(info->edev, EXTCON_DOCK,
attached);
extcon_set_cable_state_(info->edev, EXTCON_DISP_MHL,
extcon_set_state_sync(info->edev, EXTCON_DISP_MHL,
attached);
break;
}
Expand Down Expand Up @@ -905,28 +905,28 @@ static int max77693_muic_chg_handler(struct max77693_muic_info *info)
if (ret < 0)
return ret;

extcon_set_cable_state_(info->edev, EXTCON_USB,
extcon_set_state_sync(info->edev, EXTCON_USB,
attached);
extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_SDP,
attached);
break;
case MAX77693_CHARGER_TYPE_DEDICATED_CHG:
/* Only TA cable */
extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP,
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_DCP,
attached);
break;
}
break;
case MAX77693_CHARGER_TYPE_DOWNSTREAM_PORT:
extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_CDP,
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_CDP,
attached);
break;
case MAX77693_CHARGER_TYPE_APPLE_500MA:
extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SLOW,
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_SLOW,
attached);
break;
case MAX77693_CHARGER_TYPE_APPLE_1A_2A:
extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_FAST,
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_FAST,
attached);
break;
case MAX77693_CHARGER_TYPE_DEAD_BATTERY:
Expand Down
22 changes: 11 additions & 11 deletions drivers/extcon/extcon-max77843.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ static int max77843_muic_adc_gnd_handler(struct max77843_muic_info *info)
if (ret < 0)
return ret;

extcon_set_cable_state_(info->edev, EXTCON_USB_HOST, attached);
extcon_set_state_sync(info->edev, EXTCON_USB_HOST, attached);
break;
case MAX77843_MUIC_GND_MHL_VB:
case MAX77843_MUIC_GND_MHL:
Expand All @@ -356,7 +356,7 @@ static int max77843_muic_adc_gnd_handler(struct max77843_muic_info *info)
if (ret < 0)
return ret;

extcon_set_cable_state_(info->edev, EXTCON_DISP_MHL, attached);
extcon_set_state_sync(info->edev, EXTCON_DISP_MHL, attached);
break;
default:
dev_err(info->dev, "failed to detect %s accessory(gnd:0x%x)\n",
Expand Down Expand Up @@ -392,7 +392,7 @@ static int max77843_muic_jig_handler(struct max77843_muic_info *info,
if (ret < 0)
return ret;

extcon_set_cable_state_(info->edev, EXTCON_JIG, attached);
extcon_set_state_sync(info->edev, EXTCON_JIG, attached);

return 0;
}
Expand Down Expand Up @@ -486,8 +486,8 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
if (ret < 0)
return ret;

extcon_set_cable_state_(info->edev, EXTCON_USB, attached);
extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SDP,
extcon_set_state_sync(info->edev, EXTCON_USB, attached);
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_SDP,
attached);
break;
case MAX77843_MUIC_CHG_DOWNSTREAM:
Expand All @@ -497,7 +497,7 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
if (ret < 0)
return ret;

extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_CDP,
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_CDP,
attached);
break;
case MAX77843_MUIC_CHG_DEDICATED:
Expand All @@ -507,7 +507,7 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
if (ret < 0)
return ret;

extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP,
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_DCP,
attached);
break;
case MAX77843_MUIC_CHG_SPECIAL_500MA:
Expand All @@ -517,7 +517,7 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
if (ret < 0)
return ret;

extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SLOW,
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_SLOW,
attached);
break;
case MAX77843_MUIC_CHG_SPECIAL_1A:
Expand All @@ -527,7 +527,7 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
if (ret < 0)
return ret;

extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_FAST,
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_FAST,
attached);
break;
case MAX77843_MUIC_CHG_GND:
Expand All @@ -536,10 +536,10 @@ 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, EXTCON_CHG_USB_DCP,
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_DCP,
true);
else if (gnd_type == MAX77843_MUIC_GND_MHL)
extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP,
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_DCP,
false);
break;
case MAX77843_MUIC_CHG_NONE:
Expand Down
Loading

0 comments on commit 8670b45

Please sign in to comment.