]> Pileus Git - ~andy/linux/commitdiff
Merge tag 'char-misc-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 21 Feb 2013 21:57:13 +0000 (13:57 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 21 Feb 2013 21:57:13 +0000 (13:57 -0800)
Pull char/misc driver patches from Greg Kroah-Hartman:
 "Here's the big char/misc driver patches for 3.9-rc1.

  Nothing major here, just lots of different driver updates (mei,
  hyperv, ipack, extcon, vmci, etc.).

  All of these have been in the linux-next tree for a while."

* tag 'char-misc-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (209 commits)
  w1: w1_therm: Add force-pullup option for "broken" sensors
  w1: ds2482: Added 1-Wire pull-up support to the driver
  vme: add missing put_device() after device_register() fails
  extcon: max8997: Use workqueue to check cable state after completing boot of platform
  extcon: max8997: Set default UART/USB path on probe
  extcon: max8997: Consolidate duplicate code for checking ADC/CHG cable type
  extcon: max8997: Set default of ADC debounce time during initialization
  extcon: max8997: Remove duplicate code related to set H/W line path
  extcon: max8997: Move defined constant to header file
  extcon: max77693: Make max77693_extcon_cable static
  extcon: max8997: Remove unreachable code
  extcon: max8997: Make max8997_extcon_cable static
  extcon: max77693: Remove unnecessary goto statement to improve readability
  extcon: max77693: Convert to devm_input_allocate_device()
  extcon: gpio: Rename filename of extcon-gpio.c according to kernel naming style
  CREDITS: update email and address of Harald Hoyer
  extcon: arizona: Use MICDET for final microphone identification
  extcon: arizona: Always take the first HPDET reading as the final one
  extcon: arizona: Clear _trig_sts bits after jack detection
  extcon: arizona: Don't HPDET magic when headphones are enabled
  ...

12 files changed:
1  2 
MAINTAINERS
drivers/Kconfig
drivers/Makefile
drivers/char/hw_random/exynos-rng.c
drivers/char/pcmcia/synclink_cs.c
drivers/ipack/devices/ipoctal.c
drivers/mfd/wm5102-tables.c
drivers/misc/Kconfig
drivers/mmc/host/Kconfig
drivers/net/Kconfig
drivers/net/hyperv/netvsc_drv.c
include/linux/mfd/arizona/pdata.h

diff --combined MAINTAINERS
index eac5eda526406f653bfe3cb48d5663e592f6b15e,75fd3e0b76fde9f1bd85dfe4628f1388554ef511..f5b9851755a24d8f59001746d3dbd05e6997ad87
@@@ -670,16 -670,8 +670,16 @@@ F:       drivers/input/serio/ambakmi.
  F:    include/linux/amba/kmi.h
  
  ARM PRIMECELL MMCI PL180/1 DRIVER
 -S:    Orphan
 +M:    Russell King <linux@arm.linux.org.uk>
 +S:    Maintained
  F:    drivers/mmc/host/mmci.*
 +F:    include/linux/amba/mmci.h
 +
 +ARM PRIMECELL UART PL010 AND PL011 DRIVERS
 +M:    Russell King <linux@arm.linux.org.uk>
 +S:    Maintained
 +F:    drivers/tty/serial/amba-pl01*.c
 +F:    include/linux/amba/serial.h
  
  ARM PRIMECELL BUS SUPPORT
  M:    Russell King <linux@arm.linux.org.uk>
@@@ -1311,7 -1303,7 +1311,7 @@@ F:      include/linux/dmaengine.
  F:    include/linux/async_tx.h
  
  AT24 EEPROM DRIVER
 -M:    Wolfram Sang <w.sang@pengutronix.de>
 +M:    Wolfram Sang <wsa@the-dreams.de>
  L:    linux-i2c@vger.kernel.org
  S:    Maintained
  F:    drivers/misc/eeprom/at24.c
@@@ -1497,7 -1489,7 +1497,7 @@@ AVR32 ARCHITECTUR
  M:    Haavard Skinnemoen <hskinnemoen@gmail.com>
  M:    Hans-Christian Egtvedt <egtvedt@samfundet.no>
  W:    http://www.atmel.com/products/AVR32/
 -W:    http://avr32linux.org/
 +W:    http://mirror.egtvedt.no/avr32linux.org/
  W:    http://avrfreaks.net/
  S:    Maintained
  F:    arch/avr32/
@@@ -2148,10 -2140,10 +2148,10 @@@ S:   Maintaine
  F:    tools/power/cpupower
  
  CPUSETS
 -M:    Paul Menage <paul@paulmenage.org>
 +M:    Li Zefan <lizefan@huawei.com>
  W:    http://www.bullopensource.org/cpuset/
  W:    http://oss.sgi.com/projects/cpusets/
 -S:    Supported
 +S:    Maintained
  F:    Documentation/cgroups/cpusets.txt
  F:    include/linux/cpuset.h
  F:    kernel/cpuset.c
@@@ -2974,7 -2966,7 +2974,7 @@@ S:      Maintaine
  F:    drivers/net/ethernet/i825xx/eexpress.*
  
  ETHERNET BRIDGE
 -M:    Stephen Hemminger <shemminger@vyatta.com>
 +M:    Stephen Hemminger <stephen@networkplumber.org>
  L:    bridge@lists.linux-foundation.org
  L:    netdev@vger.kernel.org
  W:    http://www.linuxfoundation.org/en/Net:Bridge
@@@ -2982,6 -2974,11 +2982,6 @@@ S:     Maintaine
  F:    include/linux/netfilter_bridge/
  F:    net/bridge/
  
 -ETHERTEAM 16I DRIVER
 -M:    Mika Kuoppala <miku@iki.fi>
 -S:    Maintained
 -F:    drivers/net/ethernet/fujitsu/eth16i.c
 -
  EXT2 FILE SYSTEM
  M:    Jan Kara <jack@suse.cz>
  L:    linux-ext4@vger.kernel.org
@@@ -3760,11 -3757,12 +3760,11 @@@ S:   Maintaine
  F:    drivers/i2c/i2c-stub.c
  
  I2C SUBSYSTEM
 -M:    Wolfram Sang <w.sang@pengutronix.de>
 +M:    Wolfram Sang <wsa@the-dreams.de>
  M:    "Ben Dooks (embedded platforms)" <ben-linux@fluff.org>
  L:    linux-i2c@vger.kernel.org
  W:    http://i2c.wiki.kernel.org/
 -T:    quilt kernel.org/pub/linux/kernel/people/jdelvare/linux-2.6/jdelvare-i2c/
 -T:    git git://git.pengutronix.de/git/wsa/linux.git
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git
  S:    Maintained
  F:    Documentation/i2c/
  F:    drivers/i2c/
@@@ -4483,15 -4481,6 +4483,15 @@@ F:    arch/s390/include/asm/kvm
  F:    arch/s390/kvm/
  F:    drivers/s390/kvm/
  
 +KERNEL VIRTUAL MACHINE (KVM) FOR ARM
 +M:    Christoffer Dall <cdall@cs.columbia.edu>
 +L:    kvmarm@lists.cs.columbia.edu
 +W:    http://systems.cs.columbia.edu/projects/kvm-arm
 +S:    Maintained
 +F:    arch/arm/include/uapi/asm/kvm*
 +F:    arch/arm/include/asm/kvm*
 +F:    arch/arm/kvm/
 +
  KEXEC
  M:    Eric Biederman <ebiederm@xmission.com>
  W:    http://kernel.org/pub/linux/utils/kernel/kexec/
@@@ -4916,7 -4905,7 +4916,7 @@@ S:      Maintaine
  
  MARVELL GIGABIT ETHERNET DRIVERS (skge/sky2)
  M:    Mirko Lindner <mlindner@marvell.com>
 -M:    Stephen Hemminger <shemminger@vyatta.com>
 +M:    Stephen Hemminger <stephen@networkplumber.org>
  L:    netdev@vger.kernel.org
  S:    Maintained
  F:    drivers/net/ethernet/marvell/sk*
@@@ -5191,7 -5180,7 +5191,7 @@@ S:      Supporte
  F:    drivers/infiniband/hw/nes/
  
  NETEM NETWORK EMULATOR
 -M:    Stephen Hemminger <shemminger@vyatta.com>
 +M:    Stephen Hemminger <stephen@networkplumber.org>
  L:    netem@lists.linux-foundation.org
  S:    Maintained
  F:    net/sched/sch_netem.c
@@@ -5380,6 -5369,13 +5380,6 @@@ F:     include/linux/sunrpc
  F:    include/uapi/linux/nfs*
  F:    include/uapi/linux/sunrpc/
  
 -NI5010 NETWORK DRIVER
 -M:    Jan-Pascal van Best <janpascal@vanbest.org>
 -M:    Andreas Mohr <andi@lisas.de>
 -L:    netdev@vger.kernel.org
 -S:    Maintained
 -F:    drivers/net/ethernet/racal/ni5010.*
 -
  NILFS2 FILESYSTEM
  M:    KONISHI Ryusuke <konishi.ryusuke@lab.ntt.co.jp>
  L:    linux-nilfs@vger.kernel.org
@@@ -5405,6 -5401,13 +5405,13 @@@ S:    Maintaine
  F:    Documentation/scsi/NinjaSCSI.txt
  F:    drivers/scsi/nsp32*
  
+ NTB DRIVER
+ M:    Jon Mason <jon.mason@intel.com>
+ S:    Supported
+ F:    drivers/ntb/
+ F:    drivers/net/ntb_netdev.c
+ F:    include/linux/ntb.h
  NTFS FILESYSTEM
  M:    Anton Altaparmakov <anton@tuxera.com>
  L:    linux-ntfs-dev@lists.sourceforge.net
@@@ -5782,6 -5785,15 +5789,6 @@@ L:     linux-i2c@vger.kernel.or
  S:    Maintained
  F:    drivers/i2c/muxes/i2c-mux-pca9541.c
  
 -PCA9564/PCA9665 I2C BUS DRIVER
 -M:    Wolfram Sang <w.sang@pengutronix.de>
 -L:    linux-i2c@vger.kernel.org
 -S:    Maintained
 -F:    drivers/i2c/algos/i2c-algo-pca.c
 -F:    drivers/i2c/busses/i2c-pca-*
 -F:    include/linux/i2c-algo-pca.h
 -F:    include/linux/i2c-pca-platform.h
 -
  PCDP - PRIMARY CONSOLE AND DEBUG PORT
  M:    Khalid Aziz <khalid@gonehiking.org>
  S:    Maintained
@@@ -6593,7 -6605,7 +6600,7 @@@ F:      drivers/dma/dw_dmac_regs.
  F:    drivers/dma/dw_dmac.c
  
  TIMEKEEPING, NTP
 -M:    John Stultz <johnstul@us.ibm.com>
 +M:    John Stultz <john.stultz@linaro.org>
  M:    Thomas Gleixner <tglx@linutronix.de>
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core
  S:    Supported
@@@ -7083,7 -7095,7 +7090,7 @@@ F:      include/uapi/sound
  F:    sound/
  
  SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT (ASoC)
 -M:    Liam Girdwood <lrg@ti.com>
 +M:    Liam Girdwood <lgirdwood@gmail.com>
  M:    Mark Brown <broonie@opensource.wolfsonmicro.com>
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
  L:    alsa-devel@alsa-project.org (moderated for non-subscribers)
@@@ -7173,7 -7185,6 +7180,7 @@@ F:      drivers/clk/spear
  
  SPI SUBSYSTEM
  M:    Grant Likely <grant.likely@secretlab.ca>
 +M:    Mark Brown <broonie@opensource.wolfsonmicro.com>
  L:    spi-devel-general@lists.sourceforge.net
  Q:    http://patchwork.kernel.org/project/spi-devel-general/list/
  T:    git git://git.secretlab.ca/git/linux-2.6.git
@@@ -7299,7 -7310,8 +7306,7 @@@ S:      Odd Fixe
  F:    drivers/staging/olpc_dcon/
  
  STAGING - OZMO DEVICES USB OVER WIFI DRIVER
 -M:    Rupesh Gujare <rgujare@ozmodevices.com>
 -M:    Chris Kelly <ckelly@ozmodevices.com>
 +M:    Rupesh Gujare <rupesh.gujare@atmel.com>
  S:    Maintained
  F:    drivers/staging/ozwpan/
  
@@@ -7531,18 -7543,13 +7538,18 @@@ S:   Maintaine
  F:    drivers/media/tuners/tea5767.*
  
  TEAM DRIVER
 -M:    Jiri Pirko <jpirko@redhat.com>
 +M:    Jiri Pirko <jiri@resnulli.us>
  L:    netdev@vger.kernel.org
  S:    Supported
  F:    drivers/net/team/
  F:    include/linux/if_team.h
  F:    include/uapi/linux/if_team.h
  
 +TECHNOLOGIC SYSTEMS TS-5500 PLATFORM SUPPORT
 +M:    Savoir-faire Linux Inc. <kernel@savoirfairelinux.com>
 +S:    Maintained
 +F:    arch/x86/platform/ts5500/
 +
  TECHNOTREND USB IR RECEIVER
  M:    Sean Young <sean@mess.org>
  L:    linux-media@vger.kernel.org
