Commit b096c3f5 authored by Faik Uygur's avatar Faik Uygur Committed by Linus Torvalds

[PATCH] /proc/ide/triflex returns incomplete data

This patch fixes the incomplete data return problem of /proc/ide/triflex.
When the number of consecutive read bytes are smaller than the total
data in triflex_get_info(), the second read() returns 0.
parent e7070c0f
......@@ -49,6 +49,7 @@ static struct pci_dev *triflex_dev;
static int triflex_get_info(char *buf, char **addr, off_t offset, int count)
{
char *p = buf;
int len;
struct pci_dev *dev = triflex_dev;
unsigned long bibma = pci_resource_start(dev, 4);
......@@ -85,8 +86,11 @@ static int triflex_get_info(char *buf, char **addr, off_t offset, int count)
p += sprintf(p, "DMA\n");
p += sprintf(p, "PIO\n");
len = (p - buf) - offset;
*addr = buf + offset;
return p-buf;
return len > count ? count : len;
}
static int triflex_tune_chipset(ide_drive_t *drive, u8 xferspeed)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment