diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2012-02-18 22:03:14 +0100 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2012-02-22 22:36:00 +0100 |
commit | 26b4950de174bc96c27b77546370dec84fb75ae7 (patch) | |
tree | a48479a6f1f4675d900b621d6ddfde92aadb0e33 /drivers/firewire/core-device.c | |
parent | 8408dc1c14c113face77f6f967af98f76999989f (diff) | |
download | lwn-26b4950de174bc96c27b77546370dec84fb75ae7.tar.gz lwn-26b4950de174bc96c27b77546370dec84fb75ae7.zip |
firewire: core: prefix log messages with card name
Associate all log messages from firewire-core with the respective card
because some people have more than one card. E.g.
firewire_ohci 0000:04:00.0: added OHCI v1.10 device as card 0, 8 IR + 8 IT contexts, quirks 0x0
firewire_ohci 0000:05:00.0: added OHCI v1.10 device as card 1, 8 IR + 8 IT contexts, quirks 0x0
firewire_core: created device fw0: GUID 0814438400000389, S800
firewire_core: phy config: new root=ffc1, gap_count=5
firewire_core: created device fw1: GUID 0814438400000388, S800
firewire_core: created device fw2: GUID 0001d202e06800d1, S800
turns into
firewire_ohci 0000:04:00.0: added OHCI v1.10 device as card 0, 8 IR + 8 IT contexts, quirks 0x0
firewire_ohci 0000:05:00.0: added OHCI v1.10 device as card 1, 8 IR + 8 IT contexts, quirks 0x0
firewire_core 0000:04:00.0: created device fw0: GUID 0814438400000389, S800
firewire_core 0000:04:00.0: phy config: new root=ffc1, gap_count=5
firewire_core 0000:05:00.0: created device fw1: GUID 0814438400000388, S800
firewire_core 0000:04:00.0: created device fw2: GUID 0001d202e06800d1, S800
This increases the module size slightly; to keep this in check, turn the
former printk wrapper macros into functions. Their implementation is
largely copied from driver core's dev_printk counterparts.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/core-device.c')
-rw-r--r-- | drivers/firewire/core-device.c | 60 |
1 files changed, 28 insertions, 32 deletions
diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c index 4c6c7d8cdaf1..afa7c83bd114 100644 --- a/drivers/firewire/core-device.c +++ b/drivers/firewire/core-device.c @@ -485,6 +485,7 @@ static int read_rom(struct fw_device *device, */ static int read_config_rom(struct fw_device *device, int generation) { + struct fw_card *card = device->card; const u32 *old_rom, *new_rom; u32 *rom, *stack; u32 sp, key; @@ -529,12 +530,12 @@ static int read_config_rom(struct fw_device *device, int generation) */ if ((rom[2] & 0x7) < device->max_speed || device->max_speed == SCODE_BETA || - device->card->beta_repeaters_present) { + card->beta_repeaters_present) { u32 dummy; /* for S1600 and S3200 */ if (device->max_speed == SCODE_BETA) - device->max_speed = device->card->link_speed; + device->max_speed = card->link_speed; while (device->max_speed > SCODE_100) { if (read_rom(device, generation, 0, &dummy) == @@ -576,9 +577,9 @@ static int read_config_rom(struct fw_device *device, int generation) * a firmware bug. Ignore this whole block, i.e. * simply set a fake block length of 0. */ - fw_error("skipped invalid ROM block %x at %llx\n", - rom[i], - i * 4 | CSR_REGISTER_BASE | CSR_CONFIG_ROM); + fw_err(card, "skipped invalid ROM block %x at %llx\n", + rom[i], + i * 4 | CSR_REGISTER_BASE | CSR_CONFIG_ROM); rom[i] = 0; end = i; } @@ -604,9 +605,10 @@ static int read_config_rom(struct fw_device *device, int generation) * the ROM don't have to check offsets all the time. */ if (i + (rom[i] & 0xffffff) >= MAX_CONFIG_ROM_SIZE) { - fw_error("skipped unsupported ROM entry %x at %llx\n", - rom[i], - i * 4 | CSR_REGISTER_BASE | CSR_CONFIG_ROM); + fw_err(card, + "skipped unsupported ROM entry %x at %llx\n", + rom[i], + i * 4 | CSR_REGISTER_BASE | CSR_CONFIG_ROM); rom[i] = 0; continue; } @@ -673,7 +675,7 @@ static void create_units(struct fw_device *device) */ unit = kzalloc(sizeof(*unit), GFP_KERNEL); if (unit == NULL) { - fw_error("failed to allocate memory for unit\n"); + fw_err(device->card, "out of memory for unit\n"); continue; } @@ -875,7 +877,7 @@ static int lookup_existing_device(struct device *dev, void *data) smp_wmb(); /* update node_id before generation */ old->generation = card->generation; old->config_rom_retries = 0; - fw_notify("rediscovered device %s\n", dev_name(dev)); + fw_notice(card, "rediscovered device %s\n", dev_name(dev)); PREPARE_DELAYED_WORK(&old->work, fw_device_update); fw_schedule_device_work(old, 0); @@ -956,6 +958,7 @@ static void fw_device_init(struct work_struct *work) { struct fw_device *device = container_of(work, struct fw_device, work.work); + struct fw_card *card = device->card; struct device *revived_dev; int minor, ret; @@ -972,16 +975,16 @@ static void fw_device_init(struct work_struct *work) fw_schedule_device_work(device, RETRY_DELAY); } else { if (device->node->link_on) - fw_notify("giving up on config rom for node id %x\n", + fw_notice(card, "giving up on Config ROM for node id %x\n", device->node_id); - if (device->node == device->card->root_node) - fw_schedule_bm_work(device->card, 0); + if (device->node == card->root_node) + fw_schedule_bm_work(card, 0); fw_device_release(&device->device); } return; } - revived_dev = device_find_child(device->card->device, + revived_dev = device_find_child(card->device, device, lookup_existing_device); if (revived_dev) { put_device(revived_dev); @@ -1004,7 +1007,7 @@ static void fw_device_init(struct work_struct *work) device->device.bus = &fw_bus_type; device->device.type = &fw_device_type; - device->device.parent = device->card->device; + device->device.parent = card->device; device->device.devt = MKDEV(fw_cdev_major, minor); dev_set_name(&device->device, "fw%d", minor); @@ -1016,7 +1019,7 @@ static void fw_device_init(struct work_struct *work) &device->attribute_group); if (device_add(&device->device)) { - fw_error("Failed to add device.\n"); + fw_err(card, "failed to add device\n"); goto error_with_cdev; } @@ -1037,18 +1040,10 @@ static void fw_device_init(struct work_struct *work) PREPARE_DELAYED_WORK(&device->work, fw_device_shutdown); fw_schedule_device_work(device, SHUTDOWN_DELAY); } else { - if (device->config_rom_retries) - fw_notify("created device %s: GUID %08x%08x, S%d00, " - "%d config ROM retries\n", - dev_name(&device->device), - device->config_rom[3], device->config_rom[4], - 1 << device->max_speed, - device->config_rom_retries); - else - fw_notify("created device %s: GUID %08x%08x, S%d00\n", - dev_name(&device->device), - device->config_rom[3], device->config_rom[4], - 1 << device->max_speed); + fw_notice(card, "created device %s: GUID %08x%08x, S%d00\n", + dev_name(&device->device), + device->config_rom[3], device->config_rom[4], + 1 << device->max_speed); device->config_rom_retries = 0; set_broadcast_channel(device, device->generation); @@ -1060,8 +1055,8 @@ static void fw_device_init(struct work_struct *work) * just end up running the IRM work a couple of extra times - * pretty harmless. */ - if (device->node == device->card->root_node) - fw_schedule_bm_work(device->card, 0); + if (device->node == card->root_node) + fw_schedule_bm_work(card, 0); return; @@ -1165,12 +1160,13 @@ static void fw_device_refresh(struct work_struct *work) FW_DEVICE_RUNNING) == FW_DEVICE_GONE) goto gone; - fw_notify("refreshed device %s\n", dev_name(&device->device)); + fw_notice(card, "refreshed device %s\n", dev_name(&device->device)); device->config_rom_retries = 0; goto out; give_up: - fw_notify("giving up on refresh of device %s\n", dev_name(&device->device)); + fw_notice(card, "giving up on refresh of device %s\n", + dev_name(&device->device)); gone: atomic_set(&device->state, FW_DEVICE_GONE); PREPARE_DELAYED_WORK(&device->work, fw_device_shutdown); |