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-card.c | |
parent | 8408dc1c14c113face77f6f967af98f76999989f (diff) | |
download | op-kernel-dev-26b4950de174bc96c27b77546370dec84fb75ae7.zip op-kernel-dev-26b4950de174bc96c27b77546370dec84fb75ae7.tar.gz |
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-card.c')
-rw-r--r-- | drivers/firewire/core-card.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c index 85661b0..b19db0f 100644 --- a/drivers/firewire/core-card.c +++ b/drivers/firewire/core-card.c @@ -37,6 +37,22 @@ #include "core.h" +#define define_fw_printk_level(func, kern_level) \ +void func(const struct fw_card *card, const char *fmt, ...) \ +{ \ + struct va_format vaf; \ + va_list args; \ + \ + va_start(args, fmt); \ + vaf.fmt = fmt; \ + vaf.va = &args; \ + printk(kern_level KBUILD_MODNAME " %s: %pV", \ + dev_name(card->device), &vaf); \ + va_end(args); \ +} +define_fw_printk_level(fw_err, KERN_ERR); +define_fw_printk_level(fw_notice, KERN_NOTICE); + int fw_compute_block_crc(__be32 *block) { int length; @@ -260,7 +276,7 @@ static void allocate_broadcast_channel(struct fw_card *card, int generation) fw_iso_resource_manage(card, generation, 1ULL << 31, &channel, &bandwidth, true); if (channel != 31) { - fw_notify("failed to allocate broadcast channel\n"); + fw_notice(card, "failed to allocate broadcast channel\n"); return; } card->broadcast_channel_allocated = true; @@ -343,14 +359,14 @@ static void bm_work(struct work_struct *work) if (!card->irm_node->link_on) { new_root_id = local_id; - fw_notify("%s, making local node (%02x) root.\n", + fw_notice(card, "%s, making local node (%02x) root\n", "IRM has link off", new_root_id); goto pick_me; } if (irm_is_1394_1995_only && !keep_this_irm) { new_root_id = local_id; - fw_notify("%s, making local node (%02x) root.\n", + fw_notice(card, "%s, making local node (%02x) root\n", "IRM is not 1394a compliant", new_root_id); goto pick_me; } @@ -405,7 +421,7 @@ static void bm_work(struct work_struct *work) * root, and thus, IRM. */ new_root_id = local_id; - fw_notify("%s, making local node (%02x) root.\n", + fw_notice(card, "%s, making local node (%02x) root\n", "BM lock failed", new_root_id); goto pick_me; } @@ -478,8 +494,8 @@ static void bm_work(struct work_struct *work) spin_unlock_irq(&card->lock); if (do_reset) { - fw_notify("phy config: card %d, new root=%x, gap_count=%d\n", - card->index, new_root_id, gap_count); + fw_notice(card, "phy config: new root=%x, gap_count=%d\n", + new_root_id, gap_count); fw_send_phy_config(card, new_root_id, generation, gap_count); reset_bus(card, true); /* Will allocate broadcast channel after the reset. */ |