Lines Matching refs:index
292 static bool is_extcon_attached(struct extcon_dev *edev, unsigned int index) in is_extcon_attached() argument
294 return !!(edev->state & BIT(index)); in is_extcon_attached()
297 static bool is_extcon_changed(struct extcon_dev *edev, int index, in is_extcon_changed() argument
300 int state = !!(edev->state & BIT(index)); in is_extcon_changed()
318 unsigned int id, int index,unsigned int prop) in is_extcon_property_capability() argument
328 cable = &edev->cables[index]; in is_extcon_property_capability()
350 static void init_property(struct extcon_dev *edev, unsigned int id, int index) in init_property() argument
353 struct extcon_cable *cable = &edev->cables[index]; in init_property()
431 int index; in extcon_sync() local
438 index = find_cable_index_by_id(edev, id); in extcon_sync()
439 if (index < 0) in extcon_sync()
440 return index; in extcon_sync()
444 state = !!(edev->state & BIT(index)); in extcon_sync()
445 raw_notifier_call_chain(&edev->nh[index], state, edev); in extcon_sync()
492 int index, state; in extcon_get_state() local
498 index = find_cable_index_by_id(edev, id); in extcon_get_state()
499 if (index < 0) in extcon_get_state()
500 return index; in extcon_get_state()
503 state = is_extcon_attached(edev, index); in extcon_get_state()
527 int index, ret = 0; in extcon_set_state() local
532 index = find_cable_index_by_id(edev, id); in extcon_set_state()
533 if (index < 0) in extcon_set_state()
534 return index; in extcon_set_state()
539 if (!is_extcon_changed(edev, index, cable_state)) in extcon_set_state()
543 (edev->state & ~BIT(index)) | (cable_state & BIT(index)))) { in extcon_set_state()
553 init_property(edev, id, index); in extcon_set_state()
557 edev->state |= BIT(index); in extcon_set_state()
559 edev->state &= ~(BIT(index)); in extcon_set_state()
582 int ret, index; in extcon_set_state_sync() local
585 index = find_cable_index_by_id(edev, id); in extcon_set_state_sync()
586 if (index < 0) in extcon_set_state_sync()
587 return index; in extcon_set_state_sync()
591 ret = is_extcon_changed(edev, index, cable_state); in extcon_set_state_sync()
625 int index, ret = 0; in extcon_get_property() local
637 index = find_cable_index_by_id(edev, id); in extcon_get_property()
638 if (index < 0) in extcon_get_property()
639 return index; in extcon_get_property()
644 if (!is_extcon_property_capability(edev, id, index, prop)) { in extcon_get_property()
654 if (!is_extcon_attached(edev, index)) { in extcon_get_property()
659 cable = &edev->cables[index]; in extcon_get_property()
705 int index, ret = 0; in extcon_set_property() local
715 index = find_cable_index_by_id(edev, id); in extcon_set_property()
716 if (index < 0) in extcon_set_property()
717 return index; in extcon_set_property()
722 if (!is_extcon_property_capability(edev, id, index, prop)) { in extcon_set_property()
727 cable = &edev->cables[index]; in extcon_set_property()
792 int index; in extcon_get_property_capability() local
802 index = find_cable_index_by_id(edev, id); in extcon_get_property_capability()
803 if (index < 0) in extcon_get_property_capability()
804 return index; in extcon_get_property_capability()
806 return is_extcon_property_capability(edev, id, index, prop); in extcon_get_property_capability()
828 int index, type, ret = 0; in extcon_set_property_capability() local
838 index = find_cable_index_by_id(edev, id); in extcon_set_property_capability()
839 if (index < 0) in extcon_set_property_capability()
840 return index; in extcon_set_property_capability()
846 cable = &edev->cables[index]; in extcon_set_property_capability()
1035 int ret, index = 0; in extcon_dev_register() local
1047 for (; edev->supported_cable[index] != EXTCON_NONE; index++); in extcon_dev_register()
1049 edev->max_supported = index; in extcon_dev_register()
1050 if (index > SUPPORTED_CABLE_MAX) { in extcon_dev_register()
1079 for (index = 0; index < edev->max_supported; index++) { in extcon_dev_register()
1080 cable = &edev->cables[index]; in extcon_dev_register()
1082 snprintf(buf, 10, "cable.%d", index); in extcon_dev_register()
1086 for (index--; index >= 0; index--) { in extcon_dev_register()
1087 cable = &edev->cables[index]; in extcon_dev_register()
1097 cable->cable_index = index; in extcon_dev_register()
1121 for (index = 0; edev->mutually_exclusive[index]; index++) in extcon_dev_register()
1125 (index + 1), GFP_KERNEL); in extcon_dev_register()
1132 index, GFP_KERNEL); in extcon_dev_register()
1139 for (index = 0; edev->mutually_exclusive[index]; index++) { in extcon_dev_register()
1140 sprintf(buf, "0x%x", edev->mutually_exclusive[index]); in extcon_dev_register()
1144 for (index--; index >= 0; index--) { in extcon_dev_register()
1145 kfree(edev->d_attrs_muex[index].attr. in extcon_dev_register()
1154 sysfs_attr_init(&edev->d_attrs_muex[index].attr); in extcon_dev_register()
1155 edev->d_attrs_muex[index].attr.name = name; in extcon_dev_register()
1156 edev->d_attrs_muex[index].attr.mode = 0000; in extcon_dev_register()
1157 edev->attrs_muex[index] = &edev->d_attrs_muex[index] in extcon_dev_register()
1177 for (index = 0; index < edev->max_supported; index++) in extcon_dev_register()
1178 edev->extcon_dev_type.groups[index] = in extcon_dev_register()
1179 &edev->cables[index].attr_g; in extcon_dev_register()
1181 edev->extcon_dev_type.groups[index] = in extcon_dev_register()
1206 for (index = 0; index < edev->max_supported; index++) in extcon_dev_register()
1207 RAW_INIT_NOTIFIER_HEAD(&edev->nh[index]); in extcon_dev_register()
1223 for (index = 0; edev->mutually_exclusive[index]; index++) in extcon_dev_register()
1224 kfree(edev->d_attrs_muex[index].attr.name); in extcon_dev_register()
1229 for (index = 0; index < edev->max_supported; index++) in extcon_dev_register()
1230 kfree(edev->cables[index].attr_g.name); in extcon_dev_register()
1248 int index; in extcon_dev_unregister() local
1266 for (index = 0; edev->mutually_exclusive[index]; in extcon_dev_unregister()
1267 index++) in extcon_dev_unregister()
1268 kfree(edev->d_attrs_muex[index].attr.name); in extcon_dev_unregister()
1273 for (index = 0; index < edev->max_supported; index++) in extcon_dev_unregister()
1274 kfree(edev->cables[index].attr_g.name); in extcon_dev_unregister()
1297 struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index) in extcon_get_edev_by_phandle() argument
1310 node = of_parse_phandle(dev->of_node, "extcon", index); in extcon_get_edev_by_phandle()
1331 struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index) in extcon_get_edev_by_phandle() argument