Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1483050
| From | Kishon Vijay Abraham I <kishon@ti.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 31/51] extcon: Rename the extcon_set/get_state() to maintain the function naming pattern |
| Date | 2016-09-14 10:00 +0200 |
| Message-ID | <shdgR-6sF-9@gated-at.bofh.it> (permalink) |
| References | <shd7b-6oH-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Chanwoo Choi <cw00.choi@samsung.com>
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>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
drivers/extcon/extcon.c | 28 +++++++++++++---------------
include/linux/extcon.h | 25 ++++++++++++++++++-------
2 files changed, 31 insertions(+), 22 deletions(-)
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 599fc37..d66adfd 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -398,8 +398,7 @@ static ssize_t cable_state_show(struct device *dev,
int i = cable->cable_index;
return sprintf(buf, "%d\n",
- extcon_get_cable_state_(cable->edev,
- cable->edev->supported_cable[i]));
+ extcon_get_state(cable->edev, cable->edev->supported_cable[i]));
}
/**
@@ -495,13 +494,14 @@ static int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state)
}
/**
- * extcon_get_cable_state_() - Get the status of a specific cable.
+ * extcon_get_state() - Get the state of a external connector.
* @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 unsigned int id)
+int extcon_get_state(struct extcon_dev *edev, const unsigned int id)
{
- int index;
+ int index, state;
+ unsigned long flags;
if (!edev)
return -EINVAL;
@@ -510,22 +510,23 @@ int extcon_get_cable_state_(struct extcon_dev *edev, const unsigned int id)
if (index < 0)
return index;
- if (edev->max_supported && edev->max_supported <= index)
- return -EINVAL;
+ spin_lock_irqsave(&edev->lock, flags);
+ state = is_extcon_attached(edev, index);
+ spin_unlock_irqrestore(&edev->lock, flags);
- return is_extcon_attached(edev, index);
+ return state;
}
-EXPORT_SYMBOL_GPL(extcon_get_cable_state_);
+EXPORT_SYMBOL_GPL(extcon_get_state);
/**
- * extcon_set_cable_state_() - Set the status of a specific cable.
+ * extcon_set_state() - Set the state of a external connector.
* @edev: the extcon device that has the cable.
* @id: the unique id of each external connector
* in extcon enumeration.
* @state: the new cable status. The default semantics is
* true: attached / false: detached.
*/
-int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id,
+int extcon_set_state(struct extcon_dev *edev, unsigned int id,
bool cable_state)
{
u32 state;
@@ -538,9 +539,6 @@ int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id,
if (index < 0)
return index;
- if (edev->max_supported && edev->max_supported <= index)
- return -EINVAL;
-
/*
* Initialize the value of extcon property before setting
* the detached state for an external connector.
@@ -551,7 +549,7 @@ int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id,
state = cable_state ? (1 << index) : 0;
return extcon_update_state(edev, 1 << index, state);
}
-EXPORT_SYMBOL_GPL(extcon_set_cable_state_);
+EXPORT_SYMBOL_GPL(extcon_set_state);
/**
* extcon_get_property() - Get the property value of a specific cable.
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index f084690..4fa3738 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -216,11 +216,11 @@ extern struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
extern void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev);
/*
- * get/set_cable_state access each bit of the 32b encoded state value.
+ * get/set_state access each bit of the 32b encoded state value.
* They are used to access the status of each cable based on the cable id.
*/
-extern int extcon_get_cable_state_(struct extcon_dev *edev, unsigned int id);
-extern int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id,
+extern int extcon_get_state(struct extcon_dev *edev, unsigned int id);
+extern int extcon_set_state(struct extcon_dev *edev, unsigned int id,
bool cable_state);
/*
@@ -305,14 +305,14 @@ static inline struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
static inline void devm_extcon_dev_free(struct extcon_dev *edev) { }
-static inline int extcon_get_cable_state_(struct extcon_dev *edev,
- unsigned int id)
+
+static inline int extcon_get_state(struct extcon_dev *edev, unsigned int id)
{
return 0;
}
-static inline int extcon_set_cable_state_(struct extcon_dev *edev,
- unsigned int id, bool cable_state)
+static inline int extcon_set_state(struct extcon_dev *edev, unsigned int id,
+ bool cable_state)
{
return 0;
}
@@ -402,4 +402,15 @@ static inline int extcon_unregister_interest(struct extcon_specific_cable_nb
{
return -EINVAL;
}
+
+static inline int extcon_get_cable_state_(struct extcon_dev *edev, unsigned int id)
+{
+ return extcon_get_state(edev, id);
+}
+
+static inline int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id,
+ bool cable_state)
+{
+ return extcon_set_state(edev, id, cable_state);
+}
#endif /* __LINUX_EXTCON_H__ */
--
1.7.9.5
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[GIT PULL] phy: for 4.9 Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
[PATCH 38/51] phy: Add USB Type-C PHY driver for rk3399 Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
[PATCH 34/51] extcon: Add new EXTCON_DISP_HMD for Head-mounted Display device Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
[PATCH 48/51] phy: rockchip-usb: use rockchip_usb_phy_reset to reset phy during wakeup Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
[PATCH 14/51] phy: rcar-gen3-usb2: revise the example of device tree doc Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
[PATCH 36/51] extcon: Introduce EXTCON_PROP_USB_SS property for SuperSpeed mode Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
[PATCH 46/51] phy-sun4i-usb: Warn when external vbus is detected Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
[PATCH 43/51] phy-sun4i-usb: Refactor forced session ending Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
[PATCH 10/51] phy: tegra: add missing header dependencies Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
[PATCH 37/51] phy: da8xx-usb: Fix syscon device name Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
[PATCH 05/51] phy: qcom-ufs: use of_property_read_bool Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
[PATCH 32/51] extcon: Add the synchronization extcon APIs to support the notification Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
[PATCH 33/51] extcon: Add EXTCON_DISP_DP and the property for USB Type-C Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
[PATCH 42/51] phy-sun4i-usb: Use bool where appropriate Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
[PATCH 51/51] phy-twl4030-usb: initialize charging-related stuff via pm_runtime Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
[PATCH 39/51] Documentation: bindings: add dt doc for Rockchip USB Type-C PHY Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 09:50 +0200
[PATCH 29/51] extcon: Add the support for extcon property according to extcon type Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
[PATCH 08/51] Documentation: bindings: add dt documentation for Rockchip PCIe PHY Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
[PATCH 03/51] phy: sun4i: add support for A64 usb phy Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
[PATCH 31/51] extcon: Rename the extcon_set/get_state() to maintain the function naming pattern Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
[PATCH 23/51] extcon: adc-jack: Remove the usage of extcon_set_state() Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
[PATCH 30/51] extcon: Add the support for the capability of each property Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
[PATCH 01/51] phy: exynos5-usbdrd: Remove "static" from local variable Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
[PATCH 07/51] phy: rockchip-inno-usb2: add a new driver for Rockchip usb2phy Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
[PATCH 27/51] extcon: Fix compile time warning Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
[PATCH 18/51] phy: rockchip-inno-usb2: add COMMON_CLK dependency Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
[PATCH 11/51] phy: tegra: mark tegra_xusb_lane_lookup_function() static Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
[PATCH 16/51] phy: omap-usb2: support suspend/resume Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
[PATCH 26/51] extcon: Block the bit masking operation for cable state except for extcon core Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
[PATCH 09/51] phy: add a driver for the Rockchip SoC internal PCIe PHY Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
[PATCH 24/51] extcon: gpio: Remove the usage of extcon_set_state() Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
[PATCH 19/51] extcon: adc-jack: update cable state during boot Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
[PATCH 13/51] phy: bcm-ns2-pcie: Set missing .owner field in ns2_pci_phy_ops Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
[PATCH 22/51] extcon: arizona: Remove the usage of extcon_update_state() Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
[PATCH 21/51] extcon: arizona: Remove unneeded semi-colon Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
[PATCH 04/51] phy: bcm-ns-usb3: new driver for USB 3.0 PHY on Northstar Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-14 10:00 +0200
Re: [GIT PULL] phy: for 4.9 Greg KH <gregkh@linuxfoundation.org> - 2016-09-15 10:50 +0200
Re: [GIT PULL] phy: for 4.9 Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-15 12:30 +0200
Re: [GIT PULL] phy: for 4.9 Greg KH <gregkh@linuxfoundation.org> - 2016-09-15 12:40 +0200
Re: [GIT PULL] phy: for 4.9 Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-15 13:00 +0200
Re: [GIT PULL] phy: for 4.9 Kishon Vijay Abraham I <kishon@ti.com> - 2016-09-15 13:20 +0200
csiph-web