Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvar...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 25 Jul 2011 18:40:24 +0000 (11:40 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 25 Jul 2011 18:40:24 +0000 (11:40 -0700)
* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  i2c: Allow i2c_add_numbered_adapter() to assign a bus id
  i2c-ali1535: Fix style issues

328 files changed:
Documentation/block/queue-sysfs.txt
MAINTAINERS
arch/arm/Kconfig
arch/arm/mach-exynos4/Makefile
arch/arm/mach-s3c64xx/Makefile
arch/arm/mach-s5pv210/Makefile
block/blk-core.c
block/blk-ioc.c
block/blk-lib.c
block/blk-softirq.c
block/blk-sysfs.c
block/blk-throttle.c
block/bsg.c
block/cfq-iosched.c
block/compat_ioctl.c
block/deadline-iosched.c
block/elevator.c
block/genhd.c
drivers/ata/Kconfig
drivers/ata/acard-ahci.c
drivers/ata/ahci.c
drivers/ata/ahci.h
drivers/ata/ata_generic.c
drivers/ata/ata_piix.c
drivers/ata/libahci.c
drivers/ata/libata-acpi.c
drivers/ata/libata-core.c
drivers/ata/libata-eh.c
drivers/ata/libata-pmp.c
drivers/ata/libata-scsi.c
drivers/ata/libata-sff.c
drivers/ata/pata_acpi.c
drivers/ata/pata_ali.c
drivers/ata/pata_amd.c
drivers/ata/pata_artop.c
drivers/ata/pata_atp867x.c
drivers/ata/pata_bf54x.c
drivers/ata/pata_cs5520.c
drivers/ata/pata_efar.c
drivers/ata/pata_hpt3x3.c
drivers/ata/pata_icside.c
drivers/ata/pata_it8213.c
drivers/ata/pata_it821x.c
drivers/ata/pata_ixp4xx_cf.c
drivers/ata/pata_legacy.c
drivers/ata/pata_macio.c
drivers/ata/pata_mpiix.c
drivers/ata/pata_netcell.c
drivers/ata/pata_ns87410.c
drivers/ata/pata_ns87415.c
drivers/ata/pata_octeon_cf.c
drivers/ata/pata_oldpiix.c
drivers/ata/pata_opti.c
drivers/ata/pata_optidma.c
drivers/ata/pata_pcmcia.c
drivers/ata/pata_pdc2027x.c
drivers/ata/pata_platform.c
drivers/ata/pata_radisys.c
drivers/ata/pata_rdc.c
drivers/ata/pata_rz1000.c
drivers/ata/pata_samsung_cf.c
drivers/ata/pata_scc.c
drivers/ata/pata_sch.c
drivers/ata/pata_sil680.c
drivers/ata/pata_sis.c
drivers/ata/pata_sl82c105.c
drivers/ata/pata_triflex.c
drivers/ata/pata_via.c
drivers/ata/pdc_adma.c
drivers/ata/sata_dwc_460ex.c
drivers/ata/sata_fsl.c
drivers/ata/sata_inic162x.c
drivers/ata/sata_mv.c
drivers/ata/sata_nv.c
drivers/ata/sata_promise.c
drivers/ata/sata_qstor.c
drivers/ata/sata_sil.c
drivers/ata/sata_sil24.c
drivers/ata/sata_sis.c
drivers/ata/sata_svw.c
drivers/ata/sata_sx4.c
drivers/ata/sata_uli.c
drivers/ata/sata_via.c
drivers/ata/sata_vsc.c
drivers/bcma/core.c
drivers/bcma/driver_chipcommon.c
drivers/bcma/driver_pci.c
drivers/bcma/sprom.c
drivers/block/cciss.h
drivers/block/xen-blkback/blkback.c
drivers/cpufreq/Kconfig
drivers/cpufreq/Kconfig.arm [new file with mode: 0644]
drivers/cpufreq/Makefile
drivers/cpufreq/acpi-cpufreq.c
drivers/cpufreq/exynos4210-cpufreq.c [moved from arch/arm/mach-exynos4/cpufreq.c with 98% similarity]
drivers/cpufreq/s3c64xx-cpufreq.c [moved from arch/arm/mach-s3c64xx/cpufreq.c with 98% similarity]
drivers/cpufreq/s5pv210-cpufreq.c [moved from arch/arm/mach-s5pv210/cpufreq.c with 73% similarity]
drivers/net/bna/bfa_cee.c
drivers/net/bna/bfa_cee.h
drivers/net/bna/bfa_cs.h [moved from drivers/net/bna/bfa_sm.h with 60% similarity]
drivers/net/bna/bfa_defs.h
drivers/net/bna/bfa_defs_mfg_comm.h
drivers/net/bna/bfa_defs_status.h
drivers/net/bna/bfa_ioc.c
drivers/net/bna/bfa_ioc.h
drivers/net/bna/bfa_wc.h [deleted file]
drivers/net/bna/bfi.h
drivers/net/bna/bna.h
drivers/net/bna/bna_ctrl.c
drivers/net/bna/bna_hw.h
drivers/net/bna/bna_txrx.c
drivers/net/bna/bna_types.h
drivers/net/bna/bnad.c
drivers/net/bna/bnad.h
drivers/net/bna/bnad_ethtool.c
drivers/net/bna/cna.h
drivers/net/bnx2x/bnx2x_dcb.c
drivers/net/bnx2x/bnx2x_main.c
drivers/net/can/c_can/c_can.c
drivers/net/can/c_can/c_can_platform.c
drivers/net/igb/igb_main.c
drivers/net/qlge/qlge_main.c
drivers/net/r8169.c
drivers/net/via-velocity.c
drivers/net/wan/sbni.c
drivers/net/wireless/ath/ath5k/ahb.c
drivers/net/wireless/ath/ath5k/ani.c
drivers/net/wireless/ath/ath5k/ath5k.h
drivers/net/wireless/ath/ath5k/attach.c
drivers/net/wireless/ath/ath5k/base.c
drivers/net/wireless/ath/ath5k/base.h
drivers/net/wireless/ath/ath5k/caps.c
drivers/net/wireless/ath/ath5k/debug.c
drivers/net/wireless/ath/ath5k/debug.h
drivers/net/wireless/ath/ath5k/desc.c
drivers/net/wireless/ath/ath5k/dma.c
drivers/net/wireless/ath/ath5k/eeprom.c
drivers/net/wireless/ath/ath5k/initvals.c
drivers/net/wireless/ath/ath5k/led.c
drivers/net/wireless/ath/ath5k/mac80211-ops.c
drivers/net/wireless/ath/ath5k/pci.c
drivers/net/wireless/ath/ath5k/pcu.c
drivers/net/wireless/ath/ath5k/phy.c
drivers/net/wireless/ath/ath5k/qcu.c
drivers/net/wireless/ath/ath5k/reset.c
drivers/net/wireless/ath/ath5k/rfkill.c
drivers/net/wireless/ath/ath5k/sysfs.c
drivers/net/wireless/ath/ath5k/trace.h
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
drivers/net/wireless/ath/ath9k/btcoex.c
drivers/net/wireless/ath/ath9k/debug.c
drivers/net/wireless/ath/ath9k/eeprom_4k.c
drivers/net/wireless/ath/ath9k/eeprom_9287.c
drivers/net/wireless/ath/ath9k/eeprom_def.c
drivers/net/wireless/ath/ath9k/hif_usb.c
drivers/net/wireless/ath/ath9k/htc_drv_debug.c
drivers/net/wireless/ath/ath9k/hw.c
drivers/net/wireless/ath/ath9k/init.c
drivers/net/wireless/ath/ath9k/recv.c
drivers/net/wireless/ath/ath9k/reg.h
drivers/net/wireless/ath/ath9k/xmit.c
drivers/net/wireless/ath/carl9170/carl9170.h
drivers/net/wireless/ath/carl9170/cmd.h
drivers/net/wireless/ath/carl9170/debug.c
drivers/net/wireless/ath/carl9170/fwdesc.h
drivers/net/wireless/ath/carl9170/hw.h
drivers/net/wireless/ath/carl9170/led.c
drivers/net/wireless/ath/carl9170/mac.c
drivers/net/wireless/ath/carl9170/main.c
drivers/net/wireless/ath/carl9170/phy.c
drivers/net/wireless/ath/carl9170/tx.c
drivers/net/wireless/ath/key.c
drivers/net/wireless/b43/b43.h
drivers/net/wireless/b43/bus.c
drivers/net/wireless/b43/dma.c
drivers/net/wireless/b43/dma.h
drivers/net/wireless/b43/main.c
drivers/net/wireless/b43/phy_ht.c
drivers/net/wireless/b43/phy_n.c
drivers/net/wireless/b43/radio_2059.c
drivers/net/wireless/b43legacy/b43legacy.h
drivers/net/wireless/b43legacy/dma.c
drivers/net/wireless/iwlwifi/Makefile
drivers/net/wireless/iwlwifi/iwl-1000.c
drivers/net/wireless/iwlwifi/iwl-2000.c
drivers/net/wireless/iwlwifi/iwl-5000.c
drivers/net/wireless/iwlwifi/iwl-6000.c
drivers/net/wireless/iwlwifi/iwl-agn-calib.c
drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c [deleted file]
drivers/net/wireless/iwlwifi/iwl-agn-ict.c [deleted file]
drivers/net/wireless/iwlwifi/iwl-agn-lib.c
drivers/net/wireless/iwlwifi/iwl-agn-rs.c
drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
drivers/net/wireless/iwlwifi/iwl-agn-sta.c
drivers/net/wireless/iwlwifi/iwl-agn-tx.c
drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-agn.h
drivers/net/wireless/iwlwifi/iwl-bus.h [moved from drivers/net/wireless/iwlwifi/iwl-pci.h with 61% similarity]
drivers/net/wireless/iwlwifi/iwl-commands.h
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-core.h
drivers/net/wireless/iwlwifi/iwl-csr.h
drivers/net/wireless/iwlwifi/iwl-debug.h
drivers/net/wireless/iwlwifi/iwl-debugfs.c
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl-eeprom.c
drivers/net/wireless/iwlwifi/iwl-hcmd.c [deleted file]
drivers/net/wireless/iwlwifi/iwl-io.h
drivers/net/wireless/iwlwifi/iwl-led.c
drivers/net/wireless/iwlwifi/iwl-pci.c
drivers/net/wireless/iwlwifi/iwl-power.c
drivers/net/wireless/iwlwifi/iwl-prph.h
drivers/net/wireless/iwlwifi/iwl-rx.c
drivers/net/wireless/iwlwifi/iwl-scan.c
drivers/net/wireless/iwlwifi/iwl-sta.c
drivers/net/wireless/iwlwifi/iwl-sta.h
drivers/net/wireless/iwlwifi/iwl-sv-open.c
drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h [new file with mode: 0644]
drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c [new file with mode: 0644]
drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c [moved from drivers/net/wireless/iwlwifi/iwl-tx.c with 53% similarity]
drivers/net/wireless/iwlwifi/iwl-trans.c
drivers/net/wireless/iwlwifi/iwl-trans.h
drivers/net/wireless/libertas/dev.h
drivers/net/wireless/libertas/main.c
drivers/net/wireless/libertas/mesh.c
drivers/net/wireless/libertas/mesh.h
drivers/net/wireless/libertas/tx.c
drivers/net/wireless/mwifiex/debugfs.c
drivers/net/wireless/mwifiex/ioctl.h
drivers/net/wireless/mwifiex/main.h
drivers/net/wireless/mwifiex/sdio.c
drivers/net/wireless/mwifiex/sta_ioctl.c
drivers/net/wireless/mwifiex/wmm.c
drivers/net/wireless/mwl8k.c
drivers/net/wireless/orinoco/airport.c
drivers/net/wireless/orinoco/cfg.c
drivers/net/wireless/orinoco/fw.c
drivers/net/wireless/orinoco/fw.h
drivers/net/wireless/orinoco/hermes.c
drivers/net/wireless/orinoco/hermes.h
drivers/net/wireless/orinoco/hermes_dld.c
drivers/net/wireless/orinoco/hermes_dld.h
drivers/net/wireless/orinoco/hw.c
drivers/net/wireless/orinoco/hw.h
drivers/net/wireless/orinoco/main.c
drivers/net/wireless/orinoco/mic.c
drivers/net/wireless/orinoco/orinoco.h
drivers/net/wireless/orinoco/orinoco_cs.c
drivers/net/wireless/orinoco/orinoco_nortel.c
drivers/net/wireless/orinoco/orinoco_pci.c
drivers/net/wireless/orinoco/orinoco_plx.c
drivers/net/wireless/orinoco/orinoco_tmd.c
drivers/net/wireless/orinoco/orinoco_usb.c
drivers/net/wireless/orinoco/spectrum_cs.c
drivers/net/wireless/orinoco/wext.c
drivers/net/wireless/rtlwifi/base.c
drivers/net/wireless/rtlwifi/cam.c
drivers/net/wireless/rtlwifi/core.c
drivers/net/wireless/rtlwifi/debug.h
drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c
drivers/net/wireless/rtlwifi/rtl8192ce/hw.c
drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
drivers/net/wireless/rtlwifi/rtl8192de/hw.c
drivers/net/wireless/rtlwifi/rtl8192de/sw.c
drivers/net/wireless/rtlwifi/rtl8192se/hw.c
drivers/net/wireless/rtlwifi/rtl8192se/phy.c
drivers/net/wireless/rtlwifi/rtl8192se/rf.c
drivers/net/wireless/rtlwifi/rtl8192se/sw.c
drivers/net/wireless/rtlwifi/usb.c
drivers/ssb/main.c
drivers/staging/gma500/psb_intel_display.c
fs/block_dev.c
fs/compat_ioctl.c
fs/partitions/check.c
fs/reiserfs/journal.c
fs/super.c
include/asm-generic/iomap.h
include/linux/bcma/bcma.h
include/linux/bcma/bcma_driver_chipcommon.h
include/linux/bcma/bcma_regs.h
include/linux/blkdev.h
include/linux/elevator.h
include/linux/fd.h
include/linux/fs.h
include/linux/genhd.h
include/linux/ieee80211.h
include/linux/init_task.h
include/linux/iocontext.h
include/linux/libata.h
include/linux/nl80211.h
include/linux/sched.h
include/linux/ssb/ssb.h
include/net/cfg80211.h
include/net/mac80211.h
kernel/exit.c
kernel/fork.c
mm/backing-dev.c
net/bridge/br_if.c
net/bridge/br_netlink.c
net/bridge/br_private.h
net/bridge/br_private_stp.h
net/bridge/br_stp.c
net/bridge/br_stp_bpdu.c
net/bridge/br_stp_if.c
net/bridge/br_stp_timer.c
net/core/link_watch.c
net/ipv4/gre.c
net/ipv4/ipmr.c
net/ipv4/route.c
net/mac80211/agg-rx.c
net/mac80211/cfg.c
net/mac80211/driver-ops.h
net/mac80211/driver-trace.h
net/mac80211/ieee80211_i.h
net/mac80211/key.c
net/mac80211/mlme.c
net/mac80211/pm.c
net/mac80211/scan.c
net/mac80211/tkip.c
net/mac80211/util.c
net/mac80211/work.c
net/wireless/core.c
net/wireless/core.h
net/wireless/nl80211.c
net/wireless/scan.c
net/wireless/util.c

index f652740..d8147b3 100644 (file)
@@ -45,9 +45,13 @@ device.
 
 rq_affinity (RW)
 ----------------
-If this option is enabled, the block layer will migrate request completions
-to the CPU that originally submitted the request. For some workloads
-this provides a significant reduction in CPU cycles due to caching effects.
+If this option is '1', the block layer will migrate request completions to the
+cpu "group" that originally submitted the request. For some workloads this
+provides a significant reduction in CPU cycles due to caching effects.
+
+For storage configurations that need to maximize distribution of completion
+processing setting this option to '2' forces the completion to run on the
+requesting cpu (bypassing the "group" aggregation logic).
 
 scheduler (RW)
 --------------
index 43392c9..39d8822 100644 (file)
@@ -4106,6 +4106,12 @@ S:       Maintained
 F:     drivers/net/mv643xx_eth.*
 F:     include/linux/mv643xx.h
 
+MARVELL MWIFIEX WIRELESS DRIVER
+M:     Bing Zhao <bzhao@marvell.com>
+L:     linux-wireless@vger.kernel.org
+S:     Maintained
+F:     drivers/net/wireless/mwifiex/
+
 MARVELL MWL8K WIRELESS DRIVER
 M:     Lennert Buytenhek <buytenh@wantstofly.org>
 L:     linux-wireless@vger.kernel.org
@@ -6972,9 +6978,9 @@ S:        Maintained
 F:     drivers/input/misc/wistron_btns.c
 
 WL1251 WIRELESS DRIVER
-M:     Kalle Valo <kvalo@adurom.com>
+M:     Luciano Coelho <coelho@ti.com>
 L:     linux-wireless@vger.kernel.org
-W:     http://wireless.kernel.org
+W:     http://wireless.kernel.org/en/users/Drivers/wl1251
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
 S:     Maintained
 F:     drivers/net/wireless/wl1251/*
index 1478c61..83a7aa2 100644 (file)
@@ -1895,10 +1895,6 @@ config CPU_FREQ_PXA
        default y
        select CPU_FREQ_DEFAULT_GOV_USERSPACE
 
-config CPU_FREQ_S3C64XX
-       bool "CPUfreq support for Samsung S3C64XX CPUs"
-       depends on CPU_FREQ && CPU_S3C6410
-
 config CPU_FREQ_S3C
        bool
        help
index 60fe5ec..1366995 100644 (file)
@@ -15,7 +15,6 @@ obj-                          :=
 obj-$(CONFIG_CPU_EXYNOS4210)   += cpu.o init.o clock.o irq-combiner.o
 obj-$(CONFIG_CPU_EXYNOS4210)   += setup-i2c0.o irq-eint.o dma.o
 obj-$(CONFIG_PM)               += pm.o sleep.o
-obj-$(CONFIG_CPU_FREQ)         += cpufreq.o
 obj-$(CONFIG_CPU_IDLE)         += cpuidle.o
 
 obj-$(CONFIG_SMP)              += platsmp.o headsmp.o
index 4657363..f5a7144 100644 (file)
@@ -23,10 +23,6 @@ obj-$(CONFIG_CPU_S3C6410)    += s3c6410.o
 obj-y                          += irq.o
 obj-y                          += irq-eint.o
 
-# CPU frequency scaling
-
-obj-$(CONFIG_CPU_FREQ_S3C64XX)  += cpufreq.o
-
 # DMA support
 
 obj-$(CONFIG_S3C64XX_DMA)      += dma.o
index 50907ac..599a3c0 100644 (file)
@@ -15,7 +15,6 @@ obj-                          :=
 obj-$(CONFIG_CPU_S5PV210)      += cpu.o init.o clock.o dma.o
 obj-$(CONFIG_CPU_S5PV210)      += setup-i2c0.o
 obj-$(CONFIG_S5PV210_PM)       += pm.o sleep.o
-obj-$(CONFIG_CPU_FREQ)         += cpufreq.o
 
 # machine support
 
index 1d49e1c..f8cb099 100644 (file)
@@ -1282,10 +1282,8 @@ get_rq:
        init_request_from_bio(req, bio);
 
        if (test_bit(QUEUE_FLAG_SAME_COMP, &q->queue_flags) ||
-           bio_flagged(bio, BIO_CPU_AFFINE)) {
-               req->cpu = blk_cpu_to_group(get_cpu());
-               put_cpu();
-       }
+           bio_flagged(bio, BIO_CPU_AFFINE))
+               req->cpu = smp_processor_id();
 
        plug = current->plug;
        if (plug) {
@@ -1305,7 +1303,10 @@ get_rq:
                                plug->should_sort = 1;
                }
                list_add_tail(&req->queuelist, &plug->list);
+               plug->count++;
                drive_stat_acct(req, 1);
+               if (plug->count >= BLK_MAX_REQUEST_COUNT)
+                       blk_flush_plug_list(plug, false);
        } else {
                spin_lock_irq(q->queue_lock);
                add_acct_request(q, req, where);
@@ -2629,6 +2630,7 @@ void blk_start_plug(struct blk_plug *plug)
        INIT_LIST_HEAD(&plug->list);
        INIT_LIST_HEAD(&plug->cb_list);
        plug->should_sort = 0;
+       plug->count = 0;
 
        /*
         * If this is a nested plug, don't actually assign it. It will be
@@ -2712,6 +2714,7 @@ void blk_flush_plug_list(struct blk_plug *plug, bool from_schedule)
                return;
 
        list_splice_init(&plug->list, &list);
+       plug->count = 0;
 
        if (plug->should_sort) {
                list_sort(NULL, &list, plug_rq_cmp);
index 342eae9..6f9bbd9 100644 (file)
@@ -82,26 +82,26 @@ void exit_io_context(struct task_struct *task)
 
 struct io_context *alloc_io_context(gfp_t gfp_flags, int node)
 {
-       struct io_context *ret;
+       struct io_context *ioc;
 
-       ret = kmem_cache_alloc_node(iocontext_cachep, gfp_flags, node);
-       if (ret) {
-               atomic_long_set(&ret->refcount, 1);
-               atomic_set(&ret->nr_tasks, 1);
-               spin_lock_init(&ret->lock);
-               ret->ioprio_changed = 0;
-               ret->ioprio = 0;
-               ret->last_waited = 0; /* doesn't matter... */
-               ret->nr_batch_requests = 0; /* because this is 0 */
-               INIT_RADIX_TREE(&ret->radix_root, GFP_ATOMIC | __GFP_HIGH);
-               INIT_HLIST_HEAD(&ret->cic_list);
-               ret->ioc_data = NULL;
+       ioc = kmem_cache_alloc_node(iocontext_cachep, gfp_flags, node);
+       if (ioc) {
+               atomic_long_set(&ioc->refcount, 1);
+               atomic_set(&ioc->nr_tasks, 1);
+               spin_lock_init(&ioc->lock);
+               ioc->ioprio_changed = 0;
+               ioc->ioprio = 0;
+               ioc->last_waited = 0; /* doesn't matter... */
+               ioc->nr_batch_requests = 0; /* because this is 0 */
+               INIT_RADIX_TREE(&ioc->radix_root, GFP_ATOMIC | __GFP_HIGH);
+               INIT_HLIST_HEAD(&ioc->cic_list);
+               ioc->ioc_data = NULL;
 #if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE)
-               ret->cgroup_changed = 0;
+               ioc->cgroup_changed = 0;
 #endif
        }
 
-       return ret;
+       return ioc;
 }
 
 /*
@@ -139,19 +139,19 @@ struct io_context *current_io_context(gfp_t gfp_flags, int node)
  */
 struct io_context *get_io_context(gfp_t gfp_flags, int node)
 {
-       struct io_context *ret = NULL;
+       struct io_context *ioc = NULL;
 
        /*
         * Check for unlikely race with exiting task. ioc ref count is
         * zero when ioc is being detached.
         */
        do {
-               ret = current_io_context(gfp_flags, node);
-               if (unlikely(!ret))
+               ioc = current_io_context(gfp_flags, node);
+               if (unlikely(!ioc))
                        break;
-       } while (!atomic_long_inc_not_zero(&ret->refcount));
+       } while (!atomic_long_inc_not_zero(&ioc->refcount));
 
