aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-core.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-10-19 06:42:56 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-23 20:59:42 -0400
commit2dcb407e61458ded17503d6bd12b8c064965368b (patch)
tree6044e032197b84f9943a385b0c9dbb6656c3f97f /drivers/ata/libata-core.c
parent01e7ae8c13bb06a2ce622ebace33bb7e28ef596c (diff)
[libata] checkpatch-inspired cleanups
Tackle the relatively sane complaints of checkpatch --file. The vast majority is indentation and whitespace changes, the rest are * #include fixes * printk KERN_xxx prefix addition * BSS/initializer cleanups Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r--drivers/ata/libata-core.c66
1 files changed, 34 insertions, 32 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 69092bce1ada..b458639b4735 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -49,11 +49,11 @@
49#include <linux/workqueue.h> 49#include <linux/workqueue.h>
50#include <linux/jiffies.h> 50#include <linux/jiffies.h>
51#include <linux/scatterlist.h> 51#include <linux/scatterlist.h>
52#include <linux/io.h>
52#include <scsi/scsi.h> 53#include <scsi/scsi.h>
53#include <scsi/scsi_cmnd.h> 54#include <scsi/scsi_cmnd.h>
54#include <scsi/scsi_host.h> 55#include <scsi/scsi_host.h>
55#include <linux/libata.h> 56#include <linux/libata.h>
56#include <asm/io.h>
57#include <asm/semaphore.h> 57#include <asm/semaphore.h>
58#include <asm/byteorder.h> 58#include <asm/byteorder.h>
59 59
@@ -93,7 +93,7 @@ int libata_fua = 0;
93module_param_named(fua, libata_fua, int, 0444); 93module_param_named(fua, libata_fua, int, 0444);
94MODULE_PARM_DESC(fua, "FUA support (0=off, 1=on)"); 94MODULE_PARM_DESC(fua, "FUA support (0=off, 1=on)");
95 95
96static int ata_ignore_hpa = 0; 96static int ata_ignore_hpa;
97module_param_named(ignore_hpa, ata_ignore_hpa, int, 0644); 97module_param_named(ignore_hpa, ata_ignore_hpa, int, 0644);
98MODULE_PARM_DESC(ignore_hpa, "Ignore HPA limit (0=keep BIOS limits, 1=ignore limits, using full disk)"); 98MODULE_PARM_DESC(ignore_hpa, "Ignore HPA limit (0=keep BIOS limits, 1=ignore limits, using full disk)");
99 99
@@ -713,7 +713,7 @@ unsigned int ata_dev_classify(const struct ata_taskfile *tf)
713 } 713 }
714 714
715 if ((tf->lbam == 0x3c) && (tf->lbah == 0xc3)) { 715 if ((tf->lbam == 0x3c) && (tf->lbah == 0xc3)) {
716 printk("ata: SEMB device ignored\n"); 716 printk(KERN_INFO "ata: SEMB device ignored\n");
717 return ATA_DEV_SEMB_UNSUP; /* not yet */ 717 return ATA_DEV_SEMB_UNSUP; /* not yet */
718 } 718 }
719 719
@@ -939,7 +939,7 @@ static int ata_read_native_max_address(struct ata_device *dev, u64 *max_sectors)
939 *max_sectors = ata_tf_to_lba48(&tf); 939 *max_sectors = ata_tf_to_lba48(&tf);
940 else 940 else
941 *max_sectors = ata_tf_to_lba(&tf); 941 *max_sectors = ata_tf_to_lba(&tf);
942 if (dev->horkage & ATA_HORKAGE_HPA_SIZE) 942 if (dev->horkage & ATA_HORKAGE_HPA_SIZE)
943 (*max_sectors)--; 943 (*max_sectors)--;
944 return 0; 944 return 0;
945} 945}
@@ -1151,7 +1151,7 @@ void ata_id_to_dma_mode(struct ata_device *dev, u8 unknown)
1151 * LOCKING: 1151 * LOCKING:
1152 * caller. 1152 * caller.
1153 */ 1153 */
1154void ata_noop_dev_select (struct ata_port *ap, unsigned int device) 1154void ata_noop_dev_select(struct ata_port *ap, unsigned int device)
1155{ 1155{
1156} 1156}
1157 1157
@@ -1171,7 +1171,7 @@ void ata_noop_dev_select (struct ata_port *ap, unsigned int device)
1171 * caller. 1171 * caller.
1172 */ 1172 */
1173 1173
1174void ata_std_dev_select (struct ata_port *ap, unsigned int device) 1174void ata_std_dev_select(struct ata_port *ap, unsigned int device)
1175{ 1175{
1176 u8 tmp; 1176 u8 tmp;
1177 1177
@@ -1292,7 +1292,7 @@ static unsigned int ata_id_xfermask(const u16 *id)
1292 */ 1292 */
1293 u8 mode = (id[ATA_ID_OLD_PIO_MODES] >> 8) & 0xFF; 1293 u8 mode = (id[ATA_ID_OLD_PIO_MODES] >> 8) & 0xFF;
1294 if (mode < 5) /* Valid PIO range */ 1294 if (mode < 5) /* Valid PIO range */
1295 pio_mask = (2 << mode) - 1; 1295 pio_mask = (2 << mode) - 1;
1296 else 1296 else
1297 pio_mask = 1; 1297 pio_mask = 1;
1298 1298
@@ -1693,7 +1693,7 @@ static u32 ata_pio_mask_no_iordy(const struct ata_device *adev)
1693 * for pre-ATA4 drives. 1693 * for pre-ATA4 drives.
1694 * 1694 *
1695 * FIXME: ATA_CMD_ID_ATA is optional for early drives and right 1695 * FIXME: ATA_CMD_ID_ATA is optional for early drives and right
1696 * now we abort if we hit that case. 1696 * now we abort if we hit that case.
1697 * 1697 *
1698 * LOCKING: 1698 * LOCKING:
1699 * Kernel thread context (may sleep) 1699 * Kernel thread context (may sleep)
@@ -1979,9 +1979,8 @@ int ata_dev_configure(struct ata_device *dev)
1979 "supports DRM functions and may " 1979 "supports DRM functions and may "
1980 "not be fully accessable.\n"); 1980 "not be fully accessable.\n");
1981 snprintf(revbuf, 7, "CFA"); 1981 snprintf(revbuf, 7, "CFA");
1982 } 1982 } else
1983 else 1983 snprintf(revbuf, 7, "ATA-%d", ata_id_major_version(id));
1984 snprintf(revbuf, 7, "ATA-%d", ata_id_major_version(id));
1985 1984
1986 dev->n_sectors = ata_id_n_sectors(id); 1985 dev->n_sectors = ata_id_n_sectors(id);
1987 1986
@@ -2110,7 +2109,7 @@ int ata_dev_configure(struct ata_device *dev)
2110 /* Let the user know. We don't want to disallow opens for 2109 /* Let the user know. We don't want to disallow opens for
2111 rescue purposes, or in case the vendor is just a blithering 2110 rescue purposes, or in case the vendor is just a blithering
2112 idiot */ 2111 idiot */
2113 if (print_info) { 2112 if (print_info) {
2114 ata_dev_printk(dev, KERN_WARNING, 2113 ata_dev_printk(dev, KERN_WARNING,
2115"Drive reports diagnostics failure. This may indicate a drive\n"); 2114"Drive reports diagnostics failure. This may indicate a drive\n");
2116 ata_dev_printk(dev, KERN_WARNING, 2115 ata_dev_printk(dev, KERN_WARNING,
@@ -2667,8 +2666,8 @@ static const struct ata_timing ata_timing[] = {
2667 { 0xFF } 2666 { 0xFF }
2668}; 2667};
2669 2668
2670#define ENOUGH(v,unit) (((v)-1)/(unit)+1) 2669#define ENOUGH(v, unit) (((v)-1)/(unit)+1)
2671#define EZ(v,unit) ((v)?ENOUGH(v,unit):0) 2670#define EZ(v, unit) ((v)?ENOUGH(v, unit):0)
2672 2671
2673static void ata_timing_quantize(const struct ata_timing *t, struct ata_timing *q, int T, int UT) 2672static void ata_timing_quantize(const struct ata_timing *t, struct ata_timing *q, int T, int UT)
2674{ 2673{
@@ -2695,7 +2694,7 @@ void ata_timing_merge(const struct ata_timing *a, const struct ata_timing *b,
2695 if (what & ATA_TIMING_UDMA ) m->udma = max(a->udma, b->udma); 2694 if (what & ATA_TIMING_UDMA ) m->udma = max(a->udma, b->udma);
2696} 2695}
2697 2696
2698static const struct ata_timing* ata_timing_find_mode(unsigned short speed) 2697static const struct ata_timing *ata_timing_find_mode(unsigned short speed)
2699{ 2698{
2700 const struct ata_timing *t; 2699 const struct ata_timing *t;
2701 2700
@@ -2727,10 +2726,10 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed,
2727 2726
2728 if (adev->id[ATA_ID_FIELD_VALID] & 2) { /* EIDE drive */ 2727 if (adev->id[ATA_ID_FIELD_VALID] & 2) { /* EIDE drive */
2729 memset(&p, 0, sizeof(p)); 2728 memset(&p, 0, sizeof(p));
2730 if(speed >= XFER_PIO_0 && speed <= XFER_SW_DMA_0) { 2729 if (speed >= XFER_PIO_0 && speed <= XFER_SW_DMA_0) {
2731 if (speed <= XFER_PIO_2) p.cycle = p.cyc8b = adev->id[ATA_ID_EIDE_PIO]; 2730 if (speed <= XFER_PIO_2) p.cycle = p.cyc8b = adev->id[ATA_ID_EIDE_PIO];
2732 else p.cycle = p.cyc8b = adev->id[ATA_ID_EIDE_PIO_IORDY]; 2731 else p.cycle = p.cyc8b = adev->id[ATA_ID_EIDE_PIO_IORDY];
2733 } else if(speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2) { 2732 } else if (speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2) {
2734 p.cycle = adev->id[ATA_ID_EIDE_DMA_MIN]; 2733 p.cycle = adev->id[ATA_ID_EIDE_DMA_MIN];
2735 } 2734 }
2736 ata_timing_merge(&p, t, t, ATA_TIMING_CYCLE | ATA_TIMING_CYC8B); 2735 ata_timing_merge(&p, t, t, ATA_TIMING_CYCLE | ATA_TIMING_CYC8B);
@@ -2876,14 +2875,17 @@ static int ata_dev_set_mode(struct ata_device *dev)
2876 dev->flags |= ATA_DFLAG_PIO; 2875 dev->flags |= ATA_DFLAG_PIO;
2877 2876
2878 err_mask = ata_dev_set_xfermode(dev); 2877 err_mask = ata_dev_set_xfermode(dev);
2878
2879 /* Old CFA may refuse this command, which is just fine */ 2879 /* Old CFA may refuse this command, which is just fine */
2880 if (dev->xfer_shift == ATA_SHIFT_PIO && ata_id_is_cfa(dev->id)) 2880 if (dev->xfer_shift == ATA_SHIFT_PIO && ata_id_is_cfa(dev->id))
2881 err_mask &= ~AC_ERR_DEV; 2881 err_mask &= ~AC_ERR_DEV;
2882
2882 /* Some very old devices and some bad newer ones fail any kind of 2883 /* Some very old devices and some bad newer ones fail any kind of
2883 SET_XFERMODE request but support PIO0-2 timings and no IORDY */ 2884 SET_XFERMODE request but support PIO0-2 timings and no IORDY */
2884 if (dev->xfer_shift == ATA_SHIFT_PIO && !ata_id_has_iordy(dev->id) && 2885 if (dev->xfer_shift == ATA_SHIFT_PIO && !ata_id_has_iordy(dev->id) &&
2885 dev->pio_mode <= XFER_PIO_2) 2886 dev->pio_mode <= XFER_PIO_2)
2886 err_mask &= ~AC_ERR_DEV; 2887 err_mask &= ~AC_ERR_DEV;
2888
2887 if (err_mask) { 2889 if (err_mask) {
2888 ata_dev_printk(dev, KERN_ERR, "failed to set xfermode " 2890 ata_dev_printk(dev, KERN_ERR, "failed to set xfermode "
2889 "(err_mask=0x%x)\n", err_mask); 2891 "(err_mask=0x%x)\n", err_mask);
@@ -3943,7 +3945,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
3943 { "SAMSUNG CD-ROM SC", NULL, ATA_HORKAGE_NODMA }, 3945 { "SAMSUNG CD-ROM SC", NULL, ATA_HORKAGE_NODMA },
3944 { "ATAPI CD-ROM DRIVE 40X MAXIMUM",NULL,ATA_HORKAGE_NODMA }, 3946 { "ATAPI CD-ROM DRIVE 40X MAXIMUM",NULL,ATA_HORKAGE_NODMA },
3945 { "_NEC DV5800A", NULL, ATA_HORKAGE_NODMA }, 3947 { "_NEC DV5800A", NULL, ATA_HORKAGE_NODMA },
3946 { "SAMSUNG CD-ROM SN-124","N001", ATA_HORKAGE_NODMA }, 3948 { "SAMSUNG CD-ROM SN-124", "N001", ATA_HORKAGE_NODMA },
3947 { "Seagate STT20000A", NULL, ATA_HORKAGE_NODMA }, 3949 { "Seagate STT20000A", NULL, ATA_HORKAGE_NODMA },
3948 { "IOMEGA ZIP 250 ATAPI", NULL, ATA_HORKAGE_NODMA }, /* temporary fix */ 3950 { "IOMEGA ZIP 250 ATAPI", NULL, ATA_HORKAGE_NODMA }, /* temporary fix */
3949 { "IOMEGA ZIP 250 ATAPI Floppy", 3951 { "IOMEGA ZIP 250 ATAPI Floppy",
@@ -3959,7 +3961,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
3959 3961
3960 /* Devices where NCQ should be avoided */ 3962 /* Devices where NCQ should be avoided */
3961 /* NCQ is slow */ 3963 /* NCQ is slow */
3962 { "WDC WD740ADFD-00", NULL, ATA_HORKAGE_NONCQ }, 3964 { "WDC WD740ADFD-00", NULL, ATA_HORKAGE_NONCQ },
3963 /* http://thread.gmane.org/gmane.linux.ide/14907 */ 3965 /* http://thread.gmane.org/gmane.linux.ide/14907 */
3964 { "FUJITSU MHT2060BH", NULL, ATA_HORKAGE_NONCQ }, 3966 { "FUJITSU MHT2060BH", NULL, ATA_HORKAGE_NONCQ },
3965 /* NCQ is broken */ 3967 /* NCQ is broken */
@@ -4106,7 +4108,7 @@ static void ata_dev_xfermask(struct ata_device *dev)
4106 } 4108 }
4107 4109
4108 if ((host->flags & ATA_HOST_SIMPLEX) && 4110 if ((host->flags & ATA_HOST_SIMPLEX) &&
4109 host->simplex_claimed && host->simplex_claimed != ap) { 4111 host->simplex_claimed && host->simplex_claimed != ap) {
4110 xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); 4112 xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
4111 ata_dev_printk(dev, KERN_WARNING, "simplex DMA is claimed by " 4113 ata_dev_printk(dev, KERN_WARNING, "simplex DMA is claimed by "
4112 "other device, disabling DMA\n"); 4114 "other device, disabling DMA\n");
@@ -4128,11 +4130,11 @@ static void ata_dev_xfermask(struct ata_device *dev)
4128 */ 4130 */
4129 if (xfer_mask & (0xF8 << ATA_SHIFT_UDMA)) 4131 if (xfer_mask & (0xF8 << ATA_SHIFT_UDMA))
4130 /* UDMA/44 or higher would be available */ 4132 /* UDMA/44 or higher would be available */
4131 if((ap->cbl == ATA_CBL_PATA40) || 4133 if ((ap->cbl == ATA_CBL_PATA40) ||
4132 (ata_drive_40wire(dev->id) && 4134 (ata_drive_40wire(dev->id) &&
4133 (ap->cbl == ATA_CBL_PATA_UNK || 4135 (ap->cbl == ATA_CBL_PATA_UNK ||
4134 ap->cbl == ATA_CBL_PATA80))) { 4136 ap->cbl == ATA_CBL_PATA80))) {
4135 ata_dev_printk(dev, KERN_WARNING, 4137 ata_dev_printk(dev, KERN_WARNING,
4136 "limited to UDMA/33 due to 40-wire cable\n"); 4138 "limited to UDMA/33 due to 40-wire cable\n");
4137 xfer_mask &= ~(0xF8 << ATA_SHIFT_UDMA); 4139 xfer_mask &= ~(0xF8 << ATA_SHIFT_UDMA);
4138 } 4140 }
@@ -4395,7 +4397,7 @@ static void ata_fill_sg_dumb(struct ata_queued_cmd *qc)
4395 u32 addr, offset; 4397 u32 addr, offset;
4396 u32 sg_len, len, blen; 4398 u32 sg_len, len, blen;
4397 4399
4398 /* determine if physical DMA addr spans 64K boundary. 4400 /* determine if physical DMA addr spans 64K boundary.
4399 * Note h/w doesn't support 64-bit, so we unconditionally 4401 * Note h/w doesn't support 64-bit, so we unconditionally
4400 * truncate dma_addr_t to u32. 4402 * truncate dma_addr_t to u32.
4401 */ 4403 */
@@ -4980,7 +4982,7 @@ next_sg:
4980 "%u bytes trailing data\n", bytes); 4982 "%u bytes trailing data\n", bytes);
4981 4983
4982 for (i = 0; i < words; i++) 4984 for (i = 0; i < words; i++)
4983 ap->ops->data_xfer(qc->dev, (unsigned char*)pad_buf, 2, do_write); 4985 ap->ops->data_xfer(qc->dev, (unsigned char *)pad_buf, 2, do_write);
4984 4986
4985 ap->hsm_task_state = HSM_ST_LAST; 4987 ap->hsm_task_state = HSM_ST_LAST;
4986 return; 4988 return;
@@ -5908,8 +5910,8 @@ unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc)
5908 * One if interrupt was handled, zero if not (shared irq). 5910 * One if interrupt was handled, zero if not (shared irq).
5909 */ 5911 */
5910 5912
5911inline unsigned int ata_host_intr (struct ata_port *ap, 5913inline unsigned int ata_host_intr(struct ata_port *ap,
5912 struct ata_queued_cmd *qc) 5914 struct ata_queued_cmd *qc)
5913{ 5915{
5914 struct ata_eh_info *ehi = &ap->link.eh_info; 5916 struct ata_eh_info *ehi = &ap->link.eh_info;
5915 u8 status, host_stat = 0; 5917 u8 status, host_stat = 0;
@@ -6009,7 +6011,7 @@ idle_irq:
6009 * IRQ_NONE or IRQ_HANDLED. 6011 * IRQ_NONE or IRQ_HANDLED.
6010 */ 6012 */
6011 6013
6012irqreturn_t ata_interrupt (int irq, void *dev_instance) 6014irqreturn_t ata_interrupt(int irq, void *dev_instance)
6013{ 6015{
6014 struct ata_host *host = dev_instance; 6016 struct ata_host *host = dev_instance;
6015 unsigned int i; 6017 unsigned int i;
@@ -6212,7 +6214,7 @@ int ata_flush_cache(struct ata_device *dev)
6212 6214
6213 /* This is wrong. On a failed flush we get back the LBA of the lost 6215 /* This is wrong. On a failed flush we get back the LBA of the lost
6214 sector and we should (assuming it wasn't aborted as unknown) issue 6216 sector and we should (assuming it wasn't aborted as unknown) issue
6215 a further flush command to continue the writeback until it 6217 a further flush command to continue the writeback until it
6216 does not error */ 6218 does not error */
6217 err_mask = ata_do_simple_cmd(dev, cmd); 6219 err_mask = ata_do_simple_cmd(dev, cmd);
6218 if (err_mask) { 6220 if (err_mask) {