• Ryan S. Arnold's avatar
    [PATCH] HVCS fixes · c8c90ab1
    Ryan S. Arnold authored
    Here are a set of HVCS (drivers/char/hvcs.c) fixes that were suggested by Jeff
    Garzik on July 29th in his review of this driver as well as some other fixes
    for problems I found while reviewing the driver.  These are all relatively
    minor, but necessary.
    
    - Cleaned up curly braces on single line conditional blocks.
    
    - Replaced debug memset(...,0x3F,...) with memset(...,0x00,...).
    
    - Removed explicit '= 0' after static int declarations since these default
      to zero.
    
    - Removed list_for_each_safe() instances and replaced with
      list_for_each_entry() which cut down on amt of code.  The 'safe' version is
      un-needed now that the driver is using spinlocks.
    
    - Changed spin_lock_irqsave() to spin_lock() when locking hvcs_structs_lock
      and hvcs_pi_lock since these are not touched in an int handler.
    
    - changed spin_lock_irqsave() to spin_lock() in interrupt handler.
    
    - Initialized hvcs_structs_lock and hvcs_pi_lock to SPIN_LOCK_UNLOCKED at
      declaration tiem rather than in hvcs_module_init().
    
    - Added spin_lock around list_del() in destroy_hvcs_struct() to protect the
      list traversal from deletion.  The original omission was an oversight.
    
    - Removed '= NULL' from pointer declarations since they are initialized NULL
      by default.
    
    - Removed wmb() instance from hvcs_try_write().  They probably aren't needed
      with locking in place.
    
    - Added check and cleanup for hvcs_pi_buff = kmalloc() in
      hvcs_module_init().
    
    - Exposed hvcs_struct.index via a sysfs attribute so that the coupling
      between /dev/hvcs* and a vty-server can be systematically determined.
    
    - Moved kobject_put() in hvcs_open() outside of the
      spin_unlock_irqrestore().
    
    - In hvcs_probe() changed kmalloc(sizeof(*hvcsd),...) to
      kmalloc(sizeof(struct hvcs_struct)) because hvcsd references a NULL pointer
      at the time of kmalloc.
    
    - Incremented the HVCS_DRIVER_VERSION to 1.3.1
    
    arch/ppc64/kernel/hvcserver.c:
    
    - Changed function documentation of EXPORTed functions to comply with proper
      kernel-doc documentation style.
    
    - Changed 'unsigned int' types to 'uint32_t' to comply with how unit
      addresses and partition IDs are handled in other arch/ppc64 vterm code.
    
    - Cleaned up curly braces on single line conditional blocks.
    
    include/asm-ppc64/hvcserver.h:
    
    - Added kernel-doc style documentation for hvcs_partner_info struct.
    
    - changed 'unsigned int' types to 'uint32_t' to comply with how unit
      addresses and partition IDs are handled in other arch/ppc64 vterm code.
    Signed-off-by: default avatarRyan S. Arnold <rsa@us.ibm.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    c8c90ab1
hvcs.c 46.2 KB