-       return ret;
+       return ioc;
 }
 EXPORT_SYMBOL(get_io_context);
 
index 78e627e..2b461b4 100644 (file)
@@ -59,7 +59,10 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
         * granularity
         */
        max_discard_sectors = min(q->limits.max_discard_sectors, UINT_MAX >> 9);
-       if (q->limits.discard_granularity) {
+       if (unlikely(!max_discard_sectors)) {
+               /* Avoid infinite loop below. Being cautious never hurts. */
+               return -EOPNOTSUPP;
+       } else if (q->limits.discard_granularity) {
                unsigned int disc_sects = q->limits.discard_granularity >> 9;
 
                max_discard_sectors &= ~(disc_sects - 1);
index ee9c216..475fab8 100644 (file)
@@ -103,22 +103,25 @@ static struct notifier_block __cpuinitdata blk_cpu_notifier = {
 
 void __blk_complete_request(struct request *req)
 {
+       int ccpu, cpu, group_cpu = NR_CPUS;
        struct request_queue *q = req->q;
        unsigned long flags;
-       int ccpu, cpu, group_cpu;
 
        BUG_ON(!q->softirq_done_fn);
 
        local_irq_save(flags);
        cpu = smp_processor_id();
-       group_cpu = blk_cpu_to_group(cpu);
 
        /*
         * Select completion CPU
         */
-       if (test_bit(QUEUE_FLAG_SAME_COMP, &q->queue_flags) && req->cpu != -1)
+       if (test_bit(QUEUE_FLAG_SAME_COMP, &q->queue_flags) && req->cpu != -1) {
                ccpu = req->cpu;
-       else
+               if (!test_bit(QUEUE_FLAG_SAME_FORCE, &q->queue_flags)) {
+                       ccpu = blk_cpu_to_group(ccpu);
+                       group_cpu = blk_cpu_to_group(cpu);
+               }
+       } else
                ccpu = cpu;
 
        if (ccpu == cpu || ccpu == group_cpu) {
index d935bd8..0ee17b5 100644 (file)
@@ -244,8 +244,9 @@ static ssize_t queue_nomerges_store(struct request_queue *q, const char *page,
 static ssize_t queue_rq_affinity_show(struct request_queue *q, char *page)
 {
        bool set = test_bit(QUEUE_FLAG_SAME_COMP, &q->queue_flags);
+       bool force = test_bit(QUEUE_FLAG_SAME_FORCE, &q->queue_flags);
 
-       return queue_var_show(set, page);
+       return queue_var_show(set << force, page);
 }
 
 static ssize_t
@@ -257,10 +258,14 @@ queue_rq_affinity_store(struct request_queue *q, const char *page, size_t count)
 
        ret = queue_var_store(&val, page, count);
        spin_lock_irq(q->queue_lock);
-       if (val)
+       if (val) {
                queue_flag_set(QUEUE_FLAG_SAME_COMP, q);
-       else
-               queue_flag_clear(QUEUE_FLAG_SAME_COMP,  q);
+               if (val == 2)
+                       queue_flag_set(QUEUE_FLAG_SAME_FORCE, q);
+       } else {
+               queue_flag_clear(QUEUE_FLAG_SAME_COMP, q);
+               queue_flag_clear(QUEUE_FLAG_SAME_FORCE, q);
+       }
        spin_unlock_irq(q->queue_lock);
 #endif
        return ret;
index 3689f83..f6a7941 100644 (file)
@@ -142,9 +142,9 @@ static inline struct throtl_grp *tg_of_blkg(struct blkio_group *blkg)
        return NULL;
 }
 
-static inline int total_nr_queued(struct throtl_data *td)
+static inline unsigned int total_nr_queued(struct throtl_data *td)
 {
-       return (td->nr_queued[0] + td->nr_queued[1]);
+       return td->nr_queued[0] + td->nr_queued[1];
 }
 
 static inline struct throtl_grp *throtl_ref_get_tg(struct throtl_grp *tg)
@@ -927,7 +927,7 @@ static int throtl_dispatch(struct request_queue *q)
 
        bio_list_init(&bio_list_on_stack);
 
-       throtl_log(td, "dispatch nr_queued=%d read=%u write=%u",
+       throtl_log(td, "dispatch nr_queued=%u read=%u write=%u",
                        total_nr_queued(td), td->nr_queued[READ],
                        td->nr_queued[WRITE]);
 
@@ -970,7 +970,7 @@ throtl_schedule_delayed_work(struct throtl_data *td, unsigned long delay)
        struct delayed_work *dwork = &td->throtl_work;
 
        /* schedule work if limits changed even if no bio is queued */
-       if (total_nr_queued(td) > 0 || td->limits_changed) {
+       if (total_nr_queued(td) || td->limits_changed) {
                /*
                 * We might have a work scheduled to be executed in future.
                 * Cancel that and schedule a new one.
index 0c8b64a..702f131 100644 (file)
@@ -182,7 +182,7 @@ static int blk_fill_sgv4_hdr_rq(struct request_queue *q, struct request *rq,
                        return -ENOMEM;
        }
 
-       if (copy_from_user(rq->cmd, (void *)(unsigned long)hdr->request,
+       if (copy_from_user(rq->cmd, (void __user *)(unsigned long)hdr->request,
                           hdr->request_len))
                return -EFAULT;
 
@@ -249,7 +249,7 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm,
        struct request *rq, *next_rq = NULL;
        int ret, rw;
        unsigned int dxfer_len;
-       void *dxferp = NULL;
+       void __user *dxferp = NULL;
        struct bsg_class_device *bcd = &q->bsg_dev;
 
        /* if the LLD has been removed then the bsg_unregister_queue will
@@ -291,7 +291,7 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm,
                rq->next_rq = next_rq;
                next_rq->cmd_type = rq->cmd_type;
 
-               dxferp = (void*)(unsigned long)hdr->din_xferp;
+               dxferp = (void __user *)(unsigned long)hdr->din_xferp;
                ret =  blk_rq_map_user(q, next_rq, NULL, dxferp,
                                       hdr->din_xfer_len, GFP_KERNEL);
                if (ret)
@@ -300,10 +300,10 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm,
 
        if (hdr->dout_xfer_len) {
                dxfer_len = hdr->dout_xfer_len;
-               dxferp = (void*)(unsigned long)hdr->dout_xferp;
+               dxferp = (void __user *)(unsigned long)hdr->dout_xferp;
        } else if (hdr->din_xfer_len) {
                dxfer_len = hdr->din_xfer_len;
-               dxferp = (void*)(unsigned long)hdr->din_xferp;
+               dxferp = (void __user *)(unsigned long)hdr->din_xferp;
        } else
                dxfer_len = 0;
 
@@ -445,7 +445,7 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr,
                int len = min_t(unsigned int, hdr->max_response_len,
                                        rq->sense_len);
 
-               ret = copy_to_user((void*)(unsigned long)hdr->response,
+               ret = copy_to_user((void __user *)(unsigned long)hdr->response,
                                   rq->sense, len);
                if (!ret)
                        hdr->response_len = len;
@@ -606,7 +606,7 @@ bsg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
        ret = __bsg_read(buf, count, bd, NULL, &bytes_read);
        *ppos = bytes_read;
 
-       if (!bytes_read || (bytes_read && err_block_err(ret)))
+       if (!bytes_read || err_block_err(ret))
                bytes_read = ret;
 
        return bytes_read;
@@ -686,7 +686,7 @@ bsg_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
        /*
         * return bytes written on non-fatal errors
         */
-       if (!bytes_written || (bytes_written && err_block_err(ret)))
+       if (!bytes_written || err_block_err(ret))
                bytes_written = ret;
 
        dprintk("%s: returning %Zd\n", bd->name, bytes_written);
@@ -878,7 +878,7 @@ static unsigned int bsg_poll(struct file *file, poll_table *wait)
        spin_lock_irq(&bd->lock);
        if (!list_empty(&bd->done_list))
                mask |= POLLIN | POLLRDNORM;
-       if (bd->queued_cmds >= bd->max_queue)
+       if (bd->queued_cmds < bd->max_queue)
                mask |= POLLOUT;
        spin_unlock_irq(&bd->lock);
 
index ae21919..1f96ad6 100644 (file)
@@ -87,9 +87,10 @@ struct cfq_rb_root {
        unsigned count;
        unsigned total_weight;
        u64 min_vdisktime;
+       struct cfq_ttime ttime;
 };
-#define CFQ_RB_ROOT    (struct cfq_rb_root) { .rb = RB_ROOT, .left = NULL, \
-                       .count = 0, .min_vdisktime = 0, }
+#define CFQ_RB_ROOT    (struct cfq_rb_root) { .rb = RB_ROOT, \
+                       .ttime = {.last_end_request = jiffies,},}
 
 /*
  * Per process-grouping structure
@@ -129,14 +130,12 @@ struct cfq_queue {
        unsigned long slice_end;
        long slice_resid;
 
-       /* pending metadata requests */
-       int meta_pending;
        /* number of requests that are on the dispatch list or inside driver */
        int dispatched;
 
        /* io prio of this group */
        unsigned short ioprio, org_ioprio;
-       unsigned short ioprio_class, org_ioprio_class;
+       unsigned short ioprio_class;
 
        pid_t pid;
 
@@ -212,6 +211,7 @@ struct cfq_group {
 #endif
        /* number of requests that are on the dispatch list or inside driver */
        int dispatched;
+       struct cfq_ttime ttime;
 };
 
 /*
@@ -393,6 +393,18 @@ CFQ_CFQQ_FNS(wait_busy);
                        j++, st = i < IDLE_WORKLOAD ? \
                        &cfqg->service_trees[i][j]: NULL) \
 
+static inline bool cfq_io_thinktime_big(struct cfq_data *cfqd,
+       struct cfq_ttime *ttime, bool group_idle)
+{
+       unsigned long slice;
+       if (!sample_valid(ttime->ttime_samples))
+               return false;
+       if (group_idle)
+               slice = cfqd->cfq_group_idle;
+       else
+               slice = cfqd->cfq_slice_idle;
+       return ttime->ttime_mean > slice;
+}
 
 static inline bool iops_mode(struct cfq_data *cfqd)
 {
@@ -670,9 +682,6 @@ cfq_choose_req(struct cfq_data *cfqd, struct request *rq1, struct request *rq2,
        if (rq_is_sync(rq1) != rq_is_sync(rq2))
                return rq_is_sync(rq1) ? rq1 : rq2;
 
-       if ((rq1->cmd_flags ^ rq2->cmd_flags) & REQ_META)
-               return rq1->cmd_flags & REQ_META ? rq1 : rq2;
-
        s1 = blk_rq_pos(rq1);
        s2 = blk_rq_pos(rq2);
 
@@ -1005,8 +1014,8 @@ static inline struct cfq_group *cfqg_of_blkg(struct blkio_group *blkg)
        return NULL;
 }
 
-void cfq_update_blkio_group_weight(void *key, struct blkio_group *blkg,
-                                       unsigned int weight)
+static void cfq_update_blkio_group_weight(void *key, struct blkio_group *blkg,
+                                         unsigned int weight)
 {
        struct cfq_group *cfqg = cfqg_of_blkg(blkg);
        cfqg->new_weight = weight;
@@ -1059,6 +1068,8 @@ static struct cfq_group * cfq_alloc_cfqg(struct cfq_data *cfqd)
                *st = CFQ_RB_ROOT;
        RB_CLEAR_NODE(&cfqg->rb_node);
 
+       cfqg->ttime.last_end_request = jiffies;
+
        /*
         * Take the initial reference that will be released on destroy
         * This can be thought of a joint reference by cgroup and
@@ -1235,7 +1246,7 @@ static void cfq_release_cfq_groups(struct cfq_data *cfqd)
  * it should not be NULL as even if elevator was exiting, cgroup deltion
  * path got to it first.
  */
-void cfq_unlink_blkio_group(void *key, struct blkio_group *blkg)
+static void cfq_unlink_blkio_group(void *key, struct blkio_group *blkg)
 {
        unsigned long  flags;
        struct cfq_data *cfqd = key;
@@ -1502,16 +1513,11 @@ static void cfq_add_rq_rb(struct request *rq)
 {
        struct cfq_queue *cfqq = RQ_CFQQ(rq);
        struct cfq_data *cfqd = cfqq->cfqd;
-       struct request *__alias, *prev;
+       struct request *prev;
 
        cfqq->queued[rq_is_sync(rq)]++;
 
-       /*
-        * looks a little odd, but the first insert might return an alias.
-        * if that happens, put the alias on the dispatch list
-        */
-       while ((__alias = elv_rb_add(&cfqq->sort_list, rq)) != NULL)
-               cfq_dispatch_insert(cfqd->queue, __alias);
+       elv_rb_add(&cfqq->sort_list, rq);
 
        if (!cfq_cfqq_on_rr(cfqq))
                cfq_add_cfqq_rr(cfqd, cfqq);
@@ -1598,10 +1604,6 @@ static void cfq_remove_request(struct request *rq)
        cfqq->cfqd->rq_queued--;
        cfq_blkiocg_update_io_remove_stats(&(RQ_CFQG(rq))->blkg,
                                        rq_data_dir(rq), rq_is_sync(rq));
-       if (rq->cmd_flags & REQ_META) {
-               WARN_ON(!cfqq->meta_pending);
-               cfqq->meta_pending--;
-       }
 }
 
 static int cfq_merge(struct request_queue *q, struct request **req,
@@ -1969,7 +1971,8 @@ static bool cfq_should_idle(struct cfq_data *cfqd, struct cfq_queue *cfqq)
         * Otherwise, we do only if they are the last ones
         * in their service tree.
         */
-       if (service_tree->count == 1 && cfq_cfqq_sync(cfqq))
+       if (service_tree->count == 1 && cfq_cfqq_sync(cfqq) &&
+          !cfq_io_thinktime_big(cfqd, &service_tree->ttime, false))
                return true;
        cfq_log_cfqq(cfqd, cfqq, "Not idling. st->count:%d",
                        service_tree->count);
@@ -2022,10 +2025,10 @@ static void cfq_arm_slice_timer(struct cfq_data *cfqd)
         * slice, then don't idle. This avoids overrunning the allotted
         * time slice.
         */
-       if (sample_valid(cic->ttime_samples) &&
-           (cfqq->slice_end - jiffies < cic->ttime_mean)) {
+       if (sample_valid(cic->ttime.ttime_samples) &&
+           (cfqq->slice_end - jiffies < cic->ttime.ttime_mean)) {
                cfq_log_cfqq(cfqd, cfqq, "Not idling. think_time:%lu",
-                            cic->ttime_mean);
+                            cic->ttime.ttime_mean);
                return;
        }
 
@@ -2381,8 +2384,9 @@ static struct cfq_queue *cfq_select_queue(struct cfq_data *cfqd)
         * this group, wait for requests to complete.
         */
 check_group_idle:
-       if (cfqd->cfq_group_idle && cfqq->cfqg->nr_cfqq == 1
-           && cfqq->cfqg->dispatched) {
+       if (cfqd->cfq_group_idle && cfqq->cfqg->nr_cfqq == 1 &&
+           cfqq->cfqg->dispatched &&
+           !cfq_io_thinktime_big(cfqd, &cfqq->cfqg->ttime, true)) {
                cfqq = NULL;
                goto keep_queue;
        }
@@ -2833,7 +2837,7 @@ cfq_alloc_io_context(struct cfq_data *cfqd, gfp_t gfp_mask)
        cic = kmem_cache_alloc_node(cfq_ioc_pool, gfp_mask | __GFP_ZERO,
                                                        cfqd->queue->node);
        if (cic) {
-               cic->last_end_request = jiffies;
+               cic->ttime.last_end_request = jiffies;
                INIT_LIST_HEAD(&cic->queue_list);
                INIT_HLIST_NODE(&cic->cic_list);
                cic->dtor = cfq_free_io_context;
@@ -2883,7 +2887,6 @@ static void cfq_init_prio_data(struct cfq_queue *cfqq, struct io_context *ioc)
         * elevate the priority of this queue
         */
        cfqq->org_ioprio = cfqq->ioprio;
-       cfqq->org_ioprio_class = cfqq->ioprio_class;
        cfq_clear_cfqq_prio_changed(cfqq);
 }
 
@@ -3221,14 +3224,28 @@ err:
 }
 
 static void
-cfq_update_io_thinktime(struct cfq_data *cfqd, struct cfq_io_context *cic)
+__cfq_update_io_thinktime(struct cfq_ttime *ttime, unsigned long slice_idle)
 {
-       unsigned long elapsed = jiffies - cic->last_end_request;
-       unsigned long ttime = min(elapsed, 2UL * cfqd->cfq_slice_idle);
+       unsigned long elapsed = jiffies - ttime->last_end_request;
+       elapsed = min(elapsed, 2UL * slice_idle);
 
-       cic->ttime_samples = (7*cic->ttime_samples + 256) / 8;
-       cic->ttime_total = (7*cic->ttime_total + 256*ttime) / 8;
-       cic->ttime_mean = (cic->ttime_total + 128) / cic->ttime_samples;
+       ttime->ttime_samples = (7*ttime->ttime_samples + 256) / 8;
+       ttime->ttime_total = (7*ttime->ttime_total + 256*elapsed) / 8;
+       ttime->ttime_mean = (ttime->ttime_total + 128) / ttime->ttime_samples;
+}
+
+static void
+cfq_update_io_thinktime(struct cfq_data *cfqd, struct cfq_queue *cfqq,
+       struct cfq_io_context *cic)
+{
+       if (cfq_cfqq_sync(cfqq)) {
+               __cfq_update_io_thinktime(&cic->ttime, cfqd->cfq_slice_idle);
+               __cfq_update_io_thinktime(&cfqq->service_tree->ttime,
+                       cfqd->cfq_slice_idle);
+       }
+#ifdef CONFIG_CFQ_GROUP_IOSCHED
+       __cfq_update_io_thinktime(&cfqq->cfqg->ttime, cfqd->cfq_group_idle);
+#endif
 }
 
 static void
@@ -3277,8 +3294,8 @@ cfq_update_idle_window(struct cfq_data *cfqd, struct cfq_queue *cfqq,
        else if (!atomic_read(&cic->ioc->nr_tasks) || !cfqd->cfq_slice_idle ||
            (!cfq_cfqq_deep(cfqq) && CFQQ_SEEKY(cfqq)))
                enable_idle = 0;
-       else if (sample_valid(cic->ttime_samples)) {
-               if (cic->ttime_mean > cfqd->cfq_slice_idle)
+       else if (sample_valid(cic->ttime.ttime_samples)) {
+               if (cic->ttime.ttime_mean > cfqd->cfq_slice_idle)
                        enable_idle = 0;
                else
                        enable_idle = 1;
@@ -3339,13 +3356,6 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
            RB_EMPTY_ROOT(&cfqq->sort_list))
                return true;
 
-       /*
-        * So both queues are sync. Let the new request get disk time if
-        * it's a metadata request and the current queue is doing regular IO.
-        */
-       if ((rq->cmd_flags & REQ_META) && !cfqq->meta_pending)
-               return true;
-
        /*
         * Allow an RT request to pre-empt an ongoing non-RT cfqq timeslice.
         */
@@ -3410,10 +3420,8 @@ cfq_rq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq,
        struct cfq_io_context *cic = RQ_CIC(rq);
 
        cfqd->rq_queued++;
-       if (rq->cmd_flags & REQ_META)
-               cfqq->meta_pending++;
 
-       cfq_update_io_thinktime(cfqd, cic);
+       cfq_update_io_thinktime(cfqd, cfqq, cic);
        cfq_update_io_seektime(cfqd, cfqq, rq);
        cfq_update_idle_window(cfqd, cfqq, cic);
 
@@ -3520,12 +3528,16 @@ static bool cfq_should_wait_busy(struct cfq_data *cfqd, struct cfq_queue *cfqq)
        if (cfqq->cfqg->nr_cfqq > 1)
                return false;
 
+       /* the only queue in the group, but think time is big */
+       if (cfq_io_thinktime_big(cfqd, &cfqq->cfqg->ttime, true))
+               return false;
+
        if (cfq_slice_used(cfqq))
                return true;
 
        /* if slice left is less than think time, wait busy */
-       if (cic && sample_valid(cic->ttime_samples)
-           && (cfqq->slice_end - jiffies < cic->ttime_mean))
+       if (cic && sample_valid(cic->ttime.ttime_samples)
+           && (cfqq->slice_end - jiffies < cic->ttime.ttime_mean))
                return true;
 
        /*
@@ -3566,11 +3578,24 @@ static void cfq_completed_request(struct request_queue *q, struct request *rq)
        cfqd->rq_in_flight[cfq_cfqq_sync(cfqq)]--;
 
        if (sync) {
-               RQ_CIC(rq)->last_end_request = now;
+               struct cfq_rb_root *service_tree;
+
+               RQ_CIC(rq)->ttime.last_end_request = now;
+
+               if (cfq_cfqq_on_rr(cfqq))
+                       service_tree = cfqq->service_tree;
+               else
+                       service_tree = service_tree_for(cfqq->cfqg,
+                               cfqq_prio(cfqq), cfqq_type(cfqq));
+               service_tree->ttime.last_end_request = now;
                if (!time_after(rq->start_time + cfqd->cfq_fifo_expire[1], now))
                        cfqd->last_delayed_sync = now;
        }
 
+#ifdef CONFIG_CFQ_GROUP_IOSCHED
+       cfqq->cfqg->ttime.last_end_request = now;
+#endif
+
        /*
         * If this is the active queue, check if it needs to be expired,
         * or if we want to idle in case it has no pending requests.
@@ -3616,30 +3641,6 @@ static void cfq_completed_request(struct request_queue *q, struct request *rq)
                cfq_schedule_dispatch(cfqd);
 }
 
-/*
- * we temporarily boost lower priority queues if they are holding fs exclusive
- * resources. they are boosted to normal prio (CLASS_BE/4)
- */
-static void cfq_prio_boost(struct cfq_queue *cfqq)
-{
-       if (has_fs_excl()) {
-               /*
-                * boost idle prio on transactions that would lock out other
-                * users of the filesystem
-                */
-               if (cfq_class_idle(cfqq))
-                       cfqq->ioprio_class = IOPRIO_CLASS_BE;
-               if (cfqq->ioprio > IOPRIO_NORM)
-                       cfqq->ioprio = IOPRIO_NORM;
-       } else {
-               /*
-                * unboost the queue (if needed)
-                */
-               cfqq->ioprio_class = cfqq->org_ioprio_class;
-               cfqq->ioprio = cfqq->org_ioprio;
-       }
-}
-
 static inline int __cfq_may_queue(struct cfq_queue *cfqq)
 {
        if (cfq_cfqq_wait_request(cfqq) && !cfq_cfqq_must_alloc_slice(cfqq)) {
@@ -3670,7 +3671,6 @@ static int cfq_may_queue(struct request_queue *q, int rw)
        cfqq = cic_to_cfqq(cic, rw_is_sync(rw));
        if (cfqq) {
                cfq_init_prio_data(cfqq, cic->ioc);
-               cfq_prio_boost(cfqq);
 
                return __cfq_may_queue(cfqq);
        }
index cc3eb78..7b72502 100644 (file)
@@ -208,19 +208,6 @@ static int compat_blkpg_ioctl(struct block_device *bdev, fmode_t mode,
 #define BLKBSZSET_32           _IOW(0x12, 113, int)
 #define BLKGETSIZE64_32                _IOR(0x12, 114, int)
 
-struct compat_floppy_struct {
-       compat_uint_t   size;
-       compat_uint_t   sect;
-       compat_uint_t   head;
-       compat_uint_t   track;
-       compat_uint_t   stretch;
-       unsigned char   gap;
-       unsigned char   rate;
-       unsigned char   spec1;
-       unsigned char   fmt_gap;
-       const compat_caddr_t name;
-};
-
 struct compat_floppy_drive_params {
        char            cmos;
        compat_ulong_t  max_dtr;
@@ -288,7 +275,6 @@ struct compat_floppy_write_errors {
 
 #define FDSETPRM32 _IOW(2, 0x42, struct compat_floppy_struct)
 #define FDDEFPRM32 _IOW(2, 0x43, struct compat_floppy_struct)
-#define FDGETPRM32 _IOR(2, 0x04, struct compat_floppy_struct)
 #define FDSETDRVPRM32 _IOW(2, 0x90, struct compat_floppy_drive_params)
 #define FDGETDRVPRM32 _IOR(2, 0x11, struct compat_floppy_drive_params)
 #define FDGETDRVSTAT32 _IOR(2, 0x12, struct compat_floppy_drive_struct)
index 5139c0e..c644137 100644 (file)
@@ -77,10 +77,8 @@ static void
 deadline_add_rq_rb(struct deadline_data *dd, struct request *rq)
 {
        struct rb_root *root = deadline_rb_root(dd, rq);
-       struct request *__alias;
 
-       while (unlikely(__alias = elv_rb_add(root, rq)))
-               deadline_move_request(dd, __alias);
+       elv_rb_add(root, rq);
 }
 
 static inline void
index b0b38ce..a3b64bc 100644 (file)
@@ -353,7 +353,7 @@ static struct request *elv_rqhash_find(struct request_queue *q, sector_t offset)
  * RB-tree support functions for inserting/lookup/removal of requests
  * in a sorted RB tree.
  */
-struct request *elv_rb_add(struct rb_root *root, struct request *rq)
+void elv_rb_add(struct rb_root *root, struct request *rq)
 {
        struct rb_node **p = &root->rb_node;
        struct rb_node *parent = NULL;
@@ -365,15 +365,12 @@ struct request *elv_rb_add(struct rb_root *root, struct request *rq)
 
                if (blk_rq_pos(rq) < blk_rq_pos(__rq))
                        p = &(*p)->rb_left;
-               else if (blk_rq_pos(rq) > blk_rq_pos(__rq))
+               else if (blk_rq_pos(rq) >= blk_rq_pos(__rq))
                        p = &(*p)->rb_right;
-               else
-                       return __rq;
        }
 
        rb_link_node(&rq->rb_node, parent, p);
        rb_insert_color(&rq->rb_node, root);
-       return NULL;
 }
 EXPORT_SYMBOL(elv_rb_add);
 
index 6024b82..5cb51c5 100644 (file)
@@ -602,7 +602,7 @@ void add_disk(struct gendisk *disk)
        disk->major = MAJOR(devt);
        disk->first_minor = MINOR(devt);
 
-       /* Register BDI before referencing it from bdev */ 
+       /* Register BDI before referencing it from bdev */
        bdi = &disk->queue->backing_dev_info;
        bdi_register_dev(bdi, disk_devt(disk));
 
@@ -1140,7 +1140,7 @@ static int diskstats_show(struct seq_file *seqf, void *v)
                                "wsect wuse running use aveq"
                                "\n\n");
        */
+
        disk_part_iter_init(&piter, gp, DISK_PITER_INCL_EMPTY_PART0);
        while ((hd = disk_part_iter_next(&piter))) {
                cpu = part_stat_lock();
@@ -1164,7 +1164,7 @@ static int diskstats_show(struct seq_file *seqf, void *v)
                        );
        }
        disk_part_iter_exit(&piter);
+
        return 0;
 }
 
@@ -1492,30 +1492,32 @@ void disk_unblock_events(struct gendisk *disk)
 }
 
 /**
- * disk_check_events - schedule immediate event checking
- * @disk: disk to check events for
+ * disk_flush_events - schedule immediate event checking and flushing
+ * @disk: disk to check and flush events for
+ * @mask: events to flush
  *
- * Schedule immediate event checking on @disk if not blocked.
+ * Schedule immediate event checking on @disk if not blocked.  Events in
+ * @mask are scheduled to be cleared from the driver.  Note that this
+ * doesn't clear the events from @disk->ev.
  *
  * CONTEXT:
- * Don't care.  Safe to call from irq context.
+ * If @mask is non-zero must be called with bdev->bd_mutex held.
  */
-void disk_check_events(struct gendisk *disk)
+void disk_flush_events(struct gendisk *disk, unsigned int mask)
 {
        struct disk_events *ev = disk->ev;
-       unsigned long flags;
 
        if (!ev)
                return;
 
-       spin_lock_irqsave(&ev->lock, flags);
+       spin_lock_irq(&ev->lock);
+       ev->clearing |= mask;
        if (!ev->block) {
                cancel_delayed_work(&ev->dwork);
                queue_delayed_work(system_nrt_wq, &ev->dwork, 0);
        }
-       spin_unlock_irqrestore(&ev->lock, flags);
+       spin_unlock_irq(&ev->lock);
 }
-EXPORT_SYMBOL_GPL(disk_check_events);
 
 /**
  * disk_clear_events - synchronously check, clear and return pending events
@@ -1705,7 +1707,7 @@ static int disk_events_set_dfl_poll_msecs(const char *val,
        mutex_lock(&disk_events_mutex);
 
        list_for_each_entry(ev, &disk_events, node)
-               disk_check_events(ev->disk);
+               disk_flush_events(ev->disk, 0);
 
        mutex_unlock(&disk_events_mutex);
 
index 75afa75..ca3e6be 100644 (file)
@@ -313,6 +313,7 @@ config PATA_AMD
 
 config PATA_ARASAN_CF
        tristate "ARASAN CompactFlash PATA Controller Support"
+       depends on DMADEVICES
        select DMA_ENGINE
        help
          Say Y here to support the ARASAN CompactFlash PATA controller
index ae22be4..3bc8c79 100644 (file)
@@ -135,8 +135,8 @@ static int acard_ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg
 
        if (mesg.event & PM_EVENT_SUSPEND &&
            hpriv->flags & AHCI_HFLAG_NO_SUSPEND) {
-               dev_printk(KERN_ERR, &pdev->dev,
-                          "BIOS update required for suspend/resume\n");
+               dev_err(&pdev->dev,
+                       "BIOS update required for suspend/resume\n");
                return -EIO;
        }
 
@@ -187,7 +187,7 @@ static int acard_ahci_configure_dma_masks(struct pci_dev *pdev, int using_dac)
                if (rc) {
                        rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
                        if (rc) {
-                               dev_printk(KERN_ERR, &pdev->dev,
+                               dev_err(&pdev->dev,
                                           "64-bit DMA enable failed\n");
                                return rc;
                        }
@@ -195,14 +195,13 @@ static int acard_ahci_configure_dma_masks(struct pci_dev *pdev, int using_dac)
        } else {
                rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
                if (rc) {
-                       dev_printk(KERN_ERR, &pdev->dev,
-                                  "32-bit DMA enable failed\n");
+                       dev_err(&pdev->dev, "32-bit DMA enable failed\n");
                        return rc;
                }
                rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
                if (rc) {
-                       dev_printk(KERN_ERR, &pdev->dev,
-                                  "32-bit consistent DMA enable failed\n");
+                       dev_err(&pdev->dev,
+                               "32-bit consistent DMA enable failed\n");
                        return rc;
                }
        }
@@ -343,14 +342,12 @@ static int acard_ahci_port_start(struct ata_port *ap)
                if (cmd & PORT_CMD_FBSCP)
                        pp->fbs_supported = true;
                else if (hpriv->flags & AHCI_HFLAG_YES_FBS) {
-                       dev_printk(KERN_INFO, dev,
-                                  "port %d can do FBS, forcing FBSCP\n",
-                                  ap->port_no);
+                       dev_info(dev, "port %d can do FBS, forcing FBSCP\n",
+                                ap->port_no);
                        pp->fbs_supported = true;
                } else
-                       dev_printk(KERN_WARNING, dev,
-                                  "port %d is not capable of FBS\n",
-                                  ap->port_no);
+                       dev_warn(dev, "port %d is not capable of FBS\n",
+                                ap->port_no);
        }
 
        if (pp->fbs_supported) {
@@ -406,7 +403,6 @@ static int acard_ahci_port_start(struct ata_port *ap)
 
 static int acard_ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
-       static int printed_version;
        unsigned int board_id = ent->driver_data;
        struct ata_port_info pi = acard_ahci_port_info[board_id];
        const struct ata_port_info *ppi[] = { &pi, NULL };
@@ -419,8 +415,7 @@ static int acard_ahci_init_one(struct pci_dev *pdev, const struct pci_device_id
 
        WARN_ON((int)ATA_MAX_QUEUE > AHCI_MAX_CMDS);
 
-       if (!printed_version++)
-               dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+       ata_print_version_once(&pdev->dev, DRV_VERSION);
 
        /* acquire resources */
        rc = pcim_enable_device(pdev);
index 71afe03..fb7b90b 100644 (file)
@@ -79,8 +79,6 @@ enum board_ids {
 };
 
 static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
-static int ahci_sb600_softreset(struct ata_link *link, unsigned int *class,
-                         unsigned long deadline);
 static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,
                                 unsigned long deadline);
 static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,
@@ -104,12 +102,6 @@ static struct ata_port_operations ahci_p5wdh_ops = {
        .hardreset              = ahci_p5wdh_hardreset,
 };
 
-static struct ata_port_operations ahci_sb600_ops = {
-       .inherits               = &ahci_ops,
-       .softreset              = ahci_sb600_softreset,
-       .pmp_softreset          = ahci_sb600_softreset,
-};
-
 #define AHCI_HFLAGS(flags)     .private_data   = (void *)(flags)
 
 static const struct ata_port_info ahci_port_info[] = {
@@ -188,7 +180,7 @@ static const struct ata_port_info ahci_port_info[] = {
                .flags          = AHCI_FLAG_COMMON,
                .pio_mask       = ATA_PIO4,
                .udma_mask      = ATA_UDMA6,
-               .port_ops       = &ahci_sb600_ops,
+               .port_ops       = &ahci_pmp_retry_srst_ops,
        },
        [board_ahci_sb700] =    /* for SB700 and SB800 */
        {
@@ -196,7 +188,7 @@ static const struct ata_port_info ahci_port_info[] = {
                .flags          = AHCI_FLAG_COMMON,
                .pio_mask       = ATA_PIO4,
                .udma_mask      = ATA_UDMA6,
-               .port_ops       = &ahci_sb600_ops,
+               .port_ops       = &ahci_pmp_retry_srst_ops,
        },
        [board_ahci_vt8251] =
        {
@@ -267,6 +259,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
        { PCI_VDEVICE(INTEL, 0x1e05), board_ahci }, /* Panther Point RAID */
        { PCI_VDEVICE(INTEL, 0x1e06), board_ahci }, /* Panther Point RAID */
        { PCI_VDEVICE(INTEL, 0x1e07), board_ahci }, /* Panther Point RAID */
+       { PCI_VDEVICE(INTEL, 0x1e0e), board_ahci }, /* Panther Point RAID */
 
        /* JMicron 360/1/3/5/6, match class to avoid IDE function */
        { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
@@ -502,55 +495,6 @@ static void ahci_pci_init_controller(struct ata_host *host)
        ahci_init_controller(host);
 }
 
-static int ahci_sb600_check_ready(struct ata_link *link)
-{
-       void __iomem *port_mmio = ahci_port_base(link->ap);
-       u8 status = readl(port_mmio + PORT_TFDATA) & 0xFF;
-       u32 irq_status = readl(port_mmio + PORT_IRQ_STAT);
-
-       /*
-        * There is no need to check TFDATA if BAD PMP is found due to HW bug,
-        * which can save timeout delay.
-        */
-       if (irq_status & PORT_IRQ_BAD_PMP)
-               return -EIO;
-
-       return ata_check_ready(status);
-}
-
-static int ahci_sb600_softreset(struct ata_link *link, unsigned int *class,
-                               unsigned long deadline)
-{
-       struct ata_port *ap = link->ap;
-       void __iomem *port_mmio = ahci_port_base(ap);
-       int pmp = sata_srst_pmp(link);
-       int rc;
-       u32 irq_sts;
-
-       DPRINTK("ENTER\n");
-
-       rc = ahci_do_softreset(link, class, pmp, deadline,
-                              ahci_sb600_check_ready);
-
-       /*
-        * Soft reset fails on some ATI chips with IPMS set when PMP
-        * is enabled but SATA HDD/ODD is connected to SATA port,
-        * do soft reset again to port 0.
-        */
-       if (rc == -EIO) {
-               irq_sts = readl(port_mmio + PORT_IRQ_STAT);
-               if (irq_sts & PORT_IRQ_BAD_PMP) {
-                       ata_link_printk(link, KERN_WARNING,
-                                       "applying SB600 PMP SRST workaround "
-                                       "and retrying\n");
-                       rc = ahci_do_softreset(link, class, 0, deadline,
-                                              ahci_check_ready);
-               }
-       }
-
-       return rc;
-}
-
 static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,
                                 unsigned long deadline)
 {
@@ -629,8 +573,8 @@ static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
 
        if (mesg.event & PM_EVENT_SUSPEND &&
            hpriv->flags & AHCI_HFLAG_NO_SUSPEND) {
-               dev_printk(KERN_ERR, &pdev->dev,
-                          "BIOS update required for suspend/resume\n");
+               dev_err(&pdev->dev,
+                       "BIOS update required for suspend/resume\n");
                return -EIO;
        }
 
@@ -681,22 +625,21 @@ static int ahci_configure_dma_masks(struct pci_dev *pdev, int using_dac)
                if (rc) {
                        rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
                        if (rc) {
-                               dev_printk(KERN_ERR, &pdev->dev,
-                                          "64-bit DMA enable failed\n");
+                               dev_err(&pdev->dev,
+                                       "64-bit DMA enable failed\n");
                                return rc;
                        }
                }
        } else {
                rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
                if (rc) {
-                       dev_printk(KERN_ERR, &pdev->dev,
-                                  "32-bit DMA enable failed\n");
+                       dev_err(&pdev->dev, "32-bit DMA enable failed\n");
                        return rc;
                }
                rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
                if (rc) {
-                       dev_printk(KERN_ERR, &pdev->dev,
-                                  "32-bit consistent DMA enable failed\n");
+                       dev_err(&pdev->dev,
+                               "32-bit consistent DMA enable failed\n");
                        return rc;
                }
        }
@@ -759,8 +702,8 @@ static void ahci_p5wdh_workaround(struct ata_host *host)
            dmi_check_system(sysids)) {
                struct ata_port *ap = host->ports[1];
 
-               dev_printk(KERN_INFO, &pdev->dev, "enabling ASUS P5W DH "
-                          "Deluxe on-board SIMG4726 workaround\n");
+               dev_info(&pdev->dev,
+                        "enabling ASUS P5W DH Deluxe on-board SIMG4726 workaround\n");
 
                ap->ops = &ahci_p5wdh_ops;
                ap->link.flags |= ATA_LFLAG_NO_SRST | ATA_LFLAG_ASSUME_ATA;
@@ -811,6 +754,18 @@ static bool ahci_sb600_enable_64bit(struct pci_dev *pdev)
                                DMI_MATCH(DMI_BOARD_NAME, "MS-7376"),
                        },
                },
+               /*
+                * All BIOS versions for the Asus M3A support 64bit DMA.
+                * (all release versions from 0301 to 1206 were tested)
+                */
+               {
+                       .ident = "ASUS M3A",
+                       .matches = {
+                               DMI_MATCH(DMI_BOARD_VENDOR,
+                                         "ASUSTeK Computer INC."),
+                               DMI_MATCH(DMI_BOARD_NAME, "M3A"),
+                       },
+               },
                { }
        };
        const struct dmi_system_id *match;
@@ -831,14 +786,14 @@ static bool ahci_sb600_enable_64bit(struct pci_dev *pdev)
        if (strcmp(buf, match->driver_data) >= 0)
                goto enable_64bit;
        else {
-               dev_printk(KERN_WARNING, &pdev->dev, "%s: BIOS too old, "
-                          "forcing 32bit DMA, update BIOS\n", match->ident);
+               dev_warn(&pdev->dev,
+                        "%s: BIOS too old, forcing 32bit DMA, update BIOS\n",
+                        match->ident);
                return false;
        }
 
 enable_64bit:
-       dev_printk(KERN_WARNING, &pdev->dev, "%s: enabling 64bit DMA\n",
-                  match->ident);
+       dev_warn(&pdev->dev, "%s: enabling 64bit DMA\n", match->ident);
        return true;
 }
 
@@ -1041,9 +996,8 @@ static void ahci_gtf_filter_workaround(struct ata_host *host)
                return;
 
        filter = (unsigned long)dmi->driver_data;
-       dev_printk(KERN_INFO, host->dev,
-                  "applying extra ACPI _GTF filter 0x%x for %s\n",
-                  filter, dmi->ident);
+       dev_info(host->dev, "applying extra ACPI _GTF filter 0x%x for %s\n",
+                filter, dmi->ident);
 
        for (i = 0; i < host->n_ports; i++) {
                struct ata_port *ap = host->ports[i];
@@ -1062,7 +1016,6 @@ static inline void ahci_gtf_filter_workaround(struct ata_host *host)
 
 static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
-       static int printed_version;
        unsigned int board_id = ent->driver_data;
        struct ata_port_info pi = ahci_port_info[board_id];
        const struct ata_port_info *ppi[] = { &pi, NULL };
@@ -1075,8 +1028,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 
        WARN_ON((int)ATA_MAX_QUEUE > AHCI_MAX_CMDS);
 
-       if (!printed_version++)
-               dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+       ata_print_version_once(&pdev->dev, DRV_VERSION);
 
        /* The AHCI driver can only drive the SATA ports, the PATA driver
           can drive them all so if both drivers are selected make sure
@@ -1099,8 +1051,8 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
         * that for SAS drives they're out of luck.
         */
        if (pdev->vendor == PCI_VENDOR_ID_PROMISE)
-               dev_printk(KERN_INFO, &pdev->dev, "PDC42819 "
-                          "can only drive SATA devices with this driver\n");
+               dev_info(&pdev->dev,
+                        "PDC42819 can only drive SATA devices with this driver\n");
 
        /* acquire resources */
        rc = pcim_enable_device(pdev);
@@ -1126,8 +1078,8 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
                 */
                pci_read_config_byte(pdev, ICH_MAP, &map);
                if (map & 0x3) {
-                       dev_printk(KERN_INFO, &pdev->dev, "controller is in "
-                                  "combined mode, can't enable AHCI mode\n");
+                       dev_info(&pdev->dev,
+                                "controller is in combined mode, can't enable AHCI mode\n");
                        return -ENODEV;
                }
        }
@@ -1184,8 +1136,8 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 
        if (ahci_broken_suspend(pdev)) {
                hpriv->flags |= AHCI_HFLAG_NO_SUSPEND;
-               dev_printk(KERN_WARNING, &pdev->dev,
-                          "BIOS update required for suspend/resume\n");
+               dev_warn(&pdev->dev,
+                        "BIOS update required for suspend/resume\n");
        }
 
        if (ahci_broken_online(pdev)) {
index 12c5282..b175000 100644 (file)
@@ -312,6 +312,7 @@ extern struct device_attribute *ahci_sdev_attrs[];
        .sdev_attrs             = ahci_sdev_attrs
 
 extern struct ata_port_operations ahci_ops;
+extern struct ata_port_operations ahci_pmp_retry_srst_ops;
 
 void ahci_fill_cmd_slot(struct ahci_port_priv *pp, unsigned int tag,
                        u32 opts);
index 721d38b..7df56ec 100644 (file)
@@ -81,14 +81,13 @@ static int generic_set_mode(struct ata_link *link, struct ata_device **unused)
                                xfer_mask |= ata_xfer_mode2mask(XFER_MW_DMA_0);
                        }
 
-                       ata_dev_printk(dev, KERN_INFO, "configured for %s\n",
-                                      name);
+                       ata_dev_info(dev, "configured for %s\n", name);
 
                        dev->xfer_mode = ata_xfer_mask2mode(xfer_mask);
                        dev->xfer_shift = ata_xfer_mode2shift(dev->xfer_mode);
                        dev->flags &= ~ATA_DFLAG_PIO;
                } else {
-                       ata_dev_printk(dev, KERN_INFO, "configured for PIO\n");
+                       ata_dev_info(dev, "configured for PIO\n");
                        dev->xfer_mode = XFER_PIO_0;
                        dev->xfer_shift = ATA_SHIFT_PIO;
                        dev->flags |= ATA_DFLAG_PIO;
index 6f6e771..43107e9 100644 (file)
@@ -1225,8 +1225,9 @@ static int piix_pci_device_resume(struct pci_dev *pdev)
                 */
                rc = pci_reenable_device(pdev);
                if (rc)
-                       dev_printk(KERN_ERR, &pdev->dev, "failed to enable "
-                                  "device after resume (%d)\n", rc);
+                       dev_err(&pdev->dev,
+                               "failed to enable device after resume (%d)\n",
+                               rc);
        } else
                rc = ata_pci_device_do_resume(pdev);
 
@@ -1303,9 +1304,11 @@ static int __devinit piix_check_450nx_errata(struct pci_dev *ata_dev)
                        no_piix_dma = 2;
        }
        if (no_piix_dma)
-               dev_printk(KERN_WARNING, &ata_dev->dev, "450NX errata present, disabling IDE DMA.\n");
-       if (no_piix_dma == 2)
-               dev_printk(KERN_WARNING, &ata_dev->dev, "A BIOS update may resolve this.\n");
+               dev_warn(&ata_dev->dev,
+                        "450NX errata present, disabling IDE DMA%s\n",
+                        no_piix_dma == 2 ? " - a BIOS update may resolve this"
+                        : "");
+
        return no_piix_dma;
 }
 
@@ -1338,37 +1341,36 @@ static const int *__devinit piix_init_sata_map(struct pci_dev *pdev,
 
        map = map_db->map[map_value & map_db->mask];
 
-       dev_printk(KERN_INFO, &pdev->dev, "MAP [");
+       dev_info(&pdev->dev, "MAP [");
        for (i = 0; i < 4; i++) {
                switch (map[i]) {
                case RV:
                        invalid_map = 1;
-                       printk(" XX");
+                       pr_cont(" XX");
                        break;
 
                case NA:
-                       printk(" --");
+                       pr_cont(" --");
                        break;
 
                case IDE:
                        WARN_ON((i & 1) || map[i + 1] != IDE);
                        pinfo[i / 2] = piix_port_info[ich_pata_100];
                        i++;
-                       printk(" IDE IDE");
+                       pr_cont(" IDE IDE");
                        break;
 
                default:
-                       printk(" P%d", map[i]);
+                       pr_cont(" P%d", map[i]);
                        if (i & 1)
                                pinfo[i / 2].flags |= ATA_FLAG_SLAVE_POSS;
                        break;
                }
        }
-       printk(" ]\n");
+       pr_cont(" ]\n");
 
        if (invalid_map)
-               dev_printk(KERN_ERR, &pdev->dev,
-                          "invalid MAP value %u\n", map_value);
+               dev_err(&pdev->dev, "invalid MAP value %u\n", map_value);
 
        return map;
 }
@@ -1398,8 +1400,8 @@ static bool piix_no_sidpr(struct ata_host *host)
        if (pdev->vendor == PCI_VENDOR_ID_INTEL && pdev->device == 0x2920 &&
            pdev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG &&
            pdev->subsystem_device == 0xb049) {
-               dev_printk(KERN_WARNING, host->dev,
-                          "Samsung DB-P70 detected, disabling SIDPR\n");
+               dev_warn(host->dev,
+                        "Samsung DB-P70 detected, disabling SIDPR\n");
                return true;
        }
 
@@ -1451,8 +1453,8 @@ static int __devinit piix_init_sidpr(struct ata_host *host)
                piix_sidpr_scr_read(link0, SCR_CONTROL, &scontrol);
 
                if ((scontrol & 0xf00) != 0x300) {
-                       dev_printk(KERN_INFO, host->dev, "SCR access via "
-                                  "SIDPR is available but doesn't work\n");
+                       dev_info(host->dev,
+                                "SCR access via SIDPR is available but doesn't work\n");
                        return 0;
                }
        }
@@ -1501,8 +1503,7 @@ static void piix_iocfg_bit18_quirk(struct ata_host *host)
         * affected systems.
         */
        if (hpriv->saved_iocfg & (1 << 18)) {
-               dev_printk(KERN_INFO, &pdev->dev,
-                          "applying IOCFG bit18 quirk\n");
+               dev_info(&pdev->dev, "applying IOCFG bit18 quirk\n");
                pci_write_config_dword(pdev, PIIX_IOCFG,
                                       hpriv->saved_iocfg & ~(1 << 18));
        }
@@ -1561,7 +1562,6 @@ static bool piix_broken_system_poweroff(struct pci_dev *pdev)
 static int __devinit piix_init_one(struct pci_dev *pdev,
                                   const struct pci_device_id *ent)
 {
-       static int printed_version;
        struct device *dev = &pdev->dev;
        struct ata_port_info port_info[2];
        const struct ata_port_info *ppi[] = { &port_info[0], &port_info[1] };
@@ -1571,9 +1571,7 @@ static int __devinit piix_init_one(struct pci_dev *pdev,
        struct piix_host_priv *hpriv;
        int rc;
 
-       if (!printed_version++)
-               dev_printk(KERN_DEBUG, &pdev->dev,
-                          "version " DRV_VERSION "\n");
+       ata_print_version_once(&pdev->dev, DRV_VERSION);
 
        /* no hotplugging support for later devices (FIXME) */
        if (!in_module_init && ent->driver_data >= ich5_sata)
index 41223c7..3c92dbd 100644 (file)
@@ -82,6 +82,8 @@ static void ahci_pmp_attach(struct ata_port *ap);
 static void ahci_pmp_detach(struct ata_port *ap);
 static int ahci_softreset(struct ata_link *link, unsigned int *class,
                          unsigned long deadline);
+static int ahci_pmp_retry_softreset(struct ata_link *link, unsigned int *class,
+                         unsigned long deadline);
 static int ahci_hardreset(struct ata_link *link, unsigned int *class,
                          unsigned long deadline);
 static void ahci_postreset(struct ata_link *link, unsigned int *class);
@@ -178,6 +180,12 @@ struct ata_port_operations ahci_ops = {
 };
 EXPORT_SYMBOL_GPL(ahci_ops);
 
+struct ata_port_operations ahci_pmp_retry_srst_ops = {
+       .inherits               = &ahci_ops,
+       .softreset              = ahci_pmp_retry_softreset,
+};
+EXPORT_SYMBOL_GPL(ahci_pmp_retry_srst_ops);
+
 int ahci_em_messages = 1;
 EXPORT_SYMBOL_GPL(ahci_em_messages);
 module_param(ahci_em_messages, int, 0444);
@@ -286,10 +294,10 @@ static ssize_t ahci_read_em_buffer(struct device *dev,
        /* the count should not be larger than PAGE_SIZE */
        if (count > PAGE_SIZE) {
                if (printk_ratelimit())
-                       ata_port_printk(ap, KERN_WARNING,
-                                       "EM read buffer size too large: "
-                                       "buffer size %u, page size %lu\n",
-                                       hpriv->em_buf_sz, PAGE_SIZE);
+                       ata_port_warn(ap,
+                                     "EM read buffer size too large: "
+                                     "buffer size %u, page size %lu\n",
+                                     hpriv->em_buf_sz, PAGE_SIZE);
                count = PAGE_SIZE;
        }
 
@@ -410,51 +418,46 @@ void ahci_save_initial_config(struct device *dev,
 
        /* some chips have errata preventing 64bit use */
        if ((cap & HOST_CAP_64) && (hpriv->flags & AHCI_HFLAG_32BIT_ONLY)) {
-               dev_printk(KERN_INFO, dev,
-                          "controller can't do 64bit DMA, forcing 32bit\n");
+               dev_info(dev, "controller can't do 64bit DMA, forcing 32bit\n");
                cap &= ~HOST_CAP_64;
        }
 
        if ((cap & HOST_CAP_NCQ) && (hpriv->flags & AHCI_HFLAG_NO_NCQ)) {
-               dev_printk(KERN_INFO, dev,
-                          "controller can't do NCQ, turning off CAP_NCQ\n");
+               dev_info(dev, "controller can't do NCQ, turning off CAP_NCQ\n");
                cap &= ~HOST_CAP_NCQ;
        }
 
        if (!(cap & HOST_CAP_NCQ) && (hpriv->flags & AHCI_HFLAG_YES_NCQ)) {
-               dev_printk(KERN_INFO, dev,
-                          "controller can do NCQ, turning on CAP_NCQ\n");
+               dev_info(dev, "controller can do NCQ, turning on CAP_NCQ\n");
                cap |= HOST_CAP_NCQ;
        }
 
        if ((cap & HOST_CAP_PMP) && (hpriv->flags & AHCI_HFLAG_NO_PMP)) {
-               dev_printk(KERN_INFO, dev,
-                          "controller can't do PMP, turning off CAP_PMP\n");
+               dev_info(dev, "controller can't do PMP, turning off CAP_PMP\n");
                cap &= ~HOST_CAP_PMP;
        }
 
        if ((cap & HOST_CAP_SNTF) && (hpriv->flags & AHCI_HFLAG_NO_SNTF)) {
-               dev_printk(KERN_INFO, dev,
-                          "controller can't do SNTF, turning off CAP_SNTF\n");
+               dev_info(dev,
+                        "controller can't do SNTF, turning off CAP_SNTF\n");
                cap &= ~HOST_CAP_SNTF;
        }
 
        if (!(cap & HOST_CAP_FBS) && (hpriv->flags & AHCI_HFLAG_YES_FBS)) {
-               dev_printk(KERN_INFO, dev,
-                          "controller can do FBS, turning on CAP_FBS\n");
+               dev_info(dev, "controller can do FBS, turning on CAP_FBS\n");
                cap |= HOST_CAP_FBS;
        }
 
        if (force_port_map && port_map != force_port_map) {
-               dev_printk(KERN_INFO, dev, "forcing port_map 0x%x -> 0x%x\n",
-                          port_map, force_port_map);
+               dev_info(dev, "forcing port_map 0x%x -> 0x%x\n",
+                        port_map, force_port_map);
                port_map = force_port_map;
        }
 
        if (mask_port_map) {
-               dev_printk(KERN_WARNING, dev, "masking port_map 0x%x -> 0x%x\n",
-                          port_map,
-                          port_map & mask_port_map);
+               dev_warn(dev, "masking port_map 0x%x -> 0x%x\n",
+                       port_map,
+                       port_map & mask_port_map);
                port_map &= mask_port_map;
        }
 
@@ -470,10 +473,9 @@ void ahci_save_initial_config(struct device *dev,
                 * port_map and let it be generated from n_ports.
                 */
                if (map_ports > ahci_nr_ports(cap)) {
-                       dev_printk(KERN_WARNING, dev,
-                                  "implemented port map (0x%x) contains more "
-                                  "ports than nr_ports (%u), using nr_ports\n",
-                                  port_map, ahci_nr_ports(cap));
+                       dev_warn(dev,
+                                "implemented port map (0x%x) contains more ports than nr_ports (%u), using nr_ports\n",
+                                port_map, ahci_nr_ports(cap));
                        port_map = 0;
                }
        }
@@ -481,8 +483,7 @@ void ahci_save_initial_config(struct device *dev,
        /* fabricate port_map from cap.nr_ports */
        if (!port_map) {
                port_map = (1 << ahci_nr_ports(cap)) - 1;
-               dev_printk(KERN_WARNING, dev,
-                          "forcing PORTS_IMPL to 0x%x\n", port_map);
+               dev_warn(dev, "forcing PORTS_IMPL to 0x%x\n", port_map);
 
                /* write the fixed up value to the PI register */
                hpriv->saved_port_map = port_map;
@@ -822,8 +823,8 @@ int ahci_reset_controller(struct ata_host *host)
                                        HOST_RESET, 10, 1000);
 
                if (tmp & HOST_RESET) {
-                       dev_printk(KERN_ERR, host->dev,
-                                  "controller reset failed (0x%x)\n", tmp);
+                       dev_err(host->dev, "controller reset failed (0x%x)\n",
+                               tmp);
                        return -EIO;
                }
 
@@ -835,8 +836,7 @@ int ahci_reset_controller(struct ata_host *host)
                 */
                ahci_restore_initial_config(host);
        } else
-               dev_printk(KERN_INFO, host->dev,
-                          "skipping global host reset\n");
+               dev_info(host->dev, "skipping global host reset\n");
 
        return 0;
 }
@@ -1132,8 +1132,8 @@ static void ahci_dev_config(struct ata_device *dev)
 
        if (hpriv->flags & AHCI_HFLAG_SECT255) {
                dev->max_sectors = 255;
-               ata_dev_printk(dev, KERN_INFO,
-                              "SB600 AHCI: limiting to 255 sectors per cmd\n");
+               ata_dev_info(dev,
+                            "SB600 AHCI: limiting to 255 sectors per cmd\n");
        }
 }
 
@@ -1257,8 +1257,7 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class,
        /* prepare for SRST (AHCI-1.1 10.4.1) */
        rc = ahci_kick_engine(ap);
        if (rc && rc != -EOPNOTSUPP)
-               ata_link_printk(link, KERN_WARNING,
-                               "failed to reset engine (errno=%d)\n", rc);
+               ata_link_warn(link, "failed to reset engine (errno=%d)\n", rc);
 
        ata_tf_init(link->device, &tf);
 
@@ -1291,8 +1290,7 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class,
                 * be trusted.  Treat device readiness timeout as link
                 * offline.
                 */
-               ata_link_printk(link, KERN_INFO,
-                               "device not ready, treating as offline\n");
+               ata_link_info(link, "device not ready, treating as offline\n");
                *class = ATA_DEV_NONE;
        } else if (rc) {
                /* link occupied, -ENODEV too is an error */
@@ -1305,7 +1303,7 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class,
        return 0;
 
  fail:
-       ata_link_printk(link, KERN_ERR, "softreset failed (%s)\n", reason);
+       ata_link_err(link, "softreset failed (%s)\n", reason);
        return rc;
 }
 
@@ -1329,6 +1327,55 @@ static int ahci_softreset(struct ata_link *link, unsigned int *class,
 }
 EXPORT_SYMBOL_GPL(ahci_do_softreset);
 
+static int ahci_bad_pmp_check_ready(struct ata_link *link)
+{
+       void __iomem *port_mmio = ahci_port_base(link->ap);
+       u8 status = readl(port_mmio + PORT_TFDATA) & 0xFF;
+       u32 irq_status = readl(port_mmio + PORT_IRQ_STAT);
+
+       /*
+        * There is no need to check TFDATA if BAD PMP is found due to HW bug,
+        * which can save timeout delay.
+        */
+       if (irq_status & PORT_IRQ_BAD_PMP)
+               return -EIO;
+
+       return ata_check_ready(status);
+}
+
+int ahci_pmp_retry_softreset(struct ata_link *link, unsigned int *class,
+                               unsigned long deadline)
+{
+       struct ata_port *ap = link->ap;
+       void __iomem *port_mmio = ahci_port_base(ap);
+       int pmp = sata_srst_pmp(link);
+       int rc;
+       u32 irq_sts;
+
+       DPRINTK("ENTER\n");
+
+       rc = ahci_do_softreset(link, class, pmp, deadline,
+                              ahci_bad_pmp_check_ready);
+
+       /*
+        * Soft reset fails with IPMS set when PMP is enabled but
+        * SATA HDD/ODD is connected to SATA port, do soft reset
+        * again to port 0.
+        */
+       if (rc == -EIO) {
+               irq_sts = readl(port_mmio + PORT_IRQ_STAT);
+               if (irq_sts & PORT_IRQ_BAD_PMP) {
+                       ata_link_printk(link, KERN_WARNING,
+                                       "applying PMP SRST workaround "
+                                       "and retrying\n");
+                       rc = ahci_do_softreset(link, class, 0, deadline,
+                                              ahci_check_ready);
+               }
+       }
+
+       return rc;
+}
+
 static int ahci_hardreset(struct ata_link *link, unsigned int *class,
                          unsigned long deadline)
 {
@@ -1474,8 +1521,7 @@ static void ahci_fbs_dec_intr(struct ata_port *ap)
        }
 
        if (fbs & PORT_FBS_DEC)
-               dev_printk(KERN_ERR, ap->host->dev,
-                          "failed to clear device error\n");
+               dev_err(ap->host->dev, "failed to clear device error\n");
 }
 
 static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)
@@ -1713,8 +1759,8 @@ irqreturn_t ahci_interrupt(int irq, void *dev_instance)
                } else {
                        VPRINTK("port %u (no irq)\n", i);
                        if (ata_ratelimit())
-                               dev_printk(KERN_WARNING, host->dev,
-                                       "interrupt on disabled port %u\n", i);
+                               dev_warn(host->dev,
+                                        "interrupt on disabled port %u\n", i);
                }
 
                handled = 1;
@@ -1865,11 +1911,11 @@ static void ahci_enable_fbs(struct ata_port *ap)
        writel(fbs | PORT_FBS_EN, port_mmio + PORT_FBS);
        fbs = readl(port_mmio + PORT_FBS);
        if (fbs & PORT_FBS_EN) {
-               dev_printk(KERN_INFO, ap->host->dev, "FBS is enabled.\n");
+               dev_info(ap->host->dev, "FBS is enabled\n");
                pp->fbs_enabled = true;
                pp->fbs_last_dev = -1; /* initialization */
        } else
-               dev_printk(KERN_ERR, ap->host->dev, "Failed to enable FBS\n");
+               dev_err(ap->host->dev, "Failed to enable FBS\n");
 
        ahci_start_engine(ap);
 }
