Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'char-misc-3.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char/misc driver fixes from Greg Kroah-Hartman:
"Here are some driver fixes for 3.7. They include extcon driver fixes,
a hyper-v bugfix, and two other minor driver fixes.

All of these have been in the linux-next releases for a while.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"

* tag 'char-misc-3.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
sonypi: suspend/resume callbacks should be conditionally compiled on CONFIG_PM_SLEEP
Drivers: hv: Cleanup error handling in vmbus_open()
extcon : register for cable interest by cable name
extcon: trivial: kfree missed from remove path
extcon: driver model release call not needed
extcon: MAX77693: Add platform data for MUIC device to initialize registers
extcon: max77693: Use max77693_update_reg for rmw operations
extcon: Fix kerneldoc for extcon_set_cable_state and extcon_set_cable_state_
extcon: adc-jack: Add missing MODULE_LICENSE
extcon: adc-jack: Fix checking return value of request_any_context_irq
extcon: Fix return value in extcon_register_interest()
extcon: unregister compat link on cleanup
extcon: Unregister compat class at module unload to fix oops
extcon: optimising the check_mutually_exclusive function
extcon: standard cable names definition and declaration changed
extcon-max8997: remove usage of ret in max8997_muic_handle_charger_type_detach
extcon: Remove duplicate inclusion of extcon.h header file

