Lines Matching refs:index
275 static bool is_extcon_attached(struct extcon_dev *edev, unsigned int index) in is_extcon_attached() argument
277 return !!(edev->state & BIT(index)); in is_extcon_attached()
280 static bool is_extcon_changed(struct extcon_dev *edev, int index, in is_extcon_changed() argument
283 int state = !!(edev->state & BIT(index)); in is_extcon_changed()
301 unsigned int id, int index,unsigned int prop) in is_extcon_property_capability() argument
311 cable = &edev->cables[index]; in is_extcon_property_capability()
333 static void init_property(struct extcon_dev *edev, unsigned int id, int index) in init_property() argument
336 struct extcon_cable *cable = &edev->cables[index]; in init_property()
416 int index; in extcon_sync() local
423 index = find_cable_index_by_id(edev, id); in extcon_sync()
424 if (index < 0) in extcon_sync()
425 return index; in extcon_sync()
428 state = !!(edev->state & BIT(index)); in extcon_sync()
435 raw_notifier_call_chain(&edev->nh[index], state, edev); in extcon_sync()
491 int index, state; in extcon_get_state() local
497 index = find_cable_index_by_id(edev, id); in extcon_get_state()
498 if (index < 0) in extcon_get_state()
499 return index; in extcon_get_state()
502 state = is_extcon_attached(edev, index); in extcon_get_state()
525 int index, ret = 0; in extcon_set_state() local
530 index = find_cable_index_by_id(edev, id); in extcon_set_state()
531 if (index < 0) in extcon_set_state()
532 return index; in extcon_set_state()
537 if (!is_extcon_changed(edev, index, state)) in extcon_set_state()
541 (edev->state & ~BIT(index)) | (state & BIT(index)))) { in extcon_set_state()
551 init_property(edev, id, index); in extcon_set_state()
555 edev->state |= BIT(index); in extcon_set_state()
557 edev->state &= ~(BIT(index)); in extcon_set_state()
579 int ret, index; in extcon_set_state_sync() local
582 index = find_cable_index_by_id(edev, id); in extcon_set_state_sync()
583 if (index < 0) in extcon_set_state_sync()
584 return index; in extcon_set_state_sync()
588 ret = is_extcon_changed(edev, index, state); in extcon_set_state_sync()
621 int index, ret = 0; in extcon_get_property() local
633 index = find_cable_index_by_id(edev, id); in extcon_get_property()
634 if (index < 0) in extcon_get_property()
635 return index; in extcon_get_property()
640 if (!is_extcon_property_capability(edev, id, index, prop)) { in extcon_get_property()
650 if (!is_extcon_attached(edev, index)) { in extcon_get_property()
655 cable = &edev->cables[index]; in extcon_get_property()
700 int index, ret = 0; in extcon_set_property() local
710 index = find_cable_index_by_id(edev, id); in extcon_set_property()
711 if (index < 0) in extcon_set_property()
712 return index; in extcon_set_property()
717 if (!is_extcon_property_capability(edev, id, index, prop)) { in extcon_set_property()
722 cable = &edev->cables[index]; in extcon_set_property()
785 int index; in extcon_get_property_capability() local
795 index = find_cable_index_by_id(edev, id); in extcon_get_property_capability()
796 if (index < 0) in extcon_get_property_capability()
797 return index; in extcon_get_property_capability()
799 return is_extcon_property_capability(edev, id, index, prop); in extcon_get_property_capability()
820 int index, type, ret = 0; in extcon_set_property_capability() local
830 index = find_cable_index_by_id(edev, id); in extcon_set_property_capability()
831 if (index < 0) in extcon_set_property_capability()
832 return index; in extcon_set_property_capability()
838 cable = &edev->cables[index]; in extcon_set_property_capability()
1084 int ret, index = 0; in extcon_dev_register() local
1096 for (; edev->supported_cable[index] != EXTCON_NONE; index++); in extcon_dev_register()
1098 edev->max_supported = index; in extcon_dev_register()
1099 if (index > SUPPORTED_CABLE_MAX) { in extcon_dev_register()
1128 for (index = 0; index < edev->max_supported; index++) { in extcon_dev_register()
1129 cable = &edev->cables[index]; in extcon_dev_register()
1131 str = kasprintf(GFP_KERNEL, "cable.%d", index); in extcon_dev_register()
1133 for (index--; index >= 0; index--) { in extcon_dev_register()
1134 cable = &edev->cables[index]; in extcon_dev_register()
1143 cable->cable_index = index; in extcon_dev_register()
1166 for (index = 0; edev->mutually_exclusive[index]; index++) in extcon_dev_register()
1169 edev->attrs_muex = kcalloc(index + 1, in extcon_dev_register()
1177 edev->d_attrs_muex = kcalloc(index, in extcon_dev_register()
1186 for (index = 0; edev->mutually_exclusive[index]; index++) { in extcon_dev_register()
1188 edev->mutually_exclusive[index]); in extcon_dev_register()
1190 for (index--; index >= 0; index--) { in extcon_dev_register()
1191 kfree(edev->d_attrs_muex[index].attr. in extcon_dev_register()
1199 sysfs_attr_init(&edev->d_attrs_muex[index].attr); in extcon_dev_register()
1200 edev->d_attrs_muex[index].attr.name = name; in extcon_dev_register()
1201 edev->d_attrs_muex[index].attr.mode = 0000; in extcon_dev_register()
1202 edev->attrs_muex[index] = &edev->d_attrs_muex[index] in extcon_dev_register()
1223 for (index = 0; index < edev->max_supported; index++) in extcon_dev_register()
1224 edev->extcon_dev_type.groups[index] = in extcon_dev_register()
1225 &edev->cables[index].attr_g; in extcon_dev_register()
1227 edev->extcon_dev_type.groups[index] = in extcon_dev_register()
1247 for (index = 0; index < edev->max_supported; index++) in extcon_dev_register()
1248 RAW_INIT_NOTIFIER_HEAD(&edev->nh[index]); in extcon_dev_register()
1266 for (index = 0; edev->mutually_exclusive[index]; index++) in extcon_dev_register()
1267 kfree(edev->d_attrs_muex[index].attr.name); in extcon_dev_register()
1272 for (index = 0; index < edev->max_supported; index++) in extcon_dev_register()
1273 kfree(edev->cables[index].attr_g.name); in extcon_dev_register()
1291 int index; in extcon_dev_unregister() local
1309 for (index = 0; edev->mutually_exclusive[index]; in extcon_dev_unregister()
1310 index++) in extcon_dev_unregister()
1311 kfree(edev->d_attrs_muex[index].attr.name); in extcon_dev_unregister()
1316 for (index = 0; index < edev->max_supported; index++) in extcon_dev_unregister()
1317 kfree(edev->cables[index].attr_g.name); in extcon_dev_unregister()
1358 struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index) in extcon_get_edev_by_phandle() argument
1371 node = of_parse_phandle(dev->of_node, "extcon", index); in extcon_get_edev_by_phandle()
1391 struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index) in extcon_get_edev_by_phandle() argument