| .. | .. |
|---|
| 461 | 461 | * from another gadget or a random directory. |
|---|
| 462 | 462 | * Also a function instance can only be linked once. |
|---|
| 463 | 463 | */ |
|---|
| 464 | + |
|---|
| 465 | + if (gi->composite.gadget_driver.udc_name) { |
|---|
| 466 | + ret = -EINVAL; |
|---|
| 467 | + goto out; |
|---|
| 468 | + } |
|---|
| 469 | + |
|---|
| 464 | 470 | list_for_each_entry(a_fi, &gi->available_func, cfs_list) { |
|---|
| 465 | 471 | if (a_fi == fi) |
|---|
| 466 | 472 | break; |
|---|
| .. | .. |
|---|
| 1549 | 1555 | int value = -EOPNOTSUPP; |
|---|
| 1550 | 1556 | struct usb_function_instance *fi; |
|---|
| 1551 | 1557 | |
|---|
| 1552 | | - if (!android_device) |
|---|
| 1558 | + cdev = get_gadget_data(gadget); |
|---|
| 1559 | + if (!cdev) |
|---|
| 1553 | 1560 | return 0; |
|---|
| 1554 | 1561 | |
|---|
| 1555 | | - gi = dev_get_drvdata(android_device); |
|---|
| 1562 | + gi = container_of(cdev, struct gadget_info, cdev); |
|---|
| 1556 | 1563 | spin_lock_irqsave(&gi->spinlock, flags); |
|---|
| 1557 | 1564 | cdev = get_gadget_data(gadget); |
|---|
| 1558 | 1565 | if (!cdev || gi->unbind) { |
|---|