Lines Matching refs:buf
174 u8 buf[5]; in cp2112_gpio_direction_input() local
177 ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, in cp2112_gpio_direction_input()
178 sizeof(buf), HID_FEATURE_REPORT, in cp2112_gpio_direction_input()
180 if (ret != sizeof(buf)) { in cp2112_gpio_direction_input()
185 buf[1] &= ~(1 << offset); in cp2112_gpio_direction_input()
186 buf[2] = gpio_push_pull; in cp2112_gpio_direction_input()
188 ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, sizeof(buf), in cp2112_gpio_direction_input()
203 u8 buf[3]; in cp2112_gpio_set() local
206 buf[0] = CP2112_GPIO_SET; in cp2112_gpio_set()
207 buf[1] = value ? 0xff : 0; in cp2112_gpio_set()
208 buf[2] = 1 << offset; in cp2112_gpio_set()
210 ret = hid_hw_raw_request(hdev, CP2112_GPIO_SET, buf, sizeof(buf), in cp2112_gpio_set()
221 u8 buf[2]; in cp2112_gpio_get() local
224 ret = hid_hw_raw_request(hdev, CP2112_GPIO_GET, buf, sizeof(buf), in cp2112_gpio_get()
226 if (ret != sizeof(buf)) { in cp2112_gpio_get()
231 return (buf[1] >> offset) & 1; in cp2112_gpio_get()
240 u8 buf[5]; in cp2112_gpio_direction_output() local
243 ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, in cp2112_gpio_direction_output()
244 sizeof(buf), HID_FEATURE_REPORT, in cp2112_gpio_direction_output()
246 if (ret != sizeof(buf)) { in cp2112_gpio_direction_output()
251 buf[1] |= 1 << offset; in cp2112_gpio_direction_output()
252 buf[2] = gpio_push_pull; in cp2112_gpio_direction_output()
254 ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, sizeof(buf), in cp2112_gpio_direction_output()
273 u8 *buf; in cp2112_hid_get() local
276 buf = kmalloc(count, GFP_KERNEL); in cp2112_hid_get()
277 if (!buf) in cp2112_hid_get()
280 ret = hid_hw_raw_request(hdev, report_number, buf, count, in cp2112_hid_get()
282 memcpy(data, buf, count); in cp2112_hid_get()
283 kfree(buf); in cp2112_hid_get()
290 u8 *buf; in cp2112_hid_output() local
293 buf = kmemdup(data, count, GFP_KERNEL); in cp2112_hid_output()
294 if (!buf) in cp2112_hid_output()
298 ret = hid_hw_output_report(hdev, buf, count); in cp2112_hid_output()
300 ret = hid_hw_raw_request(hdev, buf[0], buf, count, report_type, in cp2112_hid_output()
303 kfree(buf); in cp2112_hid_output()
333 u8 buf[2]; in cp2112_xfer_status() local
336 buf[0] = CP2112_TRANSFER_STATUS_REQUEST; in cp2112_xfer_status()
337 buf[1] = 0x01; in cp2112_xfer_status()
340 ret = cp2112_hid_output(hdev, buf, 2, HID_OUTPUT_REPORT); in cp2112_xfer_status()
387 static int cp2112_read_req(void *buf, u8 slave_address, u16 length) in cp2112_read_req() argument
389 struct cp2112_read_req_report *report = buf; in cp2112_read_req()
400 static int cp2112_write_read_req(void *buf, u8 slave_address, u16 length, in cp2112_write_read_req() argument
403 struct cp2112_write_read_req_report *report = buf; in cp2112_write_read_req()
418 static int cp2112_write_req(void *buf, u8 slave_address, u8 command, u8 *data, in cp2112_write_req() argument
421 struct cp2112_write_req_report *report = buf; in cp2112_write_req()
434 static int cp2112_i2c_write_req(void *buf, u8 slave_address, u8 *data, in cp2112_i2c_write_req() argument
437 struct cp2112_write_req_report *report = buf; in cp2112_i2c_write_req()
454 u8 buf[64]; in cp2112_i2c_xfer() local
468 count = cp2112_read_req(buf, msgs->addr, msgs->len); in cp2112_i2c_xfer()
470 count = cp2112_i2c_write_req(buf, msgs->addr, msgs->buf, in cp2112_i2c_xfer()
482 ret = cp2112_hid_output(hdev, buf, count, HID_OUTPUT_REPORT); in cp2112_i2c_xfer()
499 buf[0] = CP2112_CANCEL_TRANSFER; in cp2112_i2c_xfer()
500 buf[1] = 0x01; in cp2112_i2c_xfer()
502 ret = cp2112_hid_output(hdev, buf, 2, HID_OUTPUT_REPORT); in cp2112_i2c_xfer()
514 ret = cp2112_read(dev, msgs->buf, msgs->len); in cp2112_i2c_xfer()
539 u8 buf[64]; in cp2112_xfer() local
555 count = cp2112_read_req(buf, addr, read_length); in cp2112_xfer()
557 count = cp2112_write_req(buf, addr, command, NULL, in cp2112_xfer()
564 count = cp2112_write_read_req(buf, addr, read_length, in cp2112_xfer()
567 count = cp2112_write_req(buf, addr, command, in cp2112_xfer()
575 count = cp2112_write_read_req(buf, addr, read_length, in cp2112_xfer()
578 count = cp2112_write_req(buf, addr, command, in cp2112_xfer()
587 count = cp2112_write_read_req(buf, addr, read_length, command, in cp2112_xfer()
595 count = cp2112_write_read_req(buf, addr, in cp2112_xfer()
599 count = cp2112_write_req(buf, addr, command, in cp2112_xfer()
608 count = cp2112_write_read_req(buf, addr, I2C_SMBUS_BLOCK_MAX, in cp2112_xfer()
626 ret = cp2112_hid_output(hdev, buf, count, HID_OUTPUT_REPORT); in cp2112_xfer()
643 buf[0] = CP2112_CANCEL_TRANSFER; in cp2112_xfer()
644 buf[1] = 0x01; in cp2112_xfer()
646 ret = cp2112_hid_output(hdev, buf, 2, HID_OUTPUT_REPORT); in cp2112_xfer()
663 ret = cp2112_read(dev, buf, read_length); in cp2112_xfer()
675 data->byte = buf[0]; in cp2112_xfer()
678 data->word = le16_to_cpup((__le16 *)buf); in cp2112_xfer()
686 memcpy(data->block, buf, read_length); in cp2112_xfer()
755 struct device_attribute *attr, const char *buf, \
771 struct device_attribute *attr, char *buf) \
778 return scnprintf(buf, PAGE_SIZE, format, ##__VA_ARGS__); \
785 if (sscanf(buf, "%hi", &vid) != 1)
795 if (sscanf(buf, "%hi", &pid) != 1)
805 if (sscanf(buf, "%i", &mA) != 1)
813 if (sscanf(buf, "%hhi", &cfg.power_mode) != 1)
820 if (sscanf(buf, "%hhi.%hhi", &cfg.release_major, &cfg.release_minor)
835 struct device_attribute *kattr, const char *buf, in pstr_store() argument
846 ret = utf8s_to_utf16s(buf, count, UTF16_LITTLE_ENDIAN, in pstr_store()
867 struct device_attribute *kattr, char *buf) in pstr_show() argument
894 ret = utf16s_to_utf8s(report.string, length, UTF16_LITTLE_ENDIAN, buf, in pstr_show()
896 buf[ret++] = '\n'; in pstr_show()
935 u8 buf[2]; in chmod_sysfs_attrs() local
938 ret = cp2112_hid_get(hdev, CP2112_LOCK_BYTE, buf, sizeof(buf), in chmod_sysfs_attrs()
940 if (ret != sizeof(buf)) { in chmod_sysfs_attrs()
946 umode_t mode = (buf[1] & 1) ? S_IWUSR | S_IRUGO : S_IRUGO; in chmod_sysfs_attrs()
951 buf[1] >>= 1; in chmod_sysfs_attrs()
958 u8 buf[3]; in cp2112_probe() local
986 ret = cp2112_hid_get(hdev, CP2112_GET_VERSION_INFO, buf, sizeof(buf), in cp2112_probe()
988 if (ret != sizeof(buf)) { in cp2112_probe()
996 buf[1], buf[2]); in cp2112_probe()