Commit defce4ed authored by Stephen Hemminger's avatar Stephen Hemminger

[netdrvr sk98lin] use seq_file for /proc

Replace proc_read with seq_file interface which is much cleaner.

Also, instead of searching the list of devices looking for the
name which is slow and would break if interface name changes;
store a pointer to device in the proc entry, and retrieve
it from the information saved by single_open.

Formatting and other behaviours are retained.
parent 3d93561d
...@@ -577,13 +577,7 @@ static int XmitFrameSG(SK_AC*, TX_PORT*, struct sk_buff*); ...@@ -577,13 +577,7 @@ static int XmitFrameSG(SK_AC*, TX_PORT*, struct sk_buff*);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static const char SK_Root_Dir_entry[] = "sk98lin"; static const char SK_Root_Dir_entry[] = "sk98lin";
static struct proc_dir_entry *pSkRootDir; static struct proc_dir_entry *pSkRootDir;
extern struct file_operations sk_proc_fops;
extern int sk_proc_read( char *buffer,
char **buffer_location,
off_t offset,
int buffer_length,
int *eof,
void *data);
#endif #endif
extern void SkDimEnableModerationIfNeeded(SK_AC *pAC); extern void SkDimEnableModerationIfNeeded(SK_AC *pAC);
...@@ -762,16 +756,11 @@ static int __init skge_probe (void) ...@@ -762,16 +756,11 @@ static int __init skge_probe (void)
} }
/* Create proc file */ /* Create proc file */
if (pSkRootDir && if (pSkRootDir
(pProcFile = create_proc_entry(dev->name, && (pProcFile = create_proc_entry(dev->name, S_IRUGO,
S_IFREG | S_IXUSR | S_IWGRP | S_IROTH, pSkRootDir))) {
pSkRootDir))) { pProcFile->proc_fops = &sk_proc_fops;
pProcFile->read_proc = sk_proc_read; pProcFile->data = dev;
pProcFile->write_proc = NULL;
pProcFile->nlink = 1;
pProcFile->size = sizeof(dev->name + 1);
pProcFile->data = (void *)pProcFile;
pProcFile->owner = THIS_MODULE;
} }
#endif #endif
...@@ -827,16 +816,11 @@ static int __init skge_probe (void) ...@@ -827,16 +816,11 @@ static int __init skge_probe (void)
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
if (pSkRootDir if (pSkRootDir
&& (pProcFile = create_proc_entry(dev->name, && (pProcFile = create_proc_entry(dev->name,
S_IFREG | S_IXUSR | S_IWGRP | S_IROTH, S_IRUGO,
pSkRootDir))) { pSkRootDir))) {
pProcFile->proc_fops = &sk_proc_fops;
pProcFile->read_proc = sk_proc_read; pProcFile->data = dev;
pProcFile->write_proc = NULL;
pProcFile->nlink = 1;
pProcFile->size = sizeof(dev->name + 1);
pProcFile->data = (void *)pProcFile;
pProcFile->owner = THIS_MODULE;
} }
#endif #endif
......
This diff is collapsed.
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