mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-13 08:39:52 +00:00
[PATCH] seq_file conversion: toshiba.c
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Cc: Dmitry Torokhov <dtor_core@ameritech.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
2e7842b887
commit
967bb77c69
@ -68,6 +68,7 @@
|
|||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/stat.h>
|
#include <linux/stat.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
|
|
||||||
#include <linux/toshiba.h>
|
#include <linux/toshiba.h>
|
||||||
|
|
||||||
@ -298,12 +299,10 @@ static int tosh_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
|
|||||||
* Print the information for /proc/toshiba
|
* Print the information for /proc/toshiba
|
||||||
*/
|
*/
|
||||||
#ifdef CONFIG_PROC_FS
|
#ifdef CONFIG_PROC_FS
|
||||||
static int tosh_get_info(char *buffer, char **start, off_t fpos, int length)
|
static int proc_toshiba_show(struct seq_file *m, void *v)
|
||||||
{
|
{
|
||||||
char *temp;
|
|
||||||
int key;
|
int key;
|
||||||
|
|
||||||
temp = buffer;
|
|
||||||
key = tosh_fn_status();
|
key = tosh_fn_status();
|
||||||
|
|
||||||
/* Arguments
|
/* Arguments
|
||||||
@ -314,8 +313,7 @@ static int tosh_get_info(char *buffer, char **start, off_t fpos, int length)
|
|||||||
4) BIOS date (in SCI date format)
|
4) BIOS date (in SCI date format)
|
||||||
5) Fn Key status
|
5) Fn Key status
|
||||||
*/
|
*/
|
||||||
|
seq_printf(m, "1.1 0x%04x %d.%d %d.%d 0x%04x 0x%02x\n",
|
||||||
temp += sprintf(temp, "1.1 0x%04x %d.%d %d.%d 0x%04x 0x%02x\n",
|
|
||||||
tosh_id,
|
tosh_id,
|
||||||
(tosh_sci & 0xff00)>>8,
|
(tosh_sci & 0xff00)>>8,
|
||||||
tosh_sci & 0xff,
|
tosh_sci & 0xff,
|
||||||
@ -323,9 +321,21 @@ static int tosh_get_info(char *buffer, char **start, off_t fpos, int length)
|
|||||||
tosh_bios & 0xff,
|
tosh_bios & 0xff,
|
||||||
tosh_date,
|
tosh_date,
|
||||||
key);
|
key);
|
||||||
|
return 0;
|
||||||
return temp-buffer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int proc_toshiba_open(struct inode *inode, struct file *file)
|
||||||
|
{
|
||||||
|
return single_open(file, proc_toshiba_show, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations proc_toshiba_fops = {
|
||||||
|
.owner = THIS_MODULE,
|
||||||
|
.open = proc_toshiba_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = single_release,
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -508,11 +518,16 @@ static int __init toshiba_init(void)
|
|||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
#ifdef CONFIG_PROC_FS
|
#ifdef CONFIG_PROC_FS
|
||||||
/* register the proc entry */
|
{
|
||||||
if (create_proc_info_entry("toshiba", 0, NULL, tosh_get_info) == NULL) {
|
struct proc_dir_entry *pde;
|
||||||
|
|
||||||
|
pde = create_proc_entry("toshiba", 0, NULL);
|
||||||
|
if (!pde) {
|
||||||
misc_deregister(&tosh_device);
|
misc_deregister(&tosh_device);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
pde->proc_fops = &proc_toshiba_fops;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user