Commit 716681ff authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] fix more proc and other oddments

parent d7e6cf35
...@@ -65,6 +65,7 @@ static int cs5520_get_info(char *buffer, char **addr, off_t offset, int count) ...@@ -65,6 +65,7 @@ static int cs5520_get_info(char *buffer, char **addr, off_t offset, int count)
{ {
char *p = buffer; char *p = buffer;
unsigned long bmiba = pci_resource_start(bmide_dev, 2); unsigned long bmiba = pci_resource_start(bmide_dev, 2);
int len;
u8 c0 = 0, c1 = 0; u8 c0 = 0, c1 = 0;
u16 reg16; u16 reg16;
u32 reg32; u32 reg32;
...@@ -94,7 +95,10 @@ static int cs5520_get_info(char *buffer, char **addr, off_t offset, int count) ...@@ -94,7 +95,10 @@ static int cs5520_get_info(char *buffer, char **addr, off_t offset, int count)
pci_read_config_dword(bmide_dev, 0x68, &reg32); pci_read_config_dword(bmide_dev, 0x68, &reg32);
p += sprintf(p, "16bit Secondary: %08x\n", reg32); p += sprintf(p, "16bit Secondary: %08x\n", reg32);
return p-buffer; len = (p - buffer) - offset;
*addr = buffer + offset;
return len > count ? count : len;
} }
#endif #endif
...@@ -288,7 +292,7 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic ...@@ -288,7 +292,7 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic
probe_hwif_init(&ide_hwifs[index.b.low]); probe_hwif_init(&ide_hwifs[index.b.low]);
if((index.b.high & 0xf0) != 0xf0) if((index.b.high & 0xf0) != 0xf0)
probe_hwif_init(&ide_hwifs[index.b.high]); probe_hwif_init(&ide_hwifs[index.b.high]);
MOD_INC_USE_COUNT;
return 0; return 0;
} }
......
...@@ -58,7 +58,7 @@ static int n_hpt34x_devs; ...@@ -58,7 +58,7 @@ static int n_hpt34x_devs;
static int hpt34x_get_info (char *buffer, char **addr, off_t offset, int count) static int hpt34x_get_info (char *buffer, char **addr, off_t offset, int count)
{ {
char *p = buffer; char *p = buffer;
int i; int i, len;
p += sprintf(p, "\n " p += sprintf(p, "\n "
"HPT34X Chipset.\n"); "HPT34X Chipset.\n");
...@@ -96,7 +96,11 @@ static int hpt34x_get_info (char *buffer, char **addr, off_t offset, int count) ...@@ -96,7 +96,11 @@ static int hpt34x_get_info (char *buffer, char **addr, off_t offset, int count)
} }
p += sprintf(p, "\n"); p += sprintf(p, "\n");
return p-buffer; /* => must be less than 4k! */ /* p - buffer must be less than 4k! */
len = (p - buffer) - offset;
*addr = buffer + offset;
return len > count ? count : len;
} }
#endif /* defined(DISPLAY_HPT34X_TIMINGS) && defined(CONFIG_PROC_FS) */ #endif /* defined(DISPLAY_HPT34X_TIMINGS) && defined(CONFIG_PROC_FS) */
......
...@@ -85,7 +85,7 @@ static int hpt366_get_info (char *buffer, char **addr, off_t offset, int count) ...@@ -85,7 +85,7 @@ static int hpt366_get_info (char *buffer, char **addr, off_t offset, int count)
char *chipset_nums[] = {"366", "366", "368", char *chipset_nums[] = {"366", "366", "368",
"370", "370A", "372", "370", "370A", "372",
"302", "371", "374" }; "302", "371", "374" };
int i; int i, len;
p += sprintf(p, "\n " p += sprintf(p, "\n "
"HighPoint HPT366/368/370/372/374\n"); "HighPoint HPT366/368/370/372/374\n");
...@@ -154,7 +154,11 @@ static int hpt366_get_info (char *buffer, char **addr, off_t offset, int count) ...@@ -154,7 +154,11 @@ static int hpt366_get_info (char *buffer, char **addr, off_t offset, int count)
} }
p += sprintf(p, "\n"); p += sprintf(p, "\n");
return p-buffer;/* => must be less than 4k! */ /* p - buffer must be less than 4k! */
len = (p - buffer) - offset;
*addr = buffer + offset;
return len > count ? count : len;
} }
#endif /* defined(DISPLAY_HPT366_TIMINGS) && defined(CONFIG_PROC_FS) */ #endif /* defined(DISPLAY_HPT366_TIMINGS) && defined(CONFIG_PROC_FS) */
......
...@@ -77,13 +77,17 @@ static char * pdcnew_info(char *buf, struct pci_dev *dev) ...@@ -77,13 +77,17 @@ static char * pdcnew_info(char *buf, struct pci_dev *dev)
static int pdcnew_get_info (char *buffer, char **addr, off_t offset, int count) static int pdcnew_get_info (char *buffer, char **addr, off_t offset, int count)
{ {
char *p = buffer; char *p = buffer;
int i; int i, len;
for (i = 0; i < n_pdc202_devs; i++) { for (i = 0; i < n_pdc202_devs; i++) {
struct pci_dev *dev = pdc202_devs[i]; struct pci_dev *dev = pdc202_devs[i];
p = pdcnew_info(buffer, dev); p = pdcnew_info(buffer, dev);
} }
return p-buffer; /* => must be less than 4k! */ /* p - buffer must be less than 4k! */
len = (p - buffer) - offset;
*addr = buffer + offset;
return len > count ? count : len;
} }
#endif /* defined(DISPLAY_PDC202XX_TIMINGS) && defined(CONFIG_PROC_FS) */ #endif /* defined(DISPLAY_PDC202XX_TIMINGS) && defined(CONFIG_PROC_FS) */
......
...@@ -177,13 +177,17 @@ static char * pdc202xx_info (char *buf, struct pci_dev *dev) ...@@ -177,13 +177,17 @@ static char * pdc202xx_info (char *buf, struct pci_dev *dev)
static int pdc202xx_get_info (char *buffer, char **addr, off_t offset, int count) static int pdc202xx_get_info (char *buffer, char **addr, off_t offset, int count)
{ {
char *p = buffer; char *p = buffer;
int i; int i, len;
for (i = 0; i < n_pdc202_devs; i++) { for (i = 0; i < n_pdc202_devs; i++) {
struct pci_dev *dev = pdc202_devs[i]; struct pci_dev *dev = pdc202_devs[i];
p = pdc202xx_info(buffer, dev); p = pdc202xx_info(buffer, dev);
} }
return p-buffer; /* => must be less than 4k! */ /* p - buffer must be less than 4k! */
len = (p - buffer) - offset;
*addr = buffer + offset;
return len > count ? count : len;
} }
#endif /* defined(DISPLAY_PDC202XX_TIMINGS) && defined(CONFIG_PROC_FS) */ #endif /* defined(DISPLAY_PDC202XX_TIMINGS) && defined(CONFIG_PROC_FS) */
......
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