x86: cleanup non-code changing
The following changes since commit 1f31834fbbb8de367914f044d3268c6afbfdd783:
Ingo Molnar (1):
Merge branch 'x86/mce2'
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jaswinder/linux-2.6-tip.git master
Jaswinder Singh Rajput (8):
x86: i8237.c cleanup
x86: topology.c cleanup
x86: kdebugfs.c cleanup
x86: i8253 cleanup
x86: pci-nommu.c cleanup
x86: io_delay.c cleanup
x86: rtc.c cleanup
x86: tls.c cleanup
arch/x86/kernel/i8237.c | 5 ++- arch/x86/kernel/i8253.c | 68 ++++++++++++++++++-------------------- arch/x86/kernel/io_delay.c | 6 ++-- arch/x86/kernel/kdebugfs.c | 76 ++++++++++++++++++++---------------------- arch/x86/kernel/pci-nommu.c | 29 +++++++++++------ arch/x86/kernel/rtc.c | 24 +++++++------ arch/x86/kernel/tls.c | 20 ++++++++--- arch/x86/kernel/topology.c | 14 ++++--- 8 files changed, 129 insertions(+), 113 deletions(-)
Complete diff:
arch/x86/kernel/i8237.c +3 -2
@@ -9,9 +9,8 @@* your option) any later version. */ -#include <linux/init.h> #include <linux/sysdev.h> - +#include <linux/init.h> #include <asm/dma.h> /*
@@ -64,8 +63,10 @@ static struct sys_device device_i8237A = {static int __init i8237A_init_sysfs (void ) {int error =sysdev_class_register (&i8237_sysdev_class); +if (!error) error =sysdev_register (&device_i8237A); +return error; }device_initcall (i8237A_init_sysfs);
arch/x86/kernel/i8253.c +33 -35
134 lines not on this page · raw message
arch/x86/kernel/io_delay.c +3 -3
@@ -7,10 +7,10 @@*/ #include <linux/kernel.h> #include <linux/module.h> -#include <linux/init.h> #include <linux/delay.h> +#include <linux/init.h> #include <linux/dmi.h> -#include <asm/io.h> +#include <linux/io.h> int io_delay_type__read_mostly =CONFIG_DEFAULT_IO_DELAY_TYPE ;
@@ -126,7 +126,7 @@ static int __init io_delay_param(char *s)return -EINVAL ; io_delay_override =1 ; +return 0 ; } -early_param ("io_delay" , io_delay_param);
arch/x86/kernel/kdebugfs.c +36 -40
201 lines not on this page · raw message
arch/x86/kernel/pci-nommu.c +19 -10
@@ -1,14 +1,14 @@/* Fallback functions when the main IOMMU code is not compiled in. This code is roughly equivalent to i386. */ -#include <linux/mm.h> -#include <linux/init.h> -#include <linux/pci.h> -#include <linux/string.h> #include <linux/dma-mapping.h> #include <linux/scatterlist.h> +#include <linux/string.h> +#include <linux/init.h> +#include <linux/pci.h> +#include <linux/mm.h> -#include <asm/iommu.h> #include <asm/processor.h> +#include <asm/iommu.h> #include <asm/dma.h> static int
@@ -20,8 +20,10 @@ check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size)"nommu_%s: overflow %Lx+%zu of device mask %Lx\n" , name, (long long )bus, size, (long long)*hwdev->dma_mask); +return 0 ; } +return 1 ; }
@@ -31,10 +33,14 @@ static dma_addr_t nommu_map_page(struct device *dev, struct page *page, struct dma_attrs *attrs) {dma_addr_t bus =page_to_phys (page) + offset; +WARN_ON (size ==0 ); +if (!check_addr ("map_single" , dev, bus, size))return bad_dma_address; +flush_write_buffers (); +return bus; }
@@ -65,11 +71,14 @@ static int nommu_map_sg(struct device *hwdev, struct scatterlist *sg,for_each_sg (sg, s, nents, i) {BUG_ON (!sg_page (s)); s->dma_address =sg_phys (s); +if (!check_addr ("map_sg" , hwdev, s->dma_address, s->length))return 0 ; + s->dma_length = s->length; }flush_write_buffers (); +return nents; }
@@ -80,11 +89,11 @@ static void nommu_free_coherent(struct device *dev, size_t size, void *vaddr, }struct dma_map_ops nommu_dma_ops = { - .alloc_coherent = dma_generic_alloc_coherent, - .free_coherent = nommu_free_coherent, - .map_sg = nommu_map_sg, - .map_page = nommu_map_page, - .is_phys =1 , + .alloc_coherent = dma_generic_alloc_coherent, + .free_coherent = nommu_free_coherent, + .map_sg = nommu_map_sg, + .map_page = nommu_map_page, + .is_phys =1 , };void __init no_iommu_init (void )
arch/x86/kernel/rtc.c +13 -11
@@ -1,14 +1,14 @@/* * RTC related functions */ +#include <linux/platform_device.h> +#include <linux/mc146818rtc.h> #include <linux/acpi.h> #include <linux/bcd.h> -#include <linux/mc146818rtc.h> -#include <linux/platform_device.h> #include <linux/pnp.h> -#include <asm/time.h> #include <asm/vsyscall.h> +#include <asm/time.h> #ifdef CONFIG_X86_32 /*
@@ -16,9 +16,9 @@* register we are working with. It is required for NMI access to the * CMOS/RTC registers. See include/asm-i386/mc146818rtc.h for details. */ -volatile unsigned long cmos_lock =0 ; +volatile unsigned long cmos_lock;EXPORT_SYMBOL (cmos_lock); -#endif +#endif /* CONFIG_X86_32 */ /* For two digit years assume time is always after that */ #define CMOS_YEARS_OFFS 2000
@@ -38,9 +38,9 @@ EXPORT_SYMBOL(rtc_lock);*/ int mach_set_rtc_mmss (unsigned long nowtime) { -int retval =0 ;int real_seconds, real_minutes, cmos_minutes;unsigned char save_control, save_freq_select; +int retval =0 ;/* tell the clock it's being set */ save_control =CMOS_READ (RTC_CONTROL );
@@ -72,8 +72,8 @@ int mach_set_rtc_mmss(unsigned long nowtime) real_seconds =bin2bcd (real_seconds); real_minutes =bin2bcd (real_minutes); } -CMOS_WRITE (real_seconds,RTC_SECONDS ); -CMOS_WRITE (real_minutes,RTC_MINUTES ); +CMOS_WRITE (real_seconds,RTC_SECONDS ); +CMOS_WRITE (real_minutes,RTC_MINUTES ); }else { printk(KERN_WARNING "set_rtc_mmss: can't update from %d to %d\n",
@@ -118,7 +118,7 @@ unsigned long mach_get_cmos_time(void)if (acpi_gbl_FADT.header.revision >=FADT2_REVISION_ID && acpi_gbl_FADT.century) century =CMOS_READ (acpi_gbl_FADT.century); -#endif +#endif /* CONFIG_ACPI */ status =CMOS_READ (RTC_CONTROL );WARN_ON_ONCE (RTC_ALWAYS_BCD && (status &RTC_DM_BINARY ));
@@ -151,6 +151,7 @@ unsigned char rtc_cmos_read(unsigned char addr)outb (addr,RTC_PORT (0 )); val =inb (RTC_PORT (1 ));lock_cmos_suffix (addr); +return val; }EXPORT_SYMBOL (rtc_cmos_read);
@@ -166,8 +167,8 @@ EXPORT_SYMBOL(rtc_cmos_write);static int set_rtc_mmss (unsigned long nowtime) { -int retval;unsigned long flags; +int retval;spin_lock_irqsave (&rtc_lock, flags); retval =set_wallclock (nowtime);
@@ -237,11 +238,12 @@ static __init int add_rtc_cmos(void) } } } -#endif +#endif /* CONFIG_PNP */ platform_device_register (&rtc_device);dev_info (&rtc_device.dev,"registered platform RTC device (no PNP device found)\n" ); +return 0 ; }device_initcall (add_rtc_cmos);
arch/x86/kernel/tls.c +14 -6
@@ -1,16 +1,16 @@ +#include <linux/uaccess.h> #include <linux/kernel.h> +#include <linux/regset.h> #include <linux/errno.h> #include <linux/sched.h> #include <linux/user.h> -#include <linux/regset.h> -#include <asm/uaccess.h> -#include <asm/desc.h> -#include <asm/system.h> -#include <asm/ldt.h> #include <asm/processor.h> -#include <asm/proto.h> #include <asm/syscalls.h> +#include <asm/system.h> +#include <asm/proto.h> +#include <asm/desc.h> +#include <asm/ldt.h> #include "tls.h"
@@ -25,6 +25,7 @@ static int get_free_idx(void)for (idx =0 ; idx <GDT_ENTRY_TLS_ENTRIES ; idx++)if (desc_empty (&t->tls_array[idx]))return idx +GDT_ENTRY_TLS_MIN ; +return -ESRCH ; }
@@ -93,7 +94,9 @@ int do_set_thread_area(struct task_struct *p, int idx, asmlinkage int sys_set_thread_area(struct user_desc __user *u_info) {int ret =do_set_thread_area (current,-1 , u_info,1 ); +asmlinkage_protect (1 , ret, u_info); +return ret; }
@@ -137,13 +140,16 @@ int do_get_thread_area(struct task_struct *p, int idx,if (copy_to_user (u_info, &info,sizeof (info)))return -EFAULT ; +return 0 ; } asmlinkage int sys_get_thread_area(struct user_desc __user *u_info) {int ret =do_get_thread_area (current,-1 , u_info); +asmlinkage_protect (1 , ret, u_info); +return ret; }
@@ -152,8 +158,10 @@ int regset_tls_active(struct task_struct *target, {struct thread_struct *t = &target->thread;int n =GDT_ENTRY_TLS_ENTRIES ; +while (n >0 &&desc_empty (&t->tls_array[n -1 ])) --n; +return n; }
arch/x86/kernel/topology.c +8 -6
@@ -25,10 +25,10 @@* * Send feedback to <[email protected]> */ -#include <linux/init.h> -#include <linux/smp.h> #include <linux/nodemask.h> #include <linux/mmzone.h> +#include <linux/init.h> +#include <linux/smp.h> #include <asm/cpu.h> static DEFINE_PER_CPU(struct x86_cpu, cpu_devices);
@@ -47,6 +47,7 @@ int __ref arch_register_cpu(int num)*/ if (num)per_cpu (cpu_devices, num).cpu.hotpluggable =1 ; +return register_cpu (&per_cpu (cpu_devices, num).cpu, num); }EXPORT_SYMBOL (arch_register_cpu);
@@ -56,12 +57,13 @@ void arch_unregister_cpu(int num) unregister_cpu(&per_cpu(cpu_devices, num).cpu); }EXPORT_SYMBOL (arch_unregister_cpu); -#else +#else /* CONFIG_HOTPLUG_CPU */ +static int __init arch_register_cpu (int num) {return register_cpu (&per_cpu (cpu_devices, num).cpu, num); } -#endif /*CONFIG_HOTPLUG_CPU*/ +#endif /* CONFIG_HOTPLUG_CPU */ static int __init topology_init (void ) {
@@ -70,11 +72,11 @@ static int __init topology_init(void)#ifdef CONFIG_NUMA for_each_online_node (i)register_one_node (i); -#endif /* CONFIG_NUMA */ +#endif for_each_present_cpu (i)arch_register_cpu (i); +return 0 ; } -subsys_initcall (topology_init);
Quoted 6 lines · Jaswinder Singh Rajput
arch/x86/kernel/kdebugfs.c +0
-0static int __init@@ -84,24 +85,20 @@ create_setup_data_node(struct dentry *parent, int no, {
arch/x86/kernel/kdebugfs.c create_setup_data_node(struct dentry *parent, int no, · line 92
Quoted 10 lines
arch/x86/kernel/kdebugfs.c +1
-3struct dentry *d, *type, *data;char buf[16 ]; -int error;sprintf (buf,"%d" , no); d =debugfs_create_dir (buf, parent); -if (!d) { - error = -ENOMEM ; +if (!d) goto err_return;
Sigh. return -ENOMEM; perhaps ????
Quoted 5 lines
arch/x86/kernel/kdebugfs.c +0
-1static int __init create_setup_data_nodes (struct dentry *parent) {struct setup_data_node *node;struct setup_data *data; -int error, no =0 ;
arch/x86/kernel/kdebugfs.c err_type: · line 123
Quoted 10 lines
arch/x86/kernel/kdebugfs.c +2
-2+int error =0 , no =0 ;struct dentry *d;struct page *pg;u64 pa_data; d =debugfs_create_dir ("setup_data" , parent); -if (!d) { - error = -ENOMEM ; +if (!d) goto err_return;
Yuck. This is the most stupid change I have seen so far.
error = 0; goto err_return;
err_return:
if (!error)
error = -ENOMEM;
return error;
WTF can't you just initialize error with -ENOMEM ?
Quoted 12 lines
arch/x86/kernel/kdebugfs.c +2
-3@@ -175,28 +171,26 @@ static struct debugfs_blob_wrapper boot_params_blob = {static int __init boot_params_kdebugfs_init (void ) {struct dentry *dbp, *version, *data; -int error; +int error =0 ; dbp =debugfs_create_dir ("boot_params" ,NULL ); -if (!dbp) { - error = -ENOMEM ; +if (!dbp) goto err_return;
...
arch/x86/kernel/kdebugfs.c static int __init create_setup_data_nodes(struct dentry *parent) · line 164
Quoted 5 lines
err_return:arch/x86/kernel/kdebugfs.c +2
-0+if (!error) + error = -ENOMEM ;return error; }
At least it is conistently stupid.
arch/x86/kernel/kdebugfs.c check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size) · line 28
Quoted 11 lines
static int
arch/x86/kernel/kdebugfs.c +2
-0@@ -20,8 +20,10 @@ check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size)"nommu_%s: overflow %Lx+%zu of device mask %Lx\n" , name, (long long )bus, size, (long long)*hwdev->dma_mask); +return 0 ; } +return 1 ; }
What's the exact point of these newlines ? The code is perfectly readable except for the weird formatted printk which you ignored.
This newlines business just has the effect that I have less code on one screen than before.
Can we please stop this time waste and take care of real problems ?
Thanks,
tglx