From a4e32b5f0ac60e6bca7c6896f47e1c624ae45df1 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Tue, 2 Oct 2007 13:30:05 -0700 Subject: [POWERPC] Sky Cpu and Nexus: code style improvement Remove useless spaces and adds some empty lines to make code more readable. Also marker for printk is added. Signed-off-by: Cyrill Gorcunov Cc: Benjamin Herrenschmidt Cc: Kumar Gala Cc: Brian Waite Signed-off-by: Andrew Morton Signed-off-by: Paul Mackerras --- drivers/misc/hdpuftrs/hdpu_nexus.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'drivers/misc/hdpuftrs/hdpu_nexus.c') diff --git a/drivers/misc/hdpuftrs/hdpu_nexus.c b/drivers/misc/hdpuftrs/hdpu_nexus.c index 60c8b26f067..fd3f3c22115 100644 --- a/drivers/misc/hdpuftrs/hdpu_nexus.c +++ b/drivers/misc/hdpuftrs/hdpu_nexus.c @@ -40,40 +40,43 @@ static struct platform_driver hdpu_nexus_driver = { int hdpu_slot_id_read(char *buffer, char **buffer_location, off_t offset, int buffer_length, int *zero, void *ptr) { - if (offset > 0) return 0; + return sprintf(buffer, "%d\n", slot_id); } int hdpu_chassis_id_read(char *buffer, char **buffer_location, off_t offset, int buffer_length, int *zero, void *ptr) { - if (offset > 0) return 0; + return sprintf(buffer, "%d\n", chassis_id); } static int hdpu_nexus_probe(struct platform_device *pdev) { struct resource *res; + int *nexus_id_addr; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - int *nexus_id_addr; - nexus_id_addr = - ioremap(res->start, (unsigned long)(res->end - res->start)); + nexus_id_addr = ioremap(res->start, + (unsigned long)(res->end - res->start)); if (nexus_id_addr) { slot_id = (*nexus_id_addr >> 8) & 0x1f; chassis_id = *nexus_id_addr & 0xff; iounmap(nexus_id_addr); - } else - printk("Could not map slot id\n"); + } else { + printk(KERN_ERR "Could not map slot id\n"); + } + hdpu_slot_id = create_proc_entry("sky_slot_id", 0666, &proc_root); hdpu_slot_id->read_proc = hdpu_slot_id_read; hdpu_chassis_id = create_proc_entry("sky_chassis_id", 0666, &proc_root); hdpu_chassis_id->read_proc = hdpu_chassis_id_read; + return 0; } @@ -81,18 +84,19 @@ static int hdpu_nexus_remove(struct platform_device *pdev) { slot_id = -1; chassis_id = -1; + remove_proc_entry("sky_slot_id", &proc_root); remove_proc_entry("sky_chassis_id", &proc_root); + hdpu_slot_id = 0; hdpu_chassis_id = 0; + return 0; } static int __init nexus_init(void) { - int rc; - rc = platform_driver_register(&hdpu_nexus_driver); - return rc; + return platform_driver_register(&hdpu_nexus_driver); } static void __exit nexus_exit(void) -- cgit v1.2.3