+154 -96
+1 -1
drivers/char/sonypi.c
··· 1456 1456 return 0; 1457 1457 } 1458 1458 1459 - #ifdef CONFIG_PM 1459 + #ifdef CONFIG_PM_SLEEP 1460 1460 static int old_camera_power; 1461 1461 1462 1462 static int sonypi_suspend(struct device *dev)
+7 -3
drivers/extcon/extcon-adc-jack.c
··· 14 14 * 15 15 */ 16 16 17 + #include <linux/module.h> 17 18 #include <linux/slab.h> 18 19 #include <linux/device.h> 19 20 #include <linux/platform_device.h> ··· 162 161 err = request_any_context_irq(data->irq, adc_jack_irq_thread, 163 162 pdata->irq_flags, pdata->name, data); 164 163 165 - if (err) { 164 + if (err < 0) { 166 165 dev_err(&pdev->dev, "error: irq %d\n", data->irq); 167 - err = -EINVAL; 168 166 goto err_irq; 169 167 } 170 168 171 - goto out; 169 + return 0; 172 170 173 171 err_irq: 174 172 extcon_dev_unregister(&data->edev); ··· 196 196 }; 197 197 198 198 module_platform_driver(adc_jack_driver); 199 + 200 + MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>"); 201 + MODULE_DESCRIPTION("ADC Jack extcon driver"); 202 + MODULE_LICENSE("GPL v2");
+83 -63
drivers/extcon/extcon-class.c
··· 41 41 * every single port-type of the following cable names. Please choose cable 42 42 * names that are actually used in your extcon device. 43 43 */ 44 - const char *extcon_cable_name[] = { 44 + const char extcon_cable_name[][CABLE_NAME_MAX + 1] = { 45 45 [EXTCON_USB] = "USB", 46 46 [EXTCON_USB_HOST] = "USB-Host", 47 47 [EXTCON_TA] = "TA", ··· 62 62 [EXTCON_VIDEO_IN] = "Video-in", 63 63 [EXTCON_VIDEO_OUT] = "Video-out", 64 64 [EXTCON_MECHANICAL] = "Mechanical", 65 - 66 - NULL, 67 65 }; 68 66 69 67 static struct class *extcon_class; ··· 89 91 return 0; 90 92 91 93 for (i = 0; edev->mutually_exclusive[i]; i++) { 92 - int count = 0, j; 94 + int weight; 93 95 u32 correspondants = new_state & edev->mutually_exclusive[i]; 94 - u32 exp = 1; 95 96 96 - for (j = 0; j < 32; j++) { 97 - if (exp & correspondants) 98 - count++; 99 - if (count > 1) 100 - return i + 1; 101 - exp <<= 1; 102 - } 97 + /* calculate the total number of bits set */ 98 + weight = hweight32(correspondants); 99 + if (weight > 1) 100 + return i + 1; 103 101 } 104 102 105 103 return 0; ··· 356 362 EXPORT_SYMBOL_GPL(extcon_get_cable_state); 357 363 358 364 /** 359 - * extcon_get_cable_state_() - Set the status of a specific cable. 365 + * extcon_set_cable_state_() - Set the status of a specific cable. 360 366 * @edev: the extcon device that has the cable. 361 367 * @index: cable index that can be retrieved by extcon_find_cable_index(). 362 368 * @cable_state: the new cable status. The default semantics is ··· 376 382 EXPORT_SYMBOL_GPL(extcon_set_cable_state_); 377 383 378 384 /** 379 - * extcon_get_cable_state() - Set the status of a specific cable. 385 + * extcon_set_cable_state() - Set the status of a specific cable. 380 386 * @edev: the extcon device that has the cable. 381 387 * @cable_name: cable name. 382 388 * @cable_state: the new cable status. The default semantics is ··· 441 447 * extcon device. 442 448 * @obj: an empty extcon_specific_cable_nb object to be returned. 443 449 * @extcon_name: the name of extcon device. 450 + * if NULL, extcon_register_interest will register 451 + * every cable with the target cable_name given. 444 452 * @cable_name: the target cable name. 445 453 * @nb: the notifier block to get notified. 446 454 * ··· 462 466 const char *extcon_name, const char *cable_name, 463 467 struct notifier_block *nb) 464 468 { 465 - if (!obj || !extcon_name || !cable_name || !nb) 469 + if (!obj || !cable_name || !nb) 466 470 return -EINVAL; 467 471 468 - obj->edev = extcon_get_extcon_dev(extcon_name); 469 - if (!obj->edev) 472 + if (extcon_name) { 473 + obj->edev = extcon_get_extcon_dev(extcon_name); 474 + if (!obj->edev) 475 + return -ENODEV; 476 + 477 + obj->cable_index = extcon_find_cable_index(obj->edev, cable_name); 478 + if (obj->cable_index < 0) 479 + return -ENODEV; 480 + 481 + obj->user_nb = nb; 482 + 483 + obj->internal_nb.notifier_call = _call_per_cable; 484 + 485 + return raw_notifier_chain_register(&obj->edev->nh, &obj->internal_nb); 486 + } else { 487 + struct class_dev_iter iter; 488 + struct extcon_dev *extd; 489 + struct device *dev; 490 + 491 + if (!extcon_class) 492 + return -ENODEV; 493 + class_dev_iter_init(&iter, extcon_class, NULL, NULL); 494 + while ((dev = class_dev_iter_next(&iter))) { 495 + extd = (struct extcon_dev *)dev_get_drvdata(dev); 496 + 497 + if (extcon_find_cable_index(extd, cable_name) < 0) 498 + continue; 499 + 500 + class_dev_iter_exit(&iter); 501 + return extcon_register_interest(obj, extd->name, 502 + cable_name, nb); 503 + } 504 + 470 505 return -ENODEV; 471 - 472 - obj->cable_index = extcon_find_cable_index(obj->edev, cable_name); 473 - if (obj->cable_index < 0) 474 - return -ENODEV; 475 - 476 - obj->user_nb = nb; 477 - 478 - obj->internal_nb.notifier_call = _call_per_cable; 479 - 480 - return raw_notifier_chain_register(&obj->edev->nh, &obj->internal_nb); 506 + } 481 507 } 482 508 483 509 /** ··· 569 551 return 0; 570 552 } 571 553 572 - static void extcon_cleanup(struct extcon_dev *edev, bool skip) 573 - { 574 - mutex_lock(&extcon_dev_list_lock); 575 - list_del(&edev->entry); 576 - mutex_unlock(&extcon_dev_list_lock); 577 - 578 - if (!skip && get_device(edev->dev)) { 579 - int index; 580 - 581 - if (edev->mutually_exclusive && edev->max_supported) { 582 - for (index = 0; edev->mutually_exclusive[index]; 583 - index++) 584 - kfree(edev->d_attrs_muex[index].attr.name); 585 - kfree(edev->d_attrs_muex); 586 - kfree(edev->attrs_muex); 587 - } 588 - 589 - for (index = 0; index < edev->max_supported; index++) 590 - kfree(edev->cables[index].attr_g.name); 591 - 592 - if (edev->max_supported) { 593 - kfree(edev->extcon_dev_type.groups); 594 - kfree(edev->cables); 595 - } 596 - 597 - device_unregister(edev->dev); 598 - put_device(edev->dev); 599 - } 600 - 601 - kfree(edev->dev); 602 - } 603 - 604 554 static void extcon_dev_release(struct device *dev) 605 555 { 606 - struct extcon_dev *edev = (struct extcon_dev *) dev_get_drvdata(dev); 607 - 608 - extcon_cleanup(edev, true); 556 + kfree(dev); 609 557 } 610 558 611 559 static const char *muex_name = "mutually_exclusive"; ··· 797 813 */ 798 814 void extcon_dev_unregister(struct extcon_dev *edev) 799 815 { 800 - extcon_cleanup(edev, false); 816 + int index; 817 + 818 + mutex_lock(&extcon_dev_list_lock); 819 + list_del(&edev->entry); 820 + mutex_unlock(&extcon_dev_list_lock); 821 + 822 + if (IS_ERR_OR_NULL(get_device(edev->dev))) { 823 + dev_err(edev->dev, "Failed to unregister extcon_dev (%s)\n", 824 + dev_name(edev->dev)); 825 + return; 826 + } 827 + 828 + if (edev->mutually_exclusive && edev->max_supported) { 829 + for (index = 0; edev->mutually_exclusive[index]; 830 + index++) 831 + kfree(edev->d_attrs_muex[index].attr.name); 832 + kfree(edev->d_attrs_muex); 833 + kfree(edev->attrs_muex); 834 + } 835 + 836 + for (index = 0; index < edev->max_supported; index++) 837 + kfree(edev->cables[index].attr_g.name); 838 + 839 + if (edev->max_supported) { 840 + kfree(edev->extcon_dev_type.groups); 841 + kfree(edev->cables); 842 + } 843 + 844 + #if defined(CONFIG_ANDROID) 845 + if (switch_class) 846 + class_compat_remove_link(switch_class, edev->dev, NULL); 847 + #endif 848 + device_unregister(edev->dev); 849 + put_device(edev->dev); 801 850 } 802 851 EXPORT_SYMBOL_GPL(extcon_dev_unregister); 803 852 ··· 842 825 843 826 static void __exit extcon_class_exit(void) 844 827 { 828 + #if defined(CONFIG_ANDROID) 829 + class_compat_unregister(switch_class); 830 + #endif 845 831 class_destroy(extcon_class); 846 832 } 847 833 module_exit(extcon_class_exit);
-1
drivers/extcon/extcon-gpio.c
··· 26 26 #include <linux/interrupt.h> 27 27 #include <linux/platform_device.h> 28 28 #include <linux/slab.h> 29 - #include <linux/extcon.h> 30 29 #include <linux/workqueue.h> 31 30 #include <linux/gpio.h> 32 31 #include <linux/extcon.h>
+34 -12
drivers/extcon/extcon-max77693.c
··· 239 239 static int max77693_muic_set_debounce_time(struct max77693_muic_info *info, 240 240 enum max77693_muic_adc_debounce_time time) 241 241 { 242 - int ret = 0; 243 - u8 ctrl3; 242 + int ret; 244 243 245 244 switch (time) { 246 245 case ADC_DEBOUNCE_TIME_5MS: 247 246 case ADC_DEBOUNCE_TIME_10MS: 248 247 case ADC_DEBOUNCE_TIME_25MS: 249 248 case ADC_DEBOUNCE_TIME_38_62MS: 250 - ret = max77693_read_reg(info->max77693->regmap_muic, 251 - MAX77693_MUIC_REG_CTRL3, &ctrl3); 252 - ctrl3 &= ~CONTROL3_ADCDBSET_MASK; 253 - ctrl3 |= (time << CONTROL3_ADCDBSET_SHIFT); 254 - 255 - ret = max77693_write_reg(info->max77693->regmap_muic, 256 - MAX77693_MUIC_REG_CTRL3, ctrl3); 257 - if (ret) { 249 + ret = max77693_update_reg(info->max77693->regmap_muic, 250 + MAX77693_MUIC_REG_CTRL3, 251 + time << CONTROL3_ADCDBSET_SHIFT, 252 + CONTROL3_ADCDBSET_MASK); 253 + if (ret) 258 254 dev_err(info->dev, "failed to set ADC debounce time\n"); 259 - ret = -EINVAL; 260 - } 261 255 break; 262 256 default: 263 257 dev_err(info->dev, "invalid ADC debounce time\n"); ··· 651 657 static int __devinit max77693_muic_probe(struct platform_device *pdev) 652 658 { 653 659 struct max77693_dev *max77693 = dev_get_drvdata(pdev->dev.parent); 660 + struct max77693_platform_data *pdata = dev_get_platdata(max77693->dev); 661 + struct max77693_muic_platform_data *muic_pdata = pdata->muic_data; 654 662 struct max77693_muic_info *info; 655 663 int ret, i; 656 664 u8 id; ··· 723 727 goto err_extcon; 724 728 } 725 729 730 + /* Initialize MUIC register by using platform data */ 731 + for (i = 0 ; i < muic_pdata->num_init_data ; i++) { 732 + enum max77693_irq_source irq_src = MAX77693_IRQ_GROUP_NR; 733 + 734 + max77693_write_reg(info->max77693->regmap_muic, 735 + muic_pdata->init_data[i].addr, 736 + muic_pdata->init_data[i].data); 737 + 738 + switch (muic_pdata->init_data[i].addr) { 739 + case MAX77693_MUIC_REG_INTMASK1: 740 + irq_src = MUIC_INT1; 741 + break; 742 + case MAX77693_MUIC_REG_INTMASK2: 743 + irq_src = MUIC_INT2; 744 + break; 745 + case MAX77693_MUIC_REG_INTMASK3: 746 + irq_src = MUIC_INT3; 747 + break; 748 + } 749 + 750 + if (irq_src < MAX77693_IRQ_GROUP_NR) 751 + info->max77693->irq_masks_cur[irq_src] 752 + = muic_pdata->init_data[i].data; 753 + } 754 + 726 755 /* Check revision number of MUIC device*/ 727 756 ret = max77693_read_reg(info->max77693->regmap_muic, 728 757 MAX77693_MUIC_REG_ID, &id); ··· 783 762 free_irq(muic_irqs[i].virq, info); 784 763 cancel_work_sync(&info->irq_work); 785 764 extcon_dev_unregister(info->edev); 765 + kfree(info->edev); 786 766 kfree(info); 787 767 788 768 return 0;
+2 -4
drivers/extcon/extcon-max8997.c
··· 271 271 static int max8997_muic_handle_charger_type_detach( 272 272 struct max8997_muic_info *info) 273 273 { 274 - int ret = 0; 275 - 276 274 switch (info->pre_charger_type) { 277 275 case MAX8997_CHARGER_TYPE_USB: 278 276 extcon_set_cable_state(info->edev, "USB", false); ··· 288 290 extcon_set_cable_state(info->edev, "Fast-charger", false); 289 291 break; 290 292 default: 291 - ret = -EINVAL; 293 + return -EINVAL; 292 294 break; 293 295 } 294 296 295 - return ret; 297 + return 0; 296 298 } 297 299 298 300 static int max8997_muic_handle_charger_type(struct max8997_muic_info *info,
+13 -11
drivers/hv/channel.c
··· 146 146 147 147 if (ret != 0) { 148 148 err = ret; 149 - goto errorout; 149 + goto error0; 150 150 } 151 151 152 152 ret = hv_ringbuffer_init( 153 153 &newchannel->inbound, in, recv_ringbuffer_size); 154 154 if (ret != 0) { 155 155 err = ret; 156 - goto errorout; 156 + goto error0; 157 157 } 158 158 159 159 ··· 168 168 169 169 if (ret != 0) { 170 170 err = ret; 171 - goto errorout; 171 + goto error0; 172 172 } 173 173 174 174 /* Create and init the channel open message */ ··· 177 177 GFP_KERNEL); 178 178 if (!open_info) { 179 179 err = -ENOMEM; 180 - goto errorout; 180 + goto error0; 181 181 } 182 182 183 183 init_completion(&open_info->waitevent); ··· 193 193 194 194 if (userdatalen > MAX_USER_DEFINED_BYTES) { 195 195 err = -EINVAL; 196 - goto errorout; 196 + goto error0; 197 197 } 198 198 199 199 if (userdatalen) ··· 208 208 sizeof(struct vmbus_channel_open_channel)); 209 209 210 210 if (ret != 0) 211 - goto cleanup; 211 + goto error1; 212 212 213 213 t = wait_for_completion_timeout(&open_info->waitevent, 5*HZ); 214 214 if (t == 0) { 215 215 err = -ETIMEDOUT; 216 - goto errorout; 216 + goto error1; 217 217 } 218 218 219 219 220 220 if (open_info->response.open_result.status) 221 221 err = open_info->response.open_result.status; 222 222 223 - cleanup: 224 223 spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags); 225 224 list_del(&open_info->msglistentry); 226 225 spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags); ··· 227 228 kfree(open_info); 228 229 return err; 229 230 230 - errorout: 231 - hv_ringbuffer_cleanup(&newchannel->outbound); 232 - hv_ringbuffer_cleanup(&newchannel->inbound); 231 + error1: 232 + spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags); 233 + list_del(&open_info->msglistentry); 234 + spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags); 235 + 236 + error0: 233 237 free_pages((unsigned long)out, 234 238 get_order(send_ringbuffer_size + recv_ringbuffer_size)); 235 239 kfree(open_info);
+1 -1
include/linux/extcon.h
··· 68 68 EXTCON_VIDEO_OUT, 69 69 EXTCON_MECHANICAL, 70 70 }; 71 - extern const char *extcon_cable_name[]; 71 + extern const char extcon_cable_name[][CABLE_NAME_MAX + 1]; 72 72 73 73 struct extcon_cable; 74 74
+13
include/linux/mfd/max77693.h
··· 30 30 #ifndef __LINUX_MFD_MAX77693_H 31 31 #define __LINUX_MFD_MAX77693_H 32 32 33 + struct max77693_reg_data { 34 + u8 addr; 35 + u8 data; 36 + }; 37 + 38 + struct max77693_muic_platform_data { 39 + struct max77693_reg_data *init_data; 40 + int num_init_data; 41 + }; 42 + 33 43 struct max77693_platform_data { 34 44 int wakeup; 45 + 46 + /* muic data */ 47 + struct max77693_muic_platform_data *muic_data; 35 48 }; 36 49 #endif /* __LINUX_MFD_MAX77693_H */