Lines Matching refs:index
204 * @cable_index: the index of this cable in the edev
268 /* Find the the index of extcon cable in edev->supported_cable */
293 static bool is_extcon_attached(struct extcon_dev *edev, unsigned int index)
295 return !!(edev->state & BIT(index));
298 static bool is_extcon_changed(struct extcon_dev *edev, int index,
301 int state = !!(edev->state & BIT(index));
319 unsigned int id, int index,unsigned int prop)
329 cable = &edev->cables[index];
351 static void init_property(struct extcon_dev *edev, unsigned int id, int index)
354 struct extcon_cable *cable = &edev->cables[index];
434 int index;
441 index = find_cable_index_by_id(edev, id);
442 if (index < 0)
443 return index;
446 state = !!(edev->state & BIT(index));
453 raw_notifier_call_chain(&edev->nh[index], state, edev);
509 int index, state;
515 index = find_cable_index_by_id(edev, id);
516 if (index < 0)
517 return index;
520 state = is_extcon_attached(edev, index);
543 int index, ret = 0;
548 index = find_cable_index_by_id(edev, id);
549 if (index < 0)
550 return index;
555 if (!is_extcon_changed(edev, index, state))
559 (edev->state & ~BIT(index)) | (state & BIT(index)))) {
569 init_property(edev, id, index);
573 edev->state |= BIT(index);
575 edev->state &= ~(BIT(index));
597 int ret, index;
600 index = find_cable_index_by_id(edev, id);
601 if (index < 0)
602 return index;
606 ret = is_extcon_changed(edev, index, state);
639 int index, ret = 0;
650 /* Find the cable index of external connector by using id */
651 index = find_cable_index_by_id(edev, id);
652 if (index < 0)
653 return index;
658 if (!is_extcon_property_capability(edev, id, index, prop)) {
668 if (!is_extcon_attached(edev, index)) {
673 cable = &edev->cables[index];
718 int index, ret = 0;
727 /* Find the cable index of external connector by using id */
728 index = find_cable_index_by_id(edev, id);
729 if (index < 0)
730 return index;
735 if (!is_extcon_property_capability(edev, id, index, prop)) {
740 cable = &edev->cables[index];
803 int index;
812 /* Find the cable index of external connector by using id */
813 index = find_cable_index_by_id(edev, id);
814 if (index < 0)
815 return index;
817 return is_extcon_property_capability(edev, id, index, prop);
838 int index, type, ret = 0;
847 /* Find the cable index of external connector by using id. */
848 index = find_cable_index_by_id(edev, id);
849 if (index < 0)
850 return index;
856 cable = &edev->cables[index];
1102 int ret, index = 0;
1114 for (; edev->supported_cable[index] != EXTCON_NONE; index++);
1116 edev->max_supported = index;
1117 if (index > SUPPORTED_CABLE_MAX) {
1146 for (index = 0; index < edev->max_supported; index++) {
1147 cable = &edev->cables[index];
1149 str = kasprintf(GFP_KERNEL, "cable.%d", index);
1151 for (index--; index >= 0; index--) {
1152 cable = &edev->cables[index];
1161 cable->cable_index = index;
1184 for (index = 0; edev->mutually_exclusive[index]; index++)
1187 edev->attrs_muex = kcalloc(index + 1,
1195 edev->d_attrs_muex = kcalloc(index,
1204 for (index = 0; edev->mutually_exclusive[index]; index++) {
1206 edev->mutually_exclusive[index]);
1208 for (index--; index >= 0; index--) {
1209 kfree(edev->d_attrs_muex[index].attr.
1217 sysfs_attr_init(&edev->d_attrs_muex[index].attr);
1218 edev->d_attrs_muex[index].attr.name = name;
1219 edev->d_attrs_muex[index].attr.mode = 0000;
1220 edev->attrs_muex[index] = &edev->d_attrs_muex[index]
1241 for (index = 0; index < edev->max_supported; index++)
1242 edev->extcon_dev_type.groups[index] =
1243 &edev->cables[index].attr_g;
1245 edev->extcon_dev_type.groups[index] =
1261 for (index = 0; index < edev->max_supported; index++)
1262 RAW_INIT_NOTIFIER_HEAD(&edev->nh[index]);
1289 for (index = 0; edev->mutually_exclusive[index]; index++)
1290 kfree(edev->d_attrs_muex[index].attr.name);
1295 for (index = 0; index < edev->max_supported; index++)
1296 kfree(edev->cables[index].attr_g.name);
1314 int index;
1332 for (index = 0; edev->mutually_exclusive[index];
1333 index++)
1334 kfree(edev->d_attrs_muex[index].attr.name);
1339 for (index = 0; index < edev->max_supported; index++)
1340 kfree(edev->cables[index].attr_g.name);
1378 * @index : the index into list of extcon_dev
1382 struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index)
1395 node = of_parse_phandle(dev->of_node, "extcon", index);
1415 struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index)