]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
extcon: Simplify extcon_dev_register() prototype by removing unnecessary parameter
authorChanwoo Choi <cw00.choi@samsung.com>
Fri, 27 Sep 2013 00:20:26 +0000 (09:20 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Fri, 27 Sep 2013 00:37:01 +0000 (09:37 +0900)
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>
Documentation/extcon/porting-android-switch-class
drivers/extcon/extcon-adc-jack.c
drivers/extcon/extcon-arizona.c
drivers/extcon/extcon-class.c
drivers/extcon/extcon-gpio.c
drivers/extcon/extcon-max77693.c
drivers/extcon/extcon-max8997.c
drivers/extcon/extcon-palmas.c
include/linux/extcon.h

index eb0fa5f4fe88f4b6e6b2b381f41561367bd80be8..5377f63179613e6f09721bf878e52e7f04a141a8 100644 (file)
@@ -25,8 +25,10 @@ MyungJoo Ham <myungjoo.ham@samsung.com>
     @print_state: no change but type change (switch_dev->extcon_dev)
 
 - switch_dev_register(sdev, dev)
-       => extcon_dev_register(edev, dev)
-       : no change but type change (sdev->edev)
+       => extcon_dev_register(edev)
+       : type change (sdev->edev)
+       : remove second param('dev'). if edev has parent device, should store
+         'dev' to 'edev.dev.parent' before registering extcon device
 - switch_dev_unregister(sdev)
        => extcon_dev_unregister(edev)
        : no change but type change (sdev->edev)
index dcbade667d0cf5234760d87a41be3bfd489c4870..e23f1c2e505366dd24cb2ff6037f31074f7331ff 100644 (file)
@@ -110,6 +110,7 @@ static int adc_jack_probe(struct platform_device *pdev)
                goto out;
        }
 
+       data->edev.dev.parent = &pdev->dev;
        data->edev.supported_cable = pdata->cable_names;
 
        /* Check the length of array and set num_cables */
@@ -148,7 +149,7 @@ static int adc_jack_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, data);
 
-       err = extcon_dev_register(&data->edev, &pdev->dev);
+       err = extcon_dev_register(&data->edev);
        if (err)
                goto out;
 
index e54ce08f669cb1b5b9c1b6a6b18cd2c4a99eb99e..ec9a14e05fddd22313c25615570cbc0515d62ec9 100644 (file)
@@ -1130,9 +1130,10 @@ static int arizona_extcon_probe(struct platform_device *pdev)
        }
 
        info->edev.name = "Headset Jack";
+       info->edev.dev.parent = arizona->dev;
        info->edev.supported_cable = arizona_cable;
 
-       ret = extcon_dev_register(&info->edev, arizona->dev);
+       ret = extcon_dev_register(&info->edev);
        if (ret < 0) {
                dev_err(arizona->dev, "extcon_dev_register() failed: %d\n",
                        ret);
index 2801c14d523267652d60e13307d4fa041f7d84cb..84902d3fee117cb8eb820e7e51de613f407c1c35 100644 (file)
@@ -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) {
index b02c670ef01dd8d50d6803cab143cb3853240004..7e0dff58e4943e8b1b09a44c4adba854898cda9d 100644 (file)
@@ -98,6 +98,7 @@ static int gpio_extcon_probe(struct platform_device *pdev)
                return -ENOMEM;
 
        extcon_data->edev.name = pdata->name;
+       extcon_data->edev.dev.parent = &pdev->dev;
        extcon_data->gpio = pdata->gpio;
        extcon_data->gpio_active_low = pdata->gpio_active_low;
        extcon_data->state_on = pdata->state_on;
@@ -112,7 +113,7 @@ static int gpio_extcon_probe(struct platform_device *pdev)
                                msecs_to_jiffies(pdata->debounce);
        }
 
-       ret = extcon_dev_register(&extcon_data->edev, &pdev->dev);
+       ret = extcon_dev_register(&extcon_data->edev);
        if (ret < 0)
                return ret;
 
index 4849ea1e92f6dbd7cabeab958f52b7c659fb8e32..ab9bc24e1a52e1b0c6fc27709faec5c881424279 100644 (file)
@@ -1171,8 +1171,9 @@ static int max77693_muic_probe(struct platform_device *pdev)
                goto err_irq;
        }
        info->edev->name = DEV_NAME;
+       info->edev->dev.parent = &pdev->dev;
        info->edev->supported_cable = max77693_extcon_cable;
-       ret = extcon_dev_register(info->edev, NULL);
+       ret = extcon_dev_register(info->edev);
        if (ret) {
                dev_err(&pdev->dev, "failed to register extcon device\n");
                goto err_irq;
index e55ec38b41484d0cfbc819643a4b32f9418f52cd..0b1cbb5fdf9eea8e9f8b0270492d94c90eeef359 100644 (file)
@@ -705,8 +705,9 @@ static int max8997_muic_probe(struct platform_device *pdev)
                goto err_irq;
        }
        info->edev->name = DEV_NAME;
+       info->edev->dev.parent = &pdev->dev;
        info->edev->supported_cable = max8997_extcon_cable;
-       ret = extcon_dev_register(info->edev, NULL);
+       ret = extcon_dev_register(info->edev);
        if (ret) {
                dev_err(&pdev->dev, "failed to register extcon device\n");
                goto err_irq;
index 0c2fb68fb7917a6c1512fad07bcba80f9a77996b..6c91976dd82371d63008474cb030aa7e4cfeb507 100644 (file)
@@ -178,9 +178,10 @@ static int palmas_usb_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, palmas_usb);
 
        palmas_usb->edev.supported_cable = palmas_extcon_cable;
+       palmas_usb->edev.dev.parent = palmas_usb->dev;
        palmas_usb->edev.mutually_exclusive = mutually_exclusive;
 
-       status = extcon_dev_register(&palmas_usb->edev, palmas_usb->dev);
+       status = extcon_dev_register(&palmas_usb->edev);
        if (status) {
                dev_err(&pdev->dev, "failed to register extcon device\n");
                return status;
index 0269bafb0ee89e2ebd757d0ff824fe2833c7ba2a..21c59af1150b57588fbe697c9ef9fe38aacff06f 100644 (file)
@@ -183,7 +183,7 @@ struct extcon_specific_cable_nb {
  * Following APIs are for notifiers or configurations.
  * Notifiers are the external port and connection devices.
  */
-extern int extcon_dev_register(struct extcon_dev *edev, struct device *dev);
+extern int extcon_dev_register(struct extcon_dev *edev);
 extern void extcon_dev_unregister(struct extcon_dev *edev);
 extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name);
 
@@ -241,8 +241,7 @@ extern int extcon_register_notifier(struct extcon_dev *edev,
 extern int extcon_unregister_notifier(struct extcon_dev *edev,
                                      struct notifier_block *nb);
 #else /* CONFIG_EXTCON */
-static inline int extcon_dev_register(struct extcon_dev *edev,
-                                     struct device *dev)
+static inline int extcon_dev_register(struct extcon_dev *edev)
 {
        return 0;
 }