From: Robert Baldyga <r.baldyga@samsung.com>
Cc: robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com,
ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
rob@landley.net, myungjoo.ham@samsung.com, cw00.choi@samsung.com,
dbaryshkov@gmail.com, dwmw2@infradead.org, balbi@ti.com,
gregkh@linuxfoundation.org, grant.likely@linaro.org,
ldewangan@nvidia.com, kishon@ti.com, gg@slimlogic.co.uk,
anton@enomsg.org, jonghwa3.lee@samsung.com, rongjun.ying@csr.com,
linux@roeck-us.net, aaro.koskinen@iki.fi, tony@atomide.com,
devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org,
patches@opensource.wolfsonmicro.com, linux-usb@vger.kernel.org,
linux-omap@vger.kernel.org,
Robert Baldyga <r.baldyga@samsung.com>
Subject: [PATCH 07/13] extcon: extcon-class: improve get_cable_state_()/set_cable_state_() functions
Date: Thu, 10 Apr 2014 15:16:45 +0200 [thread overview]
Message-ID: <1397135811-12866-8-git-send-email-r.baldyga@samsung.com> (raw)
In-Reply-To: <1397135811-12866-1-git-send-email-r.baldyga@samsung.com>
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
next prev parent reply other threads:[~2014-04-10 13:16 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-10 13:16 [PATCH 00/13] extcon: major rework Robert Baldyga
2014-04-10 13:16 ` [PATCH 01/13] Documentation: add extcon devicetree bindings Robert Baldyga
2014-04-10 13:16 ` [PATCH 03/13] extcon: extcon-class: remove extcon_set_cable_state() function Robert Baldyga
2014-04-10 13:16 ` [PATCH 04/13] extcon: extcon-class: match extcon device by devicetree node Robert Baldyga
[not found] ` <1397135811-12866-1-git-send-email-r.baldyga-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-04-10 13:16 ` [PATCH 02/13] Documentation: update charger-manager devicetree bindings Robert Baldyga
2014-04-10 13:16 ` [PATCH 05/13] extcon: extcon-class: improve extcon client API Robert Baldyga
[not found] ` <1397135811-12866-6-git-send-email-r.baldyga-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-04-10 18:09 ` Aaro Koskinen
2014-04-10 13:16 ` [PATCH 06/13] extcon: extcon-class: remove unused functions Robert Baldyga
2014-04-10 13:16 ` Robert Baldyga [this message]
2014-04-10 13:16 ` [PATCH 08/13] extcon: extcon-class: simplify extcon_updata_state() function Robert Baldyga
2014-04-10 13:16 ` [PATCH 09/13] extcon: extcon-class: move example to Documentation Robert Baldyga
2014-04-10 13:16 ` [PATCH 10/13] extcon: extcon-gpio: add devicetree support Robert Baldyga
2014-04-10 13:16 ` [PATCH 11/13] extcon: extcon-adc-jack: " Robert Baldyga
2014-04-10 13:16 ` [PATCH 12/13] extcon: extcon-max8997: check if pdata exists Robert Baldyga
2014-04-10 13:16 ` [PATCH 13/13] extcon: extcon-max77693: " Robert Baldyga
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1397135811-12866-8-git-send-email-r.baldyga@samsung.com \
--to=r.baldyga@samsung.com \
--cc=aaro.koskinen@iki.fi \
--cc=anton@enomsg.org \
--cc=balbi@ti.com \
--cc=cw00.choi@samsung.com \
--cc=dbaryshkov@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dwmw2@infradead.org \
--cc=galak@codeaurora.org \
--cc=gg@slimlogic.co.uk \
--cc=grant.likely@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=jonghwa3.lee@samsung.com \
--cc=kishon@ti.com \
--cc=ldewangan@nvidia.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=mark.rutland@arm.com \
--cc=myungjoo.ham@samsung.com \
--cc=patches@opensource.wolfsonmicro.com \
--cc=pawel.moll@arm.com \
--cc=rob@landley.net \
--cc=robh+dt@kernel.org \
--cc=rongjun.ying@csr.com \
--cc=tony@atomide.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).