@@ -1897,9 +1943,9 @@ static void ahci_disable_fbs(struct ata_port *ap)
        writel(fbs & ~PORT_FBS_EN, port_mmio + PORT_FBS);
        fbs = readl(port_mmio + PORT_FBS);
        if (fbs & PORT_FBS_EN)
-               dev_printk(KERN_ERR, ap->host->dev, "Failed to disable FBS\n");
+               dev_err(ap->host->dev, "Failed to disable FBS\n");
        else {
-               dev_printk(KERN_INFO, ap->host->dev, "FBS is disabled.\n");
+               dev_info(ap->host->dev, "FBS is disabled\n");
                pp->fbs_enabled = false;
        }
 
@@ -1975,7 +2021,7 @@ static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg)
        if (rc == 0)
                ahci_power_down(ap);
        else {
-               ata_port_printk(ap, KERN_ERR, "%s (%d)\n", emsg, rc);
+               ata_port_err(ap, "%s (%d)\n", emsg, rc);
                ahci_start_port(ap);
        }
 
@@ -2003,14 +2049,12 @@ static int ahci_port_start(struct ata_port *ap)
                if (cmd & PORT_CMD_FBSCP)
                        pp->fbs_supported = true;
                else if (hpriv->flags & AHCI_HFLAG_YES_FBS) {
-                       dev_printk(KERN_INFO, dev,
-                                  "port %d can do FBS, forcing FBSCP\n",
-                                  ap->port_no);
+                       dev_info(dev, "port %d can do FBS, forcing FBSCP\n",
+                                ap->port_no);
                        pp->fbs_supported = true;
                } else
