Lines Matching refs:buf

175 	u8 buf[5];  in cp2112_gpio_direction_input()  local
178 ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, in cp2112_gpio_direction_input()
179 sizeof(buf), HID_FEATURE_REPORT, in cp2112_gpio_direction_input()
181 if (ret != sizeof(buf)) { in cp2112_gpio_direction_input()
186 buf[1] &= ~(1 << offset); in cp2112_gpio_direction_input()
187 buf[2] = gpio_push_pull; in cp2112_gpio_direction_input()
189 ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, sizeof(buf), in cp2112_gpio_direction_input()
204 u8 buf[3]; in cp2112_gpio_set() local
207 buf[0] = CP2112_GPIO_SET; in cp2112_gpio_set()
208 buf[1] = value ? 0xff : 0; in cp2112_gpio_set()
209 buf[2] = 1 << offset; in cp2112_gpio_set()
211 ret = hid_hw_raw_request(hdev, CP2112_GPIO_SET, buf, sizeof(buf), in cp2112_gpio_set()
222 u8 buf[2]; in cp2112_gpio_get() local
225 ret = hid_hw_raw_request(hdev, CP2112_GPIO_GET, buf, sizeof(buf), in cp2112_gpio_get()
227 if (ret != sizeof(buf)) { in cp2112_gpio_get()
232 return (buf[1] >> offset) & 1; in cp2112_gpio_get()
241 u8 buf[5]; in cp2112_gpio_direction_output() local
244 ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, in cp2112_gpio_direction_output()
245 sizeof(buf), HID_FEATURE_REPORT, in cp2112_gpio_direction_output()
247 if (ret != sizeof(buf)) { in cp2112_gpio_direction_output()
252 buf[1] |= 1 << offset; in cp2112_gpio_direction_output()
253 buf[2] = gpio_push_pull; in cp2112_gpio_direction_output()
255 ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, sizeof(buf), in cp2112_gpio_direction_output()
274 u8 *buf; in cp2112_hid_get() local
277 buf = kmalloc(count, GFP_KERNEL); in cp2112_hid_get()
278 if (!buf) in cp2112_hid_get()
281 ret = hid_hw_raw_request(hdev, report_number, buf, count, in cp2112_hid_get()
283 memcpy(data, buf, count); in cp2112_hid_get()
284 kfree(buf); in cp2112_hid_get()
291 u8 *buf; in cp2112_hid_output() local
294 buf = kmemdup(data, count, GFP_KERNEL); in cp2112_hid_output()
295 if (!buf) in cp2112_hid_output()
299 ret = hid_hw_output_report(hdev, buf, count); in cp2112_hid_output()
301 ret = hid_hw_raw_request(hdev, buf[0], buf, count, report_type, in cp2112_hid_output()
304 kfree(buf); in cp2112_hid_output()
334 u8 buf[2]; in cp2112_xfer_status() local
337 buf[0] = CP2112_TRANSFER_STATUS_REQUEST; in cp2112_xfer_status()
338 buf[1] = 0x01; in cp2112_xfer_status()
341 ret = cp2112_hid_output(hdev, buf, 2, HID_OUTPUT_REPORT); in cp2112_xfer_status()
388 static int cp2112_read_req(void *buf, u8 slave_address, u16 length) in cp2112_read_req() argument
390 struct cp2112_read_req_report *report = buf; in cp2112_read_req()
401 static int cp2112_write_read_req(void *buf, u8 slave_address, u16 length, in cp2112_write_read_req() argument
404 struct cp2112_write_read_req_report *report = buf; in cp2112_write_read_req()
419 static int cp2112_write_req(void *buf, u8 slave_address, u8 command, u8 *data, in cp2112_write_req() argument
422 struct cp2112_write_req_report *report = buf; in cp2112_write_req()
435 static int cp2112_i2c_write_req(void *buf, u8 slave_address, u8 *data, in cp2112_i2c_write_req() argument
438 struct cp2112_write_req_report *report = buf; in cp2112_i2c_write_req()
450 static int cp2112_i2c_write_read_req(void *buf, u8 slave_address, in cp2112_i2c_write_read_req() argument
454 struct cp2112_write_read_req_report *report = buf; in cp2112_i2c_write_read_req()
473 u8 buf[64]; in cp2112_i2c_xfer() local
487 read_buf = msgs->buf; in cp2112_i2c_xfer()
488 count = cp2112_read_req(buf, msgs->addr, msgs->len); in cp2112_i2c_xfer()
492 count = cp2112_i2c_write_req(buf, msgs->addr, in cp2112_i2c_xfer()
493 msgs->buf, msgs->len); in cp2112_i2c_xfer()
504 read_buf = msgs[1].buf; in cp2112_i2c_xfer()
505 count = cp2112_i2c_write_read_req(buf, msgs[0].addr, in cp2112_i2c_xfer()
506 msgs[0].buf, msgs[0].len, msgs[1].len); in cp2112_i2c_xfer()
521 ret = cp2112_hid_output(hdev, buf, count, HID_OUTPUT_REPORT); in cp2112_i2c_xfer()
538 buf[0] = CP2112_CANCEL_TRANSFER; in cp2112_i2c_xfer()
539 buf[1] = 0x01; in cp2112_i2c_xfer()
541 ret = cp2112_hid_output(hdev, buf, 2, HID_OUTPUT_REPORT); in cp2112_i2c_xfer()
591 u8 buf[64]; in cp2112_xfer() local
607 count = cp2112_read_req(buf, addr, read_length); in cp2112_xfer()
609 count = cp2112_write_req(buf, addr, command, NULL, in cp2112_xfer()
616 count = cp2112_write_read_req(buf, addr, read_length, in cp2112_xfer()
619 count = cp2112_write_req(buf, addr, command, in cp2112_xfer()
627 count = cp2112_write_read_req(buf, addr, read_length, in cp2112_xfer()
630 count = cp2112_write_req(buf, addr, command, in cp2112_xfer()
639 count = cp2112_write_read_req(buf, addr, read_length, command, in cp2112_xfer()
647 count = cp2112_write_read_req(buf, addr, in cp2112_xfer()
651 count = cp2112_write_req(buf, addr, command, in cp2112_xfer()
660 count = cp2112_write_read_req(buf, addr, I2C_SMBUS_BLOCK_MAX, in cp2112_xfer()
678 ret = cp2112_hid_output(hdev, buf, count, HID_OUTPUT_REPORT); in cp2112_xfer()
695 buf[0] = CP2112_CANCEL_TRANSFER; in cp2112_xfer()
696 buf[1] = 0x01; in cp2112_xfer()
698 ret = cp2112_hid_output(hdev, buf, 2, HID_OUTPUT_REPORT); in cp2112_xfer()
715 ret = cp2112_read(dev, buf, read_length); in cp2112_xfer()
727 data->byte = buf[0]; in cp2112_xfer()
730 data->word = le16_to_cpup((__le16 *)buf); in cp2112_xfer()
738 memcpy(data->block, buf, read_length); in cp2112_xfer()
807 struct device_attribute *attr, const char *buf, \
823 struct device_attribute *attr, char *buf) \
830 return scnprintf(buf, PAGE_SIZE, format, ##__VA_ARGS__); \
837 if (sscanf(buf, "%hi", &vid) != 1)
847 if (sscanf(buf, "%hi", &pid) != 1)
857 if (sscanf(buf, "%i", &mA) != 1)
865 if (sscanf(buf, "%hhi", &cfg.power_mode) != 1)
872 if (sscanf(buf, "%hhi.%hhi", &cfg.release_major, &cfg.release_minor)
887 struct device_attribute *kattr, const char *buf, in pstr_store() argument
898 ret = utf8s_to_utf16s(buf, count, UTF16_LITTLE_ENDIAN, in pstr_store()
919 struct device_attribute *kattr, char *buf) in pstr_show() argument
946 ret = utf16s_to_utf8s(report.string, length, UTF16_LITTLE_ENDIAN, buf, in pstr_show()
948 buf[ret++] = '\n'; in pstr_show()
987 u8 buf[2]; in chmod_sysfs_attrs() local
990 ret = cp2112_hid_get(hdev, CP2112_LOCK_BYTE, buf, sizeof(buf), in chmod_sysfs_attrs()
992 if (ret != sizeof(buf)) { in chmod_sysfs_attrs()
998 umode_t mode = (buf[1] & 1) ? S_IWUSR | S_IRUGO : S_IRUGO; in chmod_sysfs_attrs()
1003 buf[1] >>= 1; in chmod_sysfs_attrs()
1010 u8 buf[3]; in cp2112_probe() local
1038 ret = cp2112_hid_get(hdev, CP2112_GET_VERSION_INFO, buf, sizeof(buf), in cp2112_probe()
1040 if (ret != sizeof(buf)) { in cp2112_probe()
1048 buf[1], buf[2]); in cp2112_probe()
1085 dev->hwversion = buf[2]; in cp2112_probe()