Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 47348
b: refs/heads/master
c: 8bfa79f
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo authored and Jeff Garzik committed Feb 9, 2007
1 parent 15ec53e commit d794bf7
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 79 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a0cf733b333eeeafb7324e2897448006c693c26c
refs/heads/master: 8bfa79fcb81d2bdb043f60ab4171704467808b55
27 changes: 6 additions & 21 deletions trunk/drivers/ata/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3325,35 +3325,20 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
{ }
};

static int ata_strim(char *s, size_t len)
{
len = strnlen(s, len);

/* ATAPI specifies that empty space is blank-filled; remove blanks */
while ((len > 0) && (s[len - 1] == ' ')) {
len--;
s[len] = 0;
}
return len;
}

unsigned long ata_device_blacklisted(const struct ata_device *dev)
{
unsigned char model_num[ATA_ID_PROD_LEN];
unsigned char model_rev[ATA_ID_FW_REV_LEN];
unsigned int nlen, rlen;
unsigned char model_num[ATA_ID_PROD_LEN + 1];
unsigned char model_rev[ATA_ID_FW_REV_LEN + 1];
const struct ata_blacklist_entry *ad = ata_device_blacklist;

ata_id_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
ata_id_string(dev->id, model_rev, ATA_ID_FW_REV, sizeof(model_rev));
nlen = ata_strim(model_num, sizeof(model_num));
rlen = ata_strim(model_rev, sizeof(model_rev));
ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
ata_id_c_string(dev->id, model_rev, ATA_ID_FW_REV, sizeof(model_rev));

while (ad->model_num) {
if (!strncmp(ad->model_num, model_num, nlen)) {
if (!strcmp(ad->model_num, model_num)) {
if (ad->model_rev == NULL)
return ad->horkage;
if (!strncmp(ad->model_rev, model_rev, rlen))
if (!strcmp(ad->model_rev, model_rev))
return ad->horkage;
}
ad++;
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/ata/pata_ali.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ static void ali_early_error_handler(struct ata_port *ap)

static unsigned long ali_20_filter(const struct ata_port *ap, struct ata_device *adev, unsigned long mask)
{
char model_num[ATA_ID_PROD_LEN];
char model_num[ATA_ID_PROD_LEN + 1];
/* No DMA on anything but a disk for now */
if (adev->class != ATA_DEV_ATA)
mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
ata_id_string(adev->id, model_num, ATA_ID_PROD, sizeof(model_num));
ata_id_c_string(adev->id, model_num, ATA_ID_PROD, sizeof(model_num));
if (strstr(model_num, "WDC"))
return mask &= ~ATA_MASK_UDMA;
return ata_pci_default_filter(ap, adev, mask);
Expand Down
18 changes: 4 additions & 14 deletions trunk/drivers/ata/pata_hpt366.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,23 +151,13 @@ static const char *bad_ata66_3[] = {

static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, const char *list[])
{
unsigned char model_num[ATA_ID_PROD_LEN];
char *s;
unsigned int len;
unsigned char model_num[ATA_ID_PROD_LEN + 1];
int i = 0;

ata_id_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
s = &model_num[0];
len = strnlen(s, sizeof(model_num));
ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));

/* ATAPI specifies that empty space is blank-filled; remove blanks */
while ((len > 0) && (s[len - 1] == ' ')) {
len--;
s[len] = 0;
}

while(list[i] != NULL) {
if (!strncmp(list[i], s, len)) {
while (list[i] != NULL) {
if (!strcmp(list[i], model_num)) {
printk(KERN_WARNING DRV_NAME ": %s is not supported for %s.\n",
modestr, list[i]);
return 1;
Expand Down
18 changes: 4 additions & 14 deletions trunk/drivers/ata/pata_hpt37x.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,23 +349,13 @@ static u32 hpt37x_find_mode(struct ata_port *ap, int speed)

static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, const char *list[])
{
unsigned char model_num[ATA_ID_PROD_LEN];
char *s;
unsigned int len;
unsigned char model_num[ATA_ID_PROD_LEN + 1];
int i = 0;

ata_id_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
s = &model_num[0];
len = strnlen(s, sizeof(model_num));
ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));

/* ATAPI specifies that empty space is blank-filled; remove blanks */
while ((len > 0) && (s[len - 1] == ' ')) {
len--;
s[len] = 0;
}

while(list[i] != NULL) {
if (!strncmp(list[i], s, len)) {
while (list[i] != NULL) {
if (!strcmp(list[i], model_num)) {
printk(KERN_WARNING DRV_NAME ": %s is not supported for %s.\n",
modestr, list[i]);
return 1;
Expand Down
17 changes: 2 additions & 15 deletions trunk/drivers/ata/pata_it821x.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,22 +531,9 @@ static int it821x_smart_set_mode(struct ata_port *ap, struct ata_device **unused

static void it821x_dev_config(struct ata_port *ap, struct ata_device *adev)
{
unsigned char model_num[ATA_ID_PROD_LEN];
char *s;
unsigned int len;
unsigned char model_num[ATA_ID_PROD_LEN + 1];

/* This block ought to be a library routine as it is in several
drivers now */

ata_id_string(adev->id, model_num, ATA_ID_PROD, sizeof(model_num));
s = &model_num[0];
len = strnlen(s, sizeof(model_num));

/* ATAPI specifies that empty space is blank-filled; remove blanks */
while ((len > 0) && (s[len - 1] == ' ')) {
len--;
s[len] = 0;
}
ata_id_c_string(adev->id, model_num, ATA_ID_PROD, sizeof(model_num));

if (adev->max_sectors > 255)
adev->max_sectors = 255;
Expand Down
17 changes: 5 additions & 12 deletions trunk/drivers/ata/pata_serverworks.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,25 +218,18 @@ static unsigned long serverworks_osb4_filter(const struct ata_port *ap, struct a
static unsigned long serverworks_csb_filter(const struct ata_port *ap, struct ata_device *adev, unsigned long mask)
{
const char *p;
char model_num[ATA_ID_PROD_LEN];
int len, i;
char model_num[ATA_ID_PROD_LEN + 1];
int i;

/* Disk, UDMA */
if (adev->class != ATA_DEV_ATA)
return ata_pci_default_filter(ap, adev, mask);

/* Actually do need to check */
ata_id_string(adev->id, model_num, ATA_ID_PROD, sizeof(model_num));
/* Precuationary - why not do this in the libata core ?? */
ata_id_c_string(adev->id, model_num, ATA_ID_PROD, sizeof(model_num));

len = strlen(model_num);
while ((len > 0) && (model_num[len - 1] == ' ')) {
len--;
model_num[len] = 0;
}

for(i = 0; (p = csb_bad_ata100[i]) != NULL; i++) {
if (!strncmp(p, model_num, len))
for (i = 0; (p = csb_bad_ata100[i]) != NULL; i++) {
if (!strcmp(p, model_num))
mask &= ~(0x1F << ATA_SHIFT_UDMA);
}
return ata_pci_default_filter(ap, adev, mask);
Expand Down

0 comments on commit d794bf7

Please sign in to comment.