-                       dev_printk(KERN_WARNING, dev,
-                                  "port %d is not capable of FBS\n",
-                                  ap->port_no);
+                       dev_warn(dev, "port %d is not capable of FBS\n",
+                                ap->port_no);
        }
 
        if (pp->fbs_supported) {
@@ -2072,7 +2116,7 @@ static void ahci_port_stop(struct ata_port *ap)
        /* de-initialize port */
        rc = ahci_deinit_port(ap, &emsg);
        if (rc)
-               ata_port_printk(ap, KERN_WARNING, "%s (%d)\n", emsg, rc);
+               ata_port_warn(ap, "%s (%d)\n", emsg, rc);
 }
 
 void ahci_print_info(struct ata_host *host, const char *scc_s)
index a791b8c..e0a5b55 100644 (file)
@@ -332,25 +332,22 @@ int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *gtm)
 
        rc = -EINVAL;
        if (ACPI_FAILURE(status)) {
-               ata_port_printk(ap, KERN_ERR,
-                               "ACPI get timing mode failed (AE 0x%x)\n",
-                               status);
+               ata_port_err(ap, "ACPI get timing mode failed (AE 0x%x)\n",
+                            status);
                goto out_free;
        }
 
        out_obj = output.pointer;
        if (out_obj->type != ACPI_TYPE_BUFFER) {
-               ata_port_printk(ap, KERN_WARNING,
-                               "_GTM returned unexpected object type 0x%x\n",
-                               out_obj->type);
+               ata_port_warn(ap, "_GTM returned unexpected object type 0x%x\n",
+                             out_obj->type);
 
                goto out_free;
        }
 
        if (out_obj->buffer.length != sizeof(struct ata_acpi_gtm)) {
-               ata_port_printk(ap, KERN_ERR,
-                               "_GTM returned invalid length %d\n",
-                               out_obj->buffer.length);
+               ata_port_err(ap, "_GTM returned invalid length %d\n",
+                            out_obj->buffer.length);
                goto out_free;
        }
 
@@ -402,8 +399,8 @@ int ata_acpi_stm(struct ata_port *ap, const struct ata_acpi_gtm *stm)
        if (status == AE_NOT_FOUND)
                return -ENOENT;
        if (ACPI_FAILURE(status)) {
-               ata_port_printk(ap, KERN_ERR,
-                       "ACPI set timing mode failed (status=0x%x)\n", status);
+               ata_port_err(ap, "ACPI set timing mode failed (status=0x%x)\n",
+                            status);
                return -EINVAL;
        }
        return 0;
@@ -450,8 +447,8 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf)
        output.pointer = NULL;  /* ACPI-CA sets this; save/free it later */
 
        if (ata_msg_probe(ap))
-               ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER: port#: %d\n",
-                              __func__, ap->port_no);
+               ata_dev_dbg(dev, "%s: ENTER: port#: %d\n",
+                           __func__, ap->port_no);
 
        /* _GTF has no input parameters */
        status = acpi_evaluate_object(dev->acpi_handle, "_GTF", NULL, &output);
@@ -459,9 +456,8 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf)
 
        if (ACPI_FAILURE(status)) {
                if (status != AE_NOT_FOUND) {
-                       ata_dev_printk(dev, KERN_WARNING,
-                                      "_GTF evaluation failed (AE 0x%x)\n",
-                                      status);
+                       ata_dev_warn(dev, "_GTF evaluation failed (AE 0x%x)\n",
+                                    status);
                        rc = -EINVAL;
                }
                goto out_free;
@@ -469,27 +465,24 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf)
 
        if (!output.length || !output.pointer) {
                if (ata_msg_probe(ap))
-                       ata_dev_printk(dev, KERN_DEBUG, "%s: Run _GTF: "
-                               "length or ptr is NULL (0x%llx, 0x%p)\n",
-                               __func__,
-                               (unsigned long long)output.length,
-                               output.pointer);
+                       ata_dev_dbg(dev, "%s: Run _GTF: length or ptr is NULL (0x%llx, 0x%p)\n",
+                                   __func__,
+                                   (unsigned long long)output.length,
+                                   output.pointer);
                rc = -EINVAL;
                goto out_free;
        }
 
        if (out_obj->type != ACPI_TYPE_BUFFER) {
-               ata_dev_printk(dev, KERN_WARNING,
-                              "_GTF unexpected object type 0x%x\n",
-                              out_obj->type);
+               ata_dev_warn(dev, "_GTF unexpected object type 0x%x\n",
+                            out_obj->type);
                rc = -EINVAL;
                goto out_free;
        }
 
        if (out_obj->buffer.length % REGS_PER_GTF) {
-               ata_dev_printk(dev, KERN_WARNING,
-                              "unexpected _GTF length (%d)\n",
-                              out_obj->buffer.length);
+               ata_dev_warn(dev, "unexpected _GTF length (%d)\n",
+                            out_obj->buffer.length);
                rc = -EINVAL;
                goto out_free;
        }
