diff options
author | Chanwoo Choi <cw00.choi@samsung.com> | 2016-07-22 00:03:17 -0400 |
---|---|---|
committer | Chanwoo Choi <cw00.choi@samsung.com> | 2016-08-07 22:17:22 -0400 |
commit | 575c2b867ee0c2affdd309f375c032c0c7dc219c (patch) | |
tree | cd9058ac27c503a659a78f1c6a9424fdebb67b10 /drivers/extcon/extcon.c | |
parent | 7f2a0a1699b51bfd738f1e0b15e057996fe1f259 (diff) |
extcon: Rename the extcon_set/get_state() to maintain the function naming pattern
This patch just renames the existing extcon_get/set_cable_state_()
as following because of maintaining the function naming pattern
like as extcon APIs for property.
- extcon_set_cable_state_() -> extcon_set_state()
- extcon_get_cable_state_() -> extcon_get_state()
But, this patch remains the old extcon_set/get_cable_state_() functions
to prevent the build break. After altering new APIs, remove the old APIs.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Diffstat (limited to 'drivers/extcon/extcon.c')
-rw-r--r-- | drivers/extcon/extcon.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index 599fc377a965..d66adfd21159 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c | |||
@@ -398,8 +398,7 @@ static ssize_t cable_state_show(struct device *dev, | |||
398 | int i = cable->cable_index; | 398 | int i = cable->cable_index; |
399 | 399 | ||
400 | return sprintf(buf, "%d\n", | 400 | return sprintf(buf, "%d\n", |
401 | extcon_get_cable_state_(cable->edev, | 401 | extcon_get_state(cable->edev, cable->edev->supported_cable[i])); |
402 | cable->edev->supported_cable[i])); | ||
403 | } | 402 | } |
404 | 403 | ||
405 | /** | 404 | /** |
@@ -495,13 +494,14 @@ static int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state) | |||
495 | } | 494 | } |
496 | 495 | ||
497 | /** | 496 | /** |
498 | * extcon_get_cable_state_() - Get the status of a specific cable. | 497 | * extcon_get_state() - Get the state of a external connector. |
499 | * @edev: the extcon device that has the cable. | 498 | * @edev: the extcon device that has the cable. |
500 | * @id: the unique id of each external connector in extcon enumeration. | 499 | * @id: the unique id of each external connector in extcon enumeration. |
501 | */ | 500 | */ |
502 | int extcon_get_cable_state_(struct extcon_dev *edev, const unsigned int id) | 501 | int extcon_get_state(struct extcon_dev *edev, const unsigned int id) |
503 | { | 502 | { |
504 | int index; | 503 | int index, state; |
504 | unsigned long flags; | ||
505 | 505 | ||
506 | if (!edev) | 506 | if (!edev) |
507 | return -EINVAL; | 507 | return -EINVAL; |
@@ -510,22 +510,23 @@ int extcon_get_cable_state_(struct extcon_dev *edev, const unsigned int id) | |||
510 | if (index < 0) | 510 | if (index < 0) |
511 | return index; | 511 | return index; |
512 | 512 | ||
513 | if (edev->max_supported && edev->max_supported <= index) | 513 | spin_lock_irqsave(&edev->lock, flags); |
514 | return -EINVAL; | 514 | state = is_extcon_attached(edev, index); |
515 | spin_unlock_irqrestore(&edev->lock, flags); | ||
515 | 516 | ||
516 | return is_extcon_attached(edev, index); | 517 | return state; |
517 | } | 518 | } |
518 | EXPORT_SYMBOL_GPL(extcon_get_cable_state_); | 519 | EXPORT_SYMBOL_GPL(extcon_get_state); |
519 | 520 | ||
520 | /** | 521 | /** |
521 | * extcon_set_cable_state_() - Set the status of a specific cable. | 522 | * extcon_set_state() - Set the state of a external connector. |
522 | * @edev: the extcon device that has the cable. | 523 | * @edev: the extcon device that has the cable. |
523 | * @id: the unique id of each external connector | 524 | * @id: the unique id of each external connector |
524 | * in extcon enumeration. | 525 | * in extcon enumeration. |
525 | * @state: the new cable status. The default semantics is | 526 | * @state: the new cable status. The default semantics is |
526 | * true: attached / false: detached. | 527 | * true: attached / false: detached. |
527 | */ | 528 | */ |
528 | int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id, | 529 | int extcon_set_state(struct extcon_dev *edev, unsigned int id, |
529 | bool cable_state) | 530 | bool cable_state) |
530 | { | 531 | { |
531 | u32 state; | 532 | u32 state; |
@@ -538,9 +539,6 @@ int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id, | |||
538 | if (index < 0) | 539 | if (index < 0) |
539 | return index; | 540 | return index; |
540 | 541 | ||
541 | if (edev->max_supported && edev->max_supported <= index) | ||
542 | return -EINVAL; | ||
543 | |||
544 | /* | 542 | /* |
545 | * Initialize the value of extcon property before setting | 543 | * Initialize the value of extcon property before setting |
546 | * the detached state for an external connector. | 544 | * the detached state for an external connector. |
@@ -551,7 +549,7 @@ int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id, | |||
551 | state = cable_state ? (1 << index) : 0; | 549 | state = cable_state ? (1 << index) : 0; |
552 | return extcon_update_state(edev, 1 << index, state); | 550 | return extcon_update_state(edev, 1 << index, state); |
553 | } | 551 | } |
554 | EXPORT_SYMBOL_GPL(extcon_set_cable_state_); | 552 | EXPORT_SYMBOL_GPL(extcon_set_state); |
555 | 553 | ||
556 | /** | 554 | /** |
557 | * extcon_get_property() - Get the property value of a specific cable. | 555 | * extcon_get_property() - Get the property value of a specific cable. |