aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChanwoo Choi <cw00.choi@samsung.com>2013-09-26 20:20:26 -0400
committerChanwoo Choi <cw00.choi@samsung.com>2013-09-26 20:37:01 -0400
commit42d7d7539a7bcf1d493b989465283c464f4a0525 (patch)
treea62b2043514378cabaf629b865612e5019ff29e4
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>
-rw-r--r--Documentation/extcon/porting-android-switch-class6
-rw-r--r--drivers/extcon/extcon-adc-jack.c3
-rw-r--r--drivers/extcon/extcon-arizona.c3
-rw-r--r--drivers/extcon/extcon-class.c11
-rw-r--r--drivers/extcon/extcon-gpio.c3
-rw-r--r--drivers/extcon/extcon-max77693.c3
-rw-r--r--drivers/extcon/extcon-max8997.c3
-rw-r--r--drivers/extcon/extcon-palmas.c3
-rw-r--r--include/linux/extcon.h5
9 files changed, 25 insertions, 15 deletions
diff --git a/Documentation/extcon/porting-android-switch-class b/Documentation/extcon/porting-android-switch-class
index eb0fa5f4fe88..5377f6317961 100644
--- a/Documentation/extcon/porting-android-switch-class
+++ b/Documentation/extcon/porting-android-switch-class
@@ -25,8 +25,10 @@ MyungJoo Ham <myungjoo.ham@samsung.com>
25 @print_state: no change but type change (switch_dev->extcon_dev) 25 @print_state: no change but type change (switch_dev->extcon_dev)
26 26
27- switch_dev_register(sdev, dev) 27- switch_dev_register(sdev, dev)
28 => extcon_dev_register(edev, dev) 28 => extcon_dev_register(edev)
29 : no change but type change (sdev->edev) 29 : type change (sdev->edev)
30 : remove second param('dev'). if edev has parent device, should store
31 'dev' to 'edev.dev.parent' before registering extcon device
30- switch_dev_unregister(sdev) 32- switch_dev_unregister(sdev)
31 => extcon_dev_unregister(edev) 33 => extcon_dev_unregister(edev)
32 : no change but type change (sdev->edev) 34 : no change but type change (sdev->edev)
diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c
index dcbade667d0c..e23f1c2e5053 100644
--- a/drivers/extcon/extcon-adc-jack.c
+++ b/drivers/extcon/extcon-adc-jack.c
@@ -110,6 +110,7 @@ static int adc_jack_probe(struct platform_device *pdev)
110 goto out; 110 goto out;
111 } 111 }
112 112
113 data->edev.dev.parent = &pdev->dev;
113 data->edev.supported_cable = pdata->cable_names; 114 data->edev.supported_cable = pdata->cable_names;
114 115
115 /* Check the length of array and set num_cables */ 116 /* Check the length of array and set num_cables */
@@ -148,7 +149,7 @@ static int adc_jack_probe(struct platform_device *pdev)
148 149
149 platform_set_drvdata(pdev, data); 150 platform_set_drvdata(pdev, data);
150 151
151 err = extcon_dev_register(&data->edev, &pdev->dev); 152 err = extcon_dev_register(&data->edev);
152 if (err) 153 if (err)
153 goto out; 154 goto out;
154 155
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index e54ce08f669c..ec9a14e05fdd 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -1130,9 +1130,10 @@ static int arizona_extcon_probe(struct platform_device *pdev)
1130 } 1130 }
1131 1131
1132 info->edev.name = "Headset Jack"; 1132 info->edev.name = "Headset Jack";
1133 info->edev.dev.parent = arizona->dev;
1133 info->edev.supported_cable = arizona_cable; 1134 info->edev.supported_cable = arizona_cable;
1134 1135
1135 ret = extcon_dev_register(&info->edev, arizona->dev); 1136 ret = extcon_dev_register(&info->edev);
1136 if (ret < 0) { 1137 if (ret < 0) {
1137 dev_err(arizona->dev, "extcon_dev_register() failed: %d\n", 1138 dev_err(arizona->dev, "extcon_dev_register() failed: %d\n",
1138 ret); 1139 ret);
diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
index 2801c14d5232..84902d3fee11 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)
566/** 566/**
567 * extcon_dev_register() - Register a new extcon device 567 * extcon_dev_register() - Register a new extcon device
568 * @edev : the new extcon device (should be allocated before calling) 568 * @edev : the new extcon device (should be allocated before calling)
569 * @dev : the parent device for this extcon device.
570 * 569 *
571 * Among the members of edev struct, please set the "user initializing data" 570 * Among the members of edev struct, please set the "user initializing data"
572 * in any case and set the "optional callbacks" if required. However, please 571 * in any case and set the "optional callbacks" if required. However, please
573 * do not set the values of "internal data", which are initialized by 572 * do not set the values of "internal data", which are initialized by
574 * this function. 573 * this function.
575 */ 574 */
576int extcon_dev_register(struct extcon_dev *edev, struct device *dev) 575int extcon_dev_register(struct extcon_dev *edev)
577{ 576{
578 int ret, index = 0; 577 int ret, index = 0;
579 578
@@ -597,11 +596,15 @@ int extcon_dev_register(struct extcon_dev *edev, struct device *dev)
597 return -EINVAL; 596 return -EINVAL;
598 } 597 }
599 598
600 edev->dev.parent = dev;
601 edev->dev.class = extcon_class; 599 edev->dev.class = extcon_class;
602 edev->dev.release = extcon_dev_release; 600 edev->dev.release = extcon_dev_release;
603 601
604 edev->name = edev->name ? edev->name : dev_name(dev); 602 edev->name = edev->name ? edev->name : dev_name(edev->dev.parent);
603 if (IS_ERR_OR_NULL(edev->name)) {
604 dev_err(&edev->dev,
605 "extcon device name is null\n");
606 return -EINVAL;
607 }
605 dev_set_name(&edev->dev, "%s", edev->name); 608 dev_set_name(&edev->dev, "%s", edev->name);
606 609
607 if (edev->max_supported) { 610 if (edev->max_supported) {
diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
index b02c670ef01d..7e0dff58e494 100644
--- a/drivers/extcon/extcon-gpio.c
+++ b/drivers/extcon/extcon-gpio.c
@@ -98,6 +98,7 @@ static int gpio_extcon_probe(struct platform_device *pdev)
98 return -ENOMEM; 98 return -ENOMEM;
99 99
100 extcon_data->edev.name = pdata->name; 100 extcon_data->edev.name = pdata->name;
101 extcon_data->edev.dev.parent = &pdev->dev;
101 extcon_data->gpio = pdata->gpio; 102 extcon_data->gpio = pdata->gpio;
102 extcon_data->gpio_active_low = pdata->gpio_active_low; 103 extcon_data->gpio_active_low = pdata->gpio_active_low;
103 extcon_data->state_on = pdata->state_on; 104 extcon_data->state_on = pdata->state_on;
@@ -112,7 +113,7 @@ static int gpio_extcon_probe(struct platform_device *pdev)
112 msecs_to_jiffies(pdata->debounce); 113 msecs_to_jiffies(pdata->debounce);
113 } 114 }
114 115
115 ret = extcon_dev_register(&extcon_data->edev, &pdev->dev); 116 ret = extcon_dev_register(&extcon_data->edev);
116 if (ret < 0) 117 if (ret < 0)
117 return ret; 118 return ret;
118 119
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index 4849ea1e92f6..ab9bc24e1a52 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -1171,8 +1171,9 @@ static int max77693_muic_probe(struct platform_device *pdev)
1171 goto err_irq; 1171 goto err_irq;
1172 } 1172 }
1173 info->edev->name = DEV_NAME; 1173 info->edev->name = DEV_NAME;
1174 info->edev->dev.parent = &pdev->dev;
1174 info->edev->supported_cable = max77693_extcon_cable; 1175 info->edev->supported_cable = max77693_extcon_cable;
1175 ret = extcon_dev_register(info->edev, NULL); 1176 ret = extcon_dev_register(info->edev);
1176 if (ret) { 1177 if (ret) {
1177 dev_err(&pdev->dev, "failed to register extcon device\n"); 1178 dev_err(&pdev->dev, "failed to register extcon device\n");
1178 goto err_irq; 1179 goto err_irq;
diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
index e55ec38b4148..0b1cbb5fdf9e 100644
--- a/drivers/extcon/extcon-max8997.c
+++ b/drivers/extcon/extcon-max8997.c
@@ -705,8 +705,9 @@ static int max8997_muic_probe(struct platform_device *pdev)
705 goto err_irq; 705 goto err_irq;
706 } 706 }
707 info->edev->name = DEV_NAME; 707 info->edev->name = DEV_NAME;
708 info->edev->dev.parent = &pdev->dev;
708 info->edev->supported_cable = max8997_extcon_cable; 709 info->edev->supported_cable = max8997_extcon_cable;
709 ret = extcon_dev_register(info->edev, NULL); 710 ret = extcon_dev_register(info->edev);
710 if (ret) { 711 if (ret) {
711 dev_err(&pdev->dev, "failed to register extcon device\n"); 712 dev_err(&pdev->dev, "failed to register extcon device\n");
712 goto err_irq; 713 goto err_irq;
diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c
index 0c2fb68fb791..6c91976dd823 100644
--- a/drivers/extcon/extcon-palmas.c
+++ b/drivers/extcon/extcon-palmas.c
@@ -178,9 +178,10 @@ static int palmas_usb_probe(struct platform_device *pdev)
178 platform_set_drvdata(pdev, palmas_usb); 178 platform_set_drvdata(pdev, palmas_usb);
179 179
180 palmas_usb->edev.supported_cable = palmas_extcon_cable; 180 palmas_usb->edev.supported_cable = palmas_extcon_cable;
181 palmas_usb->edev.dev.parent = palmas_usb->dev;
181 palmas_usb->edev.mutually_exclusive = mutually_exclusive; 182 palmas_usb->edev.mutually_exclusive = mutually_exclusive;
182 183
183 status = extcon_dev_register(&palmas_usb->edev, palmas_usb->dev); 184 status = extcon_dev_register(&palmas_usb->edev);
184 if (status) { 185 if (status) {
185 dev_err(&pdev->dev, "failed to register extcon device\n"); 186 dev_err(&pdev->dev, "failed to register extcon device\n");
186 return status; 187 return status;
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index 0269bafb0ee8..21c59af1150b 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -183,7 +183,7 @@ struct extcon_specific_cable_nb {
183 * Following APIs are for notifiers or configurations. 183 * Following APIs are for notifiers or configurations.
184 * Notifiers are the external port and connection devices. 184 * Notifiers are the external port and connection devices.
185 */ 185 */
186extern int extcon_dev_register(struct extcon_dev *edev, struct device *dev); 186extern int extcon_dev_register(struct extcon_dev *edev);
187extern void extcon_dev_unregister(struct extcon_dev *edev); 187extern void extcon_dev_unregister(struct extcon_dev *edev);
188extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name); 188extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name);
189 189
@@ -241,8 +241,7 @@ extern int extcon_register_notifier(struct extcon_dev *edev,
241extern int extcon_unregister_notifier(struct extcon_dev *edev, 241extern int extcon_unregister_notifier(struct extcon_dev *edev,
242 struct notifier_block *nb); 242 struct notifier_block *nb);
243#else /* CONFIG_EXTCON */ 243#else /* CONFIG_EXTCON */
244static inline int extcon_dev_register(struct extcon_dev *edev, 244static inline int extcon_dev_register(struct extcon_dev *edev)
245 struct device *dev)
246{ 245{
247 return 0; 246 return 0;
248} 247}