@@ -499,9 +492,8 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf)
        if (gtf) {
                *gtf = (void *)out_obj->buffer.pointer;
                if (ata_msg_probe(ap))
-                       ata_dev_printk(dev, KERN_DEBUG,
-                                      "%s: returning gtf=%p, gtf_count=%d\n",
-                                      __func__, *gtf, rc);
+                       ata_dev_dbg(dev, "%s: returning gtf=%p, gtf_count=%d\n",
+                                   __func__, *gtf, rc);
        }
        return rc;
 
@@ -811,8 +803,8 @@ static int ata_acpi_push_id(struct ata_device *dev)
        union acpi_object in_params[1];
 
        if (ata_msg_probe(ap))
-               ata_dev_printk(dev, KERN_DEBUG, "%s: ix = %d, port#: %d\n",
-                              __func__, dev->devno, ap->port_no);
+               ata_dev_dbg(dev, "%s: ix = %d, port#: %d\n",
+                           __func__, dev->devno, ap->port_no);
 
        /* Give the drive Identify data to the drive via the _SDD method */
        /* _SDD: set up input parameters */
@@ -832,8 +824,7 @@ static int ata_acpi_push_id(struct ata_device *dev)
                return -ENOENT;
 
        if (ACPI_FAILURE(status)) {
-               ata_dev_printk(dev, KERN_WARNING,
-                              "ACPI _SDD failed (AE 0x%x)\n", status);
+               ata_dev_warn(dev, "ACPI _SDD failed (AE 0x%x)\n", status);
                return -EIO;
        }
 
@@ -983,8 +974,8 @@ int ata_acpi_on_devcfg(struct ata_device *dev)
        if (nr_executed) {
                rc = ata_dev_reread_id(dev, 0);
                if (rc < 0) {
-                       ata_dev_printk(dev, KERN_ERR, "failed to IDENTIFY "
-                                      "after ACPI commands\n");
+                       ata_dev_err(dev,
+                                   "failed to IDENTIFY after ACPI commands\n");
                        return rc;
                }
        }
@@ -1002,8 +993,7 @@ int ata_acpi_on_devcfg(struct ata_device *dev)
                return rc;
        }
 
-       ata_dev_printk(dev, KERN_WARNING,
-                      "ACPI: failed the second time, disabled\n");
+       ata_dev_warn(dev, "ACPI: failed the second time, disabled\n");
        dev->acpi_handle = NULL;
 
        /* We can safely continue if no _GTF command has been executed
index 000d03a..4a3a5ae 100644 (file)
@@ -335,8 +335,7 @@ void ata_force_cbl(struct ata_port *ap)
                        continue;
 
                ap->cbl = fe->param.cbl;
-               ata_port_printk(ap, KERN_NOTICE,
-                               "FORCE: cable set to %s\n", fe->param.name);
+               ata_port_notice(ap, "FORCE: cable set to %s\n", fe->param.name);
                return;
        }
 }
@@ -378,8 +377,7 @@ static void ata_force_link_limits(struct ata_link *link)
                /* only honor the first spd limit */
                if (!did_spd && fe->param.spd_limit) {
                        link->hw_sata_spd_limit = (1 << fe->param.spd_limit) - 1;
-                       ata_link_printk(link, KERN_NOTICE,
-                                       "FORCE: PHY spd limit set to %s\n",
+                       ata_link_notice(link, "FORCE: PHY spd limit set to %s\n",
                                        fe->param.name);
                        did_spd = true;
                }
@@ -387,7 +385,7 @@ static void ata_force_link_limits(struct ata_link *link)
                /* let lflags stack */
                if (fe->param.lflags) {
                        link->flags |= fe->param.lflags;
-                       ata_link_printk(link, KERN_NOTICE,
+                       ata_link_notice(link,
                                        "FORCE: link flag 0x%x forced -> 0x%x\n",
                                        fe->param.lflags, link->flags);
                }
@@ -442,8 +440,8 @@ static void ata_force_xfermask(struct ata_device *dev)
                        dev->pio_mask = pio_mask;
                }
 
-               ata_dev_printk(dev, KERN_NOTICE,
-                       "FORCE: xfer_mask set to %s\n", fe->param.name);
+               ata_dev_notice(dev, "FORCE: xfer_mask set to %s\n",
+                              fe->param.name);
                return;
        }
 }
@@ -486,8 +484,8 @@ static void ata_force_horkage(struct ata_device *dev)
                dev->horkage |= fe->param.horkage_on;
                dev->horkage &= ~fe->param.horkage_off;
 
-               ata_dev_printk(dev, KERN_NOTICE,
-                       "FORCE: horkage modified (%s)\n", fe->param.name);
+               ata_dev_notice(dev, "FORCE: horkage modified (%s)\n",
+                              fe->param.name);
        }
 }
 
@@ -711,8 +709,8 @@ u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev)
                sect = tf->lbal;
 
                if (!sect) {
-                       ata_dev_printk(dev, KERN_WARNING, "device reported "
-                                      "invalid CHS sector 0\n");
+                       ata_dev_warn(dev,
+                                    "device reported invalid CHS sector 0\n");
                        sect = 1; /* oh well */
                }
 
@@ -1230,8 +1228,9 @@ static int ata_read_native_max_address(struct ata_device *dev, u64 *max_sectors)
 
        err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
        if (err_mask) {
-               ata_dev_printk(dev, KERN_WARNING, "failed to read native "
-                              "max address (err_mask=0x%x)\n", err_mask);
+               ata_dev_warn(dev,
+                            "failed to read native max address (err_mask=0x%x)\n",
+                            err_mask);
                if (err_mask == AC_ERR_DEV && (tf.feature & ATA_ABORTED))
                        return -EACCES;
                return -EIO;
@@ -1292,8 +1291,9 @@ static int ata_set_max_sectors(struct ata_device *dev, u64 new_sectors)
 
        err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
        if (err_mask) {
-               ata_dev_printk(dev, KERN_WARNING, "failed to set "
-                              "max address (err_mask=0x%x)\n", err_mask);
+               ata_dev_warn(dev,
+                            "failed to set max address (err_mask=0x%x)\n",
+                            err_mask);
                if (err_mask == AC_ERR_DEV &&
                    (tf.feature & (ATA_ABORTED | ATA_IDNF)))
                        return -EACCES;
@@ -1336,8 +1336,8 @@ static int ata_hpa_resize(struct ata_device *dev)
                 * be unlocked, skip HPA resizing.
                 */
                if (rc == -EACCES || !unlock_hpa) {
-                       ata_dev_printk(dev, KERN_WARNING, "HPA support seems "
-                                      "broken, skipping HPA handling\n");
+                       ata_dev_warn(dev,
+                                    "HPA support seems broken, skipping HPA handling\n");
                        dev->horkage |= ATA_HORKAGE_BROKEN_HPA;
 
                        /* we can continue if device aborted the command */
@@ -1355,14 +1355,13 @@ static int ata_hpa_resize(struct ata_device *dev)
                        return 0;
 
                if (native_sectors > sectors)
-                       ata_dev_printk(dev, KERN_INFO,
+                       ata_dev_info(dev,
                                "HPA detected: current %llu, native %llu\n",
                                (unsigned long long)sectors,
                                (unsigned long long)native_sectors);
                else if (native_sectors < sectors)
-                       ata_dev_printk(dev, KERN_WARNING,
-                               "native sectors (%llu) is smaller than "
-                               "sectors (%llu)\n",
+                       ata_dev_warn(dev,
+                               "native sectors (%llu) is smaller than sectors (%llu)\n",
                                (unsigned long long)native_sectors,
                                (unsigned long long)sectors);
                return 0;
@@ -1372,10 +1371,10 @@ static int ata_hpa_resize(struct ata_device *dev)
        rc = ata_set_max_sectors(dev, native_sectors);
        if (rc == -EACCES) {
                /* if device aborted the command, skip HPA resizing */
-               ata_dev_printk(dev, KERN_WARNING, "device aborted resize "
-                              "(%llu -> %llu), skipping HPA handling\n",
-                              (unsigned long long)sectors,
-                              (unsigned long long)native_sectors);
+               ata_dev_warn(dev,
+                            "device aborted resize (%llu -> %llu), skipping HPA handling\n",
+                            (unsigned long long)sectors,
+                            (unsigned long long)native_sectors);
                dev->horkage |= ATA_HORKAGE_BROKEN_HPA;
                return 0;
        } else if (rc)
@@ -1384,14 +1383,14 @@ static int ata_hpa_resize(struct ata_device *dev)
        /* re-read IDENTIFY data */
        rc = ata_dev_reread_id(dev, 0);
        if (rc) {
-               ata_dev_printk(dev, KERN_ERR, "failed to re-read IDENTIFY "
-                              "data after HPA resizing\n");
+               ata_dev_err(dev,
+                           "failed to re-read IDENTIFY data after HPA resizing\n");
                return rc;
        }
 
        if (print_info) {
                u64 new_sectors = ata_id_n_sectors(dev->id);
-               ata_dev_printk(dev, KERN_INFO,
+               ata_dev_info(dev,
                        "HPA unlocked: %llu -> %llu, native %llu\n",
                        (unsigned long long)sectors,
                        (unsigned long long)new_sectors,
@@ -1655,8 +1654,8 @@ unsigned ata_exec_internal_sg(struct ata_device *dev,
                                ata_qc_complete(qc);
 
                        if (ata_msg_warn(ap))
-                               ata_dev_printk(dev, KERN_WARNING,
-                                       "qc timeout (cmd 0x%x)\n", command);
+                               ata_dev_warn(dev, "qc timeout (cmd 0x%x)\n",
+                                            command);
                }
 
                spin_unlock_irqrestore(ap->lock, flags);
@@ -1870,7 +1869,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
        int rc;
 
        if (ata_msg_ctl(ap))
-               ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __func__);
+               ata_dev_dbg(dev, "%s: ENTER\n", __func__);
 
 retry:
        ata_tf_init(dev, &tf);
@@ -1909,14 +1908,13 @@ retry:
 
        if (err_mask) {
                if (err_mask & AC_ERR_NODEV_HINT) {
-                       ata_dev_printk(dev, KERN_DEBUG,
-                                      "NODEV after polling detection\n");
+                       ata_dev_dbg(dev, "NODEV after polling detection\n");
                        return -ENOENT;
                }
 
                if (is_semb) {
-                       ata_dev_printk(dev, KERN_INFO, "IDENTIFY failed on "
-                                      "device w/ SEMB sig, disabled\n");
+                       ata_dev_info(dev,
+                    "IDENTIFY failed on device w/ SEMB sig, disabled\n");
                        /* SEMB is not supported yet */
                        *p_class = ATA_DEV_SEMB_UNSUP;
                        return 0;
@@ -1942,8 +1940,8 @@ retry:
                         * both flavors of IDENTIFYs which happens
                         * sometimes with phantom devices.
                         */
-                       ata_dev_printk(dev, KERN_DEBUG,
-                                      "both IDENTIFYs aborted, assuming NODEV\n");
+                       ata_dev_dbg(dev,
+                                   "both IDENTIFYs aborted, assuming NODEV\n");
                        return -ENOENT;
                }
 
@@ -1953,9 +1951,9 @@ retry:
        }
 
        if (dev->horkage & ATA_HORKAGE_DUMP_ID) {
-               ata_dev_printk(dev, KERN_DEBUG, "dumping IDENTIFY data, "
-                              "class=%d may_fallback=%d tried_spinup=%d\n",
-                              class, may_fallback, tried_spinup);
+               ata_dev_dbg(dev, "dumping IDENTIFY data, "
+                           "class=%d may_fallback=%d tried_spinup=%d\n",
+                           class, may_fallback, tried_spinup);
                print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET,
                               16, 2, id, ATA_ID_WORDS * sizeof(*id), true);
        }
@@ -2034,8 +2032,8 @@ retry:
 
  err_out:
        if (ata_msg_warn(ap))
-               ata_dev_printk(dev, KERN_WARNING, "failed to IDENTIFY "
-                              "(%s, err_mask=0x%x)\n", reason, err_mask);
+               ata_dev_warn(dev, "failed to IDENTIFY (%s, err_mask=0x%x)\n",
+                            reason, err_mask);
        return rc;
 }
 
@@ -2065,9 +2063,8 @@ static int ata_do_link_spd_horkage(struct ata_device *dev)
         * guaranteed by setting sata_spd_limit to target_limit above.
         */
        if (plink->sata_spd > target) {
-               ata_dev_printk(dev, KERN_INFO,
-                              "applying link speed limit horkage to %s\n",
-                              sata_spd_string(target));
+               ata_dev_info(dev, "applying link speed limit horkage to %s\n",
+                            sata_spd_string(target));
                return -EAGAIN;
        }
        return 0;
@@ -2110,8 +2107,9 @@ static int ata_dev_config_ncq(struct ata_device *dev,
                err_mask = ata_dev_set_feature(dev, SETFEATURES_SATA_ENABLE,
                        SATA_FPDMA_AA);
                if (err_mask) {
-                       ata_dev_printk(dev, KERN_ERR, "failed to enable AA"
-                               "(error_mask=0x%x)\n", err_mask);
+                       ata_dev_err(dev,
+                                   "failed to enable AA (error_mask=0x%x)\n",
+                                   err_mask);
                        if (err_mask != AC_ERR_DEV) {
                                dev->horkage |= ATA_HORKAGE_BROKEN_FPDMA_AA;
                                return -EIO;
@@ -2154,31 +2152,28 @@ int ata_dev_configure(struct ata_device *dev)
        int rc;
 
        if (!ata_dev_enabled(dev) && ata_msg_info(ap)) {
-               ata_dev_printk(dev, KERN_INFO, "%s: ENTER/EXIT -- nodev\n",
-                              __func__);
+               ata_dev_info(dev, "%s: ENTER/EXIT -- nodev\n", __func__);
                return 0;
        }
 
        if (ata_msg_probe(ap))
-               ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __func__);
+               ata_dev_dbg(dev, "%s: ENTER\n", __func__);
 
        /* set horkage */
        dev->horkage |= ata_dev_blacklisted(dev);
        ata_force_horkage(dev);
 
        if (dev->horkage & ATA_HORKAGE_DISABLE) {
-               ata_dev_printk(dev, KERN_INFO,
-                              "unsupported device, disabling\n");
+               ata_dev_info(dev, "unsupported device, disabling\n");
                ata_dev_disable(dev);
                return 0;
        }
 
        if ((!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) &&
            dev->class == ATA_DEV_ATAPI) {
-               ata_dev_printk(dev, KERN_WARNING,
-                       "WARNING: ATAPI is %s, device ignored.\n",
-                       atapi_enabled ? "not supported with this driver"
-                                     : "disabled");
+               ata_dev_warn(dev, "WARNING: ATAPI is %s, device ignored\n",
+                            atapi_enabled ? "not supported with this driver"
+                            : "disabled");
                ata_dev_disable(dev);
                return 0;
        }
@@ -2199,12 +2194,12 @@ int ata_dev_configure(struct ata_device *dev)
 
        /* print device capabilities */
        if (ata_msg_probe(ap))
-               ata_dev_printk(dev, KERN_DEBUG,
-                              "%s: cfg 49:%04x 82:%04x 83:%04x 84:%04x "
-                              "85:%04x 86:%04x 87:%04x 88:%04x\n",
-                              __func__,
-                              id[49], id[82], id[83], id[84],
-                              id[85], id[86], id[87], id[88]);
+               ata_dev_dbg(dev,
+                           "%s: cfg 49:%04x 82:%04x 83:%04x 84:%04x "
+                           "85:%04x 86:%04x 87:%04x 88:%04x\n",
+                           __func__,
+                           id[49], id[82], id[83], id[84],
+                           id[85], id[86], id[87], id[88]);
 
        /* initialize to-be-configured parameters */
        dev->flags &= ~ATA_DFLAG_CFG_MASK;
@@ -2238,17 +2233,15 @@ int ata_dev_configure(struct ata_device *dev)
                if (ata_id_is_cfa(id)) {
                        /* CPRM may make this media unusable */
                        if (id[ATA_ID_CFA_KEY_MGMT] & 1)
-                               ata_dev_printk(dev, KERN_WARNING,
-                                              "supports DRM functions and may "
-                                              "not be fully accessible.\n");
+                               ata_dev_warn(dev,
+       "supports DRM functions and may not be fully accessible\n");
                        snprintf(revbuf, 7, "CFA");
                } else {
                        snprintf(revbuf, 7, "ATA-%d", ata_id_major_version(id));
                        /* Warn the user if the device has TPM extensions */
                        if (ata_id_has_tpm(id))
-                               ata_dev_printk(dev, KERN_WARNING,
-                                              "supports DRM functions and may "
-                                              "not be fully accessible.\n");
+                               ata_dev_warn(dev,
+       "supports DRM functions and may not be fully accessible\n");
                }
 
                dev->n_sectors = ata_id_n_sectors(id);
@@ -2285,12 +2278,11 @@ int ata_dev_configure(struct ata_device *dev)
 
                        /* print device info to dmesg */
                        if (ata_msg_drv(ap) && print_info) {
-                               ata_dev_printk(dev, KERN_INFO,
-                                       "%s: %s, %s, max %s\n",
-                                       revbuf, modelbuf, fwrevbuf,
-                                       ata_mode_string(xfer_mask));
-                               ata_dev_printk(dev, KERN_INFO,
-                                       "%Lu sectors, multi %u: %s %s\n",
+                               ata_dev_info(dev, "%s: %s, %s, max %s\n",
+                                            revbuf, modelbuf, fwrevbuf,
+                                            ata_mode_string(xfer_mask));
+                               ata_dev_info(dev,
+                                            "%llu sectors, multi %u: %s %s\n",
                                        (unsigned long long)dev->n_sectors,
                                        dev->multi_count, lba_desc, ncq_desc);
                        }
@@ -2311,15 +2303,14 @@ int ata_dev_configure(struct ata_device *dev)
 
                        /* print device info to dmesg */
                        if (ata_msg_drv(ap) && print_info) {
-                               ata_dev_printk(dev, KERN_INFO,
-                                       "%s: %s, %s, max %s\n",
-                                       revbuf, modelbuf, fwrevbuf,
-                                       ata_mode_string(xfer_mask));
-                               ata_dev_printk(dev, KERN_INFO,
-                                       "%Lu sectors, multi %u, CHS %u/%u/%u\n",
-                                       (unsigned long long)dev->n_sectors,
-                                       dev->multi_count, dev->cylinders,
-                                       dev->heads, dev->sectors);
+                               ata_dev_info(dev, "%s: %s, %s, max %s\n",
+                                            revbuf,    modelbuf, fwrevbuf,
+                                            ata_mode_string(xfer_mask));
+                               ata_dev_info(dev,
+                                            "%llu sectors, multi %u, CHS %u/%u/%u\n",
+                                            (unsigned long long)dev->n_sectors,
+                                            dev->multi_count, dev->cylinders,
+                                            dev->heads, dev->sectors);
                        }
                }
 
@@ -2336,8 +2327,7 @@ int ata_dev_configure(struct ata_device *dev)
                rc = atapi_cdb_len(id);
                if ((rc < 12) || (rc > ATAPI_CDB_LEN)) {
                        if (ata_msg_warn(ap))
-                               ata_dev_printk(dev, KERN_WARNING,
-                                              "unsupported CDB len\n");
+                               ata_dev_warn(dev, "unsupported CDB len\n");
                        rc = -EINVAL;
                        goto err_out_nosup;
                }
@@ -2358,9 +2348,9 @@ int ata_dev_configure(struct ata_device *dev)
                        err_mask = ata_dev_set_feature(dev,
                                        SETFEATURES_SATA_ENABLE, SATA_AN);
                        if (err_mask)
-                               ata_dev_printk(dev, KERN_ERR,
-                                       "failed to enable ATAPI AN "
-                                       "(err_mask=0x%x)\n", err_mask);
+                               ata_dev_err(dev,
+                                           "failed to enable ATAPI AN (err_mask=0x%x)\n",
+                                           err_mask);
                        else {
                                dev->flags |= ATA_DFLAG_AN;
                                atapi_an_string = ", ATAPI AN";
@@ -2379,12 +2369,12 @@ int ata_dev_configure(struct ata_device *dev)
 
                /* print device info to dmesg */
                if (ata_msg_drv(ap) && print_info)
-                       ata_dev_printk(dev, KERN_INFO,
-                                      "ATAPI: %s, %s, max %s%s%s%s\n",
-                                      modelbuf, fwrevbuf,
-                                      ata_mode_string(xfer_mask),
-                                      cdb_intr_string, atapi_an_string,
-                                      dma_dir_string);
+                       ata_dev_info(dev,
+                                    "ATAPI: %s, %s, max %s%s%s%s\n",
+                                    modelbuf, fwrevbuf,
+                                    ata_mode_string(xfer_mask),
+                                    cdb_intr_string, atapi_an_string,
+                                    dma_dir_string);
        }
 
        /* determine max_sectors */
@@ -2396,8 +2386,7 @@ int ata_dev_configure(struct ata_device *dev)
           200 sectors */
        if (ata_dev_knobble(dev)) {
                if (ata_msg_drv(ap) && print_info)
-                       ata_dev_printk(dev, KERN_INFO,
-                                      "applying bridge limits\n");
+                       ata_dev_info(dev, "applying bridge limits\n");
                dev->udma_mask &= ATA_UDMA5;
                dev->max_sectors = ATA_MAX_SECTORS;
        }
@@ -2423,26 +2412,23 @@ int ata_dev_configure(struct ata_device *dev)
                   bugs */
 
                if (print_info) {
-                       ata_dev_printk(dev, KERN_WARNING,
+                       ata_dev_warn(dev,
 "Drive reports diagnostics failure. This may indicate a drive\n");
-                       ata_dev_printk(dev, KERN_WARNING,
+                       ata_dev_warn(dev,
 "fault or invalid emulation. Contact drive vendor for information.\n");
                }
        }
 
        if ((dev->horkage & ATA_HORKAGE_FIRMWARE_WARN) && print_info) {
-               ata_dev_printk(dev, KERN_WARNING, "WARNING: device requires "
-                              "firmware update to be fully functional.\n");
-               ata_dev_printk(dev, KERN_WARNING, "         contact the vendor "
-                              "or visit http://ata.wiki.kernel.org.\n");
+               ata_dev_warn(dev, "WARNING: device requires firmware update to be fully functional\n");
+               ata_dev_warn(dev, "         contact the vendor or visit http://ata.wiki.kernel.org\n");
        }
 
        return 0;
 
 err_out_nosup:
        if (ata_msg_probe(ap))
-               ata_dev_printk(dev, KERN_DEBUG,
-                              "%s: EXIT, err\n", __func__);
+               ata_dev_dbg(dev, "%s: EXIT, err\n", __func__);
        return rc;
 }
 
@@ -2663,13 +2649,11 @@ static void sata_print_link_status(struct ata_link *link)
 
        if (ata_phys_link_online(link)) {
                tmp = (sstatus >> 4) & 0xf;
-               ata_link_printk(link, KERN_INFO,
-                               "SATA link up %s (SStatus %X SControl %X)\n",
-                               sata_spd_string(tmp), sstatus, scontrol);
+               ata_link_info(link, "SATA link up %s (SStatus %X SControl %X)\n",
+                             sata_spd_string(tmp), sstatus, scontrol);
        } else {
-               ata_link_printk(link, KERN_INFO,
-                               "SATA link down (SStatus %X SControl %X)\n",
-                               sstatus, scontrol);
+               ata_link_info(link, "SATA link down (SStatus %X SControl %X)\n",
+                             sstatus, scontrol);
        }
 }
 
@@ -2758,8 +2742,8 @@ int sata_down_spd_limit(struct ata_link *link, u32 spd_limit)
 
        link->sata_spd_limit = mask;
 
-       ata_link_printk(link, KERN_WARNING, "limiting SATA link speed to %s\n",
-                       sata_spd_string(fls(mask)));
+       ata_link_warn(link, "limiting SATA link speed to %s\n",
+                     sata_spd_string(fls(mask)));
 
        return 0;
 }
@@ -3136,8 +3120,7 @@ int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel)
                        snprintf(buf, sizeof(buf), "%s",
                                 ata_mode_string(xfer_mask));
 
-               ata_dev_printk(dev, KERN_WARNING,
-                              "limiting speed to %s\n", buf);
+               ata_dev_warn(dev, "limiting speed to %s\n", buf);
        }
 
        ata_unpack_xfermask(xfer_mask, &dev->pio_mask, &dev->mwdma_mask,
@@ -3164,9 +3147,9 @@ static int ata_dev_set_mode(struct ata_device *dev)
                dev_err_whine = " (SET_XFERMODE skipped)";
        else {
                if (nosetxfer)
-                       ata_dev_printk(dev, KERN_WARNING,
-                                      "NOSETXFER but PATA detected - can't "
-                                      "skip SETXFER, might malfunction\n");
+                       ata_dev_warn(dev,
+                                    "NOSETXFER but PATA detected - can't "
+                                    "skip SETXFER, might malfunction\n");
                err_mask = ata_dev_set_xfermode(dev);
        }
 
@@ -3216,15 +3199,14 @@ static int ata_dev_set_mode(struct ata_device *dev)
        DPRINTK("xfer_shift=%u, xfer_mode=0x%x\n",
                dev->xfer_shift, (int)dev->xfer_mode);
 
-       ata_dev_printk(dev, KERN_INFO, "configured for %s%s\n",
-                      ata_mode_string(ata_xfer_mode2mask(dev->xfer_mode)),
-                      dev_err_whine);
+       ata_dev_info(dev, "configured for %s%s\n",
+                    ata_mode_string(ata_xfer_mode2mask(dev->xfer_mode)),
+                    dev_err_whine);
 
        return 0;
 
  fail:
-       ata_dev_printk(dev, KERN_ERR, "failed to set xfermode "
-                      "(err_mask=0x%x)\n", err_mask);
+       ata_dev_err(dev, "failed to set xfermode (err_mask=0x%x)\n", err_mask);
        return -EIO;
 }
 
@@ -3286,7 +3268,7 @@ int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev)
        /* step 2: always set host PIO timings */
        ata_for_each_dev(dev, link, ENABLED) {
                if (dev->pio_mode == 0xff) {
-                       ata_dev_printk(dev, KERN_WARNING, "no PIO support\n");
+                       ata_dev_warn(dev, "no PIO support\n");
                        rc = -EINVAL;
                        goto out;
                }
@@ -3404,7 +3386,7 @@ int ata_wait_ready(struct ata_link *link, unsigned long deadline,
 
                if (!warned && time_after(now, start + 5 * HZ) &&
                    (deadline - now > 3 * HZ)) {
-                       ata_link_printk(link, KERN_WARNING,
+                       ata_link_warn(link,
                                "link is slow to respond, please be patient "
                                "(ready=%d)\n", tmp);
                        warned = 1;
@@ -3552,16 +3534,14 @@ int sata_link_resume(struct ata_link *link, const unsigned long *params,
        } while ((scontrol & 0xf0f) != 0x300 && --tries);
 
        if ((scontrol & 0xf0f) != 0x300) {
-               ata_link_printk(link, KERN_ERR,
-                               "failed to resume link (SControl %X)\n",
-                               scontrol);
+               ata_link_warn(link, "failed to resume link (SControl %X)\n",
+                            scontrol);
                return 0;
        }
 
        if (tries < ATA_LINK_RESUME_TRIES)
-               ata_link_printk(link, KERN_WARNING,
-                               "link resume succeeded after %d retries\n",
-                               ATA_LINK_RESUME_TRIES - tries);
+               ata_link_warn(link, "link resume succeeded after %d retries\n",
+                             ATA_LINK_RESUME_TRIES - tries);
 
        if ((rc = sata_link_debounce(link, params, deadline)))
                return rc;
@@ -3678,8 +3658,9 @@ int ata_std_prereset(struct ata_link *link, unsigned long deadline)
                rc = sata_link_resume(link, timing, deadline);
                /* whine about phy resume failure but proceed */
                if (rc && rc != -EOPNOTSUPP)
-                       ata_link_printk(link, KERN_WARNING, "failed to resume "
-                                       "link for reset (errno=%d)\n", rc);
+                       ata_link_warn(link,
+                                     "failed to resume link for reset (errno=%d)\n",
+                                     rc);
        }
 
        /* no point in trying softreset on offline link */
@@ -3795,8 +3776,7 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing,
                /* online is set iff link is online && reset succeeded */
                if (online)
                        *online = false;
-               ata_link_printk(link, KERN_ERR,
-                               "COMRESET failed (errno=%d)\n", rc);
+               ata_link_err(link, "COMRESET failed (errno=%d)\n", rc);
        }
        DPRINTK("EXIT, rc=%d\n", rc);
        return rc;
@@ -3880,8 +3860,8 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class,
        unsigned char serial[2][ATA_ID_SERNO_LEN + 1];
 
        if (dev->class != new_class) {
-               ata_dev_printk(dev, KERN_INFO, "class mismatch %d != %d\n",
-                              dev->class, new_class);
+               ata_dev_info(dev, "class mismatch %d != %d\n",
+                            dev->class, new_class);
                return 0;
        }
 
@@ -3891,14 +3871,14 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class,
        ata_id_c_string(new_id, serial[1], ATA_ID_SERNO, sizeof(serial[1]));
 
        if (strcmp(model[0], model[1])) {
-               ata_dev_printk(dev, KERN_INFO, "model number mismatch "
-                              "'%s' != '%s'\n", model[0], model[1]);
+               ata_dev_info(dev, "model number mismatch '%s' != '%s'\n",
+                            model[0], model[1]);
                return 0;
        }
 
        if (strcmp(serial[0], serial[1])) {
-               ata_dev_printk(dev, KERN_INFO, "serial number mismatch "
-                              "'%s' != '%s'\n", serial[0], serial[1]);
+               ata_dev_info(dev, "serial number mismatch '%s' != '%s'\n",
+                            serial[0], serial[1]);
                return 0;
        }
 
@@ -3968,8 +3948,8 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
            new_class != ATA_DEV_ATA &&
            new_class != ATA_DEV_ATAPI &&
            new_class != ATA_DEV_SEMB) {
-               ata_dev_printk(dev, KERN_INFO, "class mismatch %u != %u\n",
-                              dev->class, new_class);
+               ata_dev_info(dev, "class mismatch %u != %u\n",
+                            dev->class, new_class);
                rc = -ENODEV;
                goto fail;
        }
@@ -3990,9 +3970,9 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
                return 0;
 
        /* n_sectors has changed */
-       ata_dev_printk(dev, KERN_WARNING, "n_sectors mismatch %llu != %llu\n",
-                      (unsigned long long)n_sectors,
-                      (unsigned long long)dev->n_sectors);
+       ata_dev_warn(dev, "n_sectors mismatch %llu != %llu\n",
+                    (unsigned long long)n_sectors,
+                    (unsigned long long)dev->n_sectors);
 
        /*
         * Something could have caused HPA to be unlocked
@@ -4001,9 +3981,9 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
         */
        if (dev->n_native_sectors == n_native_sectors &&
            dev->n_sectors > n_sectors && dev->n_sectors == n_native_sectors) {
-               ata_dev_printk(dev, KERN_WARNING,
-                              "new n_sectors matches native, probably "
-                              "late HPA unlock, n_sectors updated\n");
+               ata_dev_warn(dev,
+                            "new n_sectors matches native, probably "
+                            "late HPA unlock, n_sectors updated\n");
                /* use the larger n_sectors */
                return 0;
        }
@@ -4017,9 +3997,9 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
        if (dev->n_native_sectors == n_native_sectors &&
            dev->n_sectors < n_sectors && n_sectors == n_native_sectors &&
            !(dev->horkage & ATA_HORKAGE_BROKEN_HPA)) {
-               ata_dev_printk(dev, KERN_WARNING,
-                              "old n_sectors matches native, probably "
-                              "late HPA lock, will try to unlock HPA\n");
+               ata_dev_warn(dev,
+                            "old n_sectors matches native, probably "
+                            "late HPA lock, will try to unlock HPA\n");
                /* try unlocking HPA */
                dev->flags |= ATA_DFLAG_UNLOCK_HPA;
                rc = -EIO;
@@ -4030,7 +4010,7 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
        dev->n_native_sectors = n_native_sectors;
        dev->n_sectors = n_sectors;
  fail:
-       ata_dev_printk(dev, KERN_ERR, "revalidation failed (errno=%d)\n", rc);
+       ata_dev_err(dev, "revalidation failed (errno=%d)\n", rc);
        return rc;
 }
 
@@ -4358,15 +4338,15 @@ static void ata_dev_xfermask(struct ata_device *dev)
 
        if (ata_dma_blacklisted(dev)) {
                xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
-               ata_dev_printk(dev, KERN_WARNING,
-                              "device is on DMA blacklist, disabling DMA\n");
+               ata_dev_warn(dev,
+                            "device is on DMA blacklist, disabling DMA\n");
        }
 
        if ((host->flags & ATA_HOST_SIMPLEX) &&
            host->simplex_claimed && host->simplex_claimed != ap) {
                xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
-               ata_dev_printk(dev, KERN_WARNING, "simplex DMA is claimed by "
-                              "other device, disabling DMA\n");
+               ata_dev_warn(dev,
+                            "simplex DMA is claimed by other device, disabling DMA\n");
        }
 
        if (ap->flags & ATA_FLAG_NO_IORDY)
@@ -4386,8 +4366,8 @@ static void ata_dev_xfermask(struct ata_device *dev)
        if (xfer_mask & (0xF8 << ATA_SHIFT_UDMA))
                /* UDMA/44 or higher would be available */
                if (cable_is_40wire(ap)) {
-                       ata_dev_printk(dev, KERN_WARNING,
-                                "limited to UDMA/33 due to 40-wire cable\n");
+                       ata_dev_warn(dev,
+                                    "limited to UDMA/33 due to 40-wire cable\n");
                        xfer_mask &= ~(0xF8 << ATA_SHIFT_UDMA);
                }
 
@@ -4954,8 +4934,8 @@ int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active)
        done_mask = ap->qc_active ^ qc_active;
 
        if (unlikely(done_mask & qc_active)) {
-               ata_port_printk(ap, KERN_ERR, "illegal qc_active transition "
-                               "(%08x->%08x)\n", ap->qc_active, qc_active);
+               ata_port_err(ap, "illegal qc_active transition (%08x->%08x)\n",
+                            ap->qc_active, qc_active);
                return -EINVAL;
        }
 
@@ -5847,9 +5827,9 @@ int ata_host_start(struct ata_host *host)
                        rc = ap->ops->port_start(ap);
                        if (rc) {
                                if (rc != -ENODEV)
-                                       dev_printk(KERN_ERR, host->dev,
-                                               "failed to start port %d "
-                                               "(errno=%d)\n", i, rc);
+                                       dev_err(host->dev,
+                                               "failed to start port %d (errno=%d)\n",
+                                               i, rc);
                                goto err_out;
                        }
                }
@@ -5971,8 +5951,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
 
        /* host must have been started */
        if (!(host->flags & ATA_HOST_STARTED)) {
-               dev_printk(KERN_ERR, host->dev,
-                          "BUG: trying to register unstarted host\n");
+               dev_err(host->dev, "BUG: trying to register unstarted host\n");
                WARN_ON(1);
                return -EINVAL;
        }
@@ -6023,14 +6002,13 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
                                              ap->udma_mask);
 
                if (!ata_port_is_dummy(ap)) {
-                       ata_port_printk(ap, KERN_INFO,
-                                       "%cATA max %s %s\n",
-                                       (ap->flags & ATA_FLAG_SATA) ? 'S' : 'P',
-                                       ata_mode_string(xfer_mask),
-                                       ap->link.eh_info.desc);
+                       ata_port_info(ap, "%cATA max %s %s\n",
+                                     (ap->flags & ATA_FLAG_SATA) ? 'S' : 'P',
+                                     ata_mode_string(xfer_mask),
+                                     ap->link.eh_info.desc);
                        ata_ehi_clear_desc(&ap->link.eh_info);
                } else
