Lines Matching refs:index

283 static bool is_extcon_attached(struct extcon_dev *edev, unsigned int index)  in is_extcon_attached()  argument
285 return !!(edev->state & BIT(index)); in is_extcon_attached()
288 static bool is_extcon_changed(struct extcon_dev *edev, int index, in is_extcon_changed() argument
291 int state = !!(edev->state & BIT(index)); in is_extcon_changed()
309 unsigned int id, int index,unsigned int prop) in is_extcon_property_capability() argument
319 cable = &edev->cables[index]; in is_extcon_property_capability()
341 static void init_property(struct extcon_dev *edev, unsigned int id, int index) in init_property() argument
344 struct extcon_cable *cable = &edev->cables[index]; in init_property()
424 int index; in extcon_sync() local
431 index = find_cable_index_by_id(edev, id); in extcon_sync()
432 if (index < 0) in extcon_sync()
433 return index; in extcon_sync()
436 state = !!(edev->state & BIT(index)); in extcon_sync()
443 raw_notifier_call_chain(&edev->nh[index], state, edev); in extcon_sync()
499 int index, state; in extcon_get_state() local
505 index = find_cable_index_by_id(edev, id); in extcon_get_state()
506 if (index < 0) in extcon_get_state()
507 return index; in extcon_get_state()
510 state = is_extcon_attached(edev, index); in extcon_get_state()
533 int index, ret = 0; in extcon_set_state() local
538 index = find_cable_index_by_id(edev, id); in extcon_set_state()
539 if (index < 0) in extcon_set_state()
540 return index; in extcon_set_state()
545 if (!is_extcon_changed(edev, index, state)) in extcon_set_state()
549 (edev->state & ~BIT(index)) | (state & BIT(index)))) { in extcon_set_state()
559 init_property(edev, id, index); in extcon_set_state()
563 edev->state |= BIT(index); in extcon_set_state()
565 edev->state &= ~(BIT(index)); in extcon_set_state()
587 int ret, index; in extcon_set_state_sync() local
590 index = find_cable_index_by_id(edev, id); in extcon_set_state_sync()
591 if (index < 0) in extcon_set_state_sync()
592 return index; in extcon_set_state_sync()
596 ret = is_extcon_changed(edev, index, state); in extcon_set_state_sync()
629 int index, ret = 0; in extcon_get_property() local
641 index = find_cable_index_by_id(edev, id); in extcon_get_property()
642 if (index < 0) in extcon_get_property()
643 return index; in extcon_get_property()
648 if (!is_extcon_property_capability(edev, id, index, prop)) { in extcon_get_property()
658 if (!is_extcon_attached(edev, index)) { in extcon_get_property()
663 cable = &edev->cables[index]; in extcon_get_property()
708 int index, ret = 0; in extcon_set_property() local
718 index = find_cable_index_by_id(edev, id); in extcon_set_property()
719 if (index < 0) in extcon_set_property()
720 return index; in extcon_set_property()
725 if (!is_extcon_property_capability(edev, id, index, prop)) { in extcon_set_property()
730 cable = &edev->cables[index]; in extcon_set_property()
793 int index; in extcon_get_property_capability() local
803 index = find_cable_index_by_id(edev, id); in extcon_get_property_capability()
804 if (index < 0) in extcon_get_property_capability()
805 return index; in extcon_get_property_capability()
807 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()
1092 int ret, index = 0; in extcon_dev_register() local
1104 for (; edev->supported_cable[index] != EXTCON_NONE; index++); in extcon_dev_register()
1106 edev->max_supported = index; in extcon_dev_register()
1107 if (index > SUPPORTED_CABLE_MAX) { in extcon_dev_register()
1137 for (index = 0; index < edev->max_supported; index++) { in extcon_dev_register()
1138 cable = &edev->cables[index]; in extcon_dev_register()
1140 snprintf(buf, 10, "cable.%d", index); in extcon_dev_register()
1144 for (index--; index >= 0; index--) { in extcon_dev_register()
1145 cable = &edev->cables[index]; in extcon_dev_register()
1155 cable->cable_index = index; in extcon_dev_register()
1179 for (index = 0; edev->mutually_exclusive[index]; index++) in extcon_dev_register()
1182 edev->attrs_muex = kcalloc(index + 1, in extcon_dev_register()
1190 edev->d_attrs_muex = kcalloc(index, in extcon_dev_register()
1199 for (index = 0; edev->mutually_exclusive[index]; index++) { in extcon_dev_register()
1200 sprintf(buf, "0x%x", edev->mutually_exclusive[index]); in extcon_dev_register()
1204 for (index--; index >= 0; index--) { in extcon_dev_register()
1205 kfree(edev->d_attrs_muex[index].attr. in extcon_dev_register()
1214 sysfs_attr_init(&edev->d_attrs_muex[index].attr); in extcon_dev_register()
1215 edev->d_attrs_muex[index].attr.name = name; in extcon_dev_register()
1216 edev->d_attrs_muex[index].attr.mode = 0000; in extcon_dev_register()
1217 edev->attrs_muex[index] = &edev->d_attrs_muex[index] in extcon_dev_register()
1238 for (index = 0; index < edev->max_supported; index++) in extcon_dev_register()
1239 edev->extcon_dev_type.groups[index] = in extcon_dev_register()
1240 &edev->cables[index].attr_g; in extcon_dev_register()
1242 edev->extcon_dev_type.groups[index] = in extcon_dev_register()
1262 for (index = 0; index < edev->max_supported; index++) in extcon_dev_register()
1263 RAW_INIT_NOTIFIER_HEAD(&edev->nh[index]); in extcon_dev_register()
1281 for (index = 0; edev->mutually_exclusive[index]; index++) in extcon_dev_register()
1282 kfree(edev->d_attrs_muex[index].attr.name); in extcon_dev_register()
1287 for (index = 0; index < edev->max_supported; index++) in extcon_dev_register()
1288 kfree(edev->cables[index].attr_g.name); in extcon_dev_register()
1306 int index; in extcon_dev_unregister() local
1324 for (index = 0; edev->mutually_exclusive[index]; in extcon_dev_unregister()
1325 index++) in extcon_dev_unregister()
1326 kfree(edev->d_attrs_muex[index].attr.name); in extcon_dev_unregister()
1331 for (index = 0; index < edev->max_supported; index++) in extcon_dev_unregister()
1332 kfree(edev->cables[index].attr_g.name); in extcon_dev_unregister()
1373 struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index) in extcon_get_edev_by_phandle() argument
1386 node = of_parse_phandle(dev->of_node, "extcon", index); in extcon_get_edev_by_phandle()
1406 struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index) in extcon_get_edev_by_phandle() argument