@@@ -7617,22 -7624,6 +7624,22 @@@ F:    Documentation/backlight/lp855x-drive
  F:    drivers/video/backlight/lp855x_bl.c
  F:    include/linux/platform_data/lp855x.h
  
 +TI LP8727 CHARGER DRIVER
 +M:    Milo Kim <milo.kim@ti.com>
 +S:    Maintained
 +F:    drivers/power/lp8727_charger.c
 +F:    include/linux/platform_data/lp8727.h
 +
 +TI LP8788 MFD DRIVER
 +M:    Milo Kim <milo.kim@ti.com>
 +S:    Maintained
 +F:    drivers/iio/adc/lp8788_adc.c
 +F:    drivers/leds/leds-lp8788.c
 +F:    drivers/mfd/lp8788*.c
 +F:    drivers/power/lp8788-charger.c
 +F:    drivers/regulator/lp8788-*.c
 +F:    include/linux/mfd/lp8788*.h
 +
  TI TWL4030 SERIES SOC CODEC DRIVER
  M:    Peter Ujfalusi <peter.ujfalusi@ti.com>
  L:    alsa-devel@alsa-project.org (moderated for non-subscribers)
@@@ -7927,10 -7918,9 +7934,10 @@@ F:    drivers/net/wireless/ath/ar5523
  USB ATTACHED SCSI
  M:    Matthew Wilcox <willy@linux.intel.com>
  M:    Sarah Sharp <sarah.a.sharp@linux.intel.com>
 +M:    Gerd Hoffmann <kraxel@redhat.com>
  L:    linux-usb@vger.kernel.org
  L:    linux-scsi@vger.kernel.org
 -S:    Supported
 +S:    Maintained
  F:    drivers/usb/storage/uas.c
  
  USB CDC ETHERNET DRIVER
diff --combined drivers/Kconfig
index 2b4e89ba15adafe1f6105c2dd06d5cfe0beaa8d1,c13044cb8aa95df0c796fdc830048d6f7c07f61d..202fa6d051b97b24d084aa0962d9135eea5cd798
@@@ -134,8 -134,6 +134,8 @@@ source "drivers/hwspinlock/Kconfig
  
  source "drivers/clocksource/Kconfig"
  
 +source "drivers/mailbox/Kconfig"
 +
  source "drivers/iommu/Kconfig"
  
  source "drivers/remoteproc/Kconfig"
@@@ -152,6 -150,8 +152,8 @@@ source "drivers/memory/Kconfig
  
  source "drivers/iio/Kconfig"
  
+ source "drivers/ntb/Kconfig"
  source "drivers/vme/Kconfig"
  
  source "drivers/pwm/Kconfig"
diff --combined drivers/Makefile
index a8d32f1094b4dca4204918c053e1aaa87a6babb9,3d92e12696723dc4f684c990724f0de811f23873..b359948fc02b87eae1f140453d617442bcdf02ae
@@@ -130,7 -130,6 +130,7 @@@ obj-y                              += platform
  #common clk code
  obj-y                         += clk/
  
 +obj-$(CONFIG_MAILBOX)         += mailbox/
  obj-$(CONFIG_HWSPINLOCK)      += hwspinlock/
  obj-$(CONFIG_NFC)             += nfc/
  obj-$(CONFIG_IOMMU_SUPPORT)   += iommu/
@@@ -147,3 -146,4 +147,4 @@@ obj-$(CONFIG_MEMORY)               += memory
  obj-$(CONFIG_IIO)             += iio/
  obj-$(CONFIG_VME_BUS)         += vme/
  obj-$(CONFIG_IPACK_BUS)               += ipack/
+ obj-$(CONFIG_NTB)             += ntb/
index 4673fc4ad9313093f24d30f4da8e68f9793de803,2a4a86d97333081682c28851b11c7f0867645b3a..ac47631ab34f0caa0383853a0804a4ff4759e1d1
@@@ -104,7 -104,6 +104,7 @@@ static int exynos_read(struct hwrng *rn
  static int exynos_rng_probe(struct platform_device *pdev)
  {
        struct exynos_rng *exynos_rng;
 +      struct resource *res;
  
        exynos_rng = devm_kzalloc(&pdev->dev, sizeof(struct exynos_rng),
                                        GFP_KERNEL);
                return -ENOENT;
        }
  
 -      exynos_rng->mem = devm_request_and_ioremap(&pdev->dev,
 -                      platform_get_resource(pdev, IORESOURCE_MEM, 0));
 -      if (!exynos_rng->mem)
 -              return -EBUSY;
 +      res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 +      exynos_rng->mem = devm_ioremap_resource(&pdev->dev, res);
 +      if (IS_ERR(exynos_rng->mem))
 +              return PTR_ERR(exynos_rng->mem);
  
        platform_set_drvdata(pdev, exynos_rng);
  
@@@ -163,7 -162,7 +163,7 @@@ static int exynos_rng_runtime_resume(st
  }
  
  
- UNIVERSAL_DEV_PM_OPS(exynos_rng_pm_ops, exynos_rng_runtime_suspend,
static UNIVERSAL_DEV_PM_OPS(exynos_rng_pm_ops, exynos_rng_runtime_suspend,
                                        exynos_rng_runtime_resume, NULL);
  
  static struct platform_driver exynos_rng_driver = {
index d0c9852ab8751d22f337d0221f4093e6067962da,29f6bec9d489b96a045351c02690eeed521716aa..5c5cc00ebb075b54cc2247819849db2815ae9194
@@@ -102,8 -102,7 +102,7 @@@ static MGSL_PARAMS default_params = 
        ASYNC_PARITY_NONE               /* unsigned char parity; */
  };
  
- typedef struct
- {
+ typedef struct {
        int count;
        unsigned char status;
        char data[1];
@@@ -210,7 -209,7 +209,7 @@@ typedef struct _mgslpc_info 
        char testing_irq;
        unsigned int init_error;        /* startup error (DIAGS)        */
  
 -      char flag_buf[MAX_ASYNC_BUFFER_SIZE];
 +      char *flag_buf;
        bool drop_rts_on_tx_done;
  
        struct  _input_signal_events    input_signal_events;
  #define write_reg16(info, reg, val) outw((val), (info)->io_base + (reg))
  
  #define set_reg_bits(info, reg, mask) \
-     write_reg(info, (reg), \
+       write_reg(info, (reg), \
                 (unsigned char) (read_reg(info, (reg)) | (mask)))
  #define clear_reg_bits(info, reg, mask) \
-     write_reg(info, (reg), \
+       write_reg(info, (reg), \
                 (unsigned char) (read_reg(info, (reg)) & ~(mask)))
  /*
   * interrupt enable/disable routines
@@@ -356,10 -355,10 +355,10 @@@ static void irq_enable(MGSLPC_INFO *inf
  }
  
  #define port_irq_disable(info, mask) \
-   { info->pim_value |= (mask); write_reg(info, PIM, info->pim_value); }
+       { info->pim_value |= (mask); write_reg(info, PIM, info->pim_value); }
  
  #define port_irq_enable(info, mask) \
-   { info->pim_value &= ~(mask); write_reg(info, PIM, info->pim_value); }
+       { info->pim_value &= ~(mask); write_reg(info, PIM, info->pim_value); }
  
  static void rx_start(MGSLPC_INFO *info);
  static void rx_stop(MGSLPC_INFO *info);
@@@ -397,7 -396,7 +396,7 @@@ static int adapter_test(MGSLPC_INFO *in
  
  static int claim_resources(MGSLPC_INFO *info);
  static void release_resources(MGSLPC_INFO *info);
- static void mgslpc_add_device(MGSLPC_INFO *info);
+ static int mgslpc_add_device(MGSLPC_INFO *info);
  static void mgslpc_remove_device(MGSLPC_INFO *info);
  
  static bool rx_get_frame(MGSLPC_INFO *info, struct tty_struct *tty);
@@@ -514,49 -513,56 +513,56 @@@ static const struct tty_port_operation
  
  static int mgslpc_probe(struct pcmcia_device *link)
  {
-     MGSLPC_INFO *info;
-     int ret;
-     if (debug_level >= DEBUG_LEVEL_INFO)
-           printk("mgslpc_attach\n");
-     info = kzalloc(sizeof(MGSLPC_INFO), GFP_KERNEL);
-     if (!info) {
-           printk("Error can't allocate device instance data\n");
-           return -ENOMEM;
-     }
-     info->magic = MGSLPC_MAGIC;
-     tty_port_init(&info->port);
-     info->port.ops = &mgslpc_port_ops;
-     INIT_WORK(&info->task, bh_handler);
-     info->max_frame_size = 4096;
-     info->port.close_delay = 5*HZ/10;
-     info->port.closing_wait = 30*HZ;
-     init_waitqueue_head(&info->status_event_wait_q);
-     init_waitqueue_head(&info->event_wait_q);
-     spin_lock_init(&info->lock);
-     spin_lock_init(&info->netlock);
-     memcpy(&info->params,&default_params,sizeof(MGSL_PARAMS));
-     info->idle_mode = HDLC_TXIDLE_FLAGS;
-     info->imra_value = 0xffff;
-     info->imrb_value = 0xffff;
-     info->pim_value = 0xff;
-     info->p_dev = link;
-     link->priv = info;
-     /* Initialize the struct pcmcia_device structure */
-     ret = mgslpc_config(link);
-     if (ret) {
-           tty_port_destroy(&info->port);
-           return ret;
-     }
-     mgslpc_add_device(info);
-     return 0;
+       MGSLPC_INFO *info;
+       int ret;
+       if (debug_level >= DEBUG_LEVEL_INFO)
+               printk("mgslpc_attach\n");
+       info = kzalloc(sizeof(MGSLPC_INFO), GFP_KERNEL);
+       if (!info) {
+               printk("Error can't allocate device instance data\n");
+               return -ENOMEM;
+       }
+       info->magic = MGSLPC_MAGIC;
+       tty_port_init(&info->port);
+       info->port.ops = &mgslpc_port_ops;
+       INIT_WORK(&info->task, bh_handler);
+       info->max_frame_size = 4096;
+       info->port.close_delay = 5*HZ/10;
+       info->port.closing_wait = 30*HZ;
+       init_waitqueue_head(&info->status_event_wait_q);
+       init_waitqueue_head(&info->event_wait_q);
+       spin_lock_init(&info->lock);
+       spin_lock_init(&info->netlock);
+       memcpy(&info->params,&default_params,sizeof(MGSL_PARAMS));
+       info->idle_mode = HDLC_TXIDLE_FLAGS;
+       info->imra_value = 0xffff;
+       info->imrb_value = 0xffff;
+       info->pim_value = 0xff;
+       info->p_dev = link;
+       link->priv = info;
+       /* Initialize the struct pcmcia_device structure */
+       ret = mgslpc_config(link);
+       if (ret != 0)
+               goto failed;
+       ret = mgslpc_add_device(info);
+       if (ret != 0)
+               goto failed_release;
+       return 0;
+ failed_release:
+       mgslpc_release((u_long)link);
+ failed:
+       tty_port_destroy(&info->port);
+       kfree(info);
+       return ret;
  }
  
  /* Card has been inserted.
@@@ -569,35 -575,35 +575,35 @@@ static int mgslpc_ioprobe(struct pcmcia
  
  static int mgslpc_config(struct pcmcia_device *link)
  {
-     MGSLPC_INFO *info = link->priv;
-     int ret;
+       MGSLPC_INFO *info = link->priv;
+       int ret;
  
-     if (debug_level >= DEBUG_LEVEL_INFO)
-           printk("mgslpc_config(0x%p)\n", link);
+       if (debug_level >= DEBUG_LEVEL_INFO)
+               printk("mgslpc_config(0x%p)\n", link);
  
-     link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
+       link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
  
-     ret = pcmcia_loop_config(link, mgslpc_ioprobe, NULL);
-     if (ret != 0)
-           goto failed;
+       ret = pcmcia_loop_config(link, mgslpc_ioprobe, NULL);
+       if (ret != 0)
+               goto failed;
  
-     link->config_index = 8;
-     link->config_regs = PRESENT_OPTION;
+       link->config_index = 8;
+       link->config_regs = PRESENT_OPTION;
  
-     ret = pcmcia_request_irq(link, mgslpc_isr);
-     if (ret)
-           goto failed;
-     ret = pcmcia_enable_device(link);
-     if (ret)
-           goto failed;
+       ret = pcmcia_request_irq(link, mgslpc_isr);
+       if (ret)
+               goto failed;
+       ret = pcmcia_enable_device(link);
+       if (ret)
+               goto failed;
  
-     info->io_base = link->resource[0]->start;
-     info->irq_level = link->irq;
-     return 0;
+       info->io_base = link->resource[0]->start;
+       info->irq_level = link->irq;
+       return 0;
  
  failed:
-     mgslpc_release((u_long)link);
-     return -ENODEV;
+       mgslpc_release((u_long)link);
+       return -ENODEV;
  }
  
  /* Card has been removed.
@@@ -703,12 -709,12 +709,12 @@@ static void tx_pause(struct tty_struct 
        if (mgslpc_paranoia_check(info, tty->name, "tx_pause"))
                return;
        if (debug_level >= DEBUG_LEVEL_INFO)
-               printk("tx_pause(%s)\n",info->device_name);
+               printk("tx_pause(%s)\n", info->device_name);
  
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
        if (info->tx_enabled)
-               tx_stop(info);
-       spin_unlock_irqrestore(&info->lock,flags);
+               tx_stop(info);
+       spin_unlock_irqrestore(&info->lock, flags);
  }
  
  static void tx_release(struct tty_struct *tty)
        if (mgslpc_paranoia_check(info, tty->name, "tx_release"))
                return;
        if (debug_level >= DEBUG_LEVEL_INFO)
-               printk("tx_release(%s)\n",info->device_name);
+               printk("tx_release(%s)\n", info->device_name);
  
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
        if (!info->tx_enabled)
-               tx_start(info, tty);
-       spin_unlock_irqrestore(&info->lock,flags);
+               tx_start(info, tty);
+       spin_unlock_irqrestore(&info->lock, flags);
  }
  
  /* Return next bottom half action to perform.
@@@ -735,7 -741,7 +741,7 @@@ static int bh_action(MGSLPC_INFO *info
        unsigned long flags;
        int rc = 0;
  
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
  
        if (info->pending_bh & BH_RECEIVE) {
                info->pending_bh &= ~BH_RECEIVE;
                info->bh_requested = false;
        }
  
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->lock, flags);
  
        return rc;
  }
@@@ -765,8 -771,11 +771,8 @@@ static void bh_handler(struct work_stru
        struct tty_struct *tty;
        int action;
  
 -      if (!info)
 -              return;
 -
        if (debug_level >= DEBUG_LEVEL_BH)
-               printk( "%s(%d):bh_handler(%s) entry\n",
+               printk("%s(%d):bh_handler(%s) entry\n",
                        __FILE__,__LINE__,info->device_name);
  
        info->bh_running = true;
        while((action = bh_action(info)) != 0) {
  
                /* Process work item */
-               if ( debug_level >= DEBUG_LEVEL_BH )
-                       printk( "%s(%d):bh_handler() work item action=%d\n",
+               if (debug_level >= DEBUG_LEVEL_BH)
+                       printk("%s(%d):bh_handler() work item action=%d\n",
                                __FILE__,__LINE__,action);
  
                switch (action) {
  
        tty_kref_put(tty);
        if (debug_level >= DEBUG_LEVEL_BH)
-               printk( "%s(%d):bh_handler(%s) exit\n",
+               printk("%s(%d):bh_handler(%s) exit\n",
                        __FILE__,__LINE__,info->device_name);
  }
  
@@@ -828,7 -837,7 +834,7 @@@ static void rx_ready_hdlc(MGSLPC_INFO *
        RXBUF *buf = (RXBUF*)(info->rx_buf + (info->rx_put * info->rx_buf_size));
  
        if (debug_level >= DEBUG_LEVEL_ISR)
-               printk("%s(%d):rx_ready_hdlc(eom=%d)\n",__FILE__,__LINE__,eom);
+               printk("%s(%d):rx_ready_hdlc(eom=%d)\n", __FILE__, __LINE__, eom);
  
        if (!info->rx_enabled)
                return;
  
        if (eom) {
                /* end of frame, get FIFO count from RBCL register */
-               if (!(fifo_count = (unsigned char)(read_reg(info, CHA+RBCL) & 0x1f)))
+               fifo_count = (unsigned char)(read_reg(info, CHA+RBCL) & 0x1f);
+               if (fifo_count == 0)
                        fifo_count = 32;
        } else
                fifo_count = 32;
        issue_command(info, CHA, CMD_RXFIFO);
  }
  
 -static void rx_ready_async(MGSLPC_INFO *info, int tcd, struct tty_struct *tty)
 +static void rx_ready_async(MGSLPC_INFO *info, int tcd)
  {
 +      struct tty_port *port = &info->port;
        unsigned char data, status, flag;
        int fifo_count;
        int work = 0;
-       struct mgsl_icount *icount = &info->icount;
+       struct mgsl_icount *icount = &info->icount;
  
 -      if (!tty) {
 -              /* tty is not available anymore */
 -              issue_command(info, CHA, CMD_RXRESET);
 -              if (debug_level >= DEBUG_LEVEL_ISR)
 -                      printk("%s(%d):rx_ready_async(tty=NULL)\n", __FILE__, __LINE__);
 -              return;
 -      }
 -
        if (tcd) {
                /* early termination, get FIFO count from RBCL register */
                fifo_count = (unsigned char)(read_reg(info, CHA+RBCL) & 0x1f);
        } else
                fifo_count = 32;
  
 -      tty_buffer_request_room(tty, fifo_count);
 +      tty_buffer_request_room(port, fifo_count);
        /* Flush received async data to receive data buffer. */
        while (fifo_count) {
                data   = read_reg(info, CHA + RXFIFO);
                        else if (status & BIT6)
                                flag = TTY_FRAME;
                }
 -              work += tty_insert_flip_char(tty, data, flag);
 +              work += tty_insert_flip_char(port, data, flag);
        }
        issue_command(info, CHA, CMD_RXFIFO);
  
        }
  
        if (work)
 -              tty_flip_buffer_push(tty);
 +              tty_flip_buffer_push(port);
  }
  
  
@@@ -994,7 -1011,7 +1001,7 @@@ static void tx_ready(MGSLPC_INFO *info
        int c;
  
        if (debug_level >= DEBUG_LEVEL_ISR)
-               printk("%s(%d):tx_ready(%s)\n", __FILE__,__LINE__,info->device_name);
+               printk("%s(%d):tx_ready(%s)\n", __FILE__, __LINE__, info->device_name);
  
        if (info->params.mode == MGSL_MODE_HDLC) {
                if (!info->tx_active)
@@@ -1207,7 -1224,7 +1214,7 @@@ static irqreturn_t mgslpc_isr(int dummy
                                if (info->params.mode == MGSL_MODE_HDLC)
                                        rx_ready_hdlc(info, isr & IRQ_RXEOM);
                                else
 -                                      rx_ready_async(info, isr & IRQ_RXEOM, tty);
 +                                      rx_ready_async(info, isr & IRQ_RXEOM);
                        }
  
                        /* transmit IRQs */
         */
  
        if (info->pending_bh && !info->bh_running && !info->bh_requested) {
-               if ( debug_level >= DEBUG_LEVEL_ISR )
+               if (debug_level >= DEBUG_LEVEL_ISR)
                        printk("%s(%d):%s queueing bh task.\n",
                                __FILE__,__LINE__,info->device_name);
                schedule_work(&info->task);
@@@ -1263,7 -1280,7 +1270,7 @@@ static int startup(MGSLPC_INFO * info, 
        int retval = 0;
  
        if (debug_level >= DEBUG_LEVEL_INFO)
-               printk("%s(%d):startup(%s)\n",__FILE__,__LINE__,info->device_name);
+               printk("%s(%d):startup(%s)\n", __FILE__, __LINE__, info->device_name);
  
        if (info->port.flags & ASYNC_INITIALIZED)
                return 0;
                info->tx_buf = (unsigned char *)get_zeroed_page(GFP_KERNEL);
                if (!info->tx_buf) {
                        printk(KERN_ERR"%s(%d):%s can't allocate transmit buffer\n",
-                               __FILE__,__LINE__,info->device_name);
+                               __FILE__, __LINE__, info->device_name);
                        return -ENOMEM;
                }
        }
        retval = claim_resources(info);
  
        /* perform existence check and diagnostics */
-       if ( !retval )
+       if (!retval)
                retval = adapter_test(info);
  
-       if ( retval ) {
-               if (capable(CAP_SYS_ADMIN) && tty)
+       if (retval) {
+               if (capable(CAP_SYS_ADMIN) && tty)
                        set_bit(TTY_IO_ERROR, &tty->flags);
                release_resources(info);
-               return retval;
-       }
+               return retval;
+       }
  
        /* program hardware for current parameters */
        mgslpc_change_params(info, tty);
@@@ -1320,7 -1337,7 +1327,7 @@@ static void shutdown(MGSLPC_INFO * info
  
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):mgslpc_shutdown(%s)\n",
-                        __FILE__,__LINE__, info->device_name );
+                        __FILE__, __LINE__, info->device_name);
  
        /* clear status wait queue because status changes */
        /* can't happen after shutting down the hardware */
                info->tx_buf = NULL;
        }
  
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
  
        rx_stop(info);
        tx_stop(info);
        /* TODO:disable interrupts instead of reset to preserve signal states */
        reset_device(info);
  
-       if (!tty || tty->termios.c_cflag & HUPCL) {
+       if (!tty || tty->termios.c_cflag & HUPCL) {
 -              info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS);
 +              info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR);
                set_signals(info);
        }
  
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->lock, flags);
  
        release_resources(info);
  
@@@ -1361,7 -1378,7 +1368,7 @@@ static void mgslpc_program_hw(MGSLPC_IN
  {
        unsigned long flags;
  
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
  
        rx_stop(info);
        tx_stop(info);
        if (info->netcount || (tty && (tty->termios.c_cflag & CREAD)))
                rx_start(info);
  
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->lock, flags);
  }
  
  /* Reconfigure adapter based on new parameters
@@@ -1401,16 -1418,16 +1408,16 @@@ static void mgslpc_change_params(MGSLPC
  
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):mgslpc_change_params(%s)\n",
-                        __FILE__,__LINE__, info->device_name );
+                        __FILE__, __LINE__, info->device_name);
  
        cflag = tty->termios.c_cflag;
  
 -      /* if B0 rate (hangup) specified then negate DTR and RTS */
 -      /* otherwise assert DTR and RTS */
 +      /* if B0 rate (hangup) specified then negate RTS and DTR */
 +      /* otherwise assert RTS and DTR */
-       if (cflag & CBAUD)
+       if (cflag & CBAUD)
 -              info->serial_signals |= SerialSignal_RTS + SerialSignal_DTR;
 +              info->serial_signals |= SerialSignal_RTS | SerialSignal_DTR;
        else
 -              info->serial_signals &= ~(SerialSignal_RTS + SerialSignal_DTR);
 +              info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR);
  
        /* byte size and parity */
  
                info->params.data_rate = tty_get_baud_rate(tty);
        }
  