-                       ata_port_printk(ap, KERN_INFO, "DUMMY\n");
+                       ata_port_info(ap, "DUMMY\n");
        }
 
        /* perform each probe asynchronously */
@@ -6242,8 +6220,8 @@ int ata_pci_device_do_resume(struct pci_dev *pdev)
 
        rc = pcim_enable_device(pdev);
        if (rc) {
-               dev_printk(KERN_ERR, &pdev->dev,
-                          "failed to enable device after resume (%d)\n", rc);
+               dev_err(&pdev->dev,
+                       "failed to enable device after resume (%d)\n", rc);
                return rc;
        }
 
@@ -6599,6 +6577,82 @@ const struct ata_port_info ata_dummy_port_info = {
        .port_ops               = &ata_dummy_port_ops,
 };
 
+/*
+ * Utility print functions
+ */
+int ata_port_printk(const struct ata_port *ap, const char *level,
+                   const char *fmt, ...)
+{
+       struct va_format vaf;
+       va_list args;
+       int r;
+
+       va_start(args, fmt);
+
+       vaf.fmt = fmt;
+       vaf.va = &args;
+
+       r = printk("%sata%u: %pV", level, ap->print_id, &vaf);
+
+       va_end(args);
+
+       return r;
+}
+EXPORT_SYMBOL(ata_port_printk);
+
+int ata_link_printk(const struct ata_link *link, const char *level,
+                   const char *fmt, ...)
+{
+       struct va_format vaf;
+       va_list args;
+       int r;
+
+       va_start(args, fmt);
+
+       vaf.fmt = fmt;
+       vaf.va = &args;
+
+       if (sata_pmp_attached(link->ap) || link->ap->slave_link)
+               r = printk("%sata%u.%02u: %pV",
+                          level, link->ap->print_id, link->pmp, &vaf);
+       else
+               r = printk("%sata%u: %pV",
+                          level, link->ap->print_id, &vaf);
+
+       va_end(args);
+
+       return r;
+}
+EXPORT_SYMBOL(ata_link_printk);
+
+int ata_dev_printk(const struct ata_device *dev, const char *level,
+                   const char *fmt, ...)
+{
+       struct va_format vaf;
+       va_list args;
+       int r;
+
+       va_start(args, fmt);
+
+       vaf.fmt = fmt;
+       vaf.va = &args;
+
+       r = printk("%sata%u.%02u: %pV",
+                  level, dev->link->ap->print_id, dev->link->pmp + dev->devno,
+                  &vaf);
+
+       va_end(args);
+
+       return r;
+}
+EXPORT_SYMBOL(ata_dev_printk);
+
+void ata_print_version(const struct device *dev, const char *version)
+{
+       dev_printk(KERN_DEBUG, dev, "version %s\n", version);
+}
+EXPORT_SYMBOL(ata_print_version);
+
 /*
  * libata is essentially a library of internal helper functions for
  * low-level ATA host controller drivers.  As such, the API/ABI is
index 7f099d6..ed16fbe 100644 (file)
@@ -782,8 +782,9 @@ void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap)
                                spin_unlock_irqrestore(ap->lock, flags);
                                goto repeat;
                        }
-                       ata_port_printk(ap, KERN_ERR, "EH pending after %d "
-                                       "tries, giving up\n", ATA_EH_MAX_TRIES);
+                       ata_port_err(ap,
+                                    "EH pending after %d tries, giving up\n",
+                                    ATA_EH_MAX_TRIES);
                        ap->pflags &= ~ATA_PFLAG_EH_PENDING;
                }
 
@@ -816,7 +817,7 @@ void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap)
                schedule_delayed_work(&ap->hotplug_task, 0);
 
        if (ap->pflags & ATA_PFLAG_RECOVERED)
-               ata_port_printk(ap, KERN_INFO, "EH complete\n");
+               ata_port_info(ap, "EH complete\n");
 
        ap->pflags &= ~(ATA_PFLAG_SCSI_HOTPLUG | ATA_PFLAG_RECOVERED);
 
@@ -1310,7 +1311,7 @@ void ata_dev_disable(struct ata_device *dev)
                return;
 
        if (ata_msg_drv(dev->link->ap))
-               ata_dev_printk(dev, KERN_WARNING, "disabled\n");
+               ata_dev_warn(dev, "disabled\n");
        ata_acpi_on_disable(dev);
        ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 | ATA_DNXFER_QUIET);
        dev->class++;
@@ -1515,8 +1516,8 @@ static int ata_eh_read_log_10h(struct ata_device *dev,
        for (i = 0; i < ATA_SECT_SIZE; i++)
                csum += buf[i];
        if (csum)
-               ata_dev_printk(dev, KERN_WARNING,
-                              "invalid checksum 0x%x on log page 10h\n", csum);
+               ata_dev_warn(dev, "invalid checksum 0x%x on log page 10h\n",
+                            csum);
 
        if (buf[0] & 0x80)
                return -ENOENT;
@@ -1716,14 +1717,14 @@ void ata_eh_analyze_ncq_error(struct ata_link *link)
        memset(&tf, 0, sizeof(tf));
        rc = ata_eh_read_log_10h(dev, &tag, &tf);
        if (rc) {
-               ata_link_printk(link, KERN_ERR, "failed to read log page 10h "
-                               "(errno=%d)\n", rc);
+               ata_link_err(link, "failed to read log page 10h (errno=%d)\n",
+                            rc);
                return;
        }
 
        if (!(link->sactive & (1 << tag))) {
-               ata_link_printk(link, KERN_ERR, "log page 10h reported "
-                               "inactive tag %d\n", tag);
+               ata_link_err(link, "log page 10h reported inactive tag %d\n",
+                            tag);
                return;
        }
 
@@ -1988,8 +1989,7 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev,
            (dev->flags & (ATA_DFLAG_PIO | ATA_DFLAG_NCQ |
                           ATA_DFLAG_NCQ_OFF)) == ATA_DFLAG_NCQ) {
                dev->flags |= ATA_DFLAG_NCQ_OFF;
-               ata_dev_printk(dev, KERN_WARNING,
-                              "NCQ disabled due to excessive errors\n");
+               ata_dev_warn(dev, "NCQ disabled due to excessive errors\n");
                goto done;
        }
 
@@ -2374,24 +2374,24 @@ static void ata_eh_link_report(struct ata_link *link)
                         ap->eh_tries);
 
        if (ehc->i.dev) {
-               ata_dev_printk(ehc->i.dev, KERN_ERR, "exception Emask 0x%x "
-                              "SAct 0x%x SErr 0x%x action 0x%x%s%s\n",
-                              ehc->i.err_mask, link->sactive, ehc->i.serror,
-                              ehc->i.action, frozen, tries_buf);
+               ata_dev_err(ehc->i.dev, "exception Emask 0x%x "
+                           "SAct 0x%x SErr 0x%x action 0x%x%s%s\n",
+                           ehc->i.err_mask, link->sactive, ehc->i.serror,
+                           ehc->i.action, frozen, tries_buf);
                if (desc)
-                       ata_dev_printk(ehc->i.dev, KERN_ERR, "%s\n", desc);
+                       ata_dev_err(ehc->i.dev, "%s\n", desc);
        } else {
-               ata_link_printk(link, KERN_ERR, "exception Emask 0x%x "
-                               "SAct 0x%x SErr 0x%x action 0x%x%s%s\n",
-                               ehc->i.err_mask, link->sactive, ehc->i.serror,
-                               ehc->i.action, frozen, tries_buf);
+               ata_link_err(link, "exception Emask 0x%x "
+                            "SAct 0x%x SErr 0x%x action 0x%x%s%s\n",
+                            ehc->i.err_mask, link->sactive, ehc->i.serror,
+                            ehc->i.action, frozen, tries_buf);
                if (desc)
-                       ata_link_printk(link, KERN_ERR, "%s\n", desc);
+                       ata_link_err(link, "%s\n", desc);
        }
 
 #ifdef CONFIG_ATA_VERBOSE_ERROR
        if (ehc->i.serror)
-               ata_link_printk(link, KERN_ERR,
+               ata_link_err(link,
                  "SError: { %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s}\n",
                  ehc->i.serror & SERR_DATA_RECOVERED ? "RecovData " : "",
                  ehc->i.serror & SERR_COMM_RECOVERED ? "RecovComm " : "",
@@ -2456,11 +2456,11 @@ static void ata_eh_link_report(struct ata_link *link)
                } else {
                        const char *descr = ata_get_cmd_descript(cmd->command);
                        if (descr)
-                               ata_dev_printk(qc->dev, KERN_ERR,
-                                       "failed command: %s\n", descr);
+                               ata_dev_err(qc->dev, "failed command: %s\n",
+                                           descr);
                }
 
-               ata_dev_printk(qc->dev, KERN_ERR,
+               ata_dev_err(qc->dev,
                        "cmd %02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x "
                        "tag %d%s\n         %s"
                        "res %02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x "
@@ -2481,11 +2481,9 @@ static void ata_eh_link_report(struct ata_link *link)
                if (res->command & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ |
                                    ATA_ERR)) {
                        if (res->command & ATA_BUSY)
-                               ata_dev_printk(qc->dev, KERN_ERR,
-                                 "status: { Busy }\n");
+                               ata_dev_err(qc->dev, "status: { Busy }\n");
                        else
-                               ata_dev_printk(qc->dev, KERN_ERR,
-                                 "status: { %s%s%s%s}\n",
+                               ata_dev_err(qc->dev, "status: { %s%s%s%s}\n",
                                  res->command & ATA_DRDY ? "DRDY " : "",
                                  res->command & ATA_DF ? "DF " : "",
                                  res->command & ATA_DRQ ? "DRQ " : "",
@@ -2495,8 +2493,7 @@ static void ata_eh_link_report(struct ata_link *link)
                if (cmd->command != ATA_CMD_PACKET &&
                    (res->feature & (ATA_ICRC | ATA_UNC | ATA_IDNF |
                                     ATA_ABORTED)))
-                       ata_dev_printk(qc->dev, KERN_ERR,
-                         "error: { %s%s%s%s}\n",
+                       ata_dev_err(qc->dev, "error: { %s%s%s%s}\n",
                          res->feature & ATA_ICRC ? "ICRC " : "",
                          res->feature & ATA_UNC ? "UNC " : "",
                          res->feature & ATA_IDNF ? "IDNF " : "",
@@ -2650,8 +2647,7 @@ int ata_eh_reset(struct ata_link *link, int classify,
 
                if (rc) {
                        if (rc == -ENOENT) {
-                               ata_link_printk(link, KERN_DEBUG,
-                                               "port disabled. ignoring.\n");
+                               ata_link_dbg(link, "port disabled--ignoring\n");
                                ehc->i.action &= ~ATA_EH_RESET;
 
                                ata_for_each_dev(dev, link, ALL)
@@ -2659,8 +2655,9 @@ int ata_eh_reset(struct ata_link *link, int classify,
 
                                rc = 0;
                        } else
-                               ata_link_printk(link, KERN_ERR,
-                                       "prereset failed (errno=%d)\n", rc);
+                               ata_link_err(link,
+                                            "prereset failed (errno=%d)\n",
+                                            rc);
                        goto out;
                }
 
@@ -2689,8 +2686,8 @@ int ata_eh_reset(struct ata_link *link, int classify,
 
        if (reset) {
                if (verbose)
-                       ata_link_printk(link, KERN_INFO, "%s resetting link\n",
-                                       reset == softreset ? "soft" : "hard");
+                       ata_link_info(link, "%s resetting link\n",
+                                     reset == softreset ? "soft" : "hard");
 
                /* mark that this EH session started with reset */
                ehc->last_reset = jiffies;
