Lines Matching refs:index

285 static bool is_extcon_attached(struct extcon_dev *edev, unsigned int index)  in is_extcon_attached()  argument
287 return !!(edev->state & BIT(index)); in is_extcon_attached()
290 static bool is_extcon_changed(struct extcon_dev *edev, int index, in is_extcon_changed() argument
293 int state = !!(edev->state & BIT(index)); in is_extcon_changed()
311 unsigned int id, int index,unsigned int prop) in is_extcon_property_capability() argument
321 cable = &edev->cables[index]; in is_extcon_property_capability()
343 static void init_property(struct extcon_dev *edev, unsigned int id, int index) in init_property() argument
346 struct extcon_cable *cable = &edev->cables[index]; in init_property()
427 int index; in extcon_sync() local
434 index = find_cable_index_by_id(edev, id); in extcon_sync()
435 if (index < 0) in extcon_sync()
436 return index; in extcon_sync()
439 state = !!(edev->state & BIT(index)); in extcon_sync()
446 raw_notifier_call_chain(&edev->nh[index], state, edev); in extcon_sync()
502 int index, state; in extcon_get_state() local
508 index = find_cable_index_by_id(edev, id); in extcon_get_state()
509 if (index < 0) in extcon_get_state()
510 return index; in extcon_get_state()
513 state = is_extcon_attached(edev, index); in extcon_get_state()
536 int index, ret = 0; in extcon_set_state() local
541 index = find_cable_index_by_id(edev, id); in extcon_set_state()
542 if (index < 0) in extcon_set_state()
543 return index; in extcon_set_state()
548 if (!is_extcon_changed(edev, index, state)) in extcon_set_state()
552 (edev->state & ~BIT(index)) | (state & BIT(index)))) { in extcon_set_state()
562 init_property(edev, id, index); in extcon_set_state()
566 edev->state |= BIT(index); in extcon_set_state()
568 edev->state &= ~(BIT(index)); in extcon_set_state()
620 int index, ret = 0; in extcon_get_property() local
632 index = find_cable_index_by_id(edev, id); in extcon_get_property()
633 if (index < 0) in extcon_get_property()
634 return index; in extcon_get_property()
639 if (!is_extcon_property_capability(edev, id, index, prop)) { in extcon_get_property()
649 if (!is_extcon_attached(edev, index)) { in extcon_get_property()
654 cable = &edev->cables[index]; in extcon_get_property()
699 int index, ret = 0; in extcon_set_property() local
709 index = find_cable_index_by_id(edev, id); in extcon_set_property()
710 if (index < 0) in extcon_set_property()
711 return index; in extcon_set_property()
716 if (!is_extcon_property_capability(edev, id, index, prop)) { in extcon_set_property()
721 cable = &edev->cables[index]; in extcon_set_property()
787 int index; in extcon_get_property_capability() local
797 index = find_cable_index_by_id(edev, id); in extcon_get_property_capability()
798 if (index < 0) in extcon_get_property_capability()
799 return index; in extcon_get_property_capability()
801 return is_extcon_property_capability(edev, id, index, prop); in extcon_get_property_capability()
822 int index, type, ret = 0; in extcon_set_property_capability() local
832 index = find_cable_index_by_id(edev, id); in extcon_set_property_capability()
833 if (index < 0) in extcon_set_property_capability()
834 return index; in extcon_set_property_capability()
840 cable = &edev->cables[index]; in extcon_set_property_capability()
1088 int ret, index = 0; in extcon_dev_register() local
1100 for (; edev->supported_cable[index] != EXTCON_NONE; index++); in extcon_dev_register()
1102 edev->max_supported = index; in extcon_dev_register()
1103 if (index > SUPPORTED_CABLE_MAX) { in extcon_dev_register()
1132 for (index = 0; index < edev->max_supported; index++) { in extcon_dev_register()
1133 cable = &edev->cables[index]; in extcon_dev_register()
1135 str = kasprintf(GFP_KERNEL, "cable.%d", index); in extcon_dev_register()
1137 for (index--; index >= 0; index--) { in extcon_dev_register()
1138 cable = &edev->cables[index]; in extcon_dev_register()
1147 cable->cable_index = index; in extcon_dev_register()
1170 for (index = 0; edev->mutually_exclusive[index]; index++) in extcon_dev_register()
1173 edev->attrs_muex = kcalloc(index + 1, in extcon_dev_register()
1181 edev->d_attrs_muex = kcalloc(index, in extcon_dev_register()
1190 for (index = 0; edev->mutually_exclusive[index]; index++) { in extcon_dev_register()
1192 edev->mutually_exclusive[index]); in extcon_dev_register()
1194 for (index--; index >= 0; index--) { in extcon_dev_register()
1195 kfree(edev->d_attrs_muex[index].attr. in extcon_dev_register()
1203 sysfs_attr_init(&edev->d_attrs_muex[index].attr); in extcon_dev_register()
1204 edev->d_attrs_muex[index].attr.name = name; in extcon_dev_register()
1205 edev->d_attrs_muex[index].attr.mode = 0000; in extcon_dev_register()
1206 edev->attrs_muex[index] = &edev->d_attrs_muex[index] in extcon_dev_register()
1227 for (index = 0; index < edev->max_supported; index++) in extcon_dev_register()
1228 edev->extcon_dev_type.groups[index] = in extcon_dev_register()
1229 &edev->cables[index].attr_g; in extcon_dev_register()
1231 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()
1275 for (index = 0; edev->mutually_exclusive[index]; index++) in extcon_dev_register()
1276 kfree(edev->d_attrs_muex[index].attr.name); in extcon_dev_register()
1281 for (index = 0; index < edev->max_supported; index++) in extcon_dev_register()
1282 kfree(edev->cables[index].attr_g.name); in extcon_dev_register()
1300 int index; in extcon_dev_unregister() local
1318 for (index = 0; edev->mutually_exclusive[index]; in extcon_dev_unregister()
1319 index++) in extcon_dev_unregister()
1320 kfree(edev->d_attrs_muex[index].attr.name); in extcon_dev_unregister()
1325 for (index = 0; index < edev->max_supported; index++) in extcon_dev_unregister()
1326 kfree(edev->cables[index].attr_g.name); in extcon_dev_unregister()
1368 struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index) in extcon_get_edev_by_phandle() argument
1381 node = of_parse_phandle(dev->of_node, "extcon", index); in extcon_get_edev_by_phandle()
1401 struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index) in extcon_get_edev_by_phandle() argument