-       if ( info->params.data_rate ) {
+       if (info->params.data_rate) {
                info->timeout = (32*HZ*bits_per_char) /
                                info->params.data_rate;
        }
@@@ -1488,8 -1505,8 +1495,8 @@@ static int mgslpc_put_char(struct tty_s
        unsigned long flags;
  
        if (debug_level >= DEBUG_LEVEL_INFO) {
-               printk( "%s(%d):mgslpc_put_char(%d) on %s\n",
-                       __FILE__,__LINE__,ch,info->device_name);
+               printk("%s(%d):mgslpc_put_char(%d) on %s\n",
+                       __FILE__, __LINE__, ch, info->device_name);
        }
  
        if (mgslpc_paranoia_check(info, tty->name, "mgslpc_put_char"))
        if (!info->tx_buf)
                return 0;
  
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
  
        if (info->params.mode == MGSL_MODE_ASYNC || !info->tx_active) {
                if (info->tx_count < TXBUFSIZE - 1) {
                }
        }
  
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->lock, flags);
        return 1;
  }
  
@@@ -1521,8 -1538,8 +1528,8 @@@ static void mgslpc_flush_chars(struct t
        unsigned long flags;
  
        if (debug_level >= DEBUG_LEVEL_INFO)
-               printk( "%s(%d):mgslpc_flush_chars() entry on %s tx_count=%d\n",
-                       __FILE__,__LINE__,info->device_name,info->tx_count);
+               printk("%s(%d):mgslpc_flush_chars() entry on %s tx_count=%d\n",
+                       __FILE__, __LINE__, info->device_name, info->tx_count);
  
        if (mgslpc_paranoia_check(info, tty->name, "mgslpc_flush_chars"))
                return;
                return;
  
        if (debug_level >= DEBUG_LEVEL_INFO)
-               printk( "%s(%d):mgslpc_flush_chars() entry on %s starting transmitter\n",
-                       __FILE__,__LINE__,info->device_name);
+               printk("%s(%d):mgslpc_flush_chars() entry on %s starting transmitter\n",
+                       __FILE__, __LINE__, info->device_name);
  
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
        if (!info->tx_active)
-               tx_start(info, tty);
-       spin_unlock_irqrestore(&info->lock,flags);
+               tx_start(info, tty);
+       spin_unlock_irqrestore(&info->lock, flags);
  }
  
  /* Send a block of data
@@@ -1559,8 -1576,8 +1566,8 @@@ static int mgslpc_write(struct tty_stru
        unsigned long flags;
  
        if (debug_level >= DEBUG_LEVEL_INFO)
-               printk( "%s(%d):mgslpc_write(%s) count=%d\n",
-                       __FILE__,__LINE__,info->device_name,count);
+               printk("%s(%d):mgslpc_write(%s) count=%d\n",
+                       __FILE__, __LINE__, info->device_name, count);
  
        if (mgslpc_paranoia_check(info, tty->name, "mgslpc_write") ||
                !info->tx_buf)
  
                memcpy(info->tx_buf + info->tx_put, buf, c);
  
-               spin_lock_irqsave(&info->lock,flags);
+               spin_lock_irqsave(&info->lock, flags);
                info->tx_put = (info->tx_put + c) & (TXBUFSIZE-1);
                info->tx_count += c;
-               spin_unlock_irqrestore(&info->lock,flags);
+               spin_unlock_irqrestore(&info->lock, flags);
  
                buf += c;
                count -= c;
                ret += c;
        }
  start:
-       if (info->tx_count && !tty->stopped && !tty->hw_stopped) {
-               spin_lock_irqsave(&info->lock,flags);
+       if (info->tx_count && !tty->stopped && !tty->hw_stopped) {
+               spin_lock_irqsave(&info->lock, flags);
                if (!info->tx_active)
-                       tx_start(info, tty);
-               spin_unlock_irqrestore(&info->lock,flags);
-       }
+                       tx_start(info, tty);
+               spin_unlock_irqrestore(&info->lock, flags);
+       }
  cleanup:
        if (debug_level >= DEBUG_LEVEL_INFO)
-               printk( "%s(%d):mgslpc_write(%s) returning=%d\n",
-                       __FILE__,__LINE__,info->device_name,ret);
+               printk("%s(%d):mgslpc_write(%s) returning=%d\n",
+                       __FILE__, __LINE__, info->device_name, ret);
        return ret;
  }
  
@@@ -1633,7 -1650,7 +1640,7 @@@ static int mgslpc_write_room(struct tty
  
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):mgslpc_write_room(%s)=%d\n",
-                        __FILE__,__LINE__, info->device_name, ret);
+                        __FILE__, __LINE__, info->device_name, ret);
        return ret;
  }
  
@@@ -1646,7 -1663,7 +1653,7 @@@ static int mgslpc_chars_in_buffer(struc
  
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):mgslpc_chars_in_buffer(%s)\n",
-                        __FILE__,__LINE__, info->device_name );
+                        __FILE__, __LINE__, info->device_name);
  
        if (mgslpc_paranoia_check(info, tty->name, "mgslpc_chars_in_buffer"))
                return 0;
  
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):mgslpc_chars_in_buffer(%s)=%d\n",
-                        __FILE__,__LINE__, info->device_name, rc);
+                        __FILE__, __LINE__, info->device_name, rc);
  
        return rc;
  }
@@@ -1672,15 -1689,15 +1679,15 @@@ static void mgslpc_flush_buffer(struct 
  
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):mgslpc_flush_buffer(%s) entry\n",
-                        __FILE__,__LINE__, info->device_name );
+                        __FILE__, __LINE__, info->device_name);
  
        if (mgslpc_paranoia_check(info, tty->name, "mgslpc_flush_buffer"))
                return;
  
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
        info->tx_count = info->tx_put = info->tx_get = 0;
        del_timer(&info->tx_timer);
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->lock, flags);
  
        wake_up_interruptible(&tty->write_wait);
        tty_wakeup(tty);
@@@ -1695,17 -1712,17 +1702,17 @@@ static void mgslpc_send_xchar(struct tt
  
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):mgslpc_send_xchar(%s,%d)\n",
-                        __FILE__,__LINE__, info->device_name, ch );
+                        __FILE__, __LINE__, info->device_name, ch);
  
        if (mgslpc_paranoia_check(info, tty->name, "mgslpc_send_xchar"))
                return;
  
        info->x_char = ch;
        if (ch) {
-               spin_lock_irqsave(&info->lock,flags);
+               spin_lock_irqsave(&info->lock, flags);
                if (!info->tx_enabled)
-                       tx_start(info, tty);
-               spin_unlock_irqrestore(&info->lock,flags);
+                       tx_start(info, tty);
+               spin_unlock_irqrestore(&info->lock, flags);
        }
  }
  
@@@ -1718,7 -1735,7 +1725,7 @@@ static void mgslpc_throttle(struct tty_
  
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):mgslpc_throttle(%s) entry\n",
-                        __FILE__,__LINE__, info->device_name );
+                        __FILE__, __LINE__, info->device_name);
  
        if (mgslpc_paranoia_check(info, tty->name, "mgslpc_throttle"))
                return;
        if (I_IXOFF(tty))
                mgslpc_send_xchar(tty, STOP_CHAR(tty));
  
-       if (tty->termios.c_cflag & CRTSCTS) {
-               spin_lock_irqsave(&info->lock,flags);
+       if (tty->termios.c_cflag & CRTSCTS) {
+               spin_lock_irqsave(&info->lock, flags);
                info->serial_signals &= ~SerialSignal_RTS;
-               set_signals(info);
-               spin_unlock_irqrestore(&info->lock,flags);
+               set_signals(info);
+               spin_unlock_irqrestore(&info->lock, flags);
        }
  }
  
@@@ -1743,7 -1760,7 +1750,7 @@@ static void mgslpc_unthrottle(struct tt
  
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):mgslpc_unthrottle(%s) entry\n",
-                        __FILE__,__LINE__, info->device_name );
+                        __FILE__, __LINE__, info->device_name);
  
        if (mgslpc_paranoia_check(info, tty->name, "mgslpc_unthrottle"))
                return;
                        mgslpc_send_xchar(tty, START_CHAR(tty));
        }
  
-       if (tty->termios.c_cflag & CRTSCTS) {
-               spin_lock_irqsave(&info->lock,flags);
+       if (tty->termios.c_cflag & CRTSCTS) {
+               spin_lock_irqsave(&info->lock, flags);
                info->serial_signals |= SerialSignal_RTS;
-               set_signals(info);
-               spin_unlock_irqrestore(&info->lock,flags);
+               set_signals(info);
+               spin_unlock_irqrestore(&info->lock, flags);
        }
  }
  
@@@ -1797,33 -1814,33 +1804,33 @@@ static int get_params(MGSLPC_INFO * inf
   *
   * Arguments:
   *
-  *    info            pointer to device instance data
-  *    new_params      user buffer containing new serial params
+  *    info            pointer to device instance data
+  *    new_params      user buffer containing new serial params
   *
   * Returns:   0 if success, otherwise error code
   */
  static int set_params(MGSLPC_INFO * info, MGSL_PARAMS __user *new_params, struct tty_struct *tty)
  {
-       unsigned long flags;
+       unsigned long flags;
        MGSL_PARAMS tmp_params;
        int err;
  
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):set_params %s\n", __FILE__,__LINE__,
-                       info->device_name );
+                       info->device_name);
        COPY_FROM_USER(err,&tmp_params, new_params, sizeof(MGSL_PARAMS));
        if (err) {
-               if ( debug_level >= DEBUG_LEVEL_INFO )
-                       printk( "%s(%d):set_params(%s) user buffer copy failed\n",
-                               __FILE__,__LINE__,info->device_name);
+               if (debug_level >= DEBUG_LEVEL_INFO)
+                       printk("%s(%d):set_params(%s) user buffer copy failed\n",
+                               __FILE__, __LINE__, info->device_name);
                return -EFAULT;
        }
  
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
        memcpy(&info->params,&tmp_params,sizeof(MGSL_PARAMS));
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->lock, flags);
  