@@ -2710,8 +2707,7 @@ int ata_eh_reset(struct ata_link *link, int classify,
                        int tmp;
 
                        if (verbose)
-                               ata_link_printk(slave, KERN_INFO,
-                                               "hard resetting link\n");
+                               ata_link_info(slave, "hard resetting link\n");
 
                        ata_eh_about_to_do(slave, NULL, ATA_EH_RESET);
                        tmp = ata_do_reset(slave, reset, classes, deadline,
@@ -2734,9 +2730,8 @@ int ata_eh_reset(struct ata_link *link, int classify,
                        reset = softreset;
 
                        if (!reset) {
-                               ata_link_printk(link, KERN_ERR,
-                                               "follow-up softreset required "
-                                               "but no softreset available\n");
+                               ata_link_err(link,
+            "follow-up softreset required but no softreset available\n");
                                failed_link = link;
                                rc = -EINVAL;
                                goto fail;
@@ -2751,8 +2746,8 @@ int ata_eh_reset(struct ata_link *link, int classify,
                }
        } else {
                if (verbose)
-                       ata_link_printk(link, KERN_INFO, "no reset method "
-                                       "available, skipping reset\n");
+                       ata_link_info(link,
+       "no reset method available, skipping reset\n");
                if (!(lflags & ATA_LFLAG_ASSUME_CLASS))
                        lflags |= ATA_LFLAG_ASSUME_ATA;
        }
@@ -2830,36 +2825,35 @@ int ata_eh_reset(struct ata_link *link, int classify,
        ata_for_each_dev(dev, link, ALL) {
                if (ata_phys_link_online(ata_dev_phys_link(dev))) {
                        if (classes[dev->devno] == ATA_DEV_UNKNOWN) {
-                               ata_dev_printk(dev, KERN_DEBUG, "link online "
-                                              "but device misclassifed\n");
+                               ata_dev_dbg(dev, "link online but device misclassified\n");
                                classes[dev->devno] = ATA_DEV_NONE;
                                nr_unknown++;
                        }
                } else if (ata_phys_link_offline(ata_dev_phys_link(dev))) {
                        if (ata_class_enabled(classes[dev->devno]))
-                               ata_dev_printk(dev, KERN_DEBUG, "link offline, "
-                                              "clearing class %d to NONE\n",
-                                              classes[dev->devno]);
+                               ata_dev_dbg(dev,
+                                           "link offline, clearing class %d to NONE\n",
+                                           classes[dev->devno]);
                        classes[dev->devno] = ATA_DEV_NONE;
                } else if (classes[dev->devno] == ATA_DEV_UNKNOWN) {
-                       ata_dev_printk(dev, KERN_DEBUG, "link status unknown, "
-                                      "clearing UNKNOWN to NONE\n");
+                       ata_dev_dbg(dev,
+                                   "link status unknown, clearing UNKNOWN to NONE\n");
                        classes[dev->devno] = ATA_DEV_NONE;
                }
        }
 
        if (classify && nr_unknown) {
                if (try < max_tries) {
-                       ata_link_printk(link, KERN_WARNING, "link online but "
-                                       "%d devices misclassified, retrying\n",
-                                       nr_unknown);
+                       ata_link_warn(link,
+                                     "link online but %d devices misclassified, retrying\n",
+                                     nr_unknown);
                        failed_link = link;
                        rc = -EAGAIN;
                        goto fail;
                }
-               ata_link_printk(link, KERN_WARNING,
-                               "link online but %d devices misclassified, "
-                               "device detection might fail\n", nr_unknown);
+               ata_link_warn(link,
+                             "link online but %d devices misclassified, "
+                             "device detection might fail\n", nr_unknown);
        }
 
        /* reset successful, schedule revalidation */
@@ -2889,14 +2883,23 @@ int ata_eh_reset(struct ata_link *link, int classify,
            sata_scr_read(link, SCR_STATUS, &sstatus))
                rc = -ERESTART;
 
-       if (rc == -ERESTART || try >= max_tries)
+       if (rc == -ERESTART || try >= max_tries) {
+               /*
+                * Thaw host port even if reset failed, so that the port
+                * can be retried on the next phy event.  This risks
+                * repeated EH runs but seems to be a better tradeoff than
+                * shutting down a port after a botched hotplug attempt.
+                */
+               if (ata_is_host_link(link))
+                       ata_eh_thaw_port(ap);
                goto out;
+       }
 
        now = jiffies;
        if (time_before(now, deadline)) {
                unsigned long delta = deadline - now;
 
-               ata_link_printk(failed_link, KERN_WARNING,
+               ata_link_warn(failed_link,
                        "reset failed (errno=%d), retrying in %u secs\n",
                        rc, DIV_ROUND_UP(jiffies_to_msecs(delta), 1000));
 
@@ -2987,7 +2990,7 @@ static void ata_eh_park_issue_cmd(struct ata_device *dev, int park)
        tf.protocol |= ATA_PROT_NODATA;
        err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
        if (park && (err_mask || tf.lbal != 0xc4)) {
-               ata_dev_printk(dev, KERN_ERR, "head unload failed!\n");
+               ata_dev_err(dev, "head unload failed!\n");
                ehc->unloaded_mask &= ~(1 << dev->devno);
        }
 }
@@ -3198,8 +3201,9 @@ static int atapi_eh_clear_ua(struct ata_device *dev)
 
                err_mask = atapi_eh_tur(dev, &sense_key);
                if (err_mask != 0 && err_mask != AC_ERR_DEV) {
-                       ata_dev_printk(dev, KERN_WARNING, "TEST_UNIT_READY "
-                               "failed (err_mask=0x%x)\n", err_mask);
+                       ata_dev_warn(dev,
+                                    "TEST_UNIT_READY failed (err_mask=0x%x)\n",
+                                    err_mask);
                        return -EIO;
                }
 
@@ -3208,14 +3212,14 @@ static int atapi_eh_clear_ua(struct ata_device *dev)
 
                err_mask = atapi_eh_request_sense(dev, sense_buffer, sense_key);
                if (err_mask) {
-                       ata_dev_printk(dev, KERN_WARNING, "failed to clear "
+                       ata_dev_warn(dev, "failed to clear "
                                "UNIT ATTENTION (err_mask=0x%x)\n", err_mask);
                        return -EIO;
                }
        }
 
-       ata_dev_printk(dev, KERN_WARNING,
-               "UNIT ATTENTION persists after %d tries\n", ATA_EH_UA_TRIES);
+       ata_dev_warn(dev, "UNIT ATTENTION persists after %d tries\n",
+                    ATA_EH_UA_TRIES);
 
        return 0;
 }
@@ -3266,7 +3270,7 @@ static int ata_eh_maybe_retry_flush(struct ata_device *dev)
        tf.flags |= ATA_TFLAG_DEVICE;
        tf.protocol = ATA_PROT_NODATA;
 
-       ata_dev_printk(dev, KERN_WARNING, "retrying FLUSH 0x%x Emask 0x%x\n",
+       ata_dev_warn(dev, "retrying FLUSH 0x%x Emask 0x%x\n",
                       tf.command, qc->err_mask);
 
        err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
@@ -3281,7 +3285,7 @@ static int ata_eh_maybe_retry_flush(struct ata_device *dev)
                 */
                qc->scsicmd->allowed = max(qc->scsicmd->allowed, 1);
        } else {
-               ata_dev_printk(dev, KERN_WARNING, "FLUSH failed Emask 0x%x\n",
+               ata_dev_warn(dev, "FLUSH failed Emask 0x%x\n",
                               err_mask);
                rc = -EIO;
 
@@ -3355,9 +3359,9 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
                        err_mask = ata_dev_set_feature(dev,
                                        SETFEATURES_SATA_DISABLE, SATA_DIPM);
                        if (err_mask && err_mask != AC_ERR_DEV) {
-                               ata_dev_printk(dev, KERN_WARNING,
-                                       "failed to disable DIPM, Emask 0x%x\n",
-                                       err_mask);
+                               ata_dev_warn(dev,
+                                            "failed to disable DIPM, Emask 0x%x\n",
+                                            err_mask);
                                rc = -EIO;
                                goto fail;
                        }
@@ -3399,7 +3403,7 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
                        err_mask = ata_dev_set_feature(dev,
                                        SETFEATURES_SATA_ENABLE, SATA_DIPM);
                        if (err_mask && err_mask != AC_ERR_DEV) {
-                               ata_dev_printk(dev, KERN_WARNING,
+                               ata_dev_warn(dev,
                                        "failed to enable DIPM, Emask 0x%x\n",
                                        err_mask);
                                rc = -EIO;
@@ -3418,8 +3422,7 @@ fail:
 
        /* if no device or only one more chance is left, disable LPM */
        if (!dev || ehc->tries[dev->devno] <= 2) {
-               ata_link_printk(link, KERN_WARNING,
-                               "disabling LPM on the link\n");
+               ata_link_warn(link, "disabling LPM on the link\n");
                link->flags |= ATA_LFLAG_NO_LPM;
        }
        if (r_failed_dev)
@@ -3690,8 +3693,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
                rc = ata_eh_reset(link, ata_link_nr_vacant(link),
                                  prereset, softreset, hardreset, postreset);
                if (rc) {
-                       ata_link_printk(link, KERN_ERR,
-                                       "reset failed, giving up\n");
+                       ata_link_err(link, "reset failed, giving up\n");
                        goto out;
                }
        }
index f06b7ea..3eb2b81 100644 (file)
@@ -147,8 +147,8 @@ int sata_pmp_scr_read(struct ata_link *link, int reg, u32 *r_val)
 
        err_mask = sata_pmp_read(link, reg, r_val);
        if (err_mask) {
-               ata_link_printk(link, KERN_WARNING, "failed to read SCR %d "
-                               "(Emask=0x%x)\n", reg, err_mask);
+               ata_link_warn(link, "failed to read SCR %d (Emask=0x%x)\n",
+                             reg, err_mask);
                return -EIO;
        }
        return 0;
@@ -178,8 +178,8 @@ int sata_pmp_scr_write(struct ata_link *link, int reg, u32 val)
 
        err_mask = sata_pmp_write(link, reg, val);
        if (err_mask) {
-               ata_link_printk(link, KERN_WARNING, "failed to write SCR %d "
-                               "(Emask=0x%x)\n", reg, err_mask);
+               ata_link_warn(link, "failed to write SCR %d (Emask=0x%x)\n",
+                             reg, err_mask);
                return -EIO;
        }
        return 0;
@@ -231,8 +231,8 @@ static int sata_pmp_read_gscr(struct ata_device *dev, u32 *gscr)
 
                err_mask = sata_pmp_read(dev->link, reg, &gscr[reg]);
                if (err_mask) {
-                       ata_dev_printk(dev, KERN_ERR, "failed to read PMP "
-                               "GSCR[%d] (Emask=0x%x)\n", reg, err_mask);
+                       ata_dev_err(dev, "failed to read PMP GSCR[%d] (Emask=0x%x)\n",
+                                   reg, err_mask);
                        return -EIO;
                }
        }
@@ -311,26 +311,25 @@ static int sata_pmp_configure(struct ata_device *dev, int print_info)
        }
 
        if (print_info) {
-               ata_dev_printk(dev, KERN_INFO, "Port Multiplier %s, "
-                              "0x%04x:0x%04x r%d, %d ports, feat 0x%x/0x%x\n",
-                              sata_pmp_spec_rev_str(gscr), vendor, devid,
-                              sata_pmp_gscr_rev(gscr),
-                              nr_ports, gscr[SATA_PMP_GSCR_FEAT_EN],
-                              gscr[SATA_PMP_GSCR_FEAT]);
+               ata_dev_info(dev, "Port Multiplier %s, "
+                            "0x%04x:0x%04x r%d, %d ports, feat 0x%x/0x%x\n",
+                            sata_pmp_spec_rev_str(gscr), vendor, devid,
+                            sata_pmp_gscr_rev(gscr),
+                            nr_ports, gscr[SATA_PMP_GSCR_FEAT_EN],
+                            gscr[SATA_PMP_GSCR_FEAT]);
 
                if (!(dev->flags & ATA_DFLAG_AN))
-                       ata_dev_printk(dev, KERN_INFO,
+                       ata_dev_info(dev,
                                "Asynchronous notification not supported, "
-                               "hotplug won't\n         work on fan-out "
-                               "ports. Use warm-plug instead.\n");
+                               "hotplug won't work on fan-out ports. Use warm-plug instead.\n");
        }
 
        return 0;
 
  fail:
-       ata_dev_printk(dev, KERN_ERR,
-                      "failed to configure Port Multiplier (%s, Emask=0x%x)\n",
-                      reason, err_mask);
+       ata_dev_err(dev,
+                   "failed to configure Port Multiplier (%s, Emask=0x%x)\n",
+                   reason, err_mask);
        return rc;
 }
 
@@ -485,20 +484,17 @@ int sata_pmp_attach(struct ata_device *dev)
 
        /* is it hanging off the right place? */
        if (!sata_pmp_supported(ap)) {
-               ata_dev_printk(dev, KERN_ERR,
-                              "host does not support Port Multiplier\n");
+               ata_dev_err(dev, "host does not support Port Multiplier\n");
                return -EINVAL;
        }
 
        if (!ata_is_host_link(link)) {
-               ata_dev_printk(dev, KERN_ERR,
-                              "Port Multipliers cannot be nested\n");
+               ata_dev_err(dev, "Port Multipliers cannot be nested\n");
                return -EINVAL;
        }
 
        if (dev->devno) {
-               ata_dev_printk(dev, KERN_ERR,
-                              "Port Multiplier must be the first device\n");
+               ata_dev_err(dev, "Port Multiplier must be the first device\n");
                return -EINVAL;
        }
 
@@ -517,8 +513,7 @@ int sata_pmp_attach(struct ata_device *dev)
 
        rc = sata_pmp_init_links(ap, sata_pmp_gscr_ports(dev->gscr));
        if (rc) {
-               ata_dev_printk(dev, KERN_INFO,
-                              "failed to initialize PMP links\n");
+               ata_dev_info(dev, "failed to initialize PMP links\n");
                goto fail;
        }
 
@@ -562,7 +557,7 @@ static void sata_pmp_detach(struct ata_device *dev)
        struct ata_link *tlink;
        unsigned long flags;
 
-       ata_dev_printk(dev, KERN_INFO, "Port Multiplier detaching\n");
+       ata_dev_info(dev, "Port Multiplier detaching\n");
 
        WARN_ON(!ata_is_host_link(link) || dev->devno ||
                link->pmp != SATA_PMP_CTRL_PORT);
@@ -609,23 +604,23 @@ static int sata_pmp_same_pmp(struct ata_device *dev, const u32 *new_gscr)
        new_nr_ports = sata_pmp_gscr_ports(new_gscr);
 
        if (old_vendor != new_vendor) {
-               ata_dev_printk(dev, KERN_INFO, "Port Multiplier "
-                              "vendor mismatch '0x%x' != '0x%x'\n",
-                              old_vendor, new_vendor);
+               ata_dev_info(dev,
+                            "Port Multiplier vendor mismatch '0x%x' != '0x%x'\n",
+                            old_vendor, new_vendor);
                return 0;
        }
 
        if (old_devid != new_devid) {
-               ata_dev_printk(dev, KERN_INFO, "Port Multiplier "
-                              "device ID mismatch '0x%x' != '0x%x'\n",
-                              old_devid, new_devid);
+               ata_dev_info(dev,
+                            "Port Multiplier device ID mismatch '0x%x' != '0x%x'\n",
+                            old_devid, new_devid);
                return 0;
        }
 
        if (old_nr_ports != new_nr_ports) {
-               ata_dev_printk(dev, KERN_INFO, "Port Multiplier "
-                              "nr_ports mismatch '0x%x' != '0x%x'\n",
-                              old_nr_ports, new_nr_ports);
+               ata_dev_info(dev,
+                            "Port Multiplier nr_ports mismatch '0x%x' != '0x%x'\n",
+                            old_nr_ports, new_nr_ports);
                return 0;
        }
 
@@ -691,8 +686,7 @@ static int sata_pmp_revalidate(struct ata_device *dev, unsigned int new_class)
        return 0;
 
  fail:
-       ata_dev_printk(dev, KERN_ERR,
-                      "PMP revalidation failed (errno=%d)\n", rc);
+       ata_dev_err(dev, "PMP revalidation failed (errno=%d)\n", rc);
        DPRINTK("EXIT, rc=%d\n", rc);
        return rc;
 }
@@ -716,13 +710,14 @@ static int sata_pmp_revalidate_quick(struct ata_device *dev)
 
        err_mask = sata_pmp_read(dev->link, SATA_PMP_GSCR_PROD_ID, &prod_id);
        if (err_mask) {
-               ata_dev_printk(dev, KERN_ERR, "failed to read PMP product ID "
-                              "(Emask=0x%x)\n", err_mask);
+               ata_dev_err(dev,
+                           "failed to read PMP product ID (Emask=0x%x)\n",
+                           err_mask);
                return -EIO;
        }
 
        if (prod_id != dev->gscr[SATA_PMP_GSCR_PROD_ID]) {
-               ata_dev_printk(dev, KERN_ERR, "PMP product ID mismatch\n");
+               ata_dev_err(dev, "PMP product ID mismatch\n");
                /* something weird is going on, request full PMP recovery */
                return -EIO;
        }
@@ -777,8 +772,7 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,
                rc = ata_eh_reset(link, 0, prereset, softreset, hardreset,
                                  postreset);
                if (rc) {
-                       ata_link_printk(link, KERN_ERR,
-                                       "failed to reset PMP, giving up\n");
+                       ata_link_err(link, "failed to reset PMP, giving up\n");
                        goto fail;
                }
 
@@ -819,9 +813,9 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,
                        ehc->i.action |= ATA_EH_RESET;
                        goto retry;
                } else {
-                       ata_dev_printk(dev, KERN_ERR, "failed to recover PMP "
-                                      "after %d tries, giving up\n",
-                                      ATA_EH_PMP_TRIES);
+                       ata_dev_err(dev,
+                                   "failed to recover PMP after %d tries, giving up\n",
+                                   ATA_EH_PMP_TRIES);
                        goto fail;
                }
        }
@@ -867,8 +861,9 @@ static int sata_pmp_eh_handle_disabled_links(struct ata_port *ap)
                /* unconditionally clear SError.N */
                rc = sata_scr_write(link, SCR_ERROR, SERR_PHYRDY_CHG);
                if (rc) {
-                       ata_link_printk(link, KERN_ERR, "failed to clear "
-                                       "SError.N (errno=%d)\n", rc);
+                       ata_link_err(link,
+                                    "failed to clear SError.N (errno=%d)\n",
+                                    rc);
                        return rc;
                }
 
@@ -890,7 +885,7 @@ static int sata_pmp_handle_link_fail(struct ata_link *link, int *link_tries)
 
        /* disable this link */
        if (!(link->flags & ATA_LFLAG_DISABLED)) {
-               ata_link_printk(link, KERN_WARNING,
+               ata_link_warn(link,
                        "failed to recover link after %d tries, disabling\n",
                        ATA_EH_PMP_LINK_TRIES);
 
@@ -974,7 +969,7 @@ static int sata_pmp_eh_recover(struct ata_port *ap)
                err_mask = sata_pmp_write(pmp_link, SATA_PMP_GSCR_FEAT_EN,
                                          gscr[SATA_PMP_GSCR_FEAT_EN]);
                if (err_mask) {
-                       ata_link_printk(pmp_link, KERN_WARNING,
+                       ata_link_warn(pmp_link,
                                "failed to disable NOTIFY (err_mask=0x%x)\n",
                                err_mask);
                        goto pmp_fail;
@@ -1018,8 +1013,9 @@ static int sata_pmp_eh_recover(struct ata_port *ap)
                err_mask = sata_pmp_write(pmp_link, SATA_PMP_GSCR_FEAT_EN,
                                          gscr[SATA_PMP_GSCR_FEAT_EN]);
                if (err_mask) {
-                       ata_dev_printk(pmp_dev, KERN_ERR, "failed to write "
-                                      "PMP_FEAT_EN (Emask=0x%x)\n", err_mask);
+                       ata_dev_err(pmp_dev,
+                                   "failed to write PMP_FEAT_EN (Emask=0x%x)\n",
+                                   err_mask);
                        rc = -EIO;
                        goto pmp_fail;
                }
@@ -1028,8 +1024,9 @@ static int sata_pmp_eh_recover(struct ata_port *ap)
        /* check GSCR_ERROR */
        err_mask = sata_pmp_read(pmp_link, SATA_PMP_GSCR_ERROR, &gscr_error);
        if (err_mask) {
-               ata_dev_printk(pmp_dev, KERN_ERR, "failed to read "
-                              "PMP_GSCR_ERROR (Emask=0x%x)\n", err_mask);
+               ata_dev_err(pmp_dev,
+                           "failed to read PMP_GSCR_ERROR (Emask=0x%x)\n",
+                           err_mask);
                rc = -EIO;
                goto pmp_fail;
        }
@@ -1043,17 +1040,16 @@ static int sata_pmp_eh_recover(struct ata_port *ap)
                        ata_ehi_hotplugged(&link->eh_context.i);
                        cnt++;
                } else {
-                       ata_link_printk(link, KERN_WARNING,
-                               "PHY status changed but maxed out on retries, "
-                               "giving up\n");
-                       ata_link_printk(link, KERN_WARNING,
-                               "Manully issue scan to resume this link\n");
+                       ata_link_warn(link,
+                               "PHY status changed but maxed out on retries, giving up\n");
+                       ata_link_warn(link,
+                               "Manually issue scan to resume this link\n");
                }
        }
 
        if (cnt) {
-               ata_port_printk(ap, KERN_INFO, "PMP SError.N set for some "
-                               "ports, repeating recovery\n");
+               ata_port_info(ap,
+                       "PMP SError.N set for some ports, repeating recovery\n");
                goto retry;
        }
 
@@ -1081,9 +1077,8 @@ static int sata_pmp_eh_recover(struct ata_port *ap)
                goto retry;
        }
 
-       ata_port_printk(ap, KERN_ERR,
-                       "failed to recover PMP after %d tries, giving up\n",
-                       ATA_EH_PMP_TRIES);
+       ata_port_err(ap, "failed to recover PMP after %d tries, giving up\n",
+                    ATA_EH_PMP_TRIES);
        sata_pmp_detach(pmp_dev);
        ata_dev_disable(pmp_dev);
 
index 927f968..46d087f 100644 (file)
@@ -1108,8 +1108,7 @@ static int ata_scsi_dev_config(struct scsi_device *sdev,
                /* configure draining */
                buf = kmalloc(ATAPI_MAX_DRAIN, q->bounce_gfp | GFP_KERNEL);
                if (!buf) {
-                       ata_dev_printk(dev, KERN_ERR,
-                                      "drain buffer allocation failed\n");
+                       ata_dev_err(dev, "drain buffer allocation failed\n");
                        return -ENOMEM;
                }
 
@@ -1127,7 +1126,7 @@ static int ata_scsi_dev_config(struct scsi_device *sdev,
         * IDENTIFY_PACKET is executed as ATA_PROT_PIO.
         */
        if (sdev->sector_size > PAGE_SIZE)
-               ata_dev_printk(dev, KERN_WARNING,
+               ata_dev_warn(dev,
                        "sector_size=%u > PAGE_SIZE, PIO may malfunction\n",
                        sdev->sector_size);
 
@@ -1784,8 +1783,7 @@ static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
        if (cmd->sc_data_direction == DMA_FROM_DEVICE ||
            cmd->sc_data_direction == DMA_TO_DEVICE) {
                if (unlikely(scsi_bufflen(cmd) < 1)) {
-                       ata_dev_printk(dev, KERN_WARNING,
-                                      "WARNING: zero len r/w req\n");
+                       ata_dev_warn(dev, "WARNING: zero len r/w req\n");
                        goto err_did;
                }
 
@@ -2969,9 +2967,8 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
                 * with the cached multi_count of libata
                 */
                if (multi_count != dev->multi_count)
-                       ata_dev_printk(dev, KERN_WARNING,
-                                      "invalid multi_count %u ignored\n",
-                                      multi_count);
+                       ata_dev_warn(dev, "invalid multi_count %u ignored\n",
+                                    multi_count);
        }
 
        /*
@@ -3466,9 +3463,8 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync)
                        goto repeat;
                }
 
-               ata_port_printk(ap, KERN_ERR, "WARNING: synchronous SCSI scan "
-                               "failed without making any progress,\n"
-                               "                  switching to async\n");
+               ata_port_err(ap,
+                            "WARNING: synchronous SCSI scan failed without making any progress, switching to async\n");
        }
 
        queue_delayed_work(system_long_wq, &ap->hotplug_task,
@@ -3550,8 +3546,8 @@ static void ata_scsi_remove_dev(struct ata_device *dev)
        mutex_unlock(&ap->scsi_host->scan_mutex);
 
        if (sdev) {
-               ata_dev_printk(dev, KERN_INFO, "detaching (SCSI %s)\n",
-                              dev_name(&sdev->sdev_gendev));
+               ata_dev_info(dev, "detaching (SCSI %s)\n",
+                            dev_name(&sdev->sdev_gendev));
 
                scsi_remove_device(sdev);
                scsi_device_put(sdev);
index b1b926c..c24127d 100644 (file)
@@ -227,9 +227,9 @@ int ata_sff_busy_sleep(struct ata_port *ap,
        }
 
        if (status != 0xff && (status & ATA_BUSY))
-               ata_port_printk(ap, KERN_WARNING,
-                               "port is slow to respond, please be patient "
-                               "(Status 0x%x)\n", status);
+               ata_port_warn(ap,
+                             "port is slow to respond, please be patient (Status 0x%x)\n",
+                             status);
 
        timeout = ata_deadline(timer_start, tmout);
        while (status != 0xff && (status & ATA_BUSY) &&
@@ -242,9 +242,9 @@ int ata_sff_busy_sleep(struct ata_port *ap,
                return -ENODEV;
 
        if (status & ATA_BUSY) {
-               ata_port_printk(ap, KERN_ERR, "port failed to respond "
-                               "(%lu secs, Status 0x%x)\n",
-                               DIV_ROUND_UP(tmout, 1000), status);
+               ata_port_err(ap,
+                            "port failed to respond (%lu secs, Status 0x%x)\n",
+                            DIV_ROUND_UP(tmout, 1000), status);
                return -EBUSY;
        }
 
@@ -350,8 +350,8 @@ static void ata_dev_select(struct ata_port *ap, unsigned int device,
                           unsigned int wait, unsigned int can_sleep)
 {
        if (ata_msg_probe(ap))
-               ata_port_printk(ap, KERN_INFO, "ata_dev_select: ENTER, "
-                               "device %u, wait %u\n", device, wait);
+               ata_port_info(ap, "ata_dev_select: ENTER, device %u, wait %u\n",
+                             device, wait);
 
        if (wait)
                ata_wait_idle(ap);
@@ -1333,9 +1333,10 @@ void ata_sff_flush_pio_task(struct ata_port *ap)
 
        cancel_delayed_work_sync(&ap->sff_pio_task);
        ap->hsm_task_state = HSM_ST_IDLE;
+       ap->sff_pio_task_link = NULL;
 
        if (ata_msg_ctl(ap))
-               ata_port_printk(ap, KERN_DEBUG, "%s: EXIT\n", __func__);
+               ata_port_dbg(ap, "%s: EXIT\n", __func__);
 }
 
 static void ata_sff_pio_task(struct work_struct *work)
@@ -1513,7 +1514,7 @@ static unsigned int ata_sff_idle_irq(struct ata_port *ap)
                ap->ops->sff_check_status(ap);
                if (ap->ops->sff_irq_clear)
                        ap->ops->sff_irq_clear(ap);
-               ata_port_printk(ap, KERN_WARNING, "irq trap\n");
+               ata_port_warn(ap, "irq trap\n");
                return 1;
        }
 #endif
@@ -1711,7 +1712,7 @@ void ata_sff_lost_interrupt(struct ata_port *ap)
 
        /* There was a command running, we are no longer busy and we have
           no interrupt. */
-       ata_port_printk(ap, KERN_WARNING, "lost interrupt (Status 0x%x)\n",
+       ata_port_warn(ap, "lost interrupt (Status 0x%x)\n",
                                                                status);
        /* Run the host interrupt logic as if the interrupt had not been
           lost */
@@ -1798,8 +1799,9 @@ int ata_sff_prereset(struct ata_link *link, unsigned long deadline)
        if (!ata_link_offline(link)) {
                rc = ata_sff_wait_ready(link, deadline);
                if (rc && rc != -ENODEV) {
-                       ata_link_printk(link, KERN_WARNING, "device not ready "
-                                       "(errno=%d), forcing hardreset\n", rc);
+                       ata_link_warn(link,
+                                     "device not ready (errno=%d), forcing hardreset\n",
+                                     rc);
                        ehc->i.action |= ATA_EH_HARDRESET;
                }
        }
@@ -2056,7 +2058,7 @@ int ata_sff_softreset(struct ata_link *link, unsigned int *classes,
        rc = ata_bus_softreset(ap, devmask, deadline);
        /* if link is occupied, -ENODEV too is an error */
        if (rc && (rc != -ENODEV || sata_scr_valid(link))) {
-               ata_link_printk(link, KERN_ERR, "SRST failed (errno=%d)\n", rc);
+               ata_link_err(link, "SRST failed (errno=%d)\n", rc);
                return rc;
        }
 
@@ -2170,8 +2172,7 @@ void ata_sff_drain_fifo(struct ata_queued_cmd *qc)
 
        /* Can become DEBUG later */
        if (count)
-               ata_port_printk(ap, KERN_DEBUG,
-                       "drained %d bytes to clear DRQ.\n", count);
+               ata_port_dbg(ap, "drained %d bytes to clear DRQ\n", count);
 
 }
 EXPORT_SYMBOL_GPL(ata_sff_drain_fifo);
@@ -2316,9 +2317,9 @@ int ata_pci_sff_init_host(struct ata_host *host)
                rc = pcim_iomap_regions(pdev, 0x3 << base,
                                        dev_driver_string(gdev));
                if (rc) {
-                       dev_printk(KERN_WARNING, gdev,
-                                  "failed to request/iomap BARs for port %d "
-                                  "(errno=%d)\n", i, rc);
+                       dev_warn(gdev,
+                                "failed to request/iomap BARs for port %d (errno=%d)\n",
+                                i, rc);
                        if (rc == -EBUSY)
                                pcim_pin_device(pdev);
                        ap->ops = &ata_dummy_port_ops;
@@ -2340,7 +2341,7 @@ int ata_pci_sff_init_host(struct ata_host *host)
        }
 
        if (!mask) {
-               dev_printk(KERN_ERR, gdev, "no available native port\n");
+               dev_err(gdev, "no available native port\n");
                return -ENODEV;
        }
 
@@ -2375,8 +2376,7 @@ int ata_pci_sff_prepare_host(struct pci_dev *pdev,
 
        host = ata_host_alloc_pinfo(&pdev->dev, ppi, 2);
        if (!host) {
-               dev_printk(KERN_ERR, &pdev->dev,
-                          "failed to allocate ATA host\n");
+               dev_err(&pdev->dev, "failed to allocate ATA host\n");
                rc = -ENOMEM;
                goto err_out;
        }
@@ -2542,8 +2542,7 @@ int ata_pci_sff_init_one(struct pci_dev *pdev,
 
        pi = ata_sff_find_valid_pi(ppi);
        if (!pi) {
-               dev_printk(KERN_ERR, &pdev->dev,
-                          "no valid port_info specified\n");
+               dev_err(&pdev->dev, "no valid port_info specified\n");
                return -EINVAL;
        }
 
@@ -3164,8 +3163,7 @@ static void ata_bmdma_nodma(struct ata_host *host, const char *reason)
 {
        int i;
 
-       dev_printk(KERN_ERR, host->dev, "BMDMA: %s, falling back to PIO\n",
-                  reason);
+       dev_err(host->dev, "BMDMA: %s, falling back to PIO\n", reason);
 
        for (i = 0; i < 2; i++) {
                host->ports[i]->mwdma_mask = 0;
@@ -3297,8 +3295,7 @@ int ata_pci_bmdma_init_one(struct pci_dev *pdev,
 
        pi = ata_sff_find_valid_pi(ppi);
        if (!pi) {
-               dev_printk(KERN_ERR, &pdev->dev,
-                          "no valid port_info specified\n");
+               dev_err(&pdev->dev, "no valid port_info specified\n");
                return -EINVAL;
        }
 
index 91949d9..54145ed 100644 (file)
@@ -195,8 +195,6 @@ static int pacpi_port_start(struct ata_port *ap)
        struct pci_dev *pdev = to_pci_dev(ap->host->dev);
        struct pata_acpi *acpi;
 
-       int ret;
-
        if (ap->acpi_handle == NULL)
                return -ENODEV;
 
@@ -205,11 +203,7 @@ static int pacpi_port_start(struct ata_port *ap)
                return -ENOMEM;
        acpi->mask[0] = pacpi_discover_modes(ap, &ap->link.device[0]);
        acpi->mask[1] = pacpi_discover_modes(ap, &ap->link.device[1]);
-       ret = ata_bmdma_port_start(ap);
-       if (ret < 0)
-               return ret;
-
-       return ret;
+       return ata_bmdma_port_start(ap);
 }
 
 static struct scsi_host_template pacpi_sht = {
index 794ec6e..cadd679 100644 (file)
@@ -287,10 +287,10 @@ static void ali_warn_atapi_dma(struct ata_device *adev)
        int print_info = ehc->i.flags & ATA_EHI_PRINTINFO;
 
        if (print_info && adev->class == ATA_DEV_ATAPI && !ali_atapi_dma) {
-               ata_dev_printk(adev, KERN_WARNING,
-                              "WARNING: ATAPI DMA disabled for reliability issues.  It can be enabled\n");
-               ata_dev_printk(adev, KERN_WARNING,
-                              "WARNING: via pata_ali.atapi_dma modparam or corresponding sysfs node.\n");
+               ata_dev_warn(adev,
+                            "WARNING: ATAPI DMA disabled for reliability issues.  It can be enabled\n");
+               ata_dev_warn(adev,
+                            "WARNING: via pata_ali.atapi_dma modparam or corresponding sysfs node.\n");
        }
 }
 
index b0975a5..dc6b5da 100644 (file)
@@ -60,7 +60,7 @@ static void timing_setup(struct ata_port *ap, struct ata_device *adev, int offse
                UT = T / 2;
 
        if (ata_timing_compute(adev, speed, &at, T, UT) < 0) {
-               dev_printk(KERN_ERR, &pdev->dev, "unknown mode %d.\n", speed);
+               dev_err(&pdev->dev, "unknown mode %d\n", speed);
                return;
        }
 
@@ -311,7 +311,7 @@ static unsigned long nv_mode_filter(struct ata_device *dev,
           cable detection result */
        limit |= ata_pack_xfermask(ATA_PIO4, ATA_MWDMA2, ATA_UDMA2);
 
-       ata_port_printk(ap, KERN_DEBUG, "nv_mode_filter: 0x%lx&0x%lx->0x%lx, "
+       ata_port_dbg(ap, "nv_mode_filter: 0x%lx&0x%lx->0x%lx, "
                        "BIOS=0x%lx (0x%x) ACPI=0x%lx%s\n",
                        xfer_mask, limit, xfer_mask & limit, bios_limit,
                        saved_udma, acpi_limit, acpi_str);
@@ -530,14 +530,12 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
                }
        };
        const struct ata_port_info *ppi[] = { NULL, NULL };
-       static int printed_version;
        int type = id->driver_data;
        void *hpriv = NULL;
        u8 fifo;
        int rc;
 
-       if (!printed_version++)
-               dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+       ata_print_version_once(&pdev->dev, DRV_VERSION);
 
        rc = pcim_enable_device(pdev);
        if (rc)
index 2215632..78a93b6 100644 (file)
@@ -346,7 +346,6 @@ static struct ata_port_operations artop6260_ops = {
 
 static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
 {
-       static int printed_version;
        static const struct ata_port_info info_6210 = {
                .flags          = ATA_FLAG_SLAVE_POSS,
                .pio_mask       = ATA_PIO4,
@@ -378,9 +377,7 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
        const struct ata_port_info *ppi[] = { NULL, NULL };
        int rc;
 
-       if (!printed_version++)
-               dev_printk(KERN_DEBUG, &pdev->dev,
-                          "version " DRV_VERSION "\n");
+       ata_print_version_once(&pdev->dev, DRV_VERSION);
 
        rc = pcim_enable_device(pdev);
        if (rc)
index 9529593..3cfabb2 100644 (file)
@@ -470,7 +470,7 @@ static int atp867x_ata_pci_sff_init_host(struct ata_host *host)
        }
 
        if (!mask) {
-               dev_printk(KERN_ERR, gdev, "no available native port\n");
+               dev_err(gdev, "no available native port\n");
                return -ENODEV;
        }
 
@@ -487,7 +487,6 @@ static int atp867x_ata_pci_sff_init_host(struct ata_host *host)
 static int atp867x_init_one(struct pci_dev *pdev,
        const struct pci_device_id *id)
 {
-       static int printed_version;
        static const struct ata_port_info info_867x = {
                .flags          = ATA_FLAG_SLAVE_POSS,
                .pio_mask       = ATA_PIO4,
@@ -499,8 +498,7 @@ static int atp867x_init_one(struct pci_dev *pdev,
        const struct ata_port_info *ppi[] = { &info_867x, NULL };
        int rc;
 
-       if (!printed_version++)
-               dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n");
+       ata_print_version_once(&pdev->dev, DRV_VERSION);
 
        rc = pcim_enable_device(pdev);
        if (rc)
@@ -511,15 +509,14 @@ static int atp867x_init_one(struct pci_dev *pdev,
 
        host = ata_host_alloc_pinfo(&pdev->dev, ppi, ATP867X_NUM_PORTS);
        if (!host) {
-               dev_printk(KERN_ERR, &pdev->dev,
-                       "failed to allocate ATA host\n");
+               dev_err(&pdev->dev, "failed to allocate ATA host\n");
                rc = -ENOMEM;
                goto err_out;
        }
 
        rc = atp867x_ata_pci_sff_init_host(host);
        if (rc) {
-               dev_printk(KERN_ERR, &pdev->dev, "failed to init host\n");
+               dev_err(&pdev->dev, "failed to init host\n");
                goto err_out;
        }
 
@@ -528,7 +525,7 @@ static int atp867x_init_one(struct pci_dev *pdev,
        rc = ata_host_activate(host, pdev->irq, ata_bmdma_interrupt,
                                IRQF_SHARED, &atp867x_sht);
        if (rc)
-               dev_printk(KERN_ERR, &pdev->dev, "failed to activate host\n");
+               dev_err(&pdev->dev, "failed to activate host\n");
 
 err_out:
        return rc;
index ea64967..bd987bb 100644 (file)
@@ -1129,7 +1129,7 @@ static int bfin_softreset(struct ata_link *link, unsigned int *classes,
        /* issue bus reset */
        err_mask = bfin_bus_softreset(ap, devmask);
        if (err_mask) {
-               ata_port_printk(ap, KERN_ERR, "SRST failed (err_mask=0x%x)\n",
+               ata_port_err(ap, "SRST failed (err_mask=0x%x)\n",
                                err_mask);
                return -EIO;
        }
@@ -1382,7 +1382,7 @@ idle_irq:
 #ifdef ATA_IRQ_TRAP
        if ((ap->stats.idle_irq % 1000) == 0) {
                ap->ops->irq_ack(ap, 0); /* debug trap */
-               ata_port_printk(ap, KERN_WARNING, "irq trap\n");
+               ata_port_warn(ap, "irq trap\n");
                return 1;
        }
 #endif
index e3254fc..9ddcddc 100644 (file)
@@ -149,8 +149,7 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
                ppi[1] = &pi;
 
        if ((pcicfg & 0x40) == 0) {
-               dev_printk(KERN_WARNING, &pdev->dev,
-                          "DMA mode disabled. Enabling.\n");
+               dev_warn(&pdev->dev, "DMA mode disabled. Enabling.\n");
                pci_write_config_byte(pdev, 0x60, pcicfg | 0x40);
        }
 
index a088347..aca47e4 100644 (file)
@@ -263,7 +263,6 @@ static struct ata_port_operations efar_ops = {
 
 static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 {
-       static int printed_version;
        static const struct ata_port_info info = {
                .flags          = ATA_FLAG_SLAVE_POSS,
                .pio_mask       = ATA_PIO4,
@@ -273,9 +272,7 @@ static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        };
        const struct ata_port_info *ppi[] = { &info, &info };
 
-       if (!printed_version++)
-               dev_printk(KERN_DEBUG, &pdev->dev,
-                          "version " DRV_VERSION "\n");
+       ata_print_version_once(&pdev->dev, DRV_VERSION);
 
        return ata_pci_bmdma_init_one(pdev, ppi, &efar_sht, NULL,
                                      ATA_HOST_PARALLEL_SCAN);
index 24d7df8..b3042da 100644 (file)
@@ -185,7 +185,6 @@ static void hpt3x3_init_chipset(struct pci_dev *dev)
 
 static int hpt3x3_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 {
-       static int printed_version;
        static const struct ata_port_info info = {
                .flags = ATA_FLAG_SLAVE_POSS,
                .pio_mask = ATA_PIO4,
@@ -206,8 +205,7 @@ static int hpt3x3_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 
        hpt3x3_init_chipset(pdev);
 
-       if (!printed_version++)
-               dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+       ata_print_version_once(&pdev->dev, DRV_VERSION);
 
        host = ata_host_alloc_pinfo(&pdev->dev, ppi, 2);
        if (!host)
index 9f2889f..52e7e7b 100644 (file)
@@ -210,8 +210,8 @@ static void pata_icside_set_dmamode(struct ata_port *ap, struct ata_device *adev
        else
                iomd_type = 'A', cycle = 562;
 
-       ata_dev_printk(adev, KERN_INFO, "timings: act %dns rec %dns cyc %dns (%c)\n",
-               t.active, t.recover, t.cycle, iomd_type);
+       ata_dev_info(adev, "timings: act %dns rec %dns cyc %dns (%c)\n",
+                    t.active, t.recover, t.cycle, iomd_type);
 
        state->port[ap->port_no].speed[adev->devno] = cycle;
 }