| .. | .. |
|---|
| 685 | 685 | p += new_msgs[j].len; |
|---|
| 686 | 686 | } |
|---|
| 687 | 687 | |
|---|
| 688 | | - if (i < num) |
|---|
| 688 | + if (i < num) { |
|---|
| 689 | 689 | ret = -ENOMEM; |
|---|
| 690 | | - else |
|---|
| 690 | + } else if (!state->cfg.split_tuner_read_i2c || rd_num == 0) { |
|---|
| 691 | 691 | ret = i2c_transfer(state->i2c_client->adapter, new_msgs, j); |
|---|
| 692 | + } else { |
|---|
| 693 | + /* |
|---|
| 694 | + * Split transactions at each I2C_M_RD message. |
|---|
| 695 | + * Some of the parent device require this, |
|---|
| 696 | + * such as Friio (see. dvb-usb-gl861). |
|---|
| 697 | + */ |
|---|
| 698 | + int from, to; |
|---|
| 699 | + |
|---|
| 700 | + ret = 0; |
|---|
| 701 | + from = 0; |
|---|
| 702 | + do { |
|---|
| 703 | + int r; |
|---|
| 704 | + |
|---|
| 705 | + to = from + 1; |
|---|
| 706 | + while (to < j && !(new_msgs[to].flags & I2C_M_RD)) |
|---|
| 707 | + to++; |
|---|
| 708 | + r = i2c_transfer(state->i2c_client->adapter, |
|---|
| 709 | + &new_msgs[from], to - from); |
|---|
| 710 | + ret = (r <= 0) ? r : ret + r; |
|---|
| 711 | + from = to; |
|---|
| 712 | + } while (from < j && ret > 0); |
|---|
| 713 | + } |
|---|
| 714 | + |
|---|
| 692 | 715 | if (ret >= 0 && ret < j) |
|---|
| 693 | 716 | ret = -EIO; |
|---|
| 694 | 717 | kfree(new_msgs); |
|---|
| .. | .. |
|---|
| 781 | 804 | adap->owner = THIS_MODULE; |
|---|
| 782 | 805 | adap->algo = &tc90522_tuner_i2c_algo; |
|---|
| 783 | 806 | adap->dev.parent = &client->dev; |
|---|
| 784 | | - strlcpy(adap->name, "tc90522_sub", sizeof(adap->name)); |
|---|
| 807 | + strscpy(adap->name, "tc90522_sub", sizeof(adap->name)); |
|---|
| 785 | 808 | i2c_set_adapdata(adap, state); |
|---|
| 786 | 809 | ret = i2c_add_adapter(adap); |
|---|
| 787 | 810 | if (ret < 0) |
|---|