Lines Matching refs:index

290 static bool is_extcon_attached(struct extcon_dev *edev, unsigned int index)  in is_extcon_attached()  argument
292 return !!(edev->state & BIT(index)); in is_extcon_attached()
295 static bool is_extcon_changed(struct extcon_dev *edev, int index, in is_extcon_changed() argument
298 int state = !!(edev->state & BIT(index)); in is_extcon_changed()
316 unsigned int id, int index,unsigned int prop) in is_extcon_property_capability() argument
326 cable = &edev->cables[index]; in is_extcon_property_capability()
348 static void init_property(struct extcon_dev *edev, unsigned int id, int index) in init_property() argument
351 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()
443 state = !!(edev->state & BIT(index)); in extcon_sync()
450 raw_notifier_call_chain(&edev->nh[index], state, edev); in extcon_sync()
506 int index, state; in extcon_get_state() local
512 index = find_cable_index_by_id(edev, id); in extcon_get_state()
513 if (index < 0) in extcon_get_state()
514 return index; in extcon_get_state()
517 state = is_extcon_attached(edev, index); in extcon_get_state()
540 int index, ret = 0; in extcon_set_state() local
545 index = find_cable_index_by_id(edev, id); in extcon_set_state()
546 if (index < 0) in extcon_set_state()
547 return index; in extcon_set_state()
552 if (!is_extcon_changed(edev, index, state)) in extcon_set_state()
556 (edev->state & ~BIT(index)) | (state & BIT(index)))) { in extcon_set_state()
566 init_property(edev, id, index); in extcon_set_state()
570 edev->state |= BIT(index); in extcon_set_state()
572 edev->state &= ~(BIT(index)); in extcon_set_state()
594 int ret, index; in extcon_set_state_sync() local
597 index = find_cable_index_by_id(edev, id); in extcon_set_state_sync()
598 if (index < 0) in extcon_set_state_sync()
599 return index; in extcon_set_state_sync()
603 ret = is_extcon_changed(edev, index, state); in extcon_set_state_sync()
636 int index, ret = 0; in extcon_get_property() local
648 index = find_cable_index_by_id(edev, id); in extcon_get_property()
649 if (index < 0) in extcon_get_property()
650 return index; in extcon_get_property()
655 if (!is_extcon_property_capability(edev, id, index, prop)) { in extcon_get_property()
665 if (!is_extcon_attached(edev, index)) { in extcon_get_property()
670 cable = &edev->cables[index]; in extcon_get_property()
715 int index, ret = 0; in extcon_set_property() local
725 index = find_cable_index_by_id(edev, id); in extcon_set_property()
726 if (index < 0) in extcon_set_property()
727 return index; in extcon_set_property()
732 if (!is_extcon_property_capability(edev, id, index, prop)) { in extcon_set_property()
737 cable = &edev->cables[index]; in extcon_set_property()
800 int index; in extcon_get_property_capability() local
810 index = find_cable_index_by_id(edev, id); in extcon_get_property_capability()
811 if (index < 0) in extcon_get_property_capability()
812 return index; in extcon_get_property_capability()
814 return is_extcon_property_capability(edev, id, index, prop); in extcon_get_property_capability()
835 int index, type, ret = 0; in extcon_set_property_capability() local
845 index = find_cable_index_by_id(edev, id); in extcon_set_property_capability()
846 if (index < 0) in extcon_set_property_capability()
847 return index; in extcon_set_property_capability()
853 cable = &edev->cables[index]; in extcon_set_property_capability()
1099 int ret, index = 0; in extcon_dev_register() local
1111 for (; edev->supported_cable[index] != EXTCON_NONE; index++); in extcon_dev_register()
1113 edev->max_supported = index; in extcon_dev_register()
1114 if (index > SUPPORTED_CABLE_MAX) { in extcon_dev_register()
1143 for (index = 0; index < edev->max_supported; index++) { in extcon_dev_register()
1144 cable = &edev->cables[index]; in extcon_dev_register()
1146 str = kasprintf(GFP_KERNEL, "cable.%d", index); in extcon_dev_register()
1148 for (index--; index >= 0; index--) { in extcon_dev_register()
1149 cable = &edev->cables[index]; in extcon_dev_register()
1158 cable->cable_index = index; in extcon_dev_register()
1181 for (index = 0; edev->mutually_exclusive[index]; index++) in extcon_dev_register()
1184 edev->attrs_muex = kcalloc(index + 1, in extcon_dev_register()
1192 edev->d_attrs_muex = kcalloc(index, in extcon_dev_register()
1201 for (index = 0; edev->mutually_exclusive[index]; index++) { in extcon_dev_register()
1203 edev->mutually_exclusive[index]); in extcon_dev_register()
1205 for (index--; index >= 0; index--) { in extcon_dev_register()
1206 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()
1258 for (index = 0; index < edev->max_supported; index++) in extcon_dev_register()
1259 RAW_INIT_NOTIFIER_HEAD(&edev->nh[index]); in extcon_dev_register()
1286 for (index = 0; edev->mutually_exclusive[index]; index++) in extcon_dev_register()
1287 kfree(edev->d_attrs_muex[index].attr.name); in extcon_dev_register()
1292 for (index = 0; index < edev->max_supported; index++) in extcon_dev_register()
1293 kfree(edev->cables[index].attr_g.name); in extcon_dev_register()
1311 int index; in extcon_dev_unregister() local
1329 for (index = 0; edev->mutually_exclusive[index]; in extcon_dev_unregister()
1330 index++) in extcon_dev_unregister()
1331 kfree(edev->d_attrs_muex[index].attr.name); in extcon_dev_unregister()
1336 for (index = 0; index < edev->max_supported; index++) in extcon_dev_unregister()
1337 kfree(edev->cables[index].attr_g.name); in extcon_dev_unregister()
1379 struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index) in extcon_get_edev_by_phandle() argument
1392 node = of_parse_phandle(dev->of_node, "extcon", index); in extcon_get_edev_by_phandle()
1412 struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index) in extcon_get_edev_by_phandle() argument