summaryrefslogtreecommitdiffstats
path: root/drivers/extcon/extcon-class.c
diff options
context:
space:
mode:
authorChanwoo Choi <cw00.choi@samsung.com>2013-09-27 09:20:26 +0900
committerChanwoo Choi <cw00.choi@samsung.com>2013-09-27 09:37:01 +0900
commit42d7d7539a7bcf1d493b989465283c464f4a0525 (patch)
treea62b2043514378cabaf629b865612e5019ff29e4 /drivers/extcon/extcon-class.c
parentdae616512476024aa61d2a598461ab6eff8c0709 (diff)
extcon: Simplify extcon_dev_register() prototype by removing unnecessary parameter
This patch remove extcon_dev_register()'s second parameter which means the pointer of parent device to simplify prototype of this function. So, if extcon device has the parent device, it should set the pointer of parent device to edev.dev.parent in extcon device driver instead of in extcon_dev_register(). Cc: Graeme Gregory <gg@slimlogic.co.uk> Cc: Kishon Vijay Abraham I <kishon@ti.com> Cc: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Cc: Mark Brown <broonie@kernel.org> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Diffstat (limited to 'drivers/extcon/extcon-class.c')
-rw-r--r--drivers/extcon/extcon-class.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
index 2801c14d523..84902d3fee1 100644
--- a/drivers/extcon/extcon-class.c
+++ b/drivers/extcon/extcon-class.c
@@ -566,14 +566,13 @@ static void dummy_sysfs_dev_release(struct device *dev)
/**
* extcon_dev_register() - Register a new extcon device
* @edev : the new extcon device (should be allocated before calling)
- * @dev : the parent device for this extcon device.
*
* Among the members of edev struct, please set the "user initializing data"
* in any case and set the "optional callbacks" if required. However, please
* do not set the values of "internal data", which are initialized by
* this function.
*/
-int extcon_dev_register(struct extcon_dev *edev, struct device *dev)
+int extcon_dev_register(struct extcon_dev *edev)
{
int ret, index = 0;
@@ -597,11 +596,15 @@ int extcon_dev_register(struct extcon_dev *edev, struct device *dev)
return -EINVAL;
}
- edev->dev.parent = dev;
edev->dev.class = extcon_class;
edev->dev.release = extcon_dev_release;
- edev->name = edev->name ? edev->name : dev_name(dev);
+ edev->name = edev->name ? edev->name : dev_name(edev->dev.parent);
+ if (IS_ERR_OR_NULL(edev->name)) {
+ dev_err(&edev->dev,
+ "extcon device name is null\n");
+ return -EINVAL;
+ }
dev_set_name(&edev->dev, "%s", edev->name);
if (edev->max_supported) {