Lines Matching refs:index

295 static bool is_extcon_attached(struct extcon_dev *edev, unsigned int index)  in is_extcon_attached()  argument
297 return !!(edev->state & BIT(index)); in is_extcon_attached()
300 static bool is_extcon_changed(struct extcon_dev *edev, int index, in is_extcon_changed() argument
303 int state = !!(edev->state & BIT(index)); in is_extcon_changed()
321 unsigned int id, int index,unsigned int prop) in is_extcon_property_capability() argument
331 cable = &edev->cables[index]; in is_extcon_property_capability()
353 static void init_property(struct extcon_dev *edev, unsigned int id, int index) in init_property() argument
356 struct extcon_cable *cable = &edev->cables[index]; in init_property()
437 int index; in extcon_sync() local
444 index = find_cable_index_by_id(edev, id); in extcon_sync()
445 if (index < 0) in extcon_sync()
446 return index; in extcon_sync()
449 state = !!(edev->state & BIT(index)); in extcon_sync()
456 raw_notifier_call_chain(&edev->nh[index], state, edev); in extcon_sync()
512 int index, state; in extcon_get_state() local
518 index = find_cable_index_by_id(edev, id); in extcon_get_state()
519 if (index < 0) in extcon_get_state()
520 return index; in extcon_get_state()
523 state = is_extcon_attached(edev, index); in extcon_get_state()
546 int index, ret = 0; in extcon_set_state() local
551 index = find_cable_index_by_id(edev, id); in extcon_set_state()
552 if (index < 0) in extcon_set_state()
553 return index; in extcon_set_state()
558 if (!is_extcon_changed(edev, index, state)) in extcon_set_state()
562 (edev->state & ~BIT(index)) | (state & BIT(index)))) { in extcon_set_state()
572 init_property(edev, id, index); in extcon_set_state()
576 edev->state |= BIT(index); in extcon_set_state()
578 edev->state &= ~(BIT(index)); in extcon_set_state()
630 int index, ret = 0; in extcon_get_property() local
642 index = find_cable_index_by_id(edev, id); in extcon_get_property()
643 if (index < 0) in extcon_get_property()
644 return index; in extcon_get_property()
649 if (!is_extcon_property_capability(edev, id, index, prop)) { in extcon_get_property()
659 if (!is_extcon_attached(edev, index)) { in extcon_get_property()
664 cable = &edev->cables[index]; in extcon_get_property()
709 int index, ret = 0; in extcon_set_property() local
719 index = find_cable_index_by_id(edev, id); in extcon_set_property()
720 if (index < 0) in extcon_set_property()
721 return index; in extcon_set_property()
726 if (!is_extcon_property_capability(edev, id, index, prop)) { in extcon_set_property()
731 cable = &edev->cables[index]; in extcon_set_property()
797 int index; in extcon_get_property_capability() local
807 index = find_cable_index_by_id(edev, id); in extcon_get_property_capability()
808 if (index < 0) in extcon_get_property_capability()
809 return index; in extcon_get_property_capability()
811 return is_extcon_property_capability(edev, id, index, prop); in extcon_get_property_capability()
832 int index, type, ret = 0; in extcon_set_property_capability() local
842 index = find_cable_index_by_id(edev, id); in extcon_set_property_capability()
843 if (index < 0) in extcon_set_property_capability()
844 return index; in extcon_set_property_capability()
850 cable = &edev->cables[index]; in extcon_set_property_capability()
1091 int index; in extcon_alloc_cables() local
1106 for (index = 0; index < edev->max_supported; index++) { in extcon_alloc_cables()
1107 cable = &edev->cables[index]; in extcon_alloc_cables()
1109 str = kasprintf(GFP_KERNEL, "cable.%d", index); in extcon_alloc_cables()
1111 for (index--; index >= 0; index--) { in extcon_alloc_cables()
1112 cable = &edev->cables[index]; in extcon_alloc_cables()
1121 cable->cable_index = index; in extcon_alloc_cables()
1151 int index; in extcon_alloc_muex() local
1160 for (index = 0; edev->mutually_exclusive[index]; index++) in extcon_alloc_muex()
1163 edev->attrs_muex = kcalloc(index + 1, sizeof(*edev->attrs_muex), in extcon_alloc_muex()
1168 edev->d_attrs_muex = kcalloc(index, sizeof(*edev->d_attrs_muex), in extcon_alloc_muex()
1175 for (index = 0; edev->mutually_exclusive[index]; index++) { in extcon_alloc_muex()
1177 edev->mutually_exclusive[index]); in extcon_alloc_muex()
1179 for (index--; index >= 0; index--) in extcon_alloc_muex()
1180 kfree(edev->d_attrs_muex[index].attr.name); in extcon_alloc_muex()
1186 sysfs_attr_init(&edev->d_attrs_muex[index].attr); in extcon_alloc_muex()
1187 edev->d_attrs_muex[index].attr.name = name; in extcon_alloc_muex()
1188 edev->d_attrs_muex[index].attr.mode = 0000; in extcon_alloc_muex()
1189 edev->attrs_muex[index] = &edev->d_attrs_muex[index].attr; in extcon_alloc_muex()
1205 int index; in extcon_alloc_groups() local
1222 for (index = 0; index < edev->max_supported; index++) in extcon_alloc_groups()
1223 edev->extcon_dev_type.groups[index] = &edev->cables[index].attr_g; in extcon_alloc_groups()
1226 edev->extcon_dev_type.groups[index] = &edev->attr_g_muex; in extcon_alloc_groups()
1249 int ret, index; in extcon_dev_register() local
1258 for (index = 0; edev->supported_cable[index] != EXTCON_NONE; index++); in extcon_dev_register()
1260 edev->max_supported = index; in extcon_dev_register()
1261 if (index > SUPPORTED_CABLE_MAX) { in extcon_dev_register()
1305 for (index = 0; index < edev->max_supported; index++) in extcon_dev_register()
1306 RAW_INIT_NOTIFIER_HEAD(&edev->nh[index]); in extcon_dev_register()
1334 for (index = 0; edev->mutually_exclusive[index]; index++) in extcon_dev_register()
1335 kfree(edev->d_attrs_muex[index].attr.name); in extcon_dev_register()
1340 for (index = 0; index < edev->max_supported; index++) in extcon_dev_register()
1341 kfree(edev->cables[index].attr_g.name); in extcon_dev_register()
1360 int index; in extcon_dev_unregister() local
1379 for (index = 0; edev->mutually_exclusive[index]; in extcon_dev_unregister()
1380 index++) in extcon_dev_unregister()
1381 kfree(edev->d_attrs_muex[index].attr.name); in extcon_dev_unregister()
1386 for (index = 0; index < edev->max_supported; index++) in extcon_dev_unregister()
1387 kfree(edev->cables[index].attr_g.name); in extcon_dev_unregister()
1429 struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index) in extcon_get_edev_by_phandle() argument
1439 node = of_parse_phandle(np, "extcon", index); in extcon_get_edev_by_phandle()
1458 struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index) in extcon_get_edev_by_phandle() argument