-       mgslpc_change_params(info, tty);
+       mgslpc_change_params(info, tty);
  
        return 0;
  }
@@@ -1841,13 -1858,13 +1848,13 @@@ static int get_txidle(MGSLPC_INFO * inf
  
  static int set_txidle(MGSLPC_INFO * info, int idle_mode)
  {
-       unsigned long flags;
+       unsigned long flags;
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("set_txidle(%s,%d)\n", info->device_name, idle_mode);
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
        info->idle_mode = idle_mode;
        tx_set_idle(info);
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->lock, flags);
        return 0;
  }
  
@@@ -1864,11 -1881,11 +1871,11 @@@ static int get_interface(MGSLPC_INFO * 
  
  static int set_interface(MGSLPC_INFO * info, int if_mode)
  {
-       unsigned long flags;
+       unsigned long flags;
        unsigned char val;
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("set_interface(%s,%d)\n", info->device_name, if_mode);
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
        info->if_mode = if_mode;
  
        val = read_reg(info, PVR) & 0x0f;
        }
        write_reg(info, PVR, val);
  
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->lock, flags);
        return 0;
  }
  
  static int set_txenable(MGSLPC_INFO * info, int enable, struct tty_struct *tty)
  {
-       unsigned long flags;
+       unsigned long flags;
  
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("set_txenable(%s,%d)\n", info->device_name, enable);
  
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
        if (enable) {
                if (!info->tx_enabled)
                        tx_start(info, tty);
                if (info->tx_enabled)
                        tx_stop(info);
        }
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->lock, flags);
        return 0;
  }
  
  static int tx_abort(MGSLPC_INFO * info)
  {
-       unsigned long flags;
+       unsigned long flags;
  
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("tx_abort(%s)\n", info->device_name);
  
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
        if (info->tx_active && info->tx_count &&
            info->params.mode == MGSL_MODE_HDLC) {
                /* clear data count so FIFO is not filled on next IRQ.
                info->tx_count = info->tx_put = info->tx_get = 0;
                info->tx_aborting = true;
        }
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->lock, flags);
        return 0;
  }
  
  static int set_rxenable(MGSLPC_INFO * info, int enable)
  {
-       unsigned long flags;
+       unsigned long flags;
  
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("set_rxenable(%s,%d)\n", info->device_name, enable);
  
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
        if (enable) {
                if (!info->rx_enabled)
                        rx_start(info);
                if (info->rx_enabled)
                        rx_stop(info);
        }
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->lock, flags);
        return 0;
  }
  
  /* wait for specified event to occur
   *
-  * Arguments:         info    pointer to device instance data
-  *                    mask    pointer to bitmask of events to wait for
-  * Return Value:      0       if successful and bit mask updated with
+  * Arguments:         info    pointer to device instance data
+  *                    mask    pointer to bitmask of events to wait for
+  * Return Value:      0       if successful and bit mask updated with
   *                            of events triggerred,
-  *                    otherwise error code
+  *                    otherwise error code
   */
  static int wait_events(MGSLPC_INFO * info, int __user *mask_ptr)
  {
-       unsigned long flags;
+       unsigned long flags;
        int s;
        int rc=0;
        struct mgsl_icount cprev, cnow;
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("wait_events(%s,%d)\n", info->device_name, mask);
  
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
  
        /* return immediately if state matches requested events */
        get_signals(info);
        s = info->serial_signals;
        events = mask &
                ( ((s & SerialSignal_DSR) ? MgslEvent_DsrActive:MgslEvent_DsrInactive) +
-                 ((s & SerialSignal_DCD) ? MgslEvent_DcdActive:MgslEvent_DcdInactive) +
+                 ((s & SerialSignal_DCD) ? MgslEvent_DcdActive:MgslEvent_DcdInactive) +
                  ((s & SerialSignal_CTS) ? MgslEvent_CtsActive:MgslEvent_CtsInactive) +
                  ((s & SerialSignal_RI)  ? MgslEvent_RiActive :MgslEvent_RiInactive) );
        if (events) {
-               spin_unlock_irqrestore(&info->lock,flags);
+               spin_unlock_irqrestore(&info->lock, flags);
                goto exit;
        }
  
        set_current_state(TASK_INTERRUPTIBLE);
        add_wait_queue(&info->event_wait_q, &wait);
  
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->lock, flags);
  
  
        for(;;) {
                }
  
                /* get current irq counts */
-               spin_lock_irqsave(&info->lock,flags);
+               spin_lock_irqsave(&info->lock, flags);
                cnow = info->icount;
                newsigs = info->input_signal_events;
                set_current_state(TASK_INTERRUPTIBLE);
-               spin_unlock_irqrestore(&info->lock,flags);
+               spin_unlock_irqrestore(&info->lock, flags);
  
                /* if no change, wait aborted for some reason */
                if (newsigs.dsr_up   == oldsigs.dsr_up   &&
        set_current_state(TASK_RUNNING);
  
        if (mask & MgslEvent_ExitHuntMode) {
-               spin_lock_irqsave(&info->lock,flags);
+               spin_lock_irqsave(&info->lock, flags);
                if (!waitqueue_active(&info->event_wait_q))
                        irq_disable(info, CHA, IRQ_EXITHUNT);
-               spin_unlock_irqrestore(&info->lock,flags);
+               spin_unlock_irqrestore(&info->lock, flags);
        }
  exit:
        if (rc == 0)
  
  static int modem_input_wait(MGSLPC_INFO *info,int arg)
  {
-       unsigned long flags;
+       unsigned long flags;
        int rc;
        struct mgsl_icount cprev, cnow;
        DECLARE_WAITQUEUE(wait, current);
  
        /* save current irq counts */
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
        cprev = info->icount;
        add_wait_queue(&info->status_event_wait_q, &wait);
        set_current_state(TASK_INTERRUPTIBLE);
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->lock, flags);
  
        for(;;) {
                schedule();
                }
  
                /* get new irq counts */
-               spin_lock_irqsave(&info->lock,flags);
+               spin_lock_irqsave(&info->lock, flags);
                cnow = info->icount;
                set_current_state(TASK_INTERRUPTIBLE);
-               spin_unlock_irqrestore(&info->lock,flags);
+               spin_unlock_irqrestore(&info->lock, flags);
  
                /* if no change, wait aborted for some reason */
                if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
@@@ -2115,11 -2132,11 +2122,11 @@@ static int tiocmget(struct tty_struct *
  {
        MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data;
        unsigned int result;
-       unsigned long flags;
+       unsigned long flags;
  
-       spin_lock_irqsave(&info->lock,flags);
-       get_signals(info);
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
+       get_signals(info);
+       spin_unlock_irqrestore(&info->lock, flags);
  
        result = ((info->serial_signals & SerialSignal_RTS) ? TIOCM_RTS:0) +
                ((info->serial_signals & SerialSignal_DTR) ? TIOCM_DTR:0) +
  
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):%s tiocmget() value=%08X\n",
-                        __FILE__,__LINE__, info->device_name, result );
+                        __FILE__, __LINE__, info->device_name, result);
        return result;
  }
  
@@@ -2140,11 -2157,11 +2147,11 @@@ static int tiocmset(struct tty_struct *
                    unsigned int set, unsigned int clear)
  {
        MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data;
-       unsigned long flags;
+       unsigned long flags;
  
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):%s tiocmset(%x,%x)\n",
-                       __FILE__,__LINE__,info->device_name, set, clear);
+                       __FILE__, __LINE__, info->device_name, set, clear);
  
        if (set & TIOCM_RTS)
                info->serial_signals |= SerialSignal_RTS;
        if (clear & TIOCM_DTR)
                info->serial_signals &= ~SerialSignal_DTR;
  
