Lines Matching refs:err
172 int err; in ds_send_control_cmd() local
174 err = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, dev->ep[EP_CONTROL]), in ds_send_control_cmd()
176 if (err < 0) { in ds_send_control_cmd()
179 value, index, err); in ds_send_control_cmd()
180 return err; in ds_send_control_cmd()
183 return err; in ds_send_control_cmd()
188 int err; in ds_send_control_mode() local
190 err = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, dev->ep[EP_CONTROL]), in ds_send_control_mode()
192 if (err < 0) { in ds_send_control_mode()
195 value, index, err); in ds_send_control_mode()
196 return err; in ds_send_control_mode()
199 return err; in ds_send_control_mode()
204 int err; in ds_send_control() local
206 err = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, dev->ep[EP_CONTROL]), in ds_send_control()
208 if (err < 0) { in ds_send_control()
211 value, index, err); in ds_send_control()
212 return err; in ds_send_control()
215 return err; in ds_send_control()
272 int count, err; in ds_recv_status() local
278 err = usb_interrupt_msg(dev->udev, in ds_recv_status()
283 if (err < 0) { in ds_recv_status()
286 dev->ep[EP_STATUS], err); in ds_recv_status()
287 return err; in ds_recv_status()
318 int count, err; in ds_recv_data() local
330 err = usb_bulk_msg(dev->udev, usb_rcvbulkpipe(dev->udev, dev->ep[EP_DATA_IN]), in ds_recv_data()
332 if (err < 0) { in ds_recv_data()
343 return err; in ds_recv_data()
361 int count, err; in ds_send_data() local
364 …err = usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, dev->ep[EP_DATA_OUT]), buf, len, &count, … in ds_send_data()
365 if (err < 0) { in ds_send_data()
367 "err=%d.\n", dev->ep[EP_DATA_OUT], err); in ds_send_data()
368 return err; in ds_send_data()
371 return err; in ds_send_data()
379 int count = 0, err = 0;
382 err = ds_send_control(dev, CTL_HALT_EXE_IDLE, 0);
383 if (err)
385 err = ds_send_control(dev, CTL_RESUME_EXE, 0);
386 if (err)
388 err = ds_recv_status(dev, &st);
389 if (err)
393 err = ds_send_control_mode(dev, MOD_PULSE_EN, 0);
394 if (err)
399 return err;
404 int err;
406 err = ds_send_control_cmd(dev, CTL_RESET_DEVICE, 0);
407 if (err)
408 return err;
410 err = ds_send_control(dev, COMM_SET_DURATION | COMM_IM, 0);
411 if (err)
412 return err;
414 err = ds_send_control(dev, COMM_SET_DURATION | COMM_IM | COMM_TYPE, 0x40);
415 if (err)
416 return err;
418 err = ds_send_control_mode(dev, MOD_PULSE_EN, PULSE_PROG);
419 if (err)
420 return err;
422 err = ds_dump_status(dev, st);
424 return err;
431 int err, count = 0; in ds_wait_status() local
435 err = ds_recv_status(dev, st); in ds_wait_status()
437 if (err >= 0) { in ds_wait_status()
439 printk("0x%x: count=%d, status: ", dev->ep[EP_STATUS], err); in ds_wait_status()
440 for (i = 0; i < err; ++i) in ds_wait_status()
445 } while (!(st->status & ST_IDLE) && !(err < 0) && ++count < 100); in ds_wait_status()
447 if (err >= 16 && st->status & ST_EPOF) { in ds_wait_status()
458 if (err > 16 || count >= 100 || err < 0) in ds_wait_status()
459 ds_dump_status(dev, dev->st_buf, err); in ds_wait_status()
465 if (count >= 100 || err < 0) in ds_wait_status()
473 int err; in ds_reset() local
484 err = ds_send_control(dev, COMM_1_WIRE_RESET | COMM_IM, SPEED_NORMAL); in ds_reset()
485 if (err) in ds_reset()
486 return err; in ds_reset()
494 int err;
504 err = ds_send_control_mode(dev, MOD_1WIRE_SPEED, speed);
505 if (err)
506 return err;
508 return err;
514 int err = 0; in ds_set_pullup() local
527 return err; in ds_set_pullup()
529 err = ds_send_control(dev, COMM_SET_DURATION | COMM_IM, del); in ds_set_pullup()
530 if (err) in ds_set_pullup()
531 return err; in ds_set_pullup()
535 return err; in ds_set_pullup()
540 int err; in ds_touch_bit() local
543 err = ds_send_control(dev, COMM_BIT_IO | COMM_IM | (bit ? COMM_D : 0), in ds_touch_bit()
545 if (err) in ds_touch_bit()
546 return err; in ds_touch_bit()
550 err = ds_recv_data(dev, tbit, sizeof(*tbit)); in ds_touch_bit()
551 if (err < 0) in ds_touch_bit()
552 return err; in ds_touch_bit()
560 int err;
567 err = ds_send_control(dev, COMM_BIT_IO | COMM_IM | COMM_ICP |
569 if (err)
570 return err;
580 int err; in ds_write_byte() local
583 err = ds_send_control(dev, COMM_BYTE_IO | COMM_IM | dev->spu_bit, byte); in ds_write_byte()
584 if (err) in ds_write_byte()
585 return err; in ds_write_byte()
590 err = ds_wait_status(dev, &st); in ds_write_byte()
591 if (err) in ds_write_byte()
592 return err; in ds_write_byte()
594 err = ds_recv_data(dev, &dev->byte_buf, 1); in ds_write_byte()
595 if (err < 0) in ds_write_byte()
596 return err; in ds_write_byte()
603 int err; in ds_read_byte() local
606 err = ds_send_control(dev, COMM_BYTE_IO | COMM_IM, 0xff); in ds_read_byte()
607 if (err) in ds_read_byte()
608 return err; in ds_read_byte()
612 err = ds_recv_data(dev, byte, sizeof(*byte)); in ds_read_byte()
613 if (err < 0) in ds_read_byte()
614 return err; in ds_read_byte()
622 int err; in read_block_chunk() local
626 err = ds_send_data(dev, buf, len); in read_block_chunk()
627 if (err < 0) in read_block_chunk()
628 return err; in read_block_chunk()
630 err = ds_send_control(dev, COMM_BLOCK_IO | COMM_IM, len); in read_block_chunk()
631 if (err) in read_block_chunk()
632 return err; in read_block_chunk()
637 err = ds_recv_data(dev, buf, len); in read_block_chunk()
639 return err; in read_block_chunk()
644 int err, to_read, rem = len; in ds_read_block() local
651 err = read_block_chunk(dev, &buf[len - rem], to_read); in ds_read_block()
652 if (err < 0) in ds_read_block()
653 return err; in ds_read_block()
657 return err; in ds_read_block()
662 int err; in ds_write_block() local
665 err = ds_send_data(dev, buf, len); in ds_write_block()
666 if (err < 0) in ds_write_block()
667 return err; in ds_write_block()
669 err = ds_send_control(dev, COMM_BLOCK_IO | COMM_IM | dev->spu_bit, len); in ds_write_block()
670 if (err) in ds_write_block()
671 return err; in ds_write_block()
678 err = ds_recv_data(dev, buf, len); in ds_write_block()
679 if (err < 0) in ds_write_block()
680 return err; in ds_write_block()
682 return !(err == len); in ds_write_block()
697 int err; in ds9490r_search() local
747 err = ds_recv_status(dev, &st); in ds9490r_search()
748 if (err < 0 || err < sizeof(st)) in ds9490r_search()
760 err = ds_recv_data(dev, (u8 *)buf, bufsize); in ds9490r_search()
761 if (err < 0) in ds9490r_search()
763 for (i = 0; i < err/8; ++i) { in ds9490r_search()
814 int err;
817 err = ds_send_data(dev, (unsigned char *)&init, sizeof(init));
818 if (err)
819 return err;
823 err = ds_send_control(dev, COMM_MATCH_ACCESS | COMM_IM | COMM_RST, 0x0055);
824 if (err)
825 return err;
834 int err;
841 err = ds_send_data(dev, buf, sizeof(buf));
842 if (err)
843 return err;
847 err = ds_send_control(dev, COMM_SET_PATH | COMM_IM | COMM_RST, 0);
848 if (err)
849 return err;
879 int err;
881 err = ds_touch_bit(dev, 1, &dev->byte_buf);
882 if (err)
899 int err; in ds9490r_read_byte() local
901 err = ds_read_byte(dev, &dev->byte_buf); in ds9490r_read_byte()
902 if (err) in ds9490r_read_byte()
928 int err; in ds9490r_read_block() local
938 err = ds_read_block(dev, tbuf, len); in ds9490r_read_block()
939 if (err >= 0) in ds9490r_read_block()
944 return err >= 0 ? len : 0; in ds9490r_read_block()
950 int err; in ds9490r_reset() local
952 err = ds_reset(dev); in ds9490r_reset()
953 if (err) in ds9490r_reset()
1019 int i, err, alt; in ds_probe() local
1027 err = -ENOMEM; in ds_probe()
1034 err = usb_reset_configuration(dev->udev); in ds_probe()
1035 if (err) { in ds_probe()
1037 "Failed to reset configuration: err=%d.\n", err); in ds_probe()
1043 err = usb_set_interface(dev->udev, in ds_probe()
1045 if (err) { in ds_probe()
1048 intf->cur_altsetting->desc.bInterfaceNumber, err); in ds_probe()
1056 err = -EINVAL; in ds_probe()
1076 err = ds_w1_init(dev); in ds_probe()
1077 if (err) in ds_probe()
1091 return err; in ds_probe()