Commit e781c3d7 authored by David Howells's avatar David Howells Committed by Al Viro

ia64: Don't use create_proc_read_entry()

Don't use create_proc_read_entry() as that is deprecated, but rather use
proc_create_data() and seq_file instead.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
cc: Tony Luck <tony.luck@intel.com>
cc: Fenghua Yu <fenghua.yu@intel.com>
cc: linux-ia64@vger.kernel.org
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 24270156
This diff is collapsed.
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <linux/cpu.h> #include <linux/cpu.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/timer.h> #include <linux/timer.h>
...@@ -53,7 +54,7 @@ MODULE_AUTHOR("Jesse Barnes <jbarnes@sgi.com>"); ...@@ -53,7 +54,7 @@ MODULE_AUTHOR("Jesse Barnes <jbarnes@sgi.com>");
MODULE_DESCRIPTION("/proc interface to IA-64 SAL features"); MODULE_DESCRIPTION("/proc interface to IA-64 SAL features");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static int salinfo_read(char *page, char **start, off_t off, int count, int *eof, void *data); static const struct file_operations proc_salinfo_fops;
typedef struct { typedef struct {
const char *name; /* name of the proc entry */ const char *name; /* name of the proc entry */
...@@ -65,7 +66,7 @@ typedef struct { ...@@ -65,7 +66,7 @@ typedef struct {
* List {name,feature} pairs for every entry in /proc/sal/<feature> * List {name,feature} pairs for every entry in /proc/sal/<feature>
* that this module exports * that this module exports
*/ */
static salinfo_entry_t salinfo_entries[]={ static const salinfo_entry_t salinfo_entries[]={
{ "bus_lock", IA64_SAL_PLATFORM_FEATURE_BUS_LOCK, }, { "bus_lock", IA64_SAL_PLATFORM_FEATURE_BUS_LOCK, },
{ "irq_redirection", IA64_SAL_PLATFORM_FEATURE_IRQ_REDIR_HINT, }, { "irq_redirection", IA64_SAL_PLATFORM_FEATURE_IRQ_REDIR_HINT, },
{ "ipi_redirection", IA64_SAL_PLATFORM_FEATURE_IPI_REDIR_HINT, }, { "ipi_redirection", IA64_SAL_PLATFORM_FEATURE_IPI_REDIR_HINT, },
...@@ -629,8 +630,9 @@ salinfo_init(void) ...@@ -629,8 +630,9 @@ salinfo_init(void)
for (i=0; i < NR_SALINFO_ENTRIES; i++) { for (i=0; i < NR_SALINFO_ENTRIES; i++) {
/* pass the feature bit in question as misc data */ /* pass the feature bit in question as misc data */
*sdir++ = create_proc_read_entry (salinfo_entries[i].name, 0, salinfo_dir, *sdir++ = proc_create_data(salinfo_entries[i].name, 0, salinfo_dir,
salinfo_read, (void *)salinfo_entries[i].feature); &proc_salinfo_fops,
(void *)salinfo_entries[i].feature);
} }
for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) { for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) {
...@@ -676,22 +678,23 @@ salinfo_init(void) ...@@ -676,22 +678,23 @@ salinfo_init(void)
* 'data' contains an integer that corresponds to the feature we're * 'data' contains an integer that corresponds to the feature we're
* testing * testing
*/ */
static int static int proc_salinfo_show(struct seq_file *m, void *v)
salinfo_read(char *page, char **start, off_t off, int count, int *eof, void *data)
{ {
int len = 0; unsigned long data = (unsigned long)v;
seq_puts(m, (sal_platform_features & data) ? "1\n" : "0\n");
len = sprintf(page, (sal_platform_features & (unsigned long)data) ? "1\n" : "0\n"); return 0;
}
if (len <= off+count) *eof = 1;
*start = page + off;
len -= off;
if (len>count) len = count;
if (len<0) len = 0;
return len; static int proc_salinfo_open(struct inode *inode, struct file *file)
{
return single_open(file, proc_salinfo_show, PDE_DATA(inode));
} }
static const struct file_operations proc_salinfo_fops = {
.open = proc_salinfo_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
module_init(salinfo_init); module_init(salinfo_init);
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/nodemask.h> #include <linux/nodemask.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/sn/sn_sal.h> #include <asm/sn/sn_sal.h>
...@@ -101,12 +102,12 @@ get_fit_entry(unsigned long nasid, int index, unsigned long *fentry, ...@@ -101,12 +102,12 @@ get_fit_entry(unsigned long nasid, int index, unsigned long *fentry,
/* /*
* These two routines display the FIT table for each node. * These two routines display the FIT table for each node.
*/ */
static int dump_fit_entry(char *page, unsigned long *fentry) static void dump_fit_entry(struct seq_file *m, unsigned long *fentry)
{ {
unsigned type; unsigned type;
type = FIT_TYPE(fentry[1]); type = FIT_TYPE(fentry[1]);
return sprintf(page, "%02x %-25s %x.%02x %016lx %u\n", seq_printf(m, "%02x %-25s %x.%02x %016lx %u\n",
type, type,
fit_type_name(type), fit_type_name(type),
FIT_MAJOR(fentry[1]), FIT_MINOR(fentry[1]), FIT_MAJOR(fentry[1]), FIT_MINOR(fentry[1]),
...@@ -124,31 +125,39 @@ static int dump_fit_entry(char *page, unsigned long *fentry) ...@@ -124,31 +125,39 @@ static int dump_fit_entry(char *page, unsigned long *fentry)
* OK except for 4kB pages (and no one is going to do that on SN * OK except for 4kB pages (and no one is going to do that on SN
* anyway). * anyway).
*/ */
static int static int proc_fit_show(struct seq_file *m, void *v)
dump_fit(char *page, unsigned long nasid)
{ {
unsigned long nasid = (unsigned long)m->private;
unsigned long fentry[2]; unsigned long fentry[2];
int index; int index;
char *p;
p = page;
for (index=0;;index++) { for (index=0;;index++) {
BUG_ON(index * 60 > PAGE_SIZE); BUG_ON(index * 60 > PAGE_SIZE);
if (get_fit_entry(nasid, index, fentry, NULL, 0)) if (get_fit_entry(nasid, index, fentry, NULL, 0))
break; break;
p += dump_fit_entry(p, fentry); dump_fit_entry(m, fentry);
} }
return 0;
}
return p - page; static int proc_fit_open(struct inode *inode, struct file *file)
{
return single_open(file, proc_fit_show, PDE_DATA(inode));
} }
static int static const struct file_operations proc_fit_fops = {
dump_version(char *page, unsigned long nasid) .open = proc_fit_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
static int proc_version_show(struct seq_file *m, void *v)
{ {
unsigned long nasid = (unsigned long)m->private;
unsigned long fentry[2]; unsigned long fentry[2];
char banner[128]; char banner[128];
int index; int index;
int len;
for (index = 0; ; index++) { for (index = 0; ; index++) {
if (get_fit_entry(nasid, index, fentry, banner, if (get_fit_entry(nasid, index, fentry, banner,
...@@ -158,56 +167,24 @@ dump_version(char *page, unsigned long nasid) ...@@ -158,56 +167,24 @@ dump_version(char *page, unsigned long nasid)
break; break;
} }
len = sprintf(page, "%x.%02x\n", FIT_MAJOR(fentry[1]), seq_printf(m, "%x.%02x\n", FIT_MAJOR(fentry[1]), FIT_MINOR(fentry[1]));
FIT_MINOR(fentry[1]));
page += len;
if (banner[0]) if (banner[0])
len += snprintf(page, PAGE_SIZE-len, "%s\n", banner); seq_printf(m, "%s\n", banner);
return 0;
return len;
}
/* same as in proc_misc.c */
static int
proc_calc_metrics(char *page, char **start, off_t off, int count, int *eof,
int len)
{
if (len <= off + count)
*eof = 1;
*start = page + off;
len -= off;
if (len > count)
len = count;
if (len < 0)
len = 0;
return len;
} }
static int static int proc_version_open(struct inode *inode, struct file *file)
read_version_entry(char *page, char **start, off_t off, int count, int *eof,
void *data)
{ {
int len; return single_open(file, proc_version_show, PDE_DATA(inode));
/* data holds the NASID of the node */
len = dump_version(page, (unsigned long)data);
len = proc_calc_metrics(page, start, off, count, eof, len);
return len;
} }
static int static const struct file_operations proc_version_fops = {
read_fit_entry(char *page, char **start, off_t off, int count, int *eof, .open = proc_version_open,
void *data) .read = seq_read,
{ .llseek = seq_lseek,
int len; .release = seq_release,
};
/* data holds the NASID of the node */
len = dump_fit(page, (unsigned long)data);
len = proc_calc_metrics(page, start, off, count, eof, len);
return len;
}
/* module entry points */ /* module entry points */
int __init prominfo_init(void); int __init prominfo_init(void);
...@@ -216,12 +193,11 @@ void __exit prominfo_exit(void); ...@@ -216,12 +193,11 @@ void __exit prominfo_exit(void);
module_init(prominfo_init); module_init(prominfo_init);
module_exit(prominfo_exit); module_exit(prominfo_exit);
static struct proc_dir_entry *sgi_prominfo_entry;
#define NODE_NAME_LEN 11 #define NODE_NAME_LEN 11
int __init prominfo_init(void) int __init prominfo_init(void)
{ {
struct proc_dir_entry *sgi_prominfo_entry;
cnodeid_t cnodeid; cnodeid_t cnodeid;
if (!ia64_platform_is("sn2")) if (!ia64_platform_is("sn2"))
...@@ -241,10 +217,10 @@ int __init prominfo_init(void) ...@@ -241,10 +217,10 @@ int __init prominfo_init(void)
if (!dir) if (!dir)
continue; continue;
nasid = cnodeid_to_nasid(cnodeid); nasid = cnodeid_to_nasid(cnodeid);
create_proc_read_entry("fit", 0, dir, read_fit_entry, proc_create_data("fit", 0, dir,
(void *)nasid); &proc_fit_fops, (void *)nasid);
create_proc_read_entry("version", 0, dir, proc_create_data("version", 0, dir,
read_version_entry, (void *)nasid); &proc_version_fops, (void *)nasid);
} }
return 0; return 0;
} }
......
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