提交 af11cb2d 编写于 作者: B Bjorn Helgaas 提交者: Len Brown

PNP: use dev_printk when possible

Use dev_printk() when possible for more informative error messages.
Signed-off-by: NBjorn Helgaas <bjorn.helgaas@hp.com>
Acked-By: NRene Herman <rene.herman@gmail.com>
Signed-off-by: NLen Brown <len.brown@intel.com>
上级 2cd13930
...@@ -737,9 +737,8 @@ static int __init isapnp_create_device(struct pnp_card *card, ...@@ -737,9 +737,8 @@ static int __init isapnp_create_device(struct pnp_card *card,
isapnp_skip_bytes(size); isapnp_skip_bytes(size);
return 1; return 1;
default: default:
printk(KERN_ERR dev_err(&dev->dev, "unknown tag %#x (card %i), "
"isapnp: unexpected or unknown tag type 0x%x for logical device %i (device %i), ignored\n", "ignored\n", type, card->number);
type, dev->number, card->number);
} }
__skip: __skip:
if (size > 0) if (size > 0)
...@@ -792,9 +791,8 @@ static void __init isapnp_parse_resource_map(struct pnp_card *card) ...@@ -792,9 +791,8 @@ static void __init isapnp_parse_resource_map(struct pnp_card *card)
isapnp_skip_bytes(size); isapnp_skip_bytes(size);
return; return;
default: default:
printk(KERN_ERR dev_err(&card->dev, "unknown tag %#x, ignored\n",
"isapnp: unexpected or unknown tag type 0x%x for device %i, ignored\n", type);
type, card->number);
} }
__skip: __skip:
if (size > 0) if (size > 0)
...@@ -841,13 +839,6 @@ static int __init isapnp_build_device_list(void) ...@@ -841,13 +839,6 @@ static int __init isapnp_build_device_list(void)
isapnp_wake(csn); isapnp_wake(csn);
isapnp_peek(header, 9); isapnp_peek(header, 9);
checksum = isapnp_checksum(header); checksum = isapnp_checksum(header);
#if 0
printk(KERN_DEBUG
"vendor: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
header[0], header[1], header[2], header[3], header[4],
header[5], header[6], header[7], header[8]);
printk(KERN_DEBUG "checksum = 0x%x\n", checksum);
#endif
eisa_id = header[0] | header[1] << 8 | eisa_id = header[0] | header[1] << 8 |
header[2] << 16 | header[3] << 24; header[2] << 16 | header[3] << 24;
pnp_eisa_id_to_string(eisa_id, id); pnp_eisa_id_to_string(eisa_id, id);
...@@ -855,6 +846,13 @@ static int __init isapnp_build_device_list(void) ...@@ -855,6 +846,13 @@ static int __init isapnp_build_device_list(void)
if (!card) if (!card)
continue; continue;
#if 0
dev_info(&card->dev,
"vendor: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
header[0], header[1], header[2], header[3], header[4],
header[5], header[6], header[7], header[8]);
dev_info(&card->dev, "checksum = %#x\n", checksum);
#endif
INIT_LIST_HEAD(&card->devices); INIT_LIST_HEAD(&card->devices);
card->serial = card->serial =
(header[7] << 24) | (header[6] << 16) | (header[5] << 8) | (header[7] << 24) | (header[6] << 16) | (header[5] << 8) |
...@@ -862,9 +860,8 @@ static int __init isapnp_build_device_list(void) ...@@ -862,9 +860,8 @@ static int __init isapnp_build_device_list(void)
isapnp_checksum_value = 0x00; isapnp_checksum_value = 0x00;
isapnp_parse_resource_map(card); isapnp_parse_resource_map(card);
if (isapnp_checksum_value != 0x00) if (isapnp_checksum_value != 0x00)
printk(KERN_ERR dev_err(&card->dev, "invalid checksum %#x\n",
"isapnp: checksum for device %i is not valid (0x%x)\n", isapnp_checksum_value);
csn, isapnp_checksum_value);
card->checksum = isapnp_checksum_value; card->checksum = isapnp_checksum_value;
pnp_add_card(card); pnp_add_card(card);
...@@ -1134,13 +1131,13 @@ static int __init isapnp_init(void) ...@@ -1134,13 +1131,13 @@ static int __init isapnp_init(void)
protocol_for_each_card(&isapnp_protocol, card) { protocol_for_each_card(&isapnp_protocol, card) {
cards++; cards++;
if (isapnp_verbose) { if (isapnp_verbose) {
printk(KERN_INFO "isapnp: Card '%s'\n", dev_info(&card->dev, "card '%s'\n",
card->name[0] ? card->name : "Unknown"); card->name[0] ? card->name : "unknown");
if (isapnp_verbose < 2) if (isapnp_verbose < 2)
continue; continue;
card_for_each_dev(card, dev) { card_for_each_dev(card, dev) {
printk(KERN_INFO "isapnp: Device '%s'\n", dev_info(&card->dev, "device '%s'\n",
dev->name[0] ? dev->name : "Unknown"); dev->name[0] ? dev->name : "unknown");
} }
} }
} }
......
...@@ -110,7 +110,7 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_dev *dev, ...@@ -110,7 +110,7 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_dev *dev,
p = p ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH; p = p ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
if (triggering != t || polarity != p) { if (triggering != t || polarity != p) {
pnp_warn("IRQ %d override to %s, %s", dev_warn(&dev->dev, "IRQ %d override to %s, %s\n",
gsi, t ? "edge":"level", p ? "low":"high"); gsi, t ? "edge":"level", p ? "low":"high");
triggering = t; triggering = t;
polarity = p; polarity = p;
...@@ -263,7 +263,7 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, ...@@ -263,7 +263,7 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev,
status = acpi_resource_to_address64(res, p); status = acpi_resource_to_address64(res, p);
if (!ACPI_SUCCESS(status)) { if (!ACPI_SUCCESS(status)) {
pnp_warn("PnPACPI: failed to convert resource type %d", dev_warn(&dev->dev, "failed to convert resource type %d\n",
res->type); res->type);
return; return;
} }
...@@ -397,7 +397,8 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, ...@@ -397,7 +397,8 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
break; break;
default: default:
pnp_warn("PnPACPI: unknown resource type %d", res->type); dev_warn(&dev->dev, "unknown resource type %d in _CRS\n",
res->type);
return AE_ERROR; return AE_ERROR;
} }
...@@ -674,7 +675,8 @@ static __init acpi_status pnpacpi_option_resource(struct acpi_resource *res, ...@@ -674,7 +675,8 @@ static __init acpi_status pnpacpi_option_resource(struct acpi_resource *res,
case ACPI_RESOURCE_TYPE_END_DEPENDENT: case ACPI_RESOURCE_TYPE_END_DEPENDENT:
/*only one EndDependentFn is allowed */ /*only one EndDependentFn is allowed */
if (!parse_data->option_independent) { if (!parse_data->option_independent) {
pnp_warn("PnPACPI: more than one EndDependentFn"); dev_warn(&dev->dev, "more than one EndDependentFn "
"in _PRS\n");
return AE_ERROR; return AE_ERROR;
} }
parse_data->option = parse_data->option_independent; parse_data->option = parse_data->option_independent;
...@@ -726,7 +728,8 @@ static __init acpi_status pnpacpi_option_resource(struct acpi_resource *res, ...@@ -726,7 +728,8 @@ static __init acpi_status pnpacpi_option_resource(struct acpi_resource *res,
break; break;
default: default:
pnp_warn("PnPACPI: unknown resource type %d", res->type); dev_warn(&dev->dev, "unknown resource type %d in _PRS\n",
res->type);
return AE_ERROR; return AE_ERROR;
} }
...@@ -808,7 +811,7 @@ int pnpacpi_build_resource_template(struct pnp_dev *dev, ...@@ -808,7 +811,7 @@ int pnpacpi_build_resource_template(struct pnp_dev *dev,
status = acpi_walk_resources(handle, METHOD_NAME__CRS, status = acpi_walk_resources(handle, METHOD_NAME__CRS,
pnpacpi_count_resources, &res_cnt); pnpacpi_count_resources, &res_cnt);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
pnp_err("Evaluate _CRS failed"); dev_err(&dev->dev, "can't evaluate _CRS\n");
return -EINVAL; return -EINVAL;
} }
if (!res_cnt) if (!res_cnt)
...@@ -823,7 +826,7 @@ int pnpacpi_build_resource_template(struct pnp_dev *dev, ...@@ -823,7 +826,7 @@ int pnpacpi_build_resource_template(struct pnp_dev *dev,
pnpacpi_type_resources, &resource); pnpacpi_type_resources, &resource);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
kfree(buffer->pointer); kfree(buffer->pointer);
pnp_err("Evaluate _CRS failed"); dev_err(&dev->dev, "can't evaluate _CRS\n");
return -EINVAL; return -EINVAL;
} }
/* resource will pointer the end resource now */ /* resource will pointer the end resource now */
...@@ -1074,7 +1077,8 @@ int pnpacpi_encode_resources(struct pnp_dev *dev, struct acpi_buffer *buffer) ...@@ -1074,7 +1077,8 @@ int pnpacpi_encode_resources(struct pnp_dev *dev, struct acpi_buffer *buffer)
case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: case ACPI_RESOURCE_TYPE_GENERIC_REGISTER:
default: /* other type */ default: /* other type */
pnp_warn("unknown resource type %d", resource->type); dev_warn(&dev->dev, "can't encode unknown resource "
"type %d\n", resource->type);
return -EINVAL; return -EINVAL;
} }
resource++; resource++;
......
...@@ -241,8 +241,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(struct pnp_dev *dev, ...@@ -241,8 +241,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(struct pnp_dev *dev,
default: /* an unkown tag */ default: /* an unkown tag */
len_err: len_err:
printk(KERN_ERR dev_err(&dev->dev, "unknown tag %#x length %d\n",
"PnPBIOS: Unknown tag '0x%x', length '%d'.\n",
tag, len); tag, len);
break; break;
} }
...@@ -254,8 +253,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(struct pnp_dev *dev, ...@@ -254,8 +253,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(struct pnp_dev *dev,
p += len + 1; p += len + 1;
} }
printk(KERN_ERR dev_err(&dev->dev, "no end tag in resource structure\n");
"PnPBIOS: Resource structure does not contain an end tag.\n");
return NULL; return NULL;
} }
...@@ -471,8 +469,8 @@ pnpbios_parse_resource_option_data(unsigned char *p, unsigned char *end, ...@@ -471,8 +469,8 @@ pnpbios_parse_resource_option_data(unsigned char *p, unsigned char *end,
if (len != 0) if (len != 0)
goto len_err; goto len_err;
if (option_independent == option) if (option_independent == option)
printk(KERN_WARNING dev_warn(&dev->dev, "missing "
"PnPBIOS: Missing SMALL_TAG_STARTDEP tag\n"); "SMALL_TAG_STARTDEP tag\n");
option = option_independent; option = option_independent;
dev_dbg(&dev->dev, "end dependent options\n"); dev_dbg(&dev->dev, "end dependent options\n");
break; break;
...@@ -482,8 +480,7 @@ pnpbios_parse_resource_option_data(unsigned char *p, unsigned char *end, ...@@ -482,8 +480,7 @@ pnpbios_parse_resource_option_data(unsigned char *p, unsigned char *end,
default: /* an unkown tag */ default: /* an unkown tag */
len_err: len_err:
printk(KERN_ERR dev_err(&dev->dev, "unknown tag %#x length %d\n",
"PnPBIOS: Unknown tag '0x%x', length '%d'.\n",
tag, len); tag, len);
break; break;
} }
...@@ -495,8 +492,7 @@ pnpbios_parse_resource_option_data(unsigned char *p, unsigned char *end, ...@@ -495,8 +492,7 @@ pnpbios_parse_resource_option_data(unsigned char *p, unsigned char *end,
p += len + 1; p += len + 1;
} }
printk(KERN_ERR dev_err(&dev->dev, "no end tag in resource structure\n");
"PnPBIOS: Resource structure does not contain an end tag.\n");
return NULL; return NULL;
} }
...@@ -554,8 +550,7 @@ static unsigned char *pnpbios_parse_compatible_ids(unsigned char *p, ...@@ -554,8 +550,7 @@ static unsigned char *pnpbios_parse_compatible_ids(unsigned char *p,
default: /* an unkown tag */ default: /* an unkown tag */
len_err: len_err:
printk(KERN_ERR dev_err(&dev->dev, "unknown tag %#x length %d\n",
"PnPBIOS: Unknown tag '0x%x', length '%d'.\n",
tag, len); tag, len);
break; break;
} }
...@@ -567,8 +562,7 @@ static unsigned char *pnpbios_parse_compatible_ids(unsigned char *p, ...@@ -567,8 +562,7 @@ static unsigned char *pnpbios_parse_compatible_ids(unsigned char *p,
p += len + 1; p += len + 1;
} }
printk(KERN_ERR dev_err(&dev->dev, "no end tag in resource structure\n");
"PnPBIOS: Resource structure does not contain an end tag.\n");
return NULL; return NULL;
} }
...@@ -774,8 +768,7 @@ static unsigned char *pnpbios_encode_allocated_resource_data(struct pnp_dev ...@@ -774,8 +768,7 @@ static unsigned char *pnpbios_encode_allocated_resource_data(struct pnp_dev
default: /* an unkown tag */ default: /* an unkown tag */
len_err: len_err:
printk(KERN_ERR dev_err(&dev->dev, "unknown tag %#x length %d\n",
"PnPBIOS: Unknown tag '0x%x', length '%d'.\n",
tag, len); tag, len);
break; break;
} }
...@@ -787,8 +780,7 @@ static unsigned char *pnpbios_encode_allocated_resource_data(struct pnp_dev ...@@ -787,8 +780,7 @@ static unsigned char *pnpbios_encode_allocated_resource_data(struct pnp_dev
p += len + 1; p += len + 1;
} }
printk(KERN_ERR dev_err(&dev->dev, "no end tag in resource structure\n");
"PnPBIOS: Resource structure does not contain an end tag.\n");
return NULL; return NULL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册