Lines Matching refs:len
73 static int em2800_i2c_send_bytes(struct em28xx *dev, u8 addr, u8 *buf, u16 len) in em2800_i2c_send_bytes() argument
79 if (len < 1 || len > 4) in em2800_i2c_send_bytes()
82 b2[5] = 0x80 + len - 1; in em2800_i2c_send_bytes()
85 if (len > 1) in em2800_i2c_send_bytes()
87 if (len > 2) in em2800_i2c_send_bytes()
89 if (len > 3) in em2800_i2c_send_bytes()
93 ret = dev->em28xx_write_regs(dev, 4 - len, &b2[4 - len], 2 + len); in em2800_i2c_send_bytes()
94 if (ret != 2 + len) { in em2800_i2c_send_bytes()
103 if (ret == 0x80 + len - 1) in em2800_i2c_send_bytes()
104 return len; in em2800_i2c_send_bytes()
105 if (ret == 0x94 + len - 1) { in em2800_i2c_send_bytes()
125 static int em2800_i2c_recv_bytes(struct em28xx *dev, u8 addr, u8 *buf, u16 len) in em2800_i2c_recv_bytes() argument
132 if (len < 1 || len > 4) in em2800_i2c_recv_bytes()
136 buf2[1] = 0x84 + len - 1; in em2800_i2c_recv_bytes()
149 if (ret == 0x84 + len - 1) in em2800_i2c_recv_bytes()
151 if (ret == 0x94 + len - 1) { in em2800_i2c_recv_bytes()
164 if (ret != 0x84 + len - 1) in em2800_i2c_recv_bytes()
168 ret = dev->em28xx_read_reg_req_len(dev, 0x00, 4 - len, buf2, len); in em2800_i2c_recv_bytes()
169 if (ret != len) { in em2800_i2c_recv_bytes()
175 for (i = 0; i < len; i++) in em2800_i2c_recv_bytes()
176 buf[i] = buf2[len - 1 - i]; in em2800_i2c_recv_bytes()
200 u16 len, int stop) in em28xx_i2c_send_bytes() argument
205 if (len < 1 || len > 64) in em28xx_i2c_send_bytes()
213 ret = dev->em28xx_write_regs_req(dev, stop ? 2 : 3, addr, buf, len); in em28xx_i2c_send_bytes()
214 if (ret != len) { in em28xx_i2c_send_bytes()
223 len, addr, ret); in em28xx_i2c_send_bytes()
231 return len; in em28xx_i2c_send_bytes()
269 static int em28xx_i2c_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, u16 len) in em28xx_i2c_recv_bytes() argument
273 if (len < 1 || len > 64) in em28xx_i2c_recv_bytes()
281 ret = dev->em28xx_read_reg_req_len(dev, 2, addr, buf, len); in em28xx_i2c_recv_bytes()
287 } else if (ret != len) { in em28xx_i2c_recv_bytes()
290 ret, addr, len); in em28xx_i2c_recv_bytes()
304 return len; in em28xx_i2c_recv_bytes()
351 u16 len) in em25xx_bus_B_send_bytes() argument
355 if (len < 1 || len > 64) in em25xx_bus_B_send_bytes()
363 ret = dev->em28xx_write_regs_req(dev, 0x06, addr, buf, len); in em25xx_bus_B_send_bytes()
364 if (ret != len) { in em25xx_bus_B_send_bytes()
374 len, addr, ret); in em25xx_bus_B_send_bytes()
384 return len; in em25xx_bus_B_send_bytes()
404 u16 len) in em25xx_bus_B_recv_bytes() argument
408 if (len < 1 || len > 64) in em25xx_bus_B_recv_bytes()
416 ret = dev->em28xx_read_reg_req_len(dev, 0x06, addr, buf, len); in em25xx_bus_B_recv_bytes()
439 return len; in em25xx_bus_B_recv_bytes()
496 rc = em28xx_i2c_recv_bytes(dev, addr, msg.buf, msg.len); in i2c_recv_bytes()
498 rc = em2800_i2c_recv_bytes(dev, addr, msg.buf, msg.len); in i2c_recv_bytes()
500 rc = em25xx_bus_B_recv_bytes(dev, addr, msg.buf, msg.len); in i2c_recv_bytes()
512 rc = em28xx_i2c_send_bytes(dev, addr, msg.buf, msg.len, stop); in i2c_send_bytes()
514 rc = em2800_i2c_send_bytes(dev, addr, msg.buf, msg.len); in i2c_send_bytes()
516 rc = em25xx_bus_B_send_bytes(dev, addr, msg.buf, msg.len); in i2c_send_bytes()
558 if (!msgs[i].len) { in em28xx_i2c_xfer()
581 addr, msgs[i].len, in em28xx_i2c_xfer()
582 msgs[i].len, msgs[i].buf); in em28xx_i2c_xfer()
592 addr, msgs[i].len, in em28xx_i2c_xfer()
609 int len = 0; in em28xx_hash_mem() local
613 if (len == length) { in em28xx_hash_mem()
614 c = (char)len; in em28xx_hash_mem()
615 len = -1; in em28xx_hash_mem()
620 len++; in em28xx_hash_mem()
621 if ((len & (32 / 8 - 1)) == 0) in em28xx_hash_mem()
623 } while (len); in em28xx_hash_mem()
633 bool addr_w16, u16 len, u8 *data) in em28xx_i2c_read_block() argument
635 int remain = len, rsize, rsize_max, ret; in em28xx_i2c_read_block()
667 return len; in em28xx_i2c_read_block()
673 const u16 len = 256; in em28xx_i2c_eeprom() local
697 data = kzalloc(len, GFP_KERNEL); in em28xx_i2c_eeprom()
704 len, data); in em28xx_i2c_eeprom()
705 if (err != len) { in em28xx_i2c_eeprom()
714 16, 1, data, len, true); in em28xx_i2c_eeprom()
727 dev->hash = em28xx_hash_mem(data, len, 32); in em28xx_i2c_eeprom()
771 err = em28xx_i2c_read_block(dev, bus, hwconf_offset, 1, len, in em28xx_i2c_eeprom()
773 if (err != len) { in em28xx_i2c_eeprom()
798 dev->hash = em28xx_hash_mem(data, len, 32); in em28xx_i2c_eeprom()
812 *eedata_len = len; in em28xx_i2c_eeprom()