Commit 49bfbd38 authored by Sergei Shtylyov's avatar Sergei Shtylyov Committed by Jeff Garzik

pata_hpt37x: coding style cleanup

Fix 12 errors and 15 warnings given by checkpatch.pl:

- *switch* and *case* not on the same indentation level;

- no space between *for*/*switch*/*while* and open parenthesis;

- space between an unary operator and its operand;

- drive blacklist arrays not being *const*;

- spaces before tabs;

- lines over 80 characters.

In addition to these changes, also do the following:

- add new line after variable definitions;

- fix the style of some multi-line comments.
Signed-off-by: default avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent 28cd4b6b
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <linux/libata.h> #include <linux/libata.h>
#define DRV_NAME "pata_hpt37x" #define DRV_NAME "pata_hpt37x"
#define DRV_VERSION "0.6.16" #define DRV_VERSION "0.6.17"
struct hpt_clock { struct hpt_clock {
u8 xfer_speed; u8 xfer_speed;
...@@ -210,7 +210,7 @@ static u32 hpt37x_find_mode(struct ata_port *ap, int speed) ...@@ -210,7 +210,7 @@ static u32 hpt37x_find_mode(struct ata_port *ap, int speed)
{ {
struct hpt_clock *clocks = ap->host->private_data; struct hpt_clock *clocks = ap->host->private_data;
while(clocks->xfer_speed) { while (clocks->xfer_speed) {
if (clocks->xfer_speed == speed) if (clocks->xfer_speed == speed)
return clocks->timing; return clocks->timing;
clocks++; clocks++;
...@@ -219,7 +219,8 @@ static u32 hpt37x_find_mode(struct ata_port *ap, int speed) ...@@ -219,7 +219,8 @@ static u32 hpt37x_find_mode(struct ata_port *ap, int speed)
return 0xffffffffU; /* silence compiler warning */ return 0xffffffffU; /* silence compiler warning */
} }
static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, const char *list[]) static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr,
const char * const list[])
{ {
unsigned char model_num[ATA_ID_PROD_LEN + 1]; unsigned char model_num[ATA_ID_PROD_LEN + 1];
int i = 0; int i = 0;
...@@ -237,18 +238,23 @@ static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, cons ...@@ -237,18 +238,23 @@ static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, cons
return 0; return 0;
} }
static const char *bad_ata33[] = { static const char * const bad_ata33[] = {
"Maxtor 92720U8", "Maxtor 92040U6", "Maxtor 91360U4", "Maxtor 91020U3", "Maxtor 90845U3", "Maxtor 90650U2", "Maxtor 92720U8", "Maxtor 92040U6", "Maxtor 91360U4", "Maxtor 91020U3",
"Maxtor 91360D8", "Maxtor 91190D7", "Maxtor 91020D6", "Maxtor 90845D5", "Maxtor 90680D4", "Maxtor 90510D3", "Maxtor 90340D2", "Maxtor 90845U3", "Maxtor 90650U2",
"Maxtor 91152D8", "Maxtor 91008D7", "Maxtor 90845D6", "Maxtor 90840D6", "Maxtor 90720D5", "Maxtor 90648D5", "Maxtor 90576D4", "Maxtor 91360D8", "Maxtor 91190D7", "Maxtor 91020D6", "Maxtor 90845D5",
"Maxtor 90680D4", "Maxtor 90510D3", "Maxtor 90340D2",
"Maxtor 91152D8", "Maxtor 91008D7", "Maxtor 90845D6", "Maxtor 90840D6",
"Maxtor 90720D5", "Maxtor 90648D5", "Maxtor 90576D4",
"Maxtor 90510D4", "Maxtor 90510D4",
"Maxtor 90432D3", "Maxtor 90288D2", "Maxtor 90256D2", "Maxtor 90432D3", "Maxtor 90288D2", "Maxtor 90256D2",
"Maxtor 91000D8", "Maxtor 90910D8", "Maxtor 90875D7", "Maxtor 90840D7", "Maxtor 90750D6", "Maxtor 90625D5", "Maxtor 90500D4", "Maxtor 91000D8", "Maxtor 90910D8", "Maxtor 90875D7", "Maxtor 90840D7",
"Maxtor 91728D8", "Maxtor 91512D7", "Maxtor 91303D6", "Maxtor 91080D5", "Maxtor 90845D4", "Maxtor 90680D4", "Maxtor 90648D3", "Maxtor 90432D2", "Maxtor 90750D6", "Maxtor 90625D5", "Maxtor 90500D4",
"Maxtor 91728D8", "Maxtor 91512D7", "Maxtor 91303D6", "Maxtor 91080D5",
"Maxtor 90845D4", "Maxtor 90680D4", "Maxtor 90648D3", "Maxtor 90432D2",
NULL NULL
}; };
static const char *bad_ata100_5[] = { static const char * const bad_ata100_5[] = {
"IBM-DTLA-307075", "IBM-DTLA-307075",
"IBM-DTLA-307060", "IBM-DTLA-307060",
"IBM-DTLA-307045", "IBM-DTLA-307045",
...@@ -389,6 +395,7 @@ static int hpt37x_pre_reset(struct ata_link *link, unsigned long deadline) ...@@ -389,6 +395,7 @@ static int hpt37x_pre_reset(struct ata_link *link, unsigned long deadline)
{ 0x50, 1, 0x04, 0x04 }, { 0x50, 1, 0x04, 0x04 },
{ 0x54, 1, 0x04, 0x04 } { 0x54, 1, 0x04, 0x04 }
}; };
if (!pci_test_config_bits(pdev, &hpt37x_enable_bits[ap->port_no])) if (!pci_test_config_bits(pdev, &hpt37x_enable_bits[ap->port_no]))
return -ENOENT; return -ENOENT;
...@@ -673,12 +680,12 @@ static int hpt37x_calibrate_dpll(struct pci_dev *dev) ...@@ -673,12 +680,12 @@ static int hpt37x_calibrate_dpll(struct pci_dev *dev)
u32 reg5c; u32 reg5c;
int tries; int tries;
for(tries = 0; tries < 0x5000; tries++) { for (tries = 0; tries < 0x5000; tries++) {
udelay(50); udelay(50);
pci_read_config_byte(dev, 0x5b, &reg5b); pci_read_config_byte(dev, 0x5b, &reg5b);
if (reg5b & 0x80) { if (reg5b & 0x80) {
/* See if it stays set */ /* See if it stays set */
for(tries = 0; tries < 0x1000; tries ++) { for (tries = 0; tries < 0x1000; tries++) {
pci_read_config_byte(dev, 0x5b, &reg5b); pci_read_config_byte(dev, 0x5b, &reg5b);
/* Failed ? */ /* Failed ? */
if ((reg5b & 0x80) == 0) if ((reg5b & 0x80) == 0)
...@@ -686,7 +693,7 @@ static int hpt37x_calibrate_dpll(struct pci_dev *dev) ...@@ -686,7 +693,7 @@ static int hpt37x_calibrate_dpll(struct pci_dev *dev)
} }
/* Turn off tuning, we have the DPLL set */ /* Turn off tuning, we have the DPLL set */
pci_read_config_dword(dev, 0x5c, &reg5c); pci_read_config_dword(dev, 0x5c, &reg5c);
pci_write_config_dword(dev, 0x5c, reg5c & ~ 0x100); pci_write_config_dword(dev, 0x5c, reg5c & ~0x100);
return 1; return 1;
} }
} }
...@@ -698,6 +705,7 @@ static u32 hpt374_read_freq(struct pci_dev *pdev) ...@@ -698,6 +705,7 @@ static u32 hpt374_read_freq(struct pci_dev *pdev)
{ {
u32 freq; u32 freq;
unsigned long io_base = pci_resource_start(pdev, 4); unsigned long io_base = pci_resource_start(pdev, 4);
if (PCI_FUNC(pdev->devfn) & 1) { if (PCI_FUNC(pdev->devfn) & 1) {
struct pci_dev *pdev_0; struct pci_dev *pdev_0;
...@@ -839,64 +847,68 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -839,64 +847,68 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
if (rev == 6) if (rev == 6)
return -ENODEV; return -ENODEV;
switch(rev) { switch (rev) {
case 3: case 3:
ppi[0] = &info_hpt370; ppi[0] = &info_hpt370;
chip_table = &hpt370; chip_table = &hpt370;
prefer_dpll = 0; prefer_dpll = 0;
break; break;
case 4: case 4:
ppi[0] = &info_hpt370a; ppi[0] = &info_hpt370a;
chip_table = &hpt370a; chip_table = &hpt370a;
prefer_dpll = 0; prefer_dpll = 0;
break; break;
case 5: case 5:
ppi[0] = &info_hpt372; ppi[0] = &info_hpt372;
chip_table = &hpt372; chip_table = &hpt372;
break; break;
default: default:
printk(KERN_ERR "pata_hpt37x: Unknown HPT366 " printk(KERN_ERR "pata_hpt37x: Unknown HPT366 subtype, "
"subtype, please report (%d).\n", rev); "please report (%d).\n", rev);
return -ENODEV; return -ENODEV;
} }
} else { } else {
switch(dev->device) { switch (dev->device) {
case PCI_DEVICE_ID_TTI_HPT372: case PCI_DEVICE_ID_TTI_HPT372:
/* 372N if rev >= 2 */ /* 372N if rev >= 2 */
if (rev >= 2) if (rev >= 2)
return -ENODEV; return -ENODEV;
ppi[0] = &info_hpt372; ppi[0] = &info_hpt372;
chip_table = &hpt372a; chip_table = &hpt372a;
break; break;
case PCI_DEVICE_ID_TTI_HPT302: case PCI_DEVICE_ID_TTI_HPT302:
/* 302N if rev > 1 */ /* 302N if rev > 1 */
if (rev > 1) if (rev > 1)
return -ENODEV; return -ENODEV;
ppi[0] = &info_hpt302; ppi[0] = &info_hpt302;
/* Check this */ /* Check this */
chip_table = &hpt302; chip_table = &hpt302;
break; break;
case PCI_DEVICE_ID_TTI_HPT371: case PCI_DEVICE_ID_TTI_HPT371:
if (rev > 1) if (rev > 1)
return -ENODEV; return -ENODEV;
ppi[0] = &info_hpt302; ppi[0] = &info_hpt302;
chip_table = &hpt371; chip_table = &hpt371;
/* Single channel device, master is not present /*
but the BIOS (or us for non x86) must mark it * Single channel device, master is not present
absent */ * but the BIOS (or us for non x86) must mark it
pci_read_config_byte(dev, 0x50, &mcr1); * absent
mcr1 &= ~0x04; */
pci_write_config_byte(dev, 0x50, mcr1); pci_read_config_byte(dev, 0x50, &mcr1);
break; mcr1 &= ~0x04;
case PCI_DEVICE_ID_TTI_HPT374: pci_write_config_byte(dev, 0x50, mcr1);
chip_table = &hpt374; break;
if (!(PCI_FUNC(dev->devfn) & 1)) case PCI_DEVICE_ID_TTI_HPT374:
*ppi = &info_hpt374_fn0; chip_table = &hpt374;
else if (!(PCI_FUNC(dev->devfn) & 1))
*ppi = &info_hpt374_fn1; *ppi = &info_hpt374_fn0;
break; else
default: *ppi = &info_hpt374_fn1;
printk(KERN_ERR "pata_hpt37x: PCI table is bogus please report (%d).\n", dev->device); break;
default:
printk(KERN_ERR
"pata_hpt37x: PCI table is bogus, please report (%d).\n",
dev->device);
return -ENODEV; return -ENODEV;
} }
} }
...@@ -927,9 +939,11 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -927,9 +939,11 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
if (chip_table == &hpt372a) if (chip_table == &hpt372a)
outb(0x0e, iobase + 0x9c); outb(0x0e, iobase + 0x9c);
/* Some devices do not let this value be accessed via PCI space /*
according to the old driver. In addition we must use the value * Some devices do not let this value be accessed via PCI space
from FN 0 on the HPT374 */ * according to the old driver. In addition we must use the value
* from FN 0 on the HPT374.
*/
if (chip_table == &hpt374) { if (chip_table == &hpt374) {
freq = hpt374_read_freq(dev); freq = hpt374_read_freq(dev);
...@@ -943,10 +957,11 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -943,10 +957,11 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
u8 sr; u8 sr;
u32 total = 0; u32 total = 0;
printk(KERN_WARNING "pata_hpt37x: BIOS has not set timing clocks.\n"); printk(KERN_WARNING
"pata_hpt37x: BIOS has not set timing clocks.\n");
/* This is the process the HPT371 BIOS is reported to use */ /* This is the process the HPT371 BIOS is reported to use */
for(i = 0; i < 128; i++) { for (i = 0; i < 128; i++) {
pci_read_config_byte(dev, 0x78, &sr); pci_read_config_byte(dev, 0x78, &sr);
total += sr & 0x1FF; total += sr & 0x1FF;
udelay(15); udelay(15);
...@@ -981,17 +996,22 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -981,17 +996,22 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
/* Select the DPLL clock. */ /* Select the DPLL clock. */
pci_write_config_byte(dev, 0x5b, 0x21); pci_write_config_byte(dev, 0x5b, 0x21);
pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low | 0x100); pci_write_config_dword(dev, 0x5C,
(f_high << 16) | f_low | 0x100);
for(adjust = 0; adjust < 8; adjust++) { for (adjust = 0; adjust < 8; adjust++) {
if (hpt37x_calibrate_dpll(dev)) if (hpt37x_calibrate_dpll(dev))
break; break;
/* See if it'll settle at a fractionally different clock */ /*
* See if it'll settle at a fractionally
* different clock
*/
if (adjust & 1) if (adjust & 1)
f_low -= adjust >> 1; f_low -= adjust >> 1;
else else
f_high += adjust >> 1; f_high += adjust >> 1;
pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low | 0x100); pci_write_config_dword(dev, 0x5C,
(f_high << 16) | f_low | 0x100);
} }
if (adjust == 8) { if (adjust == 8) {
printk(KERN_ERR "pata_hpt37x: DPLL did not stabilize!\n"); printk(KERN_ERR "pata_hpt37x: DPLL did not stabilize!\n");
...@@ -1010,7 +1030,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) ...@@ -1010,7 +1030,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
* Perform a final fixup. Note that we will have used the * Perform a final fixup. Note that we will have used the
* DPLL on the HPT372 which means we don't have to worry * DPLL on the HPT372 which means we don't have to worry
* about lack of UDMA133 support on lower clocks * about lack of UDMA133 support on lower clocks
*/ */
if (clock_slot < 2 && ppi[0] == &info_hpt370) if (clock_slot < 2 && ppi[0] == &info_hpt370)
ppi[0] = &info_hpt370_33; ppi[0] = &info_hpt370_33;
...@@ -1035,9 +1055,9 @@ static const struct pci_device_id hpt37x[] = { ...@@ -1035,9 +1055,9 @@ static const struct pci_device_id hpt37x[] = {
}; };
static struct pci_driver hpt37x_pci_driver = { static struct pci_driver hpt37x_pci_driver = {
.name = DRV_NAME, .name = DRV_NAME,
.id_table = hpt37x, .id_table = hpt37x,
.probe = hpt37x_init_one, .probe = hpt37x_init_one,
.remove = ata_pci_remove_one .remove = ata_pci_remove_one
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment