lkml.org 
[lkml]   [2014]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 07/13] extcon: extcon-class: improve get_cable_state_()/set_cable_state_() functions
Date
Added check if pointer to edev is not NULL, and updated documentation of index
parameter. Function extcon_find_cable_index() has been deleted and cannot be
used to retrieve cable number.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
---
drivers/extcon/extcon-class.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
index 2be0ac9..2659805 100644
--- a/drivers/extcon/extcon-class.c
+++ b/drivers/extcon/extcon-class.c
@@ -285,10 +285,12 @@ EXPORT_SYMBOL_GPL(extcon_set_state);
/**
* 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().
+ * @index: cable index in extcon device.
*/
int extcon_get_cable_state_(struct extcon_dev *edev, int index)
{
+ if (!edev)
+ return -ENODEV;
if (index < 0 || (edev->max_supported && edev->max_supported <= index))
return -EINVAL;

@@ -312,8 +314,7 @@ 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().
+ * @index: cable index in extcon device.
* @cable_state: the new cable status. The default semantics is
* true: attached / false: detached.
*/
@@ -322,6 +323,8 @@ int extcon_set_cable_state_(struct extcon_dev *edev,
{
u32 state;

+ if (!edev)
+ return -ENODEV;
if (index < 0 || (edev->max_supported && edev->max_supported <= index))
return -EINVAL;

--
1.7.9.5


\
 
 \ /
  Last update: 2014-04-10 16:01    [W:0.078 / U:1.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site