Re: [PATCH v3] xhci: Bad Ethernet performance plugged in ASM1042A host

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 15.06.2017 23:53, Ian Pilcher wrote:
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:

This start to look a lot better,

Some small changes still needed:


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) {

wait_count -> wait_time_count.
Or how about renaming it to retry_count instead?



         pci_read_config_byte(pdev, ASMT_CONTROL_REG, &value);

         if (value == 0xff) {
             dev_dbg(&pdev->dev, "%s: check_ready ERROR", __func__);

use dev_warn(), or dev_err() maybe?

             return -EIO;
         }

         if ((value & ASMT_CONTROL_WRITE_BIT) == 0)
             return 0;

     usleep(50);
     }

     dev_dbg(&pdev->dev, "%s: check_write_ready timeout", __func__);

dev_warn()

     return -ETIMEDOUT;
}

void usb_asmedia_modifyflowcontrol(struct pci_dev *dev)
{
     if (usb_asmedia_wait_write(pdev) != 0)
         goto err_exit;

No need for err_exit, can just return here


     /* 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;

same here


     /* 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;
}



-Mathias
--
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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux