summaryrefslogtreecommitdiff
path: root/drivers/extcon/extcon-class.c
AgeCommit message (Collapse)AuthorFilesLines
2015-06-10Revert "WIP: extcon: do not update cable state if notifier cannot handle it"Robert Baldyga1-7/+1
This reverts commit da1c928ee89c224a8ab26e77514149f5f286cb3d. Reverted commit introduces change which can cause cable state change loss, and breaks extcon drivers when there are no one notifier registered - state in sysfs does not change so debugging is impeded. Change-Id: I7b3919494023aeff0ae95301976d15d738fee65b Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
2014-11-18extcon: Move OF helper function to extcon core and change function nameChanwoo Choi1-0/+42
This patch move simply OF helper function to extcon core and change function name as following: - of_extcon_get_extcon_dev() -> extcon_get_edev_by_phandle() Change-Id: I37fd827f945e3d713cfe15607689eab6792007b1 Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Acked-by: Felipe Balbi <balbi@ti.com>
2014-11-18extcon: Extcon load time modificationKamil Debski1-1/+1
This modification enables use of extcon by drivers loaded early during the boot (e.g. udc-core). Signed-off-by: Kamil Debski <k.debski@samsung.com>
2014-11-18extcon: Add EXPORT_SYMBOL_GPL for exported functionsKishon Vijay Abraham I1-0/+2
Added EXPORT_SYMBOL_GPL() for extcon_register_interest and extcon_register_notifier in order to avoid undefined reference error when building the consumer modules of extcon as _modules_. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-18extcon: Add an API to get extcon device from dt nodeKishon Vijay Abraham I1-1/+2
Added an API of_extcon_get_extcon_dev() to be used by drivers to get extcon device in the case of dt boot (this can be used instead of extcon_get_extcon_dev()). Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2014-11-18WIP: extcon: do not update cable state if notifier cannot handle itChanho Park1-1/+7
During probing a extcon-max77693 driver, extcon-port driver can't receive nb callback due to initializing sequences. Thus, if the callback can't be handled, we do not update the cable state. I'm not sure this patch is good solution :) Signed-off-by: Chanho Park <chanho61.park@samsung.com>
2012-11-21extcon: Fix return value in extcon-class.cSachin Kamat1-1/+1
Return the value obtained from the function extcon_register_interest instead of -ENODEV. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2012-10-23extcon : register for cable interest by cable nameJenny TC1-10/+34
There are some scnearios where a driver/framework needs to register interest for a particular cable without specifying the extcon device name. One such scenario is charger notifications. The platform will have charger cabel which will be bound to any extcon device. It's not mandatory for the charger driver to know which extcon device it should use. This patch enables the support for registering interest for a cable just by cable name wihtout specifying the extcon device name Signed-off-by: Jenny TC <jenny.tc@intel.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Tested-by: Chanwoo Choi <cw00.choi@samsung.com> -- Kernel-doc comment added by MyungJoo Ham
2012-10-23extcon: driver model release call not neededanish kumar1-40/+35
There was a case where free and list_del can be called twice on the same pointer.So fixed it by re-arranging the code and removing a function which was not needed. Signed-off-by: anish kumar <anish198519851985@gmail.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-10-23extcon: Fix kerneldoc for extcon_set_cable_state and extcon_set_cable_state_Axel Lin1-2/+2
Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2012-10-23extcon: Fix return value in extcon_register_interest()Sachin Kamat1-1/+1
Propagate the value returned from extcon_find_cable_index() instead of -ENODEV. For readability, -EINVAL is returned in place of the variable. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2012-10-23extcon: unregister compat link on cleanupPeter Huewe1-0/+4
Since extcon registers this compat link at device registration (extcon_dev_register), we should probably remove them at deregistration/cleanup. Cc: stable@vger.kernel.org Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2012-10-23extcon: Unregister compat class at module unload to fix oopsPeter Huewe1-0/+3
If you compile extcon with CONFIG_ANDROID and then load and unload the module you get a simple oops as the driver does not unregister its compat class and thus cannot register it again. Full trace: root@(none):~# modprobe extcon_class root@(none):~# rmmod extcon_class root@(none):~# modprobe extcon_class ------------[ cut here ]------------ WARNING: at fs/sysfs/dir.c:536 sysfs_add_one+0xde/0x100() sysfs: cannot create duplicate filename '/class/switch' Modules linked in: extcon_class(+) [last unloaded: extcon_class] Call Trace: 9f451a00: [<602a58bc>] printk+0x0/0xa8 9f451a18: [<60039b43>] warn_slowpath_common+0x93/0xd0 9f451a28: [<6012c6de>] sysfs_add_one+0xde/0x100 9f451a50: [<601d3d90>] strcat+0x0/0x40 9f451a68: [<60039cdc>] warn_slowpath_fmt+0x9c/0xa0 9f451a90: [<6002fe32>] unblock_signals+0x0/0x84 9f451ab0: [<60039c40>] warn_slowpath_fmt+0x0/0xa0 9f451ac0: [<6002fe32>] unblock_signals+0x0/0x84 9f451ae8: [<6012bd97>] sysfs_pathname.isra.10+0x57/0x70 9f451b00: [<601d3d90>] strcat+0x0/0x40 9f451b18: [<6012bd97>] sysfs_pathname.isra.10+0x57/0x70 9f451b48: [<6012c6de>] sysfs_add_one+0xde/0x100 9f451b78: [<6012c96f>] create_dir+0x8f/0x100 9f451bc0: [<a0861000>] extcon_class_init+0x0/0x12 [extcon_class] 9f451bd8: [<6012cda6>] sysfs_create_dir+0xa6/0x1c0 9f451be8: [<601d89f1>] kvasprintf+0x81/0xa0 9f451bf8: [<601cf0f0>] kobject_get+0x0/0x50 9f451c18: [<601cf396>] kobject_add_internal+0x96/0x280 9f451c60: [<a0861000>] extcon_class_init+0x0/0x12 [extcon_class] 9f451c78: [<601cfb93>] kobject_add+0xd3/0x140 9f451cc0: [<601cfac0>] kobject_add+0x0/0x140 9f451cd0: [<6002fe32>] unblock_signals+0x0/0x84 9f451cf8: [<6002fffc>] set_signals+0x29/0x3f 9f451d28: [<600c1de1>] kmem_cache_alloc+0xe1/0x100 9f451d78: [<601cffa0>] kobject_create_and_add+0x50/0xa0 9f451da8: [<601fbe76>] class_compat_register+0x56/0x80 9f451dc8: [<a085d118>] create_extcon_class+0x88/0xd0 [extcon_class] 9f451de8: [<a0861010>] extcon_class_init+0x10/0x12 [extcon_class] 9f451df8: [<600189a8>] do_one_initcall+0x48/0x1f0 9f451e20: [<60061920>] blocking_notifier_call_chain+0x0/0x20 9f451e30: [<60061920>] blocking_notifier_call_chain+0x0/0x20 9f451e58: [<6007e3c3>] sys_init_module+0xa3/0x280 9f451e88: [<6001e2ad>] handle_syscall+0x8d/0x90 9f451ea8: [<60033370>] userspace+0x405/0x531 9f451ee8: [<6001e380>] copy_chunk_to_user+0x0/0x40 9f451ef8: [<6001e5cd>] do_op_one_page+0x14d/0x220 9f451fd8: [<6001a355>] fork_handler+0x95/0xa0 ---[ end trace dd512cc03fe1c367 ]--- ------------[ cut here ]------------ WARNING: at lib/kobject.c:196 kobject_add_internal+0x26e/0x280() kobject_add_internal failed for switch with -EEXIST, don't try to register things with the same name in the same directory. Modules linked in: extcon_class(+) [last unloaded: extcon_class] Call Trace: 9f451ad0: [<602a58bc>] printk+0x0/0xa8 9f451ae8: [<60039b43>] warn_slowpath_common+0x93/0xd0 9f451af8: [<601cf56e>] kobject_add_internal+0x26e/0x280 9f451b18: [<601cf140>] kobject_put+0x0/0x70 9f451b20: [<a0861000>] extcon_class_init+0x0/0x12 [extcon_class] 9f451b38: [<60039cdc>] warn_slowpath_fmt+0x9c/0xa0 9f451b88: [<60039c40>] warn_slowpath_fmt+0x0/0xa0 9f451bc0: [<a0861000>] extcon_class_init+0x0/0x12 [extcon_class] 9f451bd8: [<6012cda6>] sysfs_create_dir+0xa6/0x1c0 9f451be8: [<601d89f1>] kvasprintf+0x81/0xa0 9f451bf8: [<601cf0f0>] kobject_get+0x0/0x50 9f451c18: [<601cf56e>] kobject_add_internal+0x26e/0x280 9f451c60: [<a0861000>] extcon_class_init+0x0/0x12 [extcon_class] 9f451c78: [<601cfb93>] kobject_add+0xd3/0x140 9f451cc0: [<601cfac0>] kobject_add+0x0/0x140 9f451cd0: [<6002fe32>] unblock_signals+0x0/0x84 9f451cf8: [<6002fffc>] set_signals+0x29/0x3f 9f451d28: [<600c1de1>] kmem_cache_alloc+0xe1/0x100 9f451d78: [<601cffa0>] kobject_create_and_add+0x50/0xa0 9f451da8: [<601fbe76>] class_compat_register+0x56/0x80 9f451dc8: [<a085d118>] create_extcon_class+0x88/0xd0 [extcon_class] 9f451de8: [<a0861010>] extcon_class_init+0x10/0x12 [extcon_class] 9f451df8: [<600189a8>] do_one_initcall+0x48/0x1f0 9f451e20: [<60061920>] blocking_notifier_call_chain+0x0/0x20 9f451e30: [<60061920>] blocking_notifier_call_chain+0x0/0x20 9f451e58: [<6007e3c3>] sys_init_module+0xa3/0x280 9f451e88: [<6001e2ad>] handle_syscall+0x8d/0x90 9f451ea8: [<60033370>] userspace+0x405/0x531 9f451ee8: [<6001e380>] copy_chunk_to_user+0x0/0x40 9f451ef8: [<6001e5cd>] do_op_one_page+0x14d/0x220 9f451fd8: [<6001a355>] fork_handler+0x95/0xa0 ---[ end trace dd512cc03fe1c368 ]--- kobject_create_and_add: kobject_add error: -17 ------------[ cut here ]------------ WARNING: at drivers/extcon/extcon_class.c:545 create_extcon_class+0xbc/0xd0 [extcon_class]() cannot allocate Modules linked in: extcon_class(+) [last unloaded: extcon_class] Call Trace: 9f451c80: [<602a58bc>] printk+0x0/0xa8 9f451c98: [<60039b43>] warn_slowpath_common+0x93/0xd0 9f451ca0: [<6002fe32>] unblock_signals+0x0/0x84 9f451ca8: [<a085d14c>] create_extcon_class+0xbc/0xd0 [extcon_class] 9f451cd0: [<a0861000>] extcon_class_init+0x0/0x12 [extcon_class] 9f451ce8: [<60039cdc>] warn_slowpath_fmt+0x9c/0xa0 9f451d20: [<6002fe32>] unblock_signals+0x0/0x84 9f451d28: [<60039c40>] warn_slowpath_fmt+0x0/0xa0 9f451d48: [<6002fffc>] set_signals+0x29/0x3f 9f451d58: [<601cf172>] kobject_put+0x32/0x70 9f451d78: [<600c22c3>] kfree+0xb3/0x100 9f451da8: [<601fbe9a>] class_compat_register+0x7a/0x80 9f451dc8: [<a085d14c>] create_extcon_class+0xbc/0xd0 [extcon_class] 9f451de8: [<a0861010>] extcon_class_init+0x10/0x12 [extcon_class] 9f451df8: [<600189a8>] do_one_initcall+0x48/0x1f0 9f451e20: [<60061920>] blocking_notifier_call_chain+0x0/0x20 9f451e30: [<60061920>] blocking_notifier_call_chain+0x0/0x20 9f451e58: [<6007e3c3>] sys_init_module+0xa3/0x280 9f451e88: [<6001e2ad>] handle_syscall+0x8d/0x90 9f451ea8: [<60033370>] userspace+0x405/0x531 9f451ee8: [<6001e380>] copy_chunk_to_user+0x0/0x40 9f451ef8: [<6001e5cd>] do_op_one_page+0x14d/0x220 9f451fd8: [<6001a355>] fork_handler+0x95/0xa0 ---[ end trace dd512cc03fe1c369 ]--- FATAL: Error inserting extcon_class (/lib/modules/3.6.0-rc6-00178-g811315f/kernel/drivers/extcon/extcon_class.ko): Cannot allocate memory This patch fixes this. Cc: stable@vger.kernel.org Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2012-10-22extcon: optimising the check_mutually_exclusive functionanish kumar1-10/+6
Rather than re-inventing the wheel we can use the hamming function to calculate the number of bits set to check for violation of exclusivity. Signed-off-by: anish kumar <anish198519851985@gmail.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-10-22extcon: standard cable names definition and declaration changedanish kumar1-3/+1
With this change now individual drivers can use standard cable names as below: static const char *arizona_cable[] = { extcon_cable_name[EXTCON_USB], extcon_cable_name[EXTCON_USB_HOST], "CUSTOM_CABLE" NULL, } Signed-off-by: anish kumar <anish198519851985@gmail.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-09-05extcon: fixing typosPeter Meerwald1-4/+4
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-16extcon: Ensure dynamically allocated sysfs attributes are initialisedMark Brown1-0/+4
The operation of lockdep requires that all dynamically allocated sysfs nodes are initialised using sysfs_attr_init() otherwise lots of warnings are generated. Ensure that all the dynamically allocated attributes that extcon generates have this done. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-16Extcon: renamed files to comply with the standard naming.MyungJoo Ham1-0/+832
Replaced '_' with '-' in the extcon file names, which has been bogging since new drivers have been using the standard naming. Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>