firewire: some simple kernel log changes
cover firewire: some simple kernel log changes
I wanted to hold off with posting the following few patches because I still want to add some firewire-core and firewire-net logging related updates as well. But since Carl may be interested in patch 2/3 right now, here they are.
1/3 firewire: do not expose globally unique IDs in the kernel log 2/3 firewire: ohci: use dev_printk API
3/3 firewire: sbp2: use dev_printk API
drivers/firewire/core-device.c | 8 - drivers/firewire/net.c | 8 - drivers/firewire/ohci.c | 185 +++++++++++++++++++++++------------------ drivers/firewire/sbp2.c | 93 +++++++++++--------- 4 files changed, 165 insertions(+), 129 deletions(-)
Signature · 3 lines
Stefan Richter -=====-==-== ==-- =-=-- http://arcgraph.de/sr/
PATCH 1/3 firewire: do not expose globally unique IDs in the kernel log
Printing worldwide unique IDs in the kernel log is questionable from a privacy point of view. Some people edit such IDs out of the log before they post bug reports. Make life easier for them and do not log GUIDs anymore. For local debugging, GUIDs are still available during the lifetime of a device in /sys/bus/firewire/devices/fw*/guid.
Instead, log the vendor-unique part of the device ID (the OUI) in firewire-core and bus IDs in firewire-net.
--- drivers/firewire/core-device.c | 8 ++++---- drivers/firewire/net.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/firewire/core-device.c +4 -4
@@ -1036,16 +1036,16 @@ static void fw_device_init(struct work_sfw_schedule_device_work (device,SHUTDOWN_DELAY ); }else {if (device->config_rom_retries) -fw_notify ("created device %s: GUID %08x%08x, S%d00, " +fw_notify ("created device %s: OUI %06x, S%d00, " "%d config ROM retries\n" ,dev_name (&device->device), - device->config_rom[3 ], device->config_rom[4 ], + device->config_rom[3 ] >>8 ,1 << device->max_speed, device->config_rom_retries);else -fw_notify ("created device %s: GUID %08x%08x, S%d00\n" , +fw_notify ("created device %s: OUI %06x, S%d00\n" ,dev_name (&device->device), - device->config_rom[3 ], device->config_rom[4 ], + device->config_rom[3 ] >>8 ,1 << device->max_speed); device->config_rom_retries =0 ;
drivers/firewire/net.c +4 -4
@@ -574,8 +574,8 @@ static int fwnet_finish_incoming_packet(spin_unlock_irqrestore (&dev->lock, flags);if (!peer) { -fw_notify ("No peer for ARP packet from %016llx\n" , - (unsigned long long )peer_guid); +fw_notify ("No peer for ARP packet from %04x\n" , + source_node_id); goto no_peer; }
@@ -1545,8 +1545,8 @@ static int fwnet_probe(struct device *_d }list_add_tail (&dev->dev_link, &fwnet_device_list); -fw_notify ("%s: IPv4 over FireWire on device %016llx\n" , - net->name, (unsigned long long )card->guid); +fw_notify ("%s: IPv4 over FireWire on card %d device %s\n" , + net->name, card->index,dev_name (card->device)); have_dev: ret =fwnet_add_peer (dev, unit, device);if (ret && allocated_netdev) {
Signature · 3 lines
Stefan Richter -=====-==-== ==-- =-=-- http://arcgraph.de/sr/
Re: [PATCH 1/3] firewire: do not expose globally unique IDs in the kernel log
grumble.
I use those guids like so:
plug in dv cam, dmesg, cut guid to clipboard, run:
dvgrab -guid (paste)
It also kinda helps me keep track of what devices are misbehaving, but this alone isn't very important.
Any chance of making this configurable?
Quoted 71 lines · Stefan Richter
Printing worldwide unique IDs in the kernel log is questionable from a privacy point of view. Some people edit such IDs out of the log before they post bug reports. Make life easier for them and do not log GUIDs anymore. For local debugging, GUIDs are still available during the lifetime of a device in
/sys/bus/firewire/devices/fw*/guid.Instead, log the vendor-unique part of the device ID (the OUI) in firewire-core and bus IDs in firewire-net.
Signed-off-by Stefan Richter <[email protected]>---
drivers/firewire/core-device.c | 8 ++++----
drivers/firewire/net.c | 8 ++++----2 files changed, 8 insertions(+), 8 deletions(-)Index:
b/drivers/firewire/core-device.c
===================================================================drivers/firewire/core-device.c +2
-2@@ -1036,16 +1036,16 @@ static void fw_device_init(struct work_s fw_schedule_device_work(device, SHUTDOWN_DELAY); } else { if (device->config_rom_retries) - fw_notify("created device %s: GUID %08x%08x, S%d00, " + fw_notify("created device %s: OUI %06x, S%d00, " "%d config ROM retries\n", dev_name(&device->device), - device->config_rom[3], device->config_rom[4], + device->config_rom[3] >> 8, 1 << device->max_speed, device->config_rom_retries);else
- fw_notify("created device %s: GUID %08x%08x, S%d00\n",
+ fw_notify("created device %s: OUI %06x, S%d00\n",dev_name(&device->device),
- device->config_rom[3], device->config_rom[4],
+ device->config_rom[3] >> 8,
1 <<device->max_speed);device->config_rom_retries= 0;Index:
b/drivers/firewire/net.c
===================================================================drivers/firewire/net.c +4
-4@@ -574,8 +574,8 @@ static int fwnet_finish_incoming_packet( spin_unlock_irqrestore(&dev->lock, flags); if (!peer) { - fw_notify("No peer for ARP packet from %016llx\n", - (unsigned long long)peer_guid); + fw_notify("No peer for ARP packet from %04x\n", + source_node_id); goto no_peer; }@@ -1545,8 +1545,8 @@ static int fwnet_probe(struct device *_d } list_add_tail(&dev->dev_link, &fwnet_device_list); - fw_notify("%s: IPv4 over FireWire on device %016llx\n", - net->name, (unsigned long long)card->guid); + fw_notify("%s: IPv4 over FireWire on card %d device %s\n", + net->name, card->index, dev_name(card->device));have_dev:
ret =fwnet_add_peer(dev, unit, device);
if (ret &&allocated_netdev) {--
Stefan Richter
-=====-==-== ==-- =-=--
http://arcgraph.de/sr/
Signature · 1 line
Carl K
Re: [PATCH 1/3] firewire: do not expose globally unique IDs in the kernel log
Quoted 6 lines · On Dec 20 Carl Karsten wrote:
grumble.
I use those guids like so:
plug in dv cam, dmesg, cut guid to clipboard, run:
dvgrab -guid (paste)
How about:
#!/bin/sh guid=$(cat /sys/bus/firewire/devices/$1/guid) shift dvgrab -guid $guid "$@"
To be called as "dvgrab-wrapper fw3 [more dvgrab options]", with fw3 being the device of your choice, e.g. the one that just scrolled by in syslog.
Or you run "grep . /sys/bus/firewire/devices/*/guid | sed s/\\/guid:/\\t/" before dvgrab, and you get a list of GUIDs from which you can copy and paste.
Quoted 4 lines
It also kinda helps me keep track of what devices are misbehaving, but this alone isn't very important.
Any chance of making this configurable?
So far the configuration of the "new" firewire drivers were kept at an essential minimum, and I am hesitant to add more baroque ones. I would rather drop this patch now that there was negative feedback, unless there is going to be positive feedback as well.
Signature · 3 lines
Stefan Richter -=====-==-== ==-- =-=-- http://arcgraph.de/sr/
Re: [PATCH 1/3] firewire: do not expose globally unique IDs in the kernel log
Quoted 15 lines · Stefan Richter
Quoted 6 lines · On Dec 20 Carl Karsten wrote:
grumble.
I use those guids like so:
plug in dv cam, dmesg, cut guid to clipboard, run:
dvgrab -guid (paste)How about:
#!/bin/sh
guid=$(cat/sys/bus/firewire/devices/$1/guid) shift
dvgrab -guid $guid "$@"
Quoted 6 lines
To be called as "dvgrab-wrapper fw3 [more dvgrab options]", with fw3 being the device of your choice, e.g. the one that just scrolled by in syslog.
Or you run "grep .
/sys/bus/firewire/devices/*/guid| sed s/\\/guid:/\\t/" before dvgrab, and you get a list of GUIDs from which you can copy and paste.
I can't rely on these scripts being available, and I certainly won't to try and create them on the fly when I need them (which is often as a talk is starting and I am already in a panic trying to figure out why something isn't working... every second counts, and my brain is topped out.)
Quoted 10 lines
Quoted 5 lines
It also kinda helps me keep track of what devices are misbehaving, but this alone isn't very important.
Any chance of making this configurable?
So far the configuration of the "new" firewire drivers were kept at an essential minimum, and I am hesitant to add more baroque ones. I would rather drop this patch now that there was negative feedback, unless there is going to be positive feedback as well.
+1.
As a peace offering to people that want to x them out before posting:
juser@pc8:~$ sed -r 's/(GUID
[0-9A-Fa-f]{8})[0-9A-Fa-f]{8}/\1xxxxxxxx/' /var/log/syslogsnip snip
Dec 20 08:30:00 pc8 kernel: [ 1.980149] firewire_core: created
device fw0: GUID 00241b00xxxxxxxx, S100
Signature · 1 line
Carl K
Re: [PATCH 1/3] firewire: do not expose globally unique IDs in the kernel log
In reply to Stefan RichterQuoted 3 lines · On Dec 21 Stefan Richter wrote:
Or you run "grep .
/sys/bus/firewire/devices/*/guid| sed s/\\/guid:/\\t/" before dvgrab, and you get a list of GUIDs from which you can copy and paste.
Or
(cd /sys/bus/firewire/devices; grep . $(ls -c */guid)) | sed s/\\/guid:/\\t/
for a list in reverse-chronological order of discovery. Same but narrowed down to AV/C devices:
(cd /sys/bus/firewire/devices; for fw in $(grep 0x00a02d:0x010001 $(ls -c */units) | cut -f1 -d/); do printf $fw\\t; cat $fw/guid; done)
Signature · 3 lines
Stefan Richter -=====-==-== ==-- =-=-= http://arcgraph.de/sr/
Re: [PATCH 1/3] firewire: do not expose globally unique IDs in the kernel log
Quoted 5 lines · Stefan Richter
Quoted 3 lines · On Dec 21 Stefan Richter wrote:
Or you run "grep .
/sys/bus/firewire/devices/*/guid| sed s/\\/guid:/\\t/" before dvgrab, and you get a list of GUIDs from which you can copy and paste.
Quoted 7 lines
Or
(cd/sys/bus/firewire/devices; grep . $(ls -c */guid)) | sed s/\\/guid:/\\t/for a list in reverse-chronological order of discovery. Same but narrowed down to AV/C devices:
(cd
/sys/bus/firewire/devices; for fw in $(grep 0x00a02d:0x010001 $(ls -c */units) | cut -f1 -d/); do printf $fw\\t; cat $fw/guid; done)
To further describe my pain: I am going to run dmesg anyway to see if the device is being detected and or any errors. Once I see that it is connected, it is really nice having the guid right there.
I am really bummed I didn't invite you to PyCon in Leipzig so you
could see what I do first hand. Maybe next time.
Signature · 1 line
Carl K
PATCH 2/3 firewire: ohci: use dev_printk API
In reply to Stefan RichterAll messages are uniformly prefixed by driver name and device name now.
---
PS, any of these three patches is applicable independently of the others.
drivers/firewire/ohci.c | 185 +++++++++++++++++++++++----------------- 1 file changed, 106 insertions(+), 79 deletions(-)
drivers/firewire/ohci.c +106 -79
@@ -345,7 +345,7 @@ MODULE_PARM_DESC(debug, "Verbose logging ", busReset events = " __stringify(OHCI_PARAM_DEBUG_BUSRESETS) ", or a combination, or all = -1)"); -static void log_irqs (u32 evt) +static void log_irqs (struct fw_ohci *ohci,u32 evt) {if (likely (!(param_debug & (OHCI_PARAM_DEBUG_IRQS |OHCI_PARAM_DEBUG_BUSRESETS ))))
@@ -355,7 +355,8 @@ static void log_irqs(u32 evt) !(evt & OHCI1394_busReset))return ; - fw_notify("IRQ %08x%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", evt, + dev_notice(ohci->card.device, + "IRQ %08x%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", evt, evt & OHCI1394_selfIDComplete ? " selfID" : "", evt & OHCI1394_RQPkt ? " AR_req" : "", evt & OHCI1394_RSPkt ? " AR_resp" : "",
@@ -394,24 +395,29 @@ static char _p(u32 *s, int shift)return port[*s >> shift &3 ]; } -static void log_selfids (int node_id,int generation,int self_id_count,u32 *s) +static void log_selfids (struct fw_ohci *ohci,int generation,int self_id_count) { +u32 *s; +if (likely (!(param_debug &OHCI_PARAM_DEBUG_SELFIDS )))return ; -fw_notify ("%d selfIDs, generation %d, local node ID %04x\n" , - self_id_count, generation, node_id); +dev_notice (ohci->card.device, +"%d selfIDs, generation %d, local node ID %04x\n" , + self_id_count, generation, ohci->node_id); -for (; self_id_count--; ++s) +for (s = ohci->self_id_buffer; self_id_count--; ++s)if ((*s &1 <<23 ) ==0 ) -fw_notify ("selfID 0: %08x, phy %d [%c%c%c] " +dev_notice (ohci->card.device, +"selfID 0: %08x, phy %d [%c%c%c] " "%s gc=%d %s %s%s%s\n" , *s, *s >>24 &63 ,_p (s,6 ),_p (s,4 ),_p (s,2 ), speed[*s >>14 &3 ], *s >>16 &63 , power[*s >>8 &7 ], *s >>22 &1 ?"L" :"" , *s >>11 &1 ?"c" :"" , *s &2 ?"i" :"" );else -fw_notify ("selfID n: %08x, phy %d [%c%c%c%c%c%c%c%c]\n" , +dev_notice (ohci->card.device, +"selfID n: %08x, phy %d [%c%c%c%c%c%c%c%c]\n" , *s, *s >>24 &63 ,_p (s,16 ),_p (s,14 ),_p (s,12 ),_p (s,10 ),_p (s,8 ),_p (s,6 ),_p (s,4 ),_p (s,2 ));
@@ -447,7 +453,8 @@ static const char *tcodes[] = { [0xe] = "link internal", [0xf] = "-reserved-", }; -static void log_ar_at_event (char dir,int speed,u32 *header,int evt) +static void log_ar_at_event (struct fw_ohci *ohci, +char dir,int speed,u32 *header,int evt) {int tcode = header[0 ] >>4 &0xf ;char specific[12 ];
@@ -459,8 +466,9 @@ static void log_ar_at_event(char dir, in evt =0x1f ;if (evt == OHCI1394_evt_bus_reset) { -fw_notify ("A%c evt_bus_reset, generation %d\n" , - dir, (header[2 ] >>16 ) &0xff ); +dev_notice (ohci->card.device, +"A%c evt_bus_reset, generation %d\n" , + dir, (header[2 ] >>16 ) &0xff );return ; }
@@ -479,36 +487,41 @@ static void log_ar_at_event(char dir, inswitch (tcode) {case 0xa : -fw_notify ("A%c %s, %s\n" , dir, evts[evt], tcodes[tcode]); +dev_notice (ohci->card.device, +"A%c %s, %s\n" , + dir, evts[evt], tcodes[tcode]);break ;case 0xe : -fw_notify ("A%c %s, PHY %08x %08x\n" , - dir, evts[evt], header[1 ], header[2 ]); +dev_notice (ohci->card.device, +"A%c %s, PHY %08x %08x\n" , + dir, evts[evt], header[1 ], header[2 ]);break ;case 0x0 :case 0x1 :case 0x4 :case 0x5 :case 0x9 : -fw_notify ("A%c spd %x tl %02x, " -"%04x -> %04x, %s, " -"%s, %04x%08x%s\n" , - dir, speed, header[0 ] >>10 &0x3f , - header[1 ] >>16 , header[0 ] >>16 , evts[evt], - tcodes[tcode], header[1 ] &0xffff , header[2 ], specific); +dev_notice (ohci->card.device, +"A%c spd %x tl %02x, " +"%04x -> %04x, %s, " +"%s, %04x%08x%s\n" , + dir, speed, header[0 ] >>10 &0x3f , + header[1 ] >>16 , header[0 ] >>16 , evts[evt], + tcodes[tcode], header[1 ] &0xffff , header[2 ], specific);break ;default : -fw_notify ("A%c spd %x tl %02x, " -"%04x -> %04x, %s, " -"%s%s\n" , - dir, speed, header[0 ] >>10 &0x3f , - header[1 ] >>16 , header[0 ] >>16 , evts[evt], - tcodes[tcode], specific); +dev_notice (ohci->card.device, +"A%c spd %x tl %02x, " +"%04x -> %04x, %s, " +"%s%s\n" , + dir, speed, header[0 ] >>10 &0x3f , + header[1 ] >>16 , header[0 ] >>16 , evts[evt], + tcodes[tcode], specific); } }#else #define param_debug 0 -static inline void log_irqs (u32 evt) {} -static inline void log_selfids (int node_id,int generation,int self_id_count,u32 *s) {} -static inline void log_ar_at_event (char dir,int speed,u32 *header,int evt) {} +static inline void log_irqs (struct fw_ohci *ohci,u32 evt) {} +static inline void log_selfids (struct fw_ohci *ohci,int generation,int self_id_count) {} +static inline void log_ar_at_event (struct fw_ohci *ohci,char dir,int speed,u32 *header,int evt) {}#endif /* CONFIG_FIREWIRE_OHCI_DEBUG */
@@ -555,7 +568,7 @@ static int read_phy_reg(struct fw_ohci *if (i >=3 )msleep (1 ); } -fw_error ("failed to read phy reg\n" ); +dev_err (ohci->card.device,"failed to read phy reg\n" );return -EBUSY ; }
@@ -577,7 +590,7 @@ static int write_phy_reg(const struct fwif (i >=3 )msleep (1 ); } -fw_error ("failed to write phy reg\n" ); +dev_err (ohci->card.device,"failed to write phy reg\n" );return -EBUSY ; }
@@ -676,11 +689,14 @@ static void ar_context_release(struct arstatic void ar_context_abort (struct ar_context *ctx,const char *error_msg) { -if (reg_read (ctx->ohci,CONTROL_CLEAR (ctx->regs)) &CONTEXT_RUN ) { -reg_write (ctx->ohci,CONTROL_CLEAR (ctx->regs),CONTEXT_RUN ); -flush_writes (ctx->ohci); +struct fw_ohci *ohci = ctx->ohci; -fw_error ("AR error: %s; DMA stopped\n" , error_msg); +if (reg_read (ohci,CONTROL_CLEAR (ctx->regs)) &CONTEXT_RUN ) { +reg_write (ohci,CONTROL_CLEAR (ctx->regs),CONTEXT_RUN ); +flush_writes (ohci); + +dev_err (ohci->card.device,"AR error: %s; DMA stopped\n" , + error_msg); }/* FIXME: restart? */ }
@@ -850,7 +866,7 @@ static __le32 *handle_ar_packet(struct a p.timestamp = status &0xffff ; p.generation = ohci->request_generation; -log_ar_at_event ('R' , p.speed, p.header, evt); +log_ar_at_event (ohci,'R' , p.speed, p.header, evt);/* * Several controllers, notably from NEC and VIA, forget to
@@ -1222,21 +1238,22 @@ static void context_append(struct contexstatic void context_stop (struct context *ctx) { +struct fw_ohci *ohci = ctx->ohci;u32 reg;int i; -reg_write (ctx->ohci,CONTROL_CLEAR (ctx->regs),CONTEXT_RUN ); +reg_write (ohci,CONTROL_CLEAR (ctx->regs),CONTEXT_RUN ); ctx->running = false;for (i =0 ; i <1000 ; i++) { - reg =reg_read (ctx->ohci,CONTROL_SET (ctx->regs)); + reg =reg_read (ohci,CONTROL_SET (ctx->regs));if ((reg &CONTEXT_ACTIVE ) ==0 )return ;if (i)udelay (10 ); } -fw_error ("Error: DMA context still active (0x%08x)\n" , reg); +dev_err (ohci->card.device,"DMA context still active (0x%08x)\n" , reg); }struct driver_data {
@@ -1416,7 +1433,7 @@ static int handle_at_packet(struct conte evt =le16_to_cpu (last->transfer_status) &0x1f ; packet->timestamp =le16_to_cpu (last->res_count); -log_ar_at_event ('T' , packet->speed, packet->header, evt); +log_ar_at_event (ohci,'T' , packet->speed, packet->header, evt);switch (evt) {case OHCI1394_evt_timeout:
@@ -1545,7 +1562,7 @@ static void handle_local_lock(struct fw_ goto out; } -fw_error ("swap not done (CSR lock timeout)\n" ); +dev_err (ohci->card.device,"swap not done (CSR lock timeout)\n" );fw_fill_response (&response, packet->header,RCODE_BUSY ,NULL ,0 ); out:
@@ -1621,11 +1638,13 @@ static void detect_dead_context(struct f ctl =reg_read (ohci,CONTROL_SET (regs));if (ctl &CONTEXT_DEAD ) {#ifdef CONFIG_FIREWIRE_OHCI_DEBUG -fw_error ("DMA context %s has stopped, error code: %s\n" , - name, evts[ctl &0x1f ]); +dev_err (ohci->card.device, +"DMA context %s has stopped, error code: %s\n" , + name, evts[ctl &0x1f ]);#else -fw_error ("DMA context %s has stopped, error code: %#x\n" , - name, ctl &0x1f ); +dev_err (ohci->card.device, +"DMA context %s has stopped, error code: %#x\n" , + name, ctl &0x1f );#endif } }
@@ -1777,7 +1796,8 @@ static int find_and_insert_self_id(struc reg =reg_read (ohci, OHCI1394_NodeID);if (!(reg & OHCI1394_NodeID_idValid)) { -fw_notify ("node ID not valid, new bus reset in progress\n" ); +dev_notice (ohci->card.device, +"node ID not valid, new bus reset in progress\n" );return -EBUSY ; } self_id |= ((reg &0x3f ) <<24 );/* phy ID */
@@ -1823,11 +1843,12 @@ static void bus_reset_work(struct work_s reg =reg_read (ohci, OHCI1394_NodeID);if (!(reg & OHCI1394_NodeID_idValid)) { -fw_notify ("node ID not valid, new bus reset in progress\n" ); +dev_notice (ohci->card.device, +"node ID not valid, new bus reset in progress\n" );return ; }if ((reg & OHCI1394_NodeID_nodeNumber) ==63 ) { -fw_notify ("malconfigured bus\n" ); +dev_notice (ohci->card.device,"malconfigured bus\n" );return ; } ohci->node_id = reg & (OHCI1394_NodeID_busNumber |
@@ -1841,7 +1862,7 @@ static void bus_reset_work(struct work_s reg =reg_read (ohci, OHCI1394_SelfIDCount);if (reg & OHCI1394_SelfIDCount_selfIDError) { -fw_notify ("inconsistent self IDs\n" ); +dev_notice (ohci->card.device,"inconsistent self IDs\n" );return ; }/*
@@ -1853,7 +1874,7 @@ static void bus_reset_work(struct work_s self_id_count = (reg >>3 ) &0xff ;if (self_id_count >252 ) { -fw_notify ("inconsistent self IDs\n" ); +dev_notice (ohci->card.device,"inconsistent self IDs\n" );return ; }
@@ -1871,11 +1892,13 @@ static void bus_reset_work(struct work_s*/ if (cond_le32_to_cpu (ohci->self_id_cpu[i]) ==0xffff008f ) { -fw_notify ("ignoring spurious self IDs\n" ); +dev_notice (ohci->card.device, +"ignoring spurious self IDs\n" ); self_id_count = j;break ; }else { -fw_notify ("inconsistent self IDs\n" ); +dev_notice (ohci->card.device, +"inconsistent self IDs\n" );return ; } }
@@ -1886,13 +1909,14 @@ static void bus_reset_work(struct work_sif (ohci->quirks &QUIRK_TI_SLLZ059 ) { self_id_count =find_and_insert_self_id (ohci, self_id_count);if (self_id_count <0 ) { -fw_notify ("could not construct local self ID\n" ); +dev_notice (ohci->card.device, +"could not construct local self ID\n" );return ; } }if (self_id_count ==0 ) { -fw_notify ("inconsistent self IDs\n" ); +dev_notice (ohci->card.device,"inconsistent self IDs\n" );return ; }rmb ();
@@ -1913,8 +1937,8 @@ static void bus_reset_work(struct work_s new_generation = (reg_read (ohci, OHCI1394_SelfIDCount) >>16 ) &0xff ;if (new_generation != generation) { -fw_notify ("recursive bus reset detected, " -"discarding self ids\n" ); +dev_notice (ohci->card.device, +"new bus reset, discarding self ids\n" );return ; }
@@ -1985,8 +2009,7 @@ static void bus_reset_work(struct work_sdma_free_coherent (ohci->card.device,CONFIG_ROM_SIZE , free_rom, free_rom_bus); -log_selfids (ohci->node_id, generation, - self_id_count, ohci->self_id_buffer); +log_selfids (ohci, generation, self_id_count); fw_core_handle_bus_reset(&ohci->card, ohci->node_id, generation, self_id_count, ohci->self_id_buffer,
@@ -2011,7 +2034,7 @@ static irqreturn_t irq_handler(int irq,*/ reg_write (ohci, OHCI1394_IntEventClear, event & ~(OHCI1394_busReset | OHCI1394_postedWriteErr)); -log_irqs (event); +log_irqs (ohci, event);if (event & OHCI1394_selfIDComplete)queue_work (fw_workqueue, &ohci->bus_reset_work);
@@ -2053,8 +2076,8 @@ static irqreturn_t irq_handler(int irq, }if (unlikely (event & OHCI1394_regAccessFail)) -fw_error ("Register access failure - " -"please notify [email protected]\n" ); +dev_err (ohci->card.device, +"register access failure - please notify [email protected]\n" );if (unlikely (event & OHCI1394_postedWriteErr)) {reg_read (ohci, OHCI1394_PostedWriteAddressHi);
@@ -2062,12 +2085,13 @@ static irqreturn_t irq_handler(int irq,reg_write (ohci, OHCI1394_IntEventClear, OHCI1394_postedWriteErr);if (printk_ratelimit ()) -fw_error ("PCI posted write error\n" ); +dev_err (ohci->card.device,"PCI posted write error\n" ); }if (unlikely (event & OHCI1394_cycleTooLong)) {if (printk_ratelimit ()) -fw_notify ("isochronous cycle too long\n" ); +dev_notice (ohci->card.device, +"isochronous cycle too long\n" );reg_write (ohci, OHCI1394_LinkControlSet, OHCI1394_LinkControl_cycleMaster); }
@@ -2080,7 +2104,8 @@ static irqreturn_t irq_handler(int irq,* them at least two cycles later. (FIXME?) */ if (printk_ratelimit ()) -fw_notify ("isochronous cycle inconsistent\n" ); +dev_notice (ohci->card.device, +"isochronous cycle inconsistent\n" ); }if (unlikely (event & OHCI1394_unrecoverableError))
@@ -2207,7 +2232,7 @@ static int ohci_enable(struct fw_card *cint i, ret;if (software_reset (ohci)) { -fw_error ("Failed to reset ohci card.\n" ); +dev_err (card->device,"failed to reset ohci card\n" );return -EBUSY ; }
@@ -2231,7 +2256,7 @@ static int ohci_enable(struct fw_card *c }if (!lps) { -fw_error ("Failed to set Link Power Status\n" ); +dev_err (card->device,"failed to set Link Power Status\n" );return -EIO ; }
@@ -2240,7 +2265,7 @@ static int ohci_enable(struct fw_card *cif (ret <0 )return ret;if (ret) -fw_notify ("local TSB41BA3D phy\n" ); +dev_notice (card->device,"local TSB41BA3D phy\n" );else ohci->quirks &= ~QUIRK_TI_SLLZ059 ; }
@@ -2340,7 +2365,8 @@ static int ohci_enable(struct fw_card *cif (request_irq (dev->irq, irq_handler,pci_dev_msi_enabled (dev) ?0 :IRQF_SHARED , ohci_driver_name, ohci)) { -fw_error ("Failed to allocate interrupt %d.\n" , dev->irq); +dev_err (card->device,"failed to allocate interrupt %d\n" , + dev->irq);pci_disable_msi (dev);if (config_rom) {
@@ -2505,7 +2531,7 @@ static int ohci_cancel_packet(struct fw_dma_unmap_single (ohci->card.device, packet->payload_bus, packet->payload_length,DMA_TO_DEVICE ); -log_ar_at_event ('T' , packet->speed, packet->header,0x20 ); +log_ar_at_event (ohci,'T' , packet->speed, packet->header,0x20 ); driver_data->packet =NULL ; packet->ack =RCODE_CANCELLED ; packet->callback (packet, &ohci->card, packet->ack);
@@ -3459,7 +3485,7 @@ static int __devinit pci_probe(struct pc err =pci_enable_device (dev);if (err) { -fw_error ("Failed to enable OHCI hardware\n" ); +dev_err (&dev->dev,"failed to enable OHCI hardware\n" ); goto fail_free; }
@@ -3474,13 +3500,13 @@ static int __devinit pci_probe(struct pc err =pci_request_region (dev,0 , ohci_driver_name);if (err) { -fw_error ("MMIO resource unavailable\n" ); +dev_err (&dev->dev,"MMIO resource unavailable\n" ); goto fail_disable; } ohci->registers =pci_iomap (dev,0 ,OHCI1394_REGISTER_SIZE );if (ohci->registers ==NULL ) { -fw_error ("Failed to remap registers\n" ); +dev_err (&dev->dev,"failed to remap registers\n" ); err = -ENXIO ; goto fail_iomem; }
@@ -3569,9 +3595,10 @@ static int __devinit pci_probe(struct pc goto fail_contexts; version =reg_read (ohci, OHCI1394_Version) &0x00ff00ff ; -fw_notify ("Added fw-ohci device %s, OHCI v%x.%x, " +dev_notice (&dev->dev, +"added OHCI v%x.%x device as card %d, " "%d IR + %d IT contexts, quirks 0x%x\n" , -dev_name (&dev->dev), version >>16 , version &0xff , + version >>16 , version &0xff , ohci->card.index, ohci->n_ir, ohci->n_it, ohci->quirks);return 0 ;
@@ -3600,7 +3627,7 @@ static int __devinit pci_probe(struct pcpmac_ohci_off (dev); fail:if (err == -ENOMEM ) -fw_error ("Out of memory\n" ); +dev_err (&dev->dev,"out of memory\n" );return err; }
@@ -3644,7 +3671,7 @@ static void pci_remove(struct pci_dev *dkfree (ohci);pmac_ohci_off (dev); -fw_notify ("Removed fw-ohci device.\n" ); +dev_notice (&dev->dev,"removed fw-ohci device\n" ); }#ifdef CONFIG_PM
@@ -3658,12 +3685,12 @@ static int pci_suspend(struct pci_dev *dpci_disable_msi (dev); err =pci_save_state (dev);if (err) { -fw_error ("pci_save_state failed\n" ); +dev_err (&dev->dev,"pci_save_state failed\n" );return err; } err =pci_set_power_state (dev,pci_choose_state (dev, state));if (err) -fw_error ("pci_set_power_state failed with %d\n" , err); +dev_err (&dev->dev,"pci_set_power_state failed with %d\n" , err);pmac_ohci_off (dev);return 0 ;
@@ -3679,7 +3706,7 @@ static int pci_resume(struct pci_dev *depci_restore_state (dev); err =pci_enable_device (dev);if (err) { -fw_error ("pci_enable_device failed\n" ); +dev_err (&dev->dev,"pci_enable_device failed\n" );return err; }
Signature · 3 lines
Stefan Richter -=====-==-== ==-- =-=-- http://arcgraph.de/sr/
PATCH 3/3 firewire: sbp2: use dev_printk API
In reply to Stefan RichterAll messages are uniformly prefixed by driver name and device name now.
--- drivers/firewire/sbp2.c | 93 ++++++++++++++++++++++------------------ 1 file changed, 51 insertions(+), 42 deletions(-)
drivers/firewire/sbp2.c +51 -42
@@ -165,7 +165,6 @@ static void sbp2_queue_work(struct sbp2_*/ struct sbp2_target {struct fw_unit *unit; -const char *bus_id;struct list_head lu_list;u64 management_agent_address;
@@ -181,11 +180,21 @@ struct sbp2_target {int blocked;/* ditto */ }; -static struct fw_device *target_device (struct sbp2_target *tgt) +static struct fw_device *target_parent_device (struct sbp2_target *tgt) {return fw_parent_device (tgt->unit); } +static const struct device *tgt_dev (const struct sbp2_target *tgt) +{ +return &tgt->unit->device; +} + +static const struct device *lu_dev (const struct sbp2_logical_unit *lu) +{ +return &lu->tgt->unit->device; +} +/* Impossible login_id, to detect logout attempt before successful login */ #define INVALID_LOGIN_ID 0x10000
@@ -430,7 +439,8 @@ static void sbp2_status_write(struct fw_memcpy (status.data, payload +8 , length -8 );if (STATUS_GET_SOURCE (status) ==2 ||STATUS_GET_SOURCE (status) ==3 ) { -fw_notify ("non-orb related status write, not handled\n" ); +dev_notice (lu_dev (lu), +"non-ORB related status write, not handled\n" );fw_send_response (card, request,RCODE_COMPLETE );return ; }
@@ -451,7 +461,7 @@ static void sbp2_status_write(struct fw_ orb->callback (orb, &status);kref_put (&orb->kref, free_orb);/* orb callback reference */ }else { -fw_error ("status write for unknown orb\n" ); +dev_err (lu_dev (lu),"status write for unknown ORB\n" ); }fw_send_response (card, request,RCODE_COMPLETE );
@@ -492,7 +502,7 @@ static void complete_transaction(structstatic void sbp2_send_orb (struct sbp2_orb *orb,struct sbp2_logical_unit *lu,int node_id,int generation,u64 offset) { -struct fw_device *device =target_device (lu->tgt); +struct fw_device *device =target_parent_device (lu->tgt);struct sbp2_pointer orb_pointer;unsigned long flags;
@@ -513,7 +523,7 @@ static void sbp2_send_orb(struct sbp2_orstatic int sbp2_cancel_orbs (struct sbp2_logical_unit *lu) { -struct fw_device *device =target_device (lu->tgt); +struct fw_device *device =target_parent_device (lu->tgt);struct sbp2_orb *orb, *next;struct list_head list;unsigned long flags;
@@ -552,7 +562,7 @@ static int sbp2_send_management_orb(stru int generation, int function, int lun_or_login_id, void *response) { - struct fw_device *device = target_device(lu->tgt); + struct fw_device *device = target_parent_device(lu->tgt);struct sbp2_management_orb *orb;unsigned int timeout;int retval = -ENOMEM ;
@@ -612,20 +622,20 @@ static int sbp2_send_management_orb(stru retval = -EIO ;if (sbp2_cancel_orbs (lu) ==0 ) { -fw_error ("%s: orb reply timed out, rcode=0x%02x\n" , - lu->tgt->bus_id, orb->base.rcode); +dev_err (lu_dev (lu),"ORB reply timed out, rcode 0x%02x\n" , + orb->base.rcode); goto out; }if (orb->base.rcode !=RCODE_COMPLETE ) { -fw_error ("%s: management write failed, rcode 0x%02x\n" , - lu->tgt->bus_id, orb->base.rcode); +dev_err (lu_dev (lu),"management write failed, rcode 0x%02x\n" , + orb->base.rcode); goto out; }if (STATUS_GET_RESPONSE (orb->status) !=0 ||STATUS_GET_SBP_STATUS (orb->status) !=0 ) { -fw_error ("%s: error status: %d:%d\n" , lu->tgt->bus_id, +dev_err (lu_dev (lu),"error status: %d:%d\n" ,STATUS_GET_RESPONSE (orb->status),STATUS_GET_SBP_STATUS (orb->status)); goto out;
@@ -648,7 +658,7 @@ static int sbp2_send_management_orb(strustatic void sbp2_agent_reset (struct sbp2_logical_unit *lu) { -struct fw_device *device =target_device (lu->tgt); +struct fw_device *device =target_parent_device (lu->tgt);__be32 d =0 ; fw_run_transaction(device->card, TCODE_WRITE_QUADLET_REQUEST,
@@ -665,7 +675,7 @@ static void complete_agent_reset_write_nstatic void sbp2_agent_reset_no_wait (struct sbp2_logical_unit *lu) { -struct fw_device *device =target_device (lu->tgt); +struct fw_device *device =target_parent_device (lu->tgt);struct fw_transaction *t;static __be32 d;
@@ -704,7 +714,7 @@ static inline void sbp2_allow_block(strustatic void sbp2_conditionally_block (struct sbp2_logical_unit *lu) {struct sbp2_target *tgt = lu->tgt; -struct fw_card *card =target_device (tgt)->card; +struct fw_card *card =target_parent_device (tgt)->card;struct Scsi_Host *shost = container_of((void *)tgt, struct Scsi_Host, hostdata[0]);unsigned long flags;
@@ -728,7 +738,7 @@ static void sbp2_conditionally_block(strstatic void sbp2_conditionally_unblock (struct sbp2_logical_unit *lu) {struct sbp2_target *tgt = lu->tgt; -struct fw_card *card =target_device (tgt)->card; +struct fw_card *card =target_parent_device (tgt)->card;struct Scsi_Host *shost = container_of((void *)tgt, struct Scsi_Host, hostdata[0]);unsigned long flags;
@@ -753,7 +763,7 @@ static void sbp2_conditionally_unblock(s*/ static void sbp2_unblock (struct sbp2_target *tgt) { -struct fw_card *card =target_device (tgt)->card; +struct fw_card *card =target_parent_device (tgt)->card;struct Scsi_Host *shost = container_of((void *)tgt, struct Scsi_Host, hostdata[0]);unsigned long flags;
@@ -794,7 +804,7 @@ static int sbp2_lun2int(u16 lun)*/ static void sbp2_set_busy_timeout (struct sbp2_logical_unit *lu) { -struct fw_device *device =target_device (lu->tgt); +struct fw_device *device =target_parent_device (lu->tgt);__be32 d =cpu_to_be32 (SBP2_CYCLE_LIMIT |SBP2_RETRY_LIMIT ); fw_run_transaction(device->card, TCODE_WRITE_QUADLET_REQUEST,
@@ -809,7 +819,7 @@ static void sbp2_login(struct work_strucstruct sbp2_logical_unit *lu = container_of(work, struct sbp2_logical_unit, work.work);struct sbp2_target *tgt = lu->tgt; -struct fw_device *device =target_device (tgt); +struct fw_device *device =target_parent_device (tgt);struct Scsi_Host *shost;struct scsi_device *sdev;struct sbp2_login_response response;
@@ -833,8 +843,8 @@ static void sbp2_login(struct work_strucif (lu->retries++ <5 ) {sbp2_queue_work (lu,DIV_ROUND_UP (HZ ,5 )); }else { -fw_error ("%s: failed to login to LUN %04x\n" , - tgt->bus_id, lu->lun); +dev_err (tgt_dev (tgt),"failed to login to LUN %04x\n" , + lu->lun);/* Let any waiting I/O fail from now on. */ sbp2_unblock (lu->tgt); }
@@ -851,8 +861,8 @@ static void sbp2_login(struct work_struc << 32) | be32_to_cpu(response.command_block_agent.low); lu->login_id =be32_to_cpu (response.misc) &0xffff ; -fw_notify ("%s: logged in to LUN %04x (%d retries)\n" , - tgt->bus_id, lu->lun, lu->retries); +dev_notice (tgt_dev (tgt),"logged in to LUN %04x (%d retries)\n" , + lu->lun, lu->retries);/* set appropriate retry limit(s) in BUSY_TIMEOUT register */ sbp2_set_busy_timeout (lu);
@@ -919,7 +929,7 @@ static void sbp2_reconnect(struct work_sstruct sbp2_logical_unit *lu = container_of(work, struct sbp2_logical_unit, work.work);struct sbp2_target *tgt = lu->tgt; -struct fw_device *device =target_device (tgt); +struct fw_device *device =target_parent_device (tgt);int generation, node_id, local_node_id;if (fw_device_is_shutdown (device))
@@ -943,7 +953,7 @@ static void sbp2_reconnect(struct work_ssmp_rmb ();/* get current card generation */ if (generation == device->card->generation || lu->retries++ >=5 ) { -fw_error ("%s: failed to reconnect\n" , tgt->bus_id); +dev_err (tgt_dev (tgt),"failed to reconnect\n" ); lu->retries =0 ;PREPARE_DELAYED_WORK (&lu->work, sbp2_login); }
@@ -957,8 +967,8 @@ static void sbp2_reconnect(struct work_ssmp_wmb ();/* node IDs must not be older than generation */ lu->generation = generation; -fw_notify ("%s: reconnected to LUN %04x (%d retries)\n" , - tgt->bus_id, lu->lun, lu->retries); +dev_notice (tgt_dev (tgt),"reconnected to LUN %04x (%d retries)\n" , + lu->lun, lu->retries);sbp2_agent_reset (lu);sbp2_cancel_orbs (lu);
@@ -1068,8 +1078,8 @@ static void sbp2_clamp_management_orb_tiunsigned int timeout = tgt->mgt_orb_timeout;if (timeout >40000 ) -fw_notify ("%s: %ds mgt_ORB_timeout limited to 40s\n" , - tgt->bus_id, timeout /1000 ); +dev_notice (tgt_dev (tgt),"%ds mgt_ORB_timeout limited to 40s\n" , + timeout /1000 ); tgt->mgt_orb_timeout =clamp_val (timeout,5000 ,40000 ); }
@@ -1081,9 +1091,9 @@ static void sbp2_init_workarounds(structunsigned int w = sbp2_param_workarounds;if (w) -fw_notify ("Please notify [email protected] " -"if you need the workarounds parameter for %s\n" , - tgt->bus_id); +dev_notice (tgt_dev (tgt), +"Please notify [email protected] " +"if you need the workarounds parameter\n" );if (w &SBP2_WORKAROUND_OVERRIDE ) goto out;
@@ -1103,9 +1113,9 @@ static void sbp2_init_workarounds(struct } out:if (w) -fw_notify ("Workarounds for %s: 0x%x " -"(firmware_revision 0x%06x, model_id 0x%06x)\n" , - tgt->bus_id, w, firmware_revision, model); +dev_notice (tgt_dev (tgt),"workarounds 0x%x " +"(firmware_revision 0x%06x, model_id 0x%06x)\n" , + w, firmware_revision, model); tgt->workarounds = w; }
@@ -1133,7 +1143,6 @@ static int sbp2_probe(struct device *devdev_set_drvdata (&unit->device, tgt); tgt->unit = unit;INIT_LIST_HEAD (&tgt->lu_list); - tgt->bus_id =dev_name (&unit->device); tgt->guid = (u64 )device->config_rom[3 ] <<32 | device->config_rom[4 ];if (fw_device_enable_phys_dma (device) <0 )
@@ -1239,7 +1248,7 @@ static int sbp2_remove(struct device *dekfree (lu); }scsi_remove_host (shost); -fw_notify ("released %s, target %d:0:0\n" , tgt->bus_id, shost->host_no); +dev_notice (dev,"released target %d:0:0\n" , shost->host_no);scsi_host_put (shost);return 0 ;
@@ -1325,7 +1334,7 @@ static void complete_command_orb(struct {struct sbp2_command_orb *orb = container_of(base_orb, struct sbp2_command_orb, base); -struct fw_device *device =target_device (orb->lu->tgt); +struct fw_device *device =target_parent_device (orb->lu->tgt);int result;if (status !=NULL ) {
@@ -1433,7 +1442,7 @@ static int sbp2_scsi_queuecommand(struct struct scsi_cmnd *cmd) {struct sbp2_logical_unit *lu = cmd->device->hostdata; -struct fw_device *device =target_device (lu->tgt); +struct fw_device *device =target_parent_device (lu->tgt);struct sbp2_command_orb *orb;int generation, retval =SCSI_MLQUEUE_HOST_BUSY ;
@@ -1442,7 +1451,7 @@ static int sbp2_scsi_queuecommand(struct* transfer direction not handled. */ if (cmd->sc_data_direction ==DMA_BIDIRECTIONAL ) { -fw_error ("Can't handle DMA_BIDIRECTIONAL, rejecting command\n" ); +dev_err (lu_dev (lu),"cannot handle bidirectional command\n" ); cmd->result =DID_ERROR <<16 ; cmd->scsi_done (cmd);return 0 ;
@@ -1450,7 +1459,7 @@ static int sbp2_scsi_queuecommand(struct orb =kzalloc (sizeof (*orb),GFP_ATOMIC );if (orb ==NULL ) { -fw_notify ("failed to alloc orb\n" ); +dev_notice (lu_dev (lu),"failed to alloc ORB\n" );return SCSI_MLQUEUE_HOST_BUSY ; }
@@ -1550,7 +1559,7 @@ static int sbp2_scsi_abort(struct scsi_c {struct sbp2_logical_unit *lu = cmd->device->hostdata; -fw_notify ("%s: sbp2_scsi_abort\n" , lu->tgt->bus_id); +dev_notice (lu_dev (lu),"sbp2_scsi_abort\n" );sbp2_agent_reset (lu);sbp2_cancel_orbs (lu);
Signature · 3 lines
Stefan Richter -=====-==-== ==-- =-=-- http://arcgraph.de/sr/