-       spin_lock_irqsave(&info->lock,flags);
-       set_signals(info);
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
+       set_signals(info);
+       spin_unlock_irqrestore(&info->lock, flags);
  
        return 0;
  }
@@@ -2174,17 -2191,17 +2181,17 @@@ static int mgslpc_break(struct tty_stru
  
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):mgslpc_break(%s,%d)\n",
-                        __FILE__,__LINE__, info->device_name, break_state);
+                        __FILE__, __LINE__, info->device_name, break_state);
  
        if (mgslpc_paranoia_check(info, tty->name, "mgslpc_break"))
                return -EINVAL;
  
-       spin_lock_irqsave(&info->lock,flags);
-       if (break_state == -1)
+       spin_lock_irqsave(&info->lock, flags);
+       if (break_state == -1)
                set_reg_bits(info, CHA+DAFO, BIT6);
        else
                clear_reg_bits(info, CHA+DAFO, BIT6);
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->lock, flags);
        return 0;
  }
  
@@@ -2195,9 -2212,9 +2202,9 @@@ static int mgslpc_get_icount(struct tty
        struct mgsl_icount cnow;        /* kernel counter temps */
        unsigned long flags;
  
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
        cnow = info->icount;
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->lock, flags);
  
        icount->cts = cnow.cts;
        icount->dsr = cnow.dsr;
   *
   * Arguments:
   *
-  *    tty     pointer to tty instance data
-  *    cmd     IOCTL command code
-  *    arg     command argument/context
+  *    tty     pointer to tty instance data
+  *    cmd     IOCTL command code
+  *    arg     command argument/context
   *
   * Return Value:      0 if success, otherwise error code
   */
@@@ -2231,8 -2248,8 +2238,8 @@@ static int mgslpc_ioctl(struct tty_stru
        void __user *argp = (void __user *)arg;
  
        if (debug_level >= DEBUG_LEVEL_INFO)
-               printk("%s(%d):mgslpc_ioctl %s cmd=%08X\n", __FILE__,__LINE__,
-                       info->device_name, cmd );
+               printk("%s(%d):mgslpc_ioctl %s cmd=%08X\n", __FILE__, __LINE__,
+                       info->device_name, cmd);
  
        if (mgslpc_paranoia_check(info, tty->name, "mgslpc_ioctl"))
                return -ENODEV;
   *
   * Arguments:
   *
-  *    tty             pointer to tty structure
-  *    termios         pointer to buffer to hold returned old termios
+  *    tty             pointer to tty structure
+  *    termios         pointer to buffer to hold returned old termios
   */
  static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
  {
        unsigned long flags;
  
        if (debug_level >= DEBUG_LEVEL_INFO)
-               printk("%s(%d):mgslpc_set_termios %s\n", __FILE__,__LINE__,
-                       tty->driver->name );
+               printk("%s(%d):mgslpc_set_termios %s\n", __FILE__, __LINE__,
+                       tty->driver->name);
  
        /* just return if nothing has changed */
        if ((tty->termios.c_cflag == old_termios->c_cflag)
        /* Handle transition to B0 status */
        if (old_termios->c_cflag & CBAUD &&
            !(tty->termios.c_cflag & CBAUD)) {
 -              info->serial_signals &= ~(SerialSignal_RTS + SerialSignal_DTR);
 +              info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR);
-               spin_lock_irqsave(&info->lock,flags);
-               set_signals(info);
-               spin_unlock_irqrestore(&info->lock,flags);
+               spin_lock_irqsave(&info->lock, flags);
+               set_signals(info);
+               spin_unlock_irqrestore(&info->lock, flags);
        }
  
        /* Handle transition away from B0 status */
        if (!(old_termios->c_cflag & CBAUD) &&
            tty->termios.c_cflag & CBAUD) {
                info->serial_signals |= SerialSignal_DTR;
-               if (!(tty->termios.c_cflag & CRTSCTS) ||
-                   !test_bit(TTY_THROTTLED, &tty->flags)) {
+               if (!(tty->termios.c_cflag & CRTSCTS) ||
+                   !test_bit(TTY_THROTTLED, &tty->flags)) {
                        info->serial_signals |= SerialSignal_RTS;
-               }
-               spin_lock_irqsave(&info->lock,flags);
-               set_signals(info);
-               spin_unlock_irqrestore(&info->lock,flags);
+               }
+               spin_lock_irqsave(&info->lock, flags);
+               set_signals(info);
+               spin_unlock_irqrestore(&info->lock, flags);
        }
  
        /* Handle turning off CRTSCTS */
@@@ -2338,15 -2355,15 +2345,15 @@@ static void mgslpc_close(struct tty_str
  
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):mgslpc_close(%s) entry, count=%d\n",
-                        __FILE__,__LINE__, info->device_name, port->count);
+                        __FILE__, __LINE__, info->device_name, port->count);
  
        WARN_ON(!port->count);
  
        if (tty_port_close_start(port, tty, filp) == 0)
                goto cleanup;
  
-       if (port->flags & ASYNC_INITIALIZED)
-               mgslpc_wait_until_sent(tty, info->timeout);
+       if (port->flags & ASYNC_INITIALIZED)
+               mgslpc_wait_until_sent(tty, info->timeout);
  
        mgslpc_flush_buffer(tty);
  
        tty_port_tty_set(port, NULL);
  cleanup:
        if (debug_level >= DEBUG_LEVEL_INFO)
-               printk("%s(%d):mgslpc_close(%s) exit, count=%d\n", __FILE__,__LINE__,
+               printk("%s(%d):mgslpc_close(%s) exit, count=%d\n", __FILE__, __LINE__,
                        tty->driver->name, port->count);
  }
  
@@@ -2368,12 -2385,12 +2375,12 @@@ static void mgslpc_wait_until_sent(stru
        MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data;
        unsigned long orig_jiffies, char_time;
  
-       if (!info )
+       if (!info)
                return;
  
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):mgslpc_wait_until_sent(%s) entry\n",
-                        __FILE__,__LINE__, info->device_name );
+                        __FILE__, __LINE__, info->device_name);
  
        if (mgslpc_paranoia_check(info, tty->name, "mgslpc_wait_until_sent"))
                return;
         * Note: use tight timings here to satisfy the NIST-PCTS.
         */
  
-       if ( info->params.data_rate ) {
-               char_time = info->timeout/(32 * 5);
+       if (info->params.data_rate) {
+               char_time = info->timeout/(32 * 5);
                if (!char_time)
                        char_time++;
        } else
  exit:
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):mgslpc_wait_until_sent(%s) exit\n",
-                        __FILE__,__LINE__, info->device_name );
+                        __FILE__, __LINE__, info->device_name);
  }
  
  /* Called by tty_hangup() when a hangup is signaled.
@@@ -2433,7 -2450,7 +2440,7 @@@ static void mgslpc_hangup(struct tty_st
  
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):mgslpc_hangup(%s)\n",
-                        __FILE__,__LINE__, info->device_name );
+                        __FILE__, __LINE__, info->device_name);
  
        if (mgslpc_paranoia_check(info, tty->name, "mgslpc_hangup"))
                return;
@@@ -2448,9 -2465,9 +2455,9 @@@ static int carrier_raised(struct tty_po
        MGSLPC_INFO *info = container_of(port, MGSLPC_INFO, port);
        unsigned long flags;
  
-       spin_lock_irqsave(&info->lock,flags);
-       get_signals(info);
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
+       get_signals(info);
+       spin_unlock_irqrestore(&info->lock, flags);
  
        if (info->serial_signals & SerialSignal_DCD)
                return 1;
@@@ -2462,13 -2479,13 +2469,13 @@@ static void dtr_rts(struct tty_port *po
        MGSLPC_INFO *info = container_of(port, MGSLPC_INFO, port);
        unsigned long flags;
  
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
        if (onoff)
 -              info->serial_signals |= SerialSignal_RTS + SerialSignal_DTR;
 +              info->serial_signals |= SerialSignal_RTS | SerialSignal_DTR;
        else
 -              info->serial_signals &= ~SerialSignal_RTS + SerialSignal_DTR;
 +              info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR);
        set_signals(info);
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->lock, flags);
  }
  
  
@@@ -2476,14 -2493,14 +2483,14 @@@ static int mgslpc_open(struct tty_struc
  {
        MGSLPC_INFO     *info;
        struct tty_port *port;
-       int                     retval, line;
-       unsigned long flags;
+       int             retval, line;
+       unsigned long   flags;
  
        /* verify range of specified line number */
        line = tty->index;
        if (line >= mgslpc_device_count) {
                printk("%s(%d):mgslpc_open with invalid line #%d.\n",
-                       __FILE__,__LINE__,line);
+                       __FILE__, __LINE__, line);
                return -ENODEV;
        }
  
  
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):mgslpc_open(%s), old ref count = %d\n",
-                        __FILE__,__LINE__,tty->driver->name, port->count);
+                        __FILE__, __LINE__, tty->driver->name, port->count);
  
        /* If port is closing, signal caller to try again */
        if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING){
                goto cleanup;
        }
  
 -      tty->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
 +      port->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
  
        spin_lock_irqsave(&info->netlock, flags);
        if (info->netcount) {
        if (retval) {
                if (debug_level >= DEBUG_LEVEL_INFO)
                        printk("%s(%d):block_til_ready(%s) returned %d\n",
-                                __FILE__,__LINE__, info->device_name, retval);
+                                __FILE__, __LINE__, info->device_name, retval);
                goto cleanup;
        }
  
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):mgslpc_open(%s) success\n",
-                        __FILE__,__LINE__, info->device_name);
+                        __FILE__, __LINE__, info->device_name);
        retval = 0;
  
  cleanup:
@@@ -2561,9 -2578,9 +2568,9 @@@ static inline void line_info(struct seq
                      info->device_name, info->io_base, info->irq_level);
  
        /* output current serial signal states */
-       spin_lock_irqsave(&info->lock,flags);
-       get_signals(info);
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
+       get_signals(info);
+       spin_unlock_irqrestore(&info->lock, flags);
  
        stat_buf[0] = 0;
        stat_buf[1] = 0;
