FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu Kernel Team

 
 
LinkBack Thread Tools
 
Old 11-18-2008, 07:43 PM
Ben Collins
 
Default UBUNTU: SAUCE: toshiba_acpi -- convert to modern seq_file proc interfaces

On Tue, 2008-11-18 at 16:27 +0000, Andy Whitcroft wrote:
> The deprecated procfs interface create_proc_info_entry has now actually
> been removed. Refactor in terms of the modern seq_file interfaces.
>
> Signed-off-by: Andy Whitcroft <apw@canonical.com>

Good work. ACK

> ---
> drivers/acpi/toshiba_acpi.c | 24 ++++++++++++++++++------
> 1 files changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c
> index f320918..ea34164 100644
> --- a/drivers/acpi/toshiba_acpi.c
> +++ b/drivers/acpi/toshiba_acpi.c
> @@ -59,6 +59,7 @@
> #include <linux/toshiba.h>
> #include <asm/io.h>
> #include <linux/backlight.h>
> +#include <linux/seq_file.h>
>
> #include <asm/uaccess.h>
>
> @@ -629,9 +630,8 @@ setup_tosh_info(void __iomem *bios)
>
> /* /proc/toshiba read handler */
> static int
> -tosh_get_info(char* buffer, char** start, off_t fpos, int length)
> +old_toshiba_proc_show(struct seq_file *m, void *v)
> {
> - char* temp = buffer;
> /* TODO: tosh_fn_status() */
> int key = 0;
>
> @@ -643,8 +643,7 @@ tosh_get_info(char* buffer, char** start, off_t fpos, int length)
> * 4) BIOS date (in SCI date format)
> * 5) Fn Key status
> */
> -
> - temp += sprintf(temp, "1.1 0x%04x %d.%d %d.%d 0x%04x 0x%02x
",
> + seq_printf(m, "1.1 0x%04x %d.%d %d.%d 0x%04x 0x%02x
",
> tosh_id,
> (tosh_sci & 0xff00)>>8,
> tosh_sci & 0xff,
> @@ -653,9 +652,22 @@ tosh_get_info(char* buffer, char** start, off_t fpos, int length)
> tosh_date,
> key);
>
> - return temp-buffer;
> + return 0;
> }
>
> +static int old_toshiba_proc_open(struct inode *inode, struct file *file)
> +{
> + return single_open(file, old_toshiba_proc_show, NULL);
> +}
> +
> +static const struct file_operations old_toshiba_proc_fops = {
> + .owner = THIS_MODULE,
> + .open = old_toshiba_proc_open,
> + .read = seq_read,
> + .llseek = seq_lseek,
> + .release = single_release,
> +};
> +
> static int __init
> old_driver_emulation_init(void)
> {
> @@ -671,7 +683,7 @@ old_driver_emulation_init(void)
> }
>
> setup_tosh_info(bios);
> - create_proc_info_entry(OLD_PROC_TOSHIBA, 0, NULL, tosh_get_info);
> + proc_create(OLD_PROC_TOSHIBA, 0, NULL, &old_toshiba_proc_fops);
>
> iounmap(bios);
>
> --
> 1.6.0.4.911.gc990
>
>


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 

Thread Tools




All times are GMT. The time now is 07:29 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org