aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/core-device.c
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2012-02-18 16:03:14 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2012-02-22 16:36:00 -0500
commit26b4950de174bc96c27b77546370dec84fb75ae7 (patch)
treea48479a6f1f4675d900b621d6ddfde92aadb0e33 /drivers/firewire/core-device.c
parent8408dc1c14c113face77f6f967af98f76999989f (diff)
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.c60
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,
485 */ 485 */
486static int read_config_rom(struct fw_device *device, int generation) 486static int read_config_rom(struct fw_device *device, int generation)
487{ 487{
488 struct fw_card *card = device->card;
488 const u32 *old_rom, *new_rom; 489 const u32 *old_rom, *new_rom;
489 u32 *rom, *stack; 490 u32 *rom, *stack;
490 u32 sp, key; 491 u32 sp, key;
@@ -529,12 +530,12 @@ static int read_config_rom(struct fw_device *device, int generation)
529 */ 530 */
530 if ((rom[2] & 0x7) < device->max_speed || 531 if ((rom[2] & 0x7) < device->max_speed ||
531 device->max_speed == SCODE_BETA || 532 device->max_speed == SCODE_BETA ||
532 device->card->beta_repeaters_present) { 533 card->beta_repeaters_present) {
533 u32 dummy; 534 u32 dummy;
534 535
535 /* for S1600 and S3200 */ 536 /* for S1600 and S3200 */
536 if (device->max_speed == SCODE_BETA) 537 if (device->max_speed == SCODE_BETA)
537 device->max_speed = device->card->link_speed; 538 device->max_speed = card->link_speed;
538 539
539 while (device->max_speed > SCODE_100) { 540 while (device->max_speed > SCODE_100) {
540 if (read_rom(device, generation, 0, &dummy) == 541 if (read_rom(device, generation, 0, &dummy) ==
@@ -576,9 +577,9 @@ static int read_config_rom(struct fw_device *device, int generation)
576 * a firmware bug. Ignore this whole block, i.e. 577 * a firmware bug. Ignore this whole block, i.e.
577 * simply set a fake block length of 0. 578 * simply set a fake block length of 0.
578 */ 579 */
579 fw_error("skipped invalid ROM block %x at %llx\n", 580 fw_err(card, "skipped invalid ROM block %x at %llx\n",
580 rom[i], 581 rom[i],
581 i * 4 | CSR_REGISTER_BASE | CSR_CONFIG_ROM); 582 i * 4 | CSR_REGISTER_BASE | CSR_CONFIG_ROM);
582 rom[i] = 0; 583 rom[i] = 0;
583 end = i; 584 end = i;
584 } 585 }
@@ -604,9 +605,10 @@ static int read_config_rom(struct fw_device *device, int generation)
604 * the ROM don't have to check offsets all the time. 605 * the ROM don't have to check offsets all the time.
605 */ 606 */
606 if (i + (rom[i] & 0xffffff) >= MAX_CONFIG_ROM_SIZE) { 607 if (i + (rom[i] & 0xffffff) >= MAX_CONFIG_ROM_SIZE) {
607 fw_error("skipped unsupported ROM entry %x at %llx\n", 608 fw_err(card,
608 rom[i], 609 "skipped unsupported ROM entry %x at %llx\n",
609 i * 4 | CSR_REGISTER_BASE | CSR_CONFIG_ROM); 610 rom[i],
611 i * 4 | CSR_REGISTER_BASE | CSR_CONFIG_ROM);
610 rom[i] = 0; 612 rom[i] = 0;
611 continue; 613 continue;
612 } 614 }
@@ -673,7 +675,7 @@ static void create_units(struct fw_device *device)
673 */ 675 */
674 unit = kzalloc(sizeof(*unit), GFP_KERNEL); 676 unit = kzalloc(sizeof(*unit), GFP_KERNEL);
675 if (unit == NULL) { 677 if (unit == NULL) {
676 fw_error("failed to allocate memory for unit\n"); 678 fw_err(device->card, "out of memory for unit\n");
677 continue; 679 continue;
678 } 680 }
679 681
@@ -875,7 +877,7 @@ static int lookup_existing_device(struct device *dev, void *data)
875 smp_wmb(); /* update node_id before generation */ 877 smp_wmb(); /* update node_id before generation */
876 old->generation = card->generation; 878 old->generation = card->generation;
877 old->config_rom_retries = 0; 879 old->config_rom_retries = 0;
878 fw_notify("rediscovered device %s\n", dev_name(dev)); 880 fw_notice(card, "rediscovered device %s\n", dev_name(dev));
879 881
880 PREPARE_DELAYED_WORK(&old->work, fw_device_update); 882 PREPARE_DELAYED_WORK(&old->work, fw_device_update);
881 fw_schedule_device_work(old, 0); 883 fw_schedule_device_work(old, 0);
@@ -956,6 +958,7 @@ static void fw_device_init(struct work_struct *work)
956{ 958{
957 struct fw_device *device = 959 struct fw_device *device =
958 container_of(work, struct fw_device, work.work); 960 container_of(work, struct fw_device, work.work);
961 struct fw_card *card = device->card;
959 struct device *revived_dev; 962 struct device *revived_dev;
960 int minor, ret; 963 int minor, ret;
961 964
@@ -972,16 +975,16 @@ static void fw_device_init(struct work_struct *work)
972 fw_schedule_device_work(device, RETRY_DELAY); 975 fw_schedule_device_work(device, RETRY_DELAY);
973 } else { 976 } else {
974 if (device->node->link_on) 977 if (device->node->link_on)
975 fw_notify("giving up on config rom for node id %x\n", 978 fw_notice(card, "giving up on Config ROM for node id %x\n",
976 device->node_id); 979 device->node_id);
977 if (device->node == device->card->root_node) 980 if (device->node == card->root_node)
978 fw_schedule_bm_work(device->card, 0); 981 fw_schedule_bm_work(card, 0);
979 fw_device_release(&device->device); 982 fw_device_release(&device->device);
980 } 983 }
981 return; 984 return;
982 } 985 }
983 986
984 revived_dev = device_find_child(device->card->device, 987 revived_dev = device_find_child(card->device,
985 device, lookup_existing_device); 988 device, lookup_existing_device);
986 if (revived_dev) { 989 if (revived_dev) {
987 put_device(revived_dev); 990 put_device(revived_dev);
@@ -1004,7 +1007,7 @@ static void fw_device_init(struct work_struct *work)
1004 1007
1005 device->device.bus = &fw_bus_type; 1008 device->device.bus = &fw_bus_type;
1006 device->device.type = &fw_device_type; 1009 device->device.type = &fw_device_type;
1007 device->device.parent = device->card->device; 1010 device->device.parent = card->device;
1008 device->device.devt = MKDEV(fw_cdev_major, minor); 1011 device->device.devt = MKDEV(fw_cdev_major, minor);
1009 dev_set_name(&device->device, "fw%d", minor); 1012 dev_set_name(&device->device, "fw%d", minor);
1010 1013
@@ -1016,7 +1019,7 @@ static void fw_device_init(struct work_struct *work)
1016 &device->attribute_group); 1019 &device->attribute_group);
1017 1020
1018 if (device_add(&device->device)) { 1021 if (device_add(&device->device)) {
1019 fw_error("Failed to add device.\n"); 1022 fw_err(card, "failed to add device\n");
1020 goto error_with_cdev; 1023 goto error_with_cdev;
1021 } 1024 }
1022 1025
@@ -1037,18 +1040,10 @@ static void fw_device_init(struct work_struct *work)
1037 PREPARE_DELAYED_WORK(&device->work, fw_device_shutdown); 1040 PREPARE_DELAYED_WORK(&device->work, fw_device_shutdown);
1038 fw_schedule_device_work(device, SHUTDOWN_DELAY); 1041 fw_schedule_device_work(device, SHUTDOWN_DELAY);
1039 } else { 1042 } else {
1040 if (device->config_rom_retries) 1043 fw_notice(card, "created device %s: GUID %08x%08x, S%d00\n",
1041 fw_notify("created device %s: GUID %08x%08x, S%d00, " 1044 dev_name(&device->device),
1042 "%d config ROM retries\n", 1045 device->config_rom[3], device->config_rom[4],
1043 dev_name(&device->device), 1046 1 << device->max_speed);
1044 device->config_rom[3], device->config_rom[4],
1045 1 << device->max_speed,
1046 device->config_rom_retries);
1047 else
1048 fw_notify("created device %s: GUID %08x%08x, S%d00\n",
1049 dev_name(&device->device),
1050 device->config_rom[3], device->config_rom[4],
1051 1 << device->max_speed);
1052 device->config_rom_retries = 0; 1047 device->config_rom_retries = 0;
1053 1048
1054 set_broadcast_channel(device, device->generation); 1049 set_broadcast_channel(device, device->generation);
@@ -1060,8 +1055,8 @@ static void fw_device_init(struct work_struct *work)
1060 * just end up running the IRM work a couple of extra times - 1055 * just end up running the IRM work a couple of extra times -
1061 * pretty harmless. 1056 * pretty harmless.
1062 */ 1057 */
1063 if (device->node == device->card->root_node) 1058 if (device->node == card->root_node)
1064 fw_schedule_bm_work(device->card, 0); 1059 fw_schedule_bm_work(card, 0);
1065 1060
1066 return; 1061 return;
1067 1062
@@ -1165,12 +1160,13 @@ static void fw_device_refresh(struct work_struct *work)
1165 FW_DEVICE_RUNNING) == FW_DEVICE_GONE) 1160 FW_DEVICE_RUNNING) == FW_DEVICE_GONE)
1166 goto gone; 1161 goto gone;
1167 1162
1168 fw_notify("refreshed device %s\n", dev_name(&device->device)); 1163 fw_notice(card, "refreshed device %s\n", dev_name(&device->device));
1169 device->config_rom_retries = 0; 1164 device->config_rom_retries = 0;
1170 goto out; 1165 goto out;
1171 1166
1172 give_up: 1167 give_up:
1173 fw_notify("giving up on refresh of device %s\n", dev_name(&device->device)); 1168 fw_notice(card, "giving up on refresh of device %s\n",
1169 dev_name(&device->device));
1174 gone: 1170 gone:
1175 atomic_set(&device->state, FW_DEVICE_GONE); 1171 atomic_set(&device->state, FW_DEVICE_GONE);
1176 PREPARE_DELAYED_WORK(&device->work, fw_device_shutdown); 1172 PREPARE_DELAYED_WORK(&device->work, fw_device_shutdown);