1. 22 5月, 2015 1 次提交
    • C
      extcon: Use the unique id for external connector instead of string · 2a9de9c0
      Chanwoo Choi 提交于
      This patch uses the unique id to identify the type of external connector instead
      of string name. The string name have the many potential issues. So, this patch
      defines the 'extcon' enumeration which includes all supported external connector
      on EXTCON subsystem. If new external connector is necessary, the unique id of
      new connector have to be added in 'extcon' enumeration. There are current
      supported external connector in 'enum extcon' as following:
      
      enum extcon {
      	EXTCON_NONE		= 0x0,
      
      	/* USB external connector */
      	EXTCON_USB		= 0x1,
      	EXTCON_USB_HOST		= 0x2,
      
      	/* Charger external connector */
      	EXTCON_TA		= 0x10,
      	EXTCON_FAST_CHARGER	= 0x11,
      	EXTCON_SLOW_CHARGER	= 0x12,
      	EXTCON_CHARGE_DOWNSTREAM = 0x13,
      
      	/* Audio and video external connector */
      	EXTCON_LINE_IN		= 0x20,
      	EXTCON_LINE_OUT		= 0x21,
      	EXTCON_MICROPHONE	= 0x22,
      	EXTCON_HEADPHONE	= 0x23,
      
      	EXTCON_HDMI		= 0x30,
      	EXTCON_MHL		= 0x31,
      	EXTCON_DVI		= 0x32,
      	EXTCON_VGA		= 0x33,
      	EXTCON_SPDIF_IN		= 0x34,
      	EXTCON_SPDIF_OUT	= 0x35,
      	EXTCON_VIDEO_IN		= 0x36,
      	EXTCON_VIDEO_OUT	= 0x37,
      
      	/* Miscellaneous external connector */
      	EXTCON_DOCK		= 0x50,
      	EXTCON_JIG		= 0x51,
      	EXTCON_MECHANICAL	= 0x52,
      
      	EXTCON_END,
      };
      
      For example in extcon-arizona.c:
      To use unique id removes the potential issue about handling
      the inconsistent name of external connector with string.
      - Previously, use the string to register the type of arizona jack connector
      static const char *arizona_cable[] = {
      	"Mechanical",
      	"Microphone",
      	"Headphone",
      	"Line-out",
      };
      - Newly, use the unique id to register the type of arizona jack connector
      static const enum extcon arizona_cable[] = {
      	EXTCON_MECHANICAL,
      	EXTCON_MICROPHONE,
      	EXTCON_HEADPHONE,
      	EXTCON_LINE_OUT,
      
      	EXTCON_NONE,
      };
      
      And this patch modify the prototype of extcon_{get|set}_cable_state_() which
      uses the 'enum extcon id' instead of 'cable_index'. Because although one more
      extcon drivers support USB cable, each extcon driver might has the differnt
      'cable_index' for USB cable. All extcon drivers can use the unique id number
      for same external connector with modified extcon_{get|set}_cable_state_().
      
      - Previously, use 'cable_index' on these functions:
      extcon_get_cable_state_(struct extcon_dev*, int cable_index)
      extcon_set_cable_state_(struct extcon_dev*, int cable_index, bool state)
      
      -Newly, use 'enum extcon id' on these functions:
      extcon_get_cable_state_(struct extcon_dev*, enum extcon id)
      extcon_set_cable_state_(struct extcon_dev*, enum extcon id, bool state)
      
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Felipe Balbi <balbi@ti.com>
      Signed-off-by: NChanwoo Choi <cw00.choi@samsung.com>
      Acked-by: NRoger Quadros <rogerq@ti.com>
      Acked-by: NCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
      Acked-by: NRamakrishna Pallala <ramakrishna.pallala@intel.com>
      Reviewed-by: NKrzysztof Kozlowski <k.kozlowski@samsung.com>
      [arnd: Report the build break about drivers/usb/phy/phy-tahvo.c after using the
      unique id for external connector insteadf of string]
      Reported-by: NArnd Bergmann <arnd@arndb.de>
      [dan.carpenter: Report the build warning of extcon_{set|get}_cable_state_()]
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      2a9de9c0
  2. 19 5月, 2015 3 次提交
  3. 23 3月, 2015 1 次提交
  4. 07 3月, 2015 2 次提交
  5. 26 1月, 2015 1 次提交
  6. 24 11月, 2014 1 次提交
  7. 16 6月, 2014 1 次提交
  8. 29 4月, 2014 2 次提交
  9. 24 4月, 2014 1 次提交
  10. 19 3月, 2014 1 次提交
  11. 26 11月, 2013 1 次提交
    • W
      extcon: remove freed groups caused the panic or warning in unregister flow · 7585ca0d
      Wang, Xiaoming 提交于
      (edev->extcon_dev_type.groups) has been freed before device_unregister.
      extcon_dev_unregister -> kfree(edev->extcon_dev_type.groups)
      then device_unregister -> device_del -> device_remove_attrs
      -> device_remove_groups(dev, type->groups);
      panic because type->groups has been freed.
      
      This patch is move device_unregister ahead of groups free
      to avoid panic in extcon_dev_unregister.
      
      stack
      [ 22.847226] BUG: unable to handle kernel paging request at 5f39746e
      [ 22.847234] IP: [<c1387fcd>] sysfs_remove_group+0x2d/0xd0
      [ 22.847238] *pdpt = 0000000000000000 *pde = 0000000000000000
      [ 22.847241] Oops: 0000 [#1] PREEMPT SMP
      [ 22.847244] Modules linked in:
      [ 22.847249] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G W 3.10.16-261140-g6533774 #1
      [ 22.847251] task: f3078000 ti: f3072000 task.ti: f3072000
      [ 22.847254] EIP: 0060:[<c1387fcd>] EFLAGS: 00010206 CPU: 0
      [ 22.847257] EIP is at sysfs_remove_group+0x2d/0xd0
      [ 22.847259] EAX: 00000004 EBX: 5f39746e ECX: 00000000 EDX: f2773560
      [ 22.847261] ESI: f2653b80 EDI: f2773560 EBP: f3073c90 ESP: f3073c70
      [ 22.847263] DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
      [ 22.847264] CR0: 8005003b CR2: 5f39746e CR3: 020e5000 CR4: 001007f0
      [ 22.847266] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
      [ 22.847268] DR6: ffff0ff0 DR7: 00000400
      [ 22.847269] Stack:
      [ 22.847276] c13848c9 c1ae3805 f3073c80 f24ddc4c 00000246 f2773e88 f1c44408 f2531340
      [ 22.847283] f3073ca0 c16935ca f1c44400 f27d3340 f3073cb4 c1693858 f24ddc44 f1c44400
      [ 22.847289] f1c4420c f3073cc8 c1693f76 f1c44400 00000001 00000000 f3073ce8 c1694011
      [ 22.847290] Call Trace:
      [ 22.847295] [<c13848c9>] ? sysfs_hash_and_remove+0x49/0xa0
      [ 22.847300] [<c1ae3805>] ? sub_preempt_count+0x55/0xe0
      [ 22.847306] [<c16935ca>] device_remove_groups+0x2a/0x40
      [ 22.847309] [<c1693858>] device_remove_attrs+0x38/0x60
      [ 22.847313] [<c1693f76>] device_del+0xd6/0x150
      [ 22.847316] [<c1694011>] device_unregister+0x21/0x60
      [ 22.847320] [<c13869e8>] ? sysfs_remove_link+0x18/0x30
      [ 22.847323] [<c1697d04>] ? class_compat_remove_link+0x34/0x50
      [ 22.847329] [<c18bf5d9>] extcon_dev_unregister+0xf9/0x130
      [ 22.847333] [<c18bd21f>] pwrsrc_extcon_dev_reg_callback+0x7f/0xa0
      [ 22.847337] [<c1ae36e3>] notifier_call_chain+0x43/0x60
      [ 22.847343] [<c12634e1>] __blocking_notifier_call_chain+0x41/0x80
      [ 22.847347] [<c126353f>] blocking_notifier_call_chain+0x1f/0x30
      [ 22.847351] [<c18bef39>] extcon_dev_notify_add_device+0x19/0x20
      [ 22.847354] [<c18bf074>] extcon_dev_register+0x134/0x580
      [ 22.847358] [<c1ae3805>] ? sub_preempt_count+0x55/0xe0
      [ 22.847363] [<c154b4da>] ? gpiod_request+0x6a/0x1d0
      [ 22.847368] [<c132528a>] ? kmem_cache_alloc_trace+0xaa/0x170
      [ 22.847372] [<c18c0179>] ? fsa9285_probe+0x99/0x3f0
      [ 22.847375] [<c18c00e0>] ? fsa9285_irq_handler+0xf0/0xf0
      [ 22.847379] [<c18c019f>] fsa9285_probe+0xbf/0x3f0
      [ 22.847383] [<c18c00e0>] ? fsa9285_irq_handler+0xf0/0xf0
      [ 22.847388] [<c1828d9e>] i2c_device_probe+0x7e/0xf0
      [ 22.847392] [<c1386e52>] ? sysfs_create_link+0x22/0x40
      [ 22.847395] [<c1696c62>] ? driver_sysfs_add+0x72/0xa0
      [ 22.847399] [<c1697119>] driver_probe_device+0x79/0x360
      [ 22.847403] [<c1697491>] __driver_attach+0x91/0xa0
      [ 22.847407] [<c1697400>] ? driver_probe_device+0x360/0x360
      [ 22.847410] [<c16955a2>] bus_for_each_dev+0x42/0x80
      [ 22.847414] [<c1696bee>] driver_attach+0x1e/0x20
      [ 22.847417] [<c1697400>] ? driver_probe_device+0x360/0x360
      [ 22.847420] [<c169675f>] bus_add_driver+0xef/0x270
      [ 22.847425] [<c1828e10>] ? i2c_device_probe+0xf0/0xf0
      [ 22.847428] [<c1828e10>] ? i2c_device_probe+0xf0/0xf0
      [ 22.847432] [<c1697a8a>] driver_register+0x6a/0x160
      [ 22.847436] [<c1addb3d>] ? mutex_unlock+0xd/0x10
      [ 22.847440] [<c1438ab2>] ? __create_file+0x122/0x2a0
      [ 22.847446] [<c20557d3>] ? extcon_class_init+0x15/0x15
      [ 22.847450] [<c1827cbb>] i2c_register_driver+0x2b/0xd0
      [ 22.847454] [<c1438d05>] ? debugfs_create_file+0x35/0x40
      [ 22.847458] [<c20557d3>] ? extcon_class_init+0x15/0x15
      [ 22.847461] [<c20557e4>] fsa9285_extcon_init+0x11/0x29
      [ 22.847465] [<c12001aa>] do_one_initcall+0xba/0x170
      [ 22.847471] [<c2012b4a>] kernel_init_freeable+0x119/0x1b8
      [ 22.847475] [<c20124d3>] ? do_early_param+0x7a/0x7a
      [ 22.847480] [<c1ac4090>] kernel_init+0x10/0xd0
      [ 22.847485] [<c1ae6cf7>] ret_from_kernel_thread+0x1b/0x28
      [ 22.847488] [<c1ac4080>] ? rest_init+0x80/0x80
      Tested-by: NLiu, Chuansheng <chuansheng.liu@intel.com>
      Reviewed-by: NLiu, Chuansheng <chuansheng.liu@intel.com>
      Signed-off-by: Nxiaoming wang <xiaoming.wang@intel.com>
      Signed-off-by: NZhang Dongxing <dongxing.zhang@intel.com>
      Signed-off-by: NChanwoo Choi <cw00.choi@samsung.com>
      7585ca0d
  12. 27 9月, 2013 6 次提交
  13. 05 8月, 2013 1 次提交
  14. 26 7月, 2013 1 次提交
  15. 04 7月, 2013 1 次提交
  16. 18 6月, 2013 2 次提交
  17. 21 11月, 2012 1 次提交
  18. 23 10月, 2012 6 次提交
    • J
      extcon : register for cable interest by cable name · 4f2de3bf
      Jenny TC 提交于
      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: NJenny TC <jenny.tc@intel.com>
      Signed-off-by: NMyungJoo Ham <myungjoo.ham@samsung.com>
      Tested-by: NChanwoo Choi <cw00.choi@samsung.com>
      
      --
      Kernel-doc comment added by MyungJoo Ham
      4f2de3bf
    • A
      extcon: driver model release call not needed · 57e7cd37
      anish kumar 提交于
      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: Nanish kumar <anish198519851985@gmail.com>
      Signed-off-by: NChanwoo Choi <cw00.choi@samsung.com>
      Signed-off-by: NMyungJoo Ham <myungjoo.ham@samsung.com>
      57e7cd37
    • A
    • S
      extcon: Fix return value in extcon_register_interest() · 5cd3c277
      Sachin Kamat 提交于
      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: NSachin Kamat <sachin.kamat@linaro.org>
      Signed-off-by: NChanwoo Choi <cw00.choi@samsung.com>
      5cd3c277
    • P
      extcon: unregister compat link on cleanup · 824a1bc0
      Peter Huewe 提交于
      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: NPeter Huewe <peterhuewe@gmx.de>
      Signed-off-by: NChanwoo Choi <cw00.choi@samsung.com>
      824a1bc0
    • P
      extcon: Unregister compat class at module unload to fix oops · 0dc77b6d
      Peter Huewe 提交于
      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: NPeter Huewe <peterhuewe@gmx.de>
      Signed-off-by: NChanwoo Choi <cw00.choi@samsung.com>
      0dc77b6d
  19. 22 10月, 2012 2 次提交
  20. 06 9月, 2012 1 次提交
  21. 17 8月, 2012 2 次提交
  22. 15 6月, 2012 2 次提交