On 06/15/2017 03:17 PM, Greg KH wrote:
wait_usec is a count here:
Well ... I was trying to convert it into a parameter that was less confusing. I've eliminated it in "suggestion v2" below.
You aren't sleeping any :(
Oh $DIETY!
Always return real error codes, never make up random numbers.
Gotcha. I've made a couple of guesses based on the debug messages. Thanks for the feedback! Suggestion v2: static int usb_asmedia_wait_write(struct pci_dev *pdev) { unsigned long wait_time_count; unsigned char value; for (wait_time_count = 1000; wait_count > 0; --wait_time_count) { pci_read_config_byte(pdev, ASMT_CONTROL_REG, &value); if (value == 0xff) { dev_dbg(&pdev->dev, "%s: check_ready ERROR", __func__); return -EIO; } if ((value & ASMT_CONTROL_WRITE_BIT) == 0) return 0; usleep(50); } dev_dbg(&pdev->dev, "%s: check_write_ready timeout", __func__); return -ETIMEDOUT; } void usb_asmedia_modifyflowcontrol(struct pci_dev *dev) { if (usb_asmedia_wait_write(pdev) != 0) goto err_exit; /* send command and address to device */ pci_write_config_dword(pdev, ASMT_DATA_WRITE0_REG, ASMT_WRITEREG_CMD); pci_write_config_dword(pdev, ASMT_DATA_WRITE1_REG, ASMT_FLOWCTL_ADDR); pci_write_config_byte(pdev, ASMT_CONTROL_REG, ASMT_CONTROL_WRITE_BIT); if (usb_asmedia_wait_write(pdev) != 0) goto err_exit; /* send data to device */ pci_write_config_dword(pdev, ASMT_DATA_WRITE0_REG, ASMT_FLOWCTL_DATA); pci_write_config_dword(pdev, ASMT_DATA_WRITE1_REG, ASMT_PSEUDO_DATA); pci_write_config_byte(pdev, ASMT_CONTROL_REG, ASMT_CONTROL_WRITE_BIT); err_exit: return; } -- ======================================================================== Ian Pilcher arequipeno@xxxxxxxxx -------- "I grew up before Mark Zuckerberg invented friendship" -------- ======================================================================== -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html