@@@ -2625,7 -2642,7 +2632,7 @@@ static int mgslpc_proc_show(struct seq_
        seq_printf(m, "synclink driver:%s\n", driver_version);
  
        info = mgslpc_device_list;
-       while( info ) {
+       while (info) {
                line_info(m, info);
                info = info->next_device;
        }
@@@ -2664,14 -2681,6 +2671,14 @@@ static int rx_alloc_buffers(MGSLPC_INF
        if (info->rx_buf == NULL)
                return -ENOMEM;
  
 +      /* unused flag buffer to satisfy receive_buf calling interface */
 +      info->flag_buf = kzalloc(info->max_frame_size, GFP_KERNEL);
 +      if (!info->flag_buf) {
 +              kfree(info->rx_buf);
 +              info->rx_buf = NULL;
 +              return -ENOMEM;
 +      }
 +      
        rx_reset_buffers(info);
        return 0;
  }
@@@ -2680,14 -2689,12 +2687,14 @@@ static void rx_free_buffers(MGSLPC_INF
  {
        kfree(info->rx_buf);
        info->rx_buf = NULL;
 +      kfree(info->flag_buf);
 +      info->flag_buf = NULL;
  }
  
  static int claim_resources(MGSLPC_INFO *info)
  {
-       if (rx_alloc_buffers(info) < 0 ) {
-               printk( "Can't allocate rx buffer %s\n", info->device_name);
+       if (rx_alloc_buffers(info) < 0) {
+               printk("Can't allocate rx buffer %s\n", info->device_name);
                release_resources(info);
                return -ENODEV;
        }
@@@ -2706,8 -2713,12 +2713,12 @@@ static void release_resources(MGSLPC_IN
   *
   * Arguments:         info    pointer to device instance data
   */
- static void mgslpc_add_device(MGSLPC_INFO *info)
+ static int mgslpc_add_device(MGSLPC_INFO *info)
  {
+       MGSLPC_INFO *current_dev = NULL;
+       struct device *tty_dev;
+       int ret;
        info->next_device = NULL;
        info->line = mgslpc_device_count;
        sprintf(info->device_name,"ttySLP%d",info->line);
        if (!mgslpc_device_list)
                mgslpc_device_list = info;
        else {
-               MGSLPC_INFO *current_dev = mgslpc_device_list;
-               while( current_dev->next_device )
+               current_dev = mgslpc_device_list;
+               while (current_dev->next_device)
                        current_dev = current_dev->next_device;
                current_dev->next_device = info;
        }
        else if (info->max_frame_size > 65535)
                info->max_frame_size = 65535;
  
-       printk( "SyncLink PC Card %s:IO=%04X IRQ=%d\n",
+       printk("SyncLink PC Card %s:IO=%04X IRQ=%d\n",
                info->device_name, info->io_base, info->irq_level);
  
  #if SYNCLINK_GENERIC_HDLC
-       hdlcdev_init(info);
+       ret = hdlcdev_init(info);
+       if (ret != 0)
+               goto failed;
  #endif
-       tty_port_register_device(&info->port, serial_driver, info->line,
+       tty_dev = tty_port_register_device(&info->port, serial_driver, info->line,
                        &info->p_dev->dev);
+       if (IS_ERR(tty_dev)) {
+               ret = PTR_ERR(tty_dev);
+ #if SYNCLINK_GENERIC_HDLC
+               hdlcdev_exit(info);
+ #endif
+               goto failed;
+       }
+       return 0;
+ failed:
+       if (current_dev)
+               current_dev->next_device = NULL;
+       else
+               mgslpc_device_list = NULL;
+       mgslpc_device_count--;
+       return ret;
  }
  
  static void mgslpc_remove_device(MGSLPC_INFO *remove_info)
@@@ -3262,7 -3293,7 +3293,7 @@@ static void rx_stop(MGSLPC_INFO *info
  {
        if (debug_level >= DEBUG_LEVEL_ISR)
                printk("%s(%d):rx_stop(%s)\n",
-                        __FILE__,__LINE__, info->device_name );
+                        __FILE__, __LINE__, info->device_name);
  
        /* MODE:03 RAC Receiver Active, 0=inactive */
        clear_reg_bits(info, CHA + MODE, BIT3);
@@@ -3275,7 -3306,7 +3306,7 @@@ static void rx_start(MGSLPC_INFO *info
  {
        if (debug_level >= DEBUG_LEVEL_ISR)
                printk("%s(%d):rx_start(%s)\n",
-                        __FILE__,__LINE__, info->device_name );
+                        __FILE__, __LINE__, info->device_name);
  
        rx_reset_buffers(info);
        info->rx_enabled = false;
@@@ -3291,7 -3322,7 +3322,7 @@@ static void tx_start(MGSLPC_INFO *info
  {
        if (debug_level >= DEBUG_LEVEL_ISR)
                printk("%s(%d):tx_start(%s)\n",
-                        __FILE__,__LINE__, info->device_name );
+                        __FILE__, __LINE__, info->device_name);
  
        if (info->tx_count) {
                /* If auto RTS enabled and RTS is inactive, then assert */
@@@ -3329,7 -3360,7 +3360,7 @@@ static void tx_stop(MGSLPC_INFO *info
  {
        if (debug_level >= DEBUG_LEVEL_ISR)
                printk("%s(%d):tx_stop(%s)\n",
-                        __FILE__,__LINE__, info->device_name );
+                        __FILE__, __LINE__, info->device_name);
  
        del_timer(&info->tx_timer);
  
@@@ -3575,8 -3606,8 +3606,8 @@@ static void get_signals(MGSLPC_INFO *in
  {
        unsigned char status = 0;
  
 -      /* preserve DTR and RTS */
 -      info->serial_signals &= SerialSignal_DTR + SerialSignal_RTS;
 +      /* preserve RTS and DTR */
 +      info->serial_signals &= SerialSignal_RTS | SerialSignal_DTR;
  
        if (read_reg(info, CHB + VSTR) & BIT7)
                info->serial_signals |= SerialSignal_DCD;
                info->serial_signals |= SerialSignal_DSR;
  }
  
 -/* Set the state of DTR and RTS based on contents of
 +/* Set the state of RTS and DTR based on contents of
   * serial_signals member of device extension.
   */
  static void set_signals(MGSLPC_INFO *info)
@@@ -3681,7 -3712,7 +3712,7 @@@ static bool rx_get_frame(MGSLPC_INFO *i
  
        if (debug_level >= DEBUG_LEVEL_BH)
                printk("%s(%d):rx_get_frame(%s) status=%04X size=%d\n",
-                       __FILE__,__LINE__,info->device_name,status,framesize);
+                       __FILE__, __LINE__, info->device_name, status, framesize);
  
        if (debug_level >= DEBUG_LEVEL_DATA)
                trace_block(info, buf->data, framesize, 0);
                }
        }
  
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
        buf->status = buf->count = 0;
        info->rx_frame_count--;
        info->rx_get++;
        if (info->rx_get >= info->rx_buf_count)
                info->rx_get = 0;
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->lock, flags);
  
        return true;
  }
@@@ -3729,7 -3760,7 +3760,7 @@@ static bool register_test(MGSLPC_INFO *
        bool rc = true;
        unsigned long flags;
  
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
        reset_device(info);
  
        for (i = 0; i < count; i++) {
                }
        }
  
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->lock, flags);
        return rc;
  }
  
@@@ -3751,7 -3782,7 +3782,7 @@@ static bool irq_test(MGSLPC_INFO *info
        unsigned long end_time;
        unsigned long flags;
  
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
        reset_device(info);
  
        info->testing_irq = true;
        write_reg(info, CHA + TIMR, 0); /* 512 cycles */
        issue_command(info, CHA, CMD_START_TIMER);
  
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->lock, flags);
  
        end_time=100;
        while(end_time-- && !info->irq_occurred) {
  
        info->testing_irq = false;
  
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
        reset_device(info);
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->lock, flags);
  
        return info->irq_occurred;
  }
@@@ -3785,21 -3816,21 +3816,21 @@@ static int adapter_test(MGSLPC_INFO *in
  {
        if (!register_test(info)) {
                info->init_error = DiagStatus_AddressFailure;
-               printk( "%s(%d):Register test failure for device %s Addr=%04X\n",
-                       __FILE__,__LINE__,info->device_name, (unsigned short)(info->io_base) );
+               printk("%s(%d):Register test failure for device %s Addr=%04X\n",
+                       __FILE__, __LINE__, info->device_name, (unsigned short)(info->io_base));
                return -ENODEV;
        }
  
        if (!irq_test(info)) {
                info->init_error = DiagStatus_IrqFailure;
-               printk( "%s(%d):Interrupt test failure for device %s IRQ=%d\n",
-                       __FILE__,__LINE__,info->device_name, (unsigned short)(info->irq_level) );
+               printk("%s(%d):Interrupt test failure for device %s IRQ=%d\n",
+                       __FILE__, __LINE__, info->device_name, (unsigned short)(info->irq_level));
                return -ENODEV;
        }
  
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):device %s passed diagnostics\n",
-                       __FILE__,__LINE__,info->device_name);
+                       __FILE__, __LINE__, info->device_name);
        return 0;
  }
  
@@@ -3808,9 -3839,9 +3839,9 @@@ static void trace_block(MGSLPC_INFO *in
        int i;
        int linecount;
        if (xmit)
-               printk("%s tx data:\n",info->device_name);
+               printk("%s tx data:\n", info->device_name);
        else
-               printk("%s rx data:\n",info->device_name);
+               printk("%s rx data:\n", info->device_name);
  
        while(count) {
                if (count > 16)
                        linecount = count;
  
                for(i=0;i<linecount;i++)
-                       printk("%02X ",(unsigned char)data[i]);
+                       printk("%02X ", (unsigned char)data[i]);
                for(;i<17;i++)
                        printk("   ");
                for(i=0;i<linecount;i++) {
                        if (data[i]>=040 && data[i]<=0176)
-                               printk("%c",data[i]);
+                               printk("%c", data[i]);
                        else
                                printk(".");
                }
@@@ -3843,18 -3874,18 +3874,18 @@@ static void tx_timeout(unsigned long co
        MGSLPC_INFO *info = (MGSLPC_INFO*)context;
        unsigned long flags;
  
-       if ( debug_level >= DEBUG_LEVEL_INFO )
-               printk( "%s(%d):tx_timeout(%s)\n",
-                       __FILE__,__LINE__,info->device_name);
-       if(info->tx_active &&
-          info->params.mode == MGSL_MODE_HDLC) {
+       if (debug_level >= DEBUG_LEVEL_INFO)
+               printk("%s(%d):tx_timeout(%s)\n",
+                       __FILE__, __LINE__, info->device_name);
+       if (info->tx_active &&
+           info->params.mode == MGSL_MODE_HDLC) {
                info->icount.txtimeout++;
        }
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
        info->tx_active = false;
        info->tx_count = info->tx_put = info->tx_get = 0;
  
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->lock, flags);
  
  #if SYNCLINK_GENERIC_HDLC
        if (info->netcount)
@@@ -3936,7 -3967,7 +3967,7 @@@ static netdev_tx_t hdlcdev_xmit(struct 
        unsigned long flags;
  
        if (debug_level >= DEBUG_LEVEL_INFO)
-               printk(KERN_INFO "%s:hdlc_xmit(%s)\n",__FILE__,dev->name);
+               printk(KERN_INFO "%s:hdlc_xmit(%s)\n", __FILE__, dev->name);
  
        /* stop sending until this frame completes */
        netif_stop_queue(dev);
        dev->trans_start = jiffies;
  
        /* start hardware transmitter if necessary */
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
        if (!info->tx_active) {
                struct tty_struct *tty = tty_port_tty_get(&info->port);
-               tx_start(info, tty);
-               tty_kref_put(tty);
+               tx_start(info, tty);
+               tty_kref_put(tty);
        }
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->lock, flags);
  
        return NETDEV_TX_OK;
  }
@@@ -3984,10 -4015,11 +4015,11 @@@ static int hdlcdev_open(struct net_devi
        unsigned long flags;
  
        if (debug_level >= DEBUG_LEVEL_INFO)
-               printk("%s:hdlcdev_open(%s)\n",__FILE__,dev->name);
+               printk("%s:hdlcdev_open(%s)\n", __FILE__, dev->name);
  
        /* generic HDLC layer open processing */
-       if ((rc = hdlc_open(dev)))
+       rc = hdlc_open(dev);
+       if (rc != 0)
                return rc;
  
        /* arbitrate between network and tty opens */
  
        tty = tty_port_tty_get(&info->port);
        /* claim resources and init adapter */
-       if ((rc = startup(info, tty)) != 0) {
+       rc = startup(info, tty);
+       if (rc != 0) {
                tty_kref_put(tty);
                spin_lock_irqsave(&info->netlock, flags);
                info->netcount=0;
                spin_unlock_irqrestore(&info->netlock, flags);
                return rc;
        }
 -      /* assert DTR and RTS, apply hardware settings */
 -      info->serial_signals |= SerialSignal_RTS + SerialSignal_DTR;
 +      /* assert RTS and DTR, apply hardware settings */
 +      info->serial_signals |= SerialSignal_RTS | SerialSignal_DTR;
        mgslpc_program_hw(info, tty);
        tty_kref_put(tty);
  
@@@ -4044,7 -4077,7 +4077,7 @@@ static int hdlcdev_close(struct net_dev
        unsigned long flags;
  
        if (debug_level >= DEBUG_LEVEL_INFO)
-               printk("%s:hdlcdev_close(%s)\n",__FILE__,dev->name);
+               printk("%s:hdlcdev_close(%s)\n", __FILE__, dev->name);
  
        netif_stop_queue(dev);
  
@@@ -4078,7 -4111,7 +4111,7 @@@ static int hdlcdev_ioctl(struct net_dev
        unsigned int flags;
  
        if (debug_level >= DEBUG_LEVEL_INFO)
-               printk("%s:hdlcdev_ioctl(%s)\n",__FILE__,dev->name);
+               printk("%s:hdlcdev_ioctl(%s)\n", __FILE__, dev->name);
  
        /* return error if TTY interface open */
        if (info->port.count)
@@@ -4179,14 -4212,14 +4212,14 @@@ static void hdlcdev_tx_timeout(struct n
        unsigned long flags;
  
        if (debug_level >= DEBUG_LEVEL_INFO)
-               printk("hdlcdev_tx_timeout(%s)\n",dev->name);
+               printk("hdlcdev_tx_timeout(%s)\n", dev->name);
  
        dev->stats.tx_errors++;
        dev->stats.tx_aborted_errors++;
  
-       spin_lock_irqsave(&info->lock,flags);
+       spin_lock_irqsave(&info->lock, flags);
        tx_stop(info);
-       spin_unlock_irqrestore(&info->lock,flags);
+       spin_unlock_irqrestore(&info->lock, flags);
  
        netif_wake_queue(dev);
  }
@@@ -4217,7 -4250,7 +4250,7 @@@ static void hdlcdev_rx(MGSLPC_INFO *inf
        struct net_device *dev = info->netdev;
  
        if (debug_level >= DEBUG_LEVEL_INFO)
-               printk("hdlcdev_rx(%s)\n",dev->name);
+               printk("hdlcdev_rx(%s)\n", dev->name);
  
        if (skb == NULL) {
                printk(KERN_NOTICE "%s: can't alloc skb, dropping packet\n", dev->name);
@@@ -4260,8 -4293,9 +4293,9 @@@ static int hdlcdev_init(MGSLPC_INFO *in
  
        /* allocate and initialize network and HDLC layer objects */
  
-       if (!(dev = alloc_hdlcdev(info))) {
-               printk(KERN_ERR "%s:hdlc device allocation failure\n",__FILE__);
+       dev = alloc_hdlcdev(info);
+       if (dev == NULL) {
+               printk(KERN_ERR "%s:hdlc device allocation failure\n", __FILE__);
                return -ENOMEM;
        }
  
        hdlc->xmit   = hdlcdev_xmit;
  
        /* register objects with HDLC layer */
-       if ((rc = register_hdlc_device(dev))) {
-               printk(KERN_WARNING "%s:unable to register hdlc device\n",__FILE__);
+       rc = register_hdlc_device(dev);
+       if (rc) {
+               printk(KERN_WARNING "%s:unable to register hdlc device\n", __FILE__);
                free_netdev(dev);
                return rc;
        }
index ab20a0851dd269b5205d9a5c516dade92f4f2ec8,a2cf0f240929d5a543c981dde98fc87d12a9261b..141094e7c06e06d3071c8c35a65bc10a51d0ee8a
@@@ -20,7 -20,6 +20,6 @@@
  #include <linux/serial.h>
  #include <linux/tty_flip.h>
  #include <linux/slab.h>
- #include <linux/atomic.h>
  #include <linux/io.h>
  #include <linux/ipack.h>
  #include "ipoctal.h"
@@@ -38,21 -37,19 +37,19 @@@ struct ipoctal_channel 
        spinlock_t                      lock;
        unsigned int                    pointer_read;
        unsigned int                    pointer_write;
-       atomic_t                        open;
        struct tty_port                 tty_port;
        union scc2698_channel __iomem   *regs;
        union scc2698_block __iomem     *block_regs;
        unsigned int                    board_id;
-       unsigned char                   *board_write;
        u8                              isr_rx_rdy_mask;
        u8                              isr_tx_rdy_mask;
+       unsigned int                    rx_enable;
  };
  
  struct ipoctal {
        struct ipack_device             *dev;
        unsigned int                    board_id;
        struct ipoctal_channel          channel[NR_CHANNELS];
-       unsigned char                   write;
        struct tty_driver               *tty_drv;
        u8 __iomem                      *mem8_space;
        u8 __iomem                      *int_space;
@@@ -64,28 -61,23 +61,23 @@@ static int ipoctal_port_activate(struc
  
        channel = dev_get_drvdata(tty->dev);
  
+       /*
+        * Enable RX. TX will be enabled when
+        * there is something to send
+        */
        iowrite8(CR_ENABLE_RX, &channel->regs->w.cr);
+       channel->rx_enable = 1;
        return 0;
  }
  
  static int ipoctal_open(struct tty_struct *tty, struct file *file)
  {
-       int res;
        struct ipoctal_channel *channel;
  
        channel = dev_get_drvdata(tty->dev);
-       if (atomic_read(&channel->open))
-               return -EBUSY;
        tty->driver_data = channel;
  
-       res = tty_port_open(&channel->tty_port, tty, file);
-       if (res)
-               return res;
-       atomic_inc(&channel->open);
-       return 0;
+       return tty_port_open(&channel->tty_port, tty, file);
  }
  
  static void ipoctal_reset_stats(struct ipoctal_stats *stats)
@@@ -111,9 -103,7 +103,7 @@@ static void ipoctal_close(struct tty_st
        struct ipoctal_channel *channel = tty->driver_data;
  
        tty_port_close(&channel->tty_port, tty, filp);
-       if (atomic_dec_and_test(&channel->open))
-               ipoctal_free_channel(channel);
+       ipoctal_free_channel(channel);
  }
  
  static int ipoctal_get_icount(struct tty_struct *tty,
        return 0;
  }
  
 -static void ipoctal_irq_rx(struct ipoctal_channel *channel,
 -                         struct tty_struct *tty, u8 sr)
 +static void ipoctal_irq_rx(struct ipoctal_channel *channel, u8 sr)
  {
 +      struct tty_port *port = &channel->tty_port;
        unsigned char value;
-       unsigned char flag = TTY_NORMAL;
+       unsigned char flag;
        u8 isr;
  
        do {
                value = ioread8(&channel->regs->r.rhr);
+               flag = TTY_NORMAL;
                /* Error: count statistics */
                if (sr & SR_ERROR) {
                        iowrite8(CR_CMD_RESET_ERR_STATUS, &channel->regs->w.cr);
                        if (sr & SR_OVERRUN_ERROR) {
                                channel->stats.overrun_err++;
                                /* Overrun doesn't affect the current character*/
 -                              tty_insert_flip_char(tty, 0, TTY_OVERRUN);
 +                              tty_insert_flip_char(port, 0, TTY_OVERRUN);
                        }
                        if (sr & SR_PARITY_ERROR) {
                                channel->stats.parity_err++;
                                flag = TTY_BREAK;
                        }
                }
 -              tty_insert_flip_char(tty, value, flag);
 +              tty_insert_flip_char(port, value, flag);
  
                /* Check if there are more characters in RX FIFO
                 * If there are more, the isr register for this channel
                sr = ioread8(&channel->regs->r.sr);
        } while (isr & channel->isr_rx_rdy_mask);
  
 -      tty_flip_buffer_push(tty);
 +      tty_flip_buffer_push(port);
  }
  
  static void ipoctal_irq_tx(struct ipoctal_channel *channel)
        unsigned char value;
        unsigned int *pointer_write = &channel->pointer_write;
  
-       if (channel->nb_bytes <= 0) {
-               channel->nb_bytes = 0;
+       if (channel->nb_bytes == 0)
                return;
-       }
  
        value = channel->tty_port.xmit_buf[*pointer_write];
        iowrite8(value, &channel->regs->w.thr);
        (*pointer_write)++;
        *pointer_write = *pointer_write % PAGE_SIZE;
        channel->nb_bytes--;
-       if ((channel->nb_bytes == 0) &&
-           (waitqueue_active(&channel->queue))) {
-               if (channel->board_id != IPACK1_DEVICE_ID_SBS_OCTAL_485) {
-                       *channel->board_write = 1;
-                       wake_up_interruptible(&channel->queue);
-               }
-       }
  }
  
  static void ipoctal_irq_channel(struct ipoctal_channel *channel)
  {
        u8 isr, sr;
 -      struct tty_struct *tty;
 -
 -      tty = tty_port_tty_get(&channel->tty_port);
 -      if (!tty)
 -              return;
  
-       /* If there is no client, skip the check */
-       if (!atomic_read(&channel->open))
-               return;
+       spin_lock(&channel->lock);
        /* The HW is organized in pair of channels.  See which register we need
         * to read from */
        isr = ioread8(&channel->block_regs->r.isr);
        sr = ioread8(&channel->regs->r.sr);
  
-       /* In case of RS-485, change from TX to RX when finishing TX.
-        * Half-duplex. */
-       if ((channel->board_id == IPACK1_DEVICE_ID_SBS_OCTAL_485) &&
-           (sr & SR_TX_EMPTY) && (channel->nb_bytes == 0)) {
+       if ((sr & SR_TX_EMPTY) && (channel->nb_bytes == 0)) {
                iowrite8(CR_DISABLE_TX, &channel->regs->w.cr);
-               iowrite8(CR_CMD_NEGATE_RTSN, &channel->regs->w.cr);
-               iowrite8(CR_ENABLE_RX, &channel->regs->w.cr);
-               *channel->board_write = 1;
-               wake_up_interruptible(&channel->queue);
+               /* In case of RS-485, change from TX to RX when finishing TX.
+                * Half-duplex. */
+               if (channel->board_id == IPACK1_DEVICE_ID_SBS_OCTAL_485) {
+                       iowrite8(CR_CMD_NEGATE_RTSN, &channel->regs->w.cr);
+                       iowrite8(CR_ENABLE_RX, &channel->regs->w.cr);
+                       channel->rx_enable = 1;
+               }
        }
  
        /* RX data */
        if ((isr & channel->isr_rx_rdy_mask) && (sr & SR_RX_READY))
 -              ipoctal_irq_rx(channel, tty, sr);
 +              ipoctal_irq_rx(channel, sr);
  
        /* TX of each character */
        if ((isr & channel->isr_tx_rdy_mask) && (sr & SR_TX_READY))
                ipoctal_irq_tx(channel);
  
-       tty_flip_buffer_push(&channel->tty_port);
 -      tty_kref_put(tty);
+       spin_unlock(&channel->lock);
  }
  
  static irqreturn_t ipoctal_irq_handler(void *arg)
        unsigned int i;
        struct ipoctal *ipoctal = (struct ipoctal *) arg;
  
-       /* Check all channels */
-       for (i = 0; i < NR_CHANNELS; i++)
-               ipoctal_irq_channel(&ipoctal->channel[i]);
        /* Clear the IPack device interrupt */
        readw(ipoctal->int_space + ACK_INT_REQ0);
        readw(ipoctal->int_space + ACK_INT_REQ1);
  
+       /* Check all channels */
+       for (i = 0; i < NR_CHANNELS; i++)
+               ipoctal_irq_channel(&ipoctal->channel[i]);
        return IRQ_HANDLED;
  }
  
@@@ -306,7 -289,7 +283,7 @@@ static int ipoctal_inst_slot(struct ipo
        ipoctal->mem8_space =
                devm_ioremap_nocache(&ipoctal->dev->dev,
                                     region->start, 0x8000);
-       if (!addr) {
+       if (!ipoctal->mem8_space) {
                dev_err(&ipoctal->dev->dev,
                        "Unable to map slot [%d:%d] MEM8 space!\n",
                        bus_nr, slot);
                struct ipoctal_channel *channel = &ipoctal->channel[i];
                channel->regs = chan_regs + i;
                channel->block_regs = block_regs + (i >> 1);
-               channel->board_write = &ipoctal->write;
                channel->board_id = ipoctal->board_id;
                if (i & 1) {
                        channel->isr_tx_rdy_mask = ISR_TxRDY_B;
                }
  
                iowrite8(CR_DISABLE_RX | CR_DISABLE_TX, &channel->regs->w.cr);
+               channel->rx_enable = 0;
                iowrite8(CR_CMD_RESET_RX, &channel->regs->w.cr);
                iowrite8(CR_CMD_RESET_TX, &channel->regs->w.cr);
                iowrite8(MR1_CHRL_8_BITS | MR1_ERROR_CHAR | MR1_RxINT_RxRDY,
  
                ipoctal_reset_stats(&channel->stats);
                channel->nb_bytes = 0;
-               init_waitqueue_head(&channel->queue);
                spin_lock_init(&channel->lock);
                channel->pointer_read = 0;
                channel->pointer_write = 0;
                        continue;
                }
                dev_set_drvdata(tty_dev, channel);
-               /*
-                * Enable again the RX. TX will be enabled when
-                * there is something to send
-                */
-               iowrite8(CR_ENABLE_RX, &channel->regs->w.cr);
        }
  
        return 0;
@@@ -459,6 -434,7 +428,7 @@@ static int ipoctal_write_tty(struct tty
        /* As the IP-OCTAL 485 only supports half duplex, do it manually */
        if (channel->board_id == IPACK1_DEVICE_ID_SBS_OCTAL_485) {
                iowrite8(CR_DISABLE_RX, &channel->regs->w.cr);
+               channel->rx_enable = 0;
                iowrite8(CR_CMD_ASSERT_RTSN, &channel->regs->w.cr);
        }
  
         * operations
         */
        iowrite8(CR_ENABLE_TX, &channel->regs->w.cr);
-       wait_event_interruptible(channel->queue, *channel->board_write);
-       iowrite8(CR_DISABLE_TX, &channel->regs->w.cr);
-       *channel->board_write = 0;
        return char_copied;
  }
  
@@@ -622,8 -594,9 +588,9 @@@ static void ipoctal_set_termios(struct 
        iowrite8(mr2, &channel->regs->w.mr);
        iowrite8(csr, &channel->regs->w.csr);
  
-       /* Enable again the RX */
-       iowrite8(CR_ENABLE_RX, &channel->regs->w.cr);
+       /* Enable again the RX, if it was before */
+       if (channel->rx_enable)
+               iowrite8(CR_ENABLE_RX, &channel->regs->w.cr);
  }
  
  static void ipoctal_hangup(struct tty_struct *tty)
        tty_port_hangup(&channel->tty_port);
  
        iowrite8(CR_DISABLE_RX | CR_DISABLE_TX, &channel->regs->w.cr);
+       channel->rx_enable = 0;
        iowrite8(CR_CMD_RESET_RX, &channel->regs->w.cr);
        iowrite8(CR_CMD_RESET_TX, &channel->regs->w.cr);
        iowrite8(CR_CMD_RESET_ERR_STATUS, &channel->regs->w.cr);
        wake_up_interruptible(&channel->tty_port.open_wait);
  }
  
+ static void ipoctal_shutdown(struct tty_struct *tty)
+ {
+       struct ipoctal_channel *channel = tty->driver_data;
+       if (channel == NULL)
+               return;
+       iowrite8(CR_DISABLE_RX | CR_DISABLE_TX, &channel->regs->w.cr);
+       channel->rx_enable = 0;
+       iowrite8(CR_CMD_RESET_RX, &channel->regs->w.cr);
+       iowrite8(CR_CMD_RESET_TX, &channel->regs->w.cr);
+       iowrite8(CR_CMD_RESET_ERR_STATUS, &channel->regs->w.cr);
+       iowrite8(CR_CMD_RESET_MR, &channel->regs->w.cr);
+       clear_bit(ASYNCB_INITIALIZED, &channel->tty_port.flags);
+ }
  static const struct tty_operations ipoctal_fops = {
        .ioctl =                NULL,
        .open =                 ipoctal_open,
        .chars_in_buffer =      ipoctal_chars_in_buffer,
        .get_icount =           ipoctal_get_icount,
        .hangup =               ipoctal_hangup,
+       .shutdown =             ipoctal_shutdown,
  };
  
  static int ipoctal_probe(struct ipack_device *dev)
index f6fcb87b3504adc8e966d8225efcee066d2977e1,a396a3ae20458c9cbcba1d8f3040947ee8e2fde3..a9d9d41d95d342df8bcc95fa38055ac0bd47bec5
@@@ -84,6 -84,12 +84,12 @@@ int wm5102_patch(struct arizona *arizon
  }
  
  static const struct regmap_irq wm5102_aod_irqs[ARIZONA_NUM_IRQ] = {
+       [ARIZONA_IRQ_MICD_CLAMP_FALL] = {
+               .mask = ARIZONA_MICD_CLAMP_FALL_EINT1
+       },
+       [ARIZONA_IRQ_MICD_CLAMP_RISE] = {
+               .mask = ARIZONA_MICD_CLAMP_RISE_EINT1
+       },
        [ARIZONA_IRQ_GP5_FALL] = { .mask = ARIZONA_GP5_FALL_EINT1 },
        [ARIZONA_IRQ_GP5_RISE] = { .mask = ARIZONA_GP5_RISE_EINT1 },
        [ARIZONA_IRQ_JD_FALL] = { .mask = ARIZONA_JD1_FALL_EINT1 },
@@@ -96,7 -102,6 +102,7 @@@ const struct regmap_irq_chip wm5102_ao
        .mask_base = ARIZONA_AOD_IRQ_MASK_IRQ1,
        .ack_base = ARIZONA_AOD_IRQ1,
        .wake_base = ARIZONA_WAKE_CONTROL,
 +      .wake_invert = 1,
        .num_regs = 1,
        .irqs = wm5102_aod_irqs,
        .num_irqs = ARRAY_SIZE(wm5102_aod_irqs),
@@@ -313,6 -318,7 +319,7 @@@ static const struct reg_default wm5102_
        { 0x0000021A, 0x01A6 },   /* R538   - Mic Bias Ctrl 3 */ 
        { 0x00000293, 0x0000 },   /* R659   - Accessory Detect Mode 1 */ 
        { 0x0000029B, 0x0020 },   /* R667   - Headphone Detect 1 */ 
+       { 0x000002A2, 0x0000 },   /* R674   - Micd clamp control */
        { 0x000002A3, 0x1102 },   /* R675   - Mic Detect 1 */ 
        { 0x000002A4, 0x009F },   /* R676   - Mic Detect 2 */ 
        { 0x000002A5, 0x0000 },   /* R677   - Mic Detect 3 */ 
@@@ -1107,6 -1113,8 +1114,8 @@@ static bool wm5102_readable_register(st
        case ARIZONA_ACCESSORY_DETECT_MODE_1:
        case ARIZONA_HEADPHONE_DETECT_1:
        case ARIZONA_HEADPHONE_DETECT_2:
+       case ARIZONA_HP_DACVAL:
+       case ARIZONA_MICD_CLAMP_CONTROL:
        case ARIZONA_MIC_DETECT_1:
        case ARIZONA_MIC_DETECT_2:
        case ARIZONA_MIC_DETECT_3:
@@@ -1876,6 -1884,7 +1885,7 @@@ static bool wm5102_volatile_register(st
        case ARIZONA_DSP1_STATUS_2:
        case ARIZONA_DSP1_STATUS_3:
        case ARIZONA_HEADPHONE_DETECT_2:
+       case ARIZONA_HP_DACVAL:
        case ARIZONA_MIC_DETECT_3:
                return true;
        default:
        }
  }
  
 -#define WM5102_MAX_REGISTER 0x1a8fff
 +#define WM5102_MAX_REGISTER 0x1a9800
  
  const struct regmap_config wm5102_spi_regmap = {
        .reg_bits = 32,
diff --combined drivers/misc/Kconfig
index 668a5822ab4e8af1db7075dec09e3d005a62692c,3ec3f9ece9d9967a733b38989fc7761faacc618c..e83fdfe0c8ca6e66b84b7f935902a69cbcae8ef4
@@@ -127,7 -127,7 +127,7 @@@ config PHANTO
  
  config INTEL_MID_PTI
        tristate "Parallel Trace Interface for MIPI P1149.7 cJTAG standard"
 -      depends on PCI
 +      depends on PCI && TTY
        default n
        help
          The PTI (Parallel Trace Interface) driver directs
@@@ -192,7 -192,7 +192,7 @@@ config ICS932S40
  
  config ATMEL_SSC
        tristate "Device driver for Atmel SSC peripheral"
 -      depends on AVR32 || ARCH_AT91
 +      depends on HAS_IOMEM
        ---help---
          This option enables device driver support for Atmel Synchronized
          Serial Communication peripheral (SSC).
@@@ -499,6 -499,17 +499,17 @@@ config USB_SWITCH_FSA948
          stereo and mono audio, video, microphone and UART data to use
          a common connector port.
  
+ config LATTICE_ECP3_CONFIG
+       tristate "Lattice ECP3 FPGA bitstream configuration via SPI"
+       depends on SPI && SYSFS
+       select FW_LOADER
+       default n
+       help
+         This option enables support for bitstream configuration (programming
+         or loading) of the Lattice ECP3 FPGA family via SPI.
+         If unsure, say N.
  source "drivers/misc/c2port/Kconfig"
  source "drivers/misc/eeprom/Kconfig"
  source "drivers/misc/cb710/Kconfig"
@@@ -507,4 -518,5 +518,5 @@@ source "drivers/misc/lis3lv02d/Kconfig
  source "drivers/misc/carma/Kconfig"
  source "drivers/misc/altera-stapl/Kconfig"
  source "drivers/misc/mei/Kconfig"
+ source "drivers/misc/vmw_vmci/Kconfig"
  endmenu
diff --combined drivers/mmc/host/Kconfig
index cc8a8fad455aca4e9a1886404a7c5485e595ad20,30041272ab96312e2d9130fa11209c4617cbba53..3be8b94d79141b1a1cfb73212d3f14fa23ae8f62
@@@ -69,7 -69,7 +69,7 @@@ config MMC_SDHCI_PC
          If unsure, say N.
  
  config MMC_RICOH_MMC
 -      bool "Ricoh MMC Controller Disabler  (EXPERIMENTAL)"
 +      bool "Ricoh MMC Controller Disabler"
        depends on MMC_SDHCI_PCI
        help
          This adds a pci quirk to disable Ricoh MMC Controller. This
@@@ -186,6 -186,9 +186,6 @@@ config MMC_SDHCI_S3
          often referrered to as the HSMMC block in some of the Samsung S3C
          range of SoC.
  
 -        Note, due to the problems with DMA, the DMA support is only
 -        available with CONFIG_EXPERIMENTAL is selected.
 -
          If you have a controller with this interface, say Y or M here.
  
          If unsure, say N.
@@@ -230,7 -233,7 +230,7 @@@ config MMC_SDHCI_SPEA
  
  config MMC_SDHCI_S3C_DMA
        bool "DMA support on S3C SDHCI"
 -      depends on MMC_SDHCI_S3C && EXPERIMENTAL
 +      depends on MMC_SDHCI_S3C
        help
          Enable DMA support on the Samsung S3C SDHCI glue. The DMA
          has proved to be problematic if the controller encounters
@@@ -327,8 -330,8 +327,8 @@@ config MMC_MX
          If unsure, say N.
  
  config MMC_TIFM_SD
 -      tristate "TI Flash Media MMC/SD Interface support  (EXPERIMENTAL)"
 -      depends on EXPERIMENTAL && PCI
 +      tristate "TI Flash Media MMC/SD Interface support"
 +      depends on PCI
        select TIFM_CORE
        help
          Say Y here if you want to be able to access MMC/SD cards with
@@@ -407,7 -410,8 +407,7 @@@ config MMC_S3C_PI
          the S3C MCI driver.
  
  config MMC_S3C_DMA
 -      bool "Use DMA transfers only (EXPERIMENTAL)"
 -      depends on EXPERIMENTAL
 +      bool "Use DMA transfers only"
        help
          Use DMA to transfer data between memory and the hardare.
  
          option is useful.
  
  config MMC_S3C_PIODMA
 -      bool "Support for both PIO and DMA (EXPERIMENTAL)"
 +      bool "Support for both PIO and DMA"
        help
          Compile both the PIO and DMA transfer routines into the
          driver and let the platform select at run-time which one
  endchoice
  
  config MMC_SDRICOH_CS
 -      tristate "MMC/SD driver for Ricoh Bay1Controllers (EXPERIMENTAL)"
 -      depends on EXPERIMENTAL && PCI && PCMCIA
 +      tristate "MMC/SD driver for Ricoh Bay1Controllers"
 +      depends on PCI && PCMCIA
        help
          Say Y here if your Notebook reports a Ricoh Bay1Controller PCMCIA
          card whenever you insert a MMC or SD card into the card slot.
@@@ -457,7 -461,7 +457,7 @@@ config MMC_SDH
  
  config MMC_CB710
        tristate "ENE CB710 MMC/SD Interface support"
-       depends on PCI
+       depends on PCI && GENERIC_HARDIRQS
        select CB710_CORE
        help
          This option enables support for MMC/SD part of ENE CB710/720 Flash
diff --combined drivers/net/Kconfig
index 2334190ff8d231d3e6cb8dfc479a1cf032c57c59,5db9acbc0cae31efb3c845c3c1d4949467113879..56c2d75a63d49214ad518604b54579318038dd32
@@@ -123,7 -123,8 +123,7 @@@ config IF
  source "drivers/net/team/Kconfig"
  
  config MACVLAN
 -      tristate "MAC-VLAN support (EXPERIMENTAL)"
 -      depends on EXPERIMENTAL
 +      tristate "MAC-VLAN support"
        ---help---
          This allows one to create virtual interfaces that map packets to
          or from specific MAC addresses to a particular interface.
          will be called macvlan.
  
  config MACVTAP
 -      tristate "MAC-VLAN based tap driver (EXPERIMENTAL)"
 +      tristate "MAC-VLAN based tap driver"
        depends on MACVLAN
        help
          This adds a specialized tap character device driver that is based
@@@ -188,6 -189,10 +188,10 @@@ config NETPOLL_TRA
  config NET_POLL_CONTROLLER
        def_bool NETPOLL
  
+ config NTB_NETDEV
+       tristate "Virtual Ethernet over NTB"
+       depends on NTB
  config RIONET
        tristate "RapidIO Ethernet over messaging driver support"
        depends on RAPIDIO
@@@ -233,8 -238,8 +237,8 @@@ config VET
          versa.
  
  config VIRTIO_NET
 -      tristate "Virtio network driver (EXPERIMENTAL)"
 -      depends on EXPERIMENTAL && VIRTIO
 +      tristate "Virtio network driver"
 +      depends on VIRTIO
        ---help---
          This is the virtual network driver for virtio.  It can be used with
          lguest or QEMU based VMMs (like KVM or Xen).  Say Y or M.
index d5202a4b08774e99f9c4bd6c59e731ecb47f6b30,5ac9cafc4543481324526f0a5eccf93ba6d01835..5f85205cd12b81284ba7f23dfc89aa7ef50d3c10
@@@ -304,9 -304,9 +304,9 @@@ int netvsc_recv_callback(struct hv_devi
  static void netvsc_get_drvinfo(struct net_device *net,
                               struct ethtool_drvinfo *info)
  {
 -      strcpy(info->driver, KBUILD_MODNAME);
 -      strcpy(info->version, HV_DRV_VERSION);
 -      strcpy(info->fw_version, "N/A");
 +      strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
 +      strlcpy(info->version, HV_DRV_VERSION, sizeof(info->version));
 +      strlcpy(info->fw_version, "N/A", sizeof(info->fw_version));
  }
  
  static int netvsc_change_mtu(struct net_device *ndev, int mtu)
@@@ -349,7 -349,7 +349,7 @@@ static int netvsc_set_mac_addr(struct n
        struct net_device_context *ndevctx = netdev_priv(ndev);
        struct hv_device *hdev =  ndevctx->device_ctx;
        struct sockaddr *addr = p;
 -      char save_adr[14];
 +      char save_adr[ETH_ALEN];
        unsigned char save_aatype;
        int err;
  
@@@ -498,8 -498,7 +498,7 @@@ static int netvsc_remove(struct hv_devi
  
  static const struct hv_vmbus_device_id id_table[] = {
        /* Network guid */
-       { VMBUS_DEVICE(0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46,
-                      0x91, 0x3F, 0xF2, 0xD2, 0xF9, 0x65, 0xED, 0x0E) },
+       { HV_NIC_GUID, },
        { },
  };
  
index ec3e2a2a6d77a9a16c8916f63783dc2e0822036e,f8241753415c74f7329ebcdd11db7516cce19028..96d64f2b8d781393b5566bf1bacf2a6a6b669e09
@@@ -62,8 -62,6 +62,8 @@@
  
  #define ARIZONA_MAX_OUTPUT 6
  
 +#define ARIZONA_MAX_AIF 3
 +
  #define ARIZONA_HAP_ACT_ERM 0
  #define ARIZONA_HAP_ACT_LRA 2
  
@@@ -98,16 -96,30 +98,37 @@@ struct arizona_pdata 
        /** Pin state for GPIO pins */
        int gpio_defaults[ARIZONA_MAX_GPIO];
  
 +      /**
 +       * Maximum number of channels clocks will be generated for,
 +       * useful for systems where and I2S bus with multiple data
 +       * lines is mastered.
 +       */
 +      int max_channels_clocked[ARIZONA_MAX_AIF];
 +
+       /** GPIO5 is used for jack detection */
+       bool jd_gpio5;
+       /** Use the headphone detect circuit to identify the accessory */
+       bool hpdet_acc_id;
+       /** GPIO used for mic isolation with HPDET */
+       int hpdet_id_gpio;
        /** GPIO for mic detection polarity */
        int micd_pol_gpio;
  
+       /** Mic detect ramp rate */
+       int micd_bias_start_time;
+       /** Mic detect sample rate */
+       int micd_rate;
+       /** Mic detect debounce level */
+       int micd_dbtime;
+       /** Force MICBIAS on for mic detect */
+       bool micd_force_micbias;
        /** Headset polarity configurations */
        struct arizona_micd_config *micd_configs;
        int num_micd_configs;