aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2013-09-11 17:25:58 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-11 18:59:33 -0400
commitf3ded788bbd95af344a34ae40d1ab578cb76c7fb (patch)
treec1f7710f372dbc9e3997cf09cefe5ee38a0d0e03
parent0c075d64df3aa9636a8700a710a2f2ada5e453a2 (diff)
pktcdvd: add struct pktcdvd_device * to pkt_dump_sense()
Allow the device name to be emitted with pkt_err when logging the sense data. Signed-off-by: Joe Perches <joe@perches.com> Cc: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/block/pktcdvd.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 1ceafb70fc16..29a5194ab147 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -755,17 +755,18 @@ static const char *sense_key_string(__u8 index)
755 * A generic sense dump / resolve mechanism should be implemented across 755 * A generic sense dump / resolve mechanism should be implemented across
756 * all ATAPI + SCSI devices. 756 * all ATAPI + SCSI devices.
757 */ 757 */
758static void pkt_dump_sense(struct packet_command *cgc) 758static void pkt_dump_sense(struct pktcdvd_device *pd,
759 struct packet_command *cgc)
759{ 760{
760 struct request_sense *sense = cgc->sense; 761 struct request_sense *sense = cgc->sense;
761 762
762 if (sense) 763 if (sense)
763 pr_err("%*ph - sense %02x.%02x.%02x (%s)\n", 764 pkt_err(pd, "%*ph - sense %02x.%02x.%02x (%s)\n",
764 CDROM_PACKET_SIZE, cgc->cmd, 765 CDROM_PACKET_SIZE, cgc->cmd,
765 sense->sense_key, sense->asc, sense->ascq, 766 sense->sense_key, sense->asc, sense->ascq,
766 sense_key_string(sense->sense_key)); 767 sense_key_string(sense->sense_key));
767 else 768 else
768 pr_err("%*ph - no sense\n", CDROM_PACKET_SIZE, cgc->cmd); 769 pkt_err(pd, "%*ph - no sense\n", CDROM_PACKET_SIZE, cgc->cmd);
769} 770}
770 771
771/* 772/*
@@ -808,7 +809,7 @@ static noinline_for_stack int pkt_set_speed(struct pktcdvd_device *pd,
808 cgc.cmd[5] = write_speed & 0xff; 809 cgc.cmd[5] = write_speed & 0xff;
809 810
810 if ((ret = pkt_generic_packet(pd, &cgc))) 811 if ((ret = pkt_generic_packet(pd, &cgc)))
811 pkt_dump_sense(&cgc); 812 pkt_dump_sense(pd, &cgc);
812 813
813 return ret; 814 return ret;
814} 815}
@@ -1700,7 +1701,7 @@ static noinline_for_stack int pkt_set_write_settings(struct pktcdvd_device *pd)
1700 init_cdrom_command(&cgc, buffer, sizeof(*wp), CGC_DATA_READ); 1701 init_cdrom_command(&cgc, buffer, sizeof(*wp), CGC_DATA_READ);
1701 cgc.sense = &sense; 1702 cgc.sense = &sense;
1702 if ((ret = pkt_mode_sense(pd, &cgc, GPMODE_WRITE_PARMS_PAGE, 0))) { 1703 if ((ret = pkt_mode_sense(pd, &cgc, GPMODE_WRITE_PARMS_PAGE, 0))) {
1703 pkt_dump_sense(&cgc); 1704 pkt_dump_sense(pd, &cgc);
1704 return ret; 1705 return ret;
1705 } 1706 }
1706 1707
@@ -1715,7 +1716,7 @@ static noinline_for_stack int pkt_set_write_settings(struct pktcdvd_device *pd)
1715 init_cdrom_command(&cgc, buffer, size, CGC_DATA_READ); 1716 init_cdrom_command(&cgc, buffer, size, CGC_DATA_READ);
1716 cgc.sense = &sense; 1717 cgc.sense = &sense;
1717 if ((ret = pkt_mode_sense(pd, &cgc, GPMODE_WRITE_PARMS_PAGE, 0))) { 1718 if ((ret = pkt_mode_sense(pd, &cgc, GPMODE_WRITE_PARMS_PAGE, 0))) {
1718 pkt_dump_sense(&cgc); 1719 pkt_dump_sense(pd, &cgc);
1719 return ret; 1720 return ret;
1720 } 1721 }
1721 1722
@@ -1757,7 +1758,7 @@ static noinline_for_stack int pkt_set_write_settings(struct pktcdvd_device *pd)
1757 1758
1758 cgc.buflen = cgc.cmd[8] = size; 1759 cgc.buflen = cgc.cmd[8] = size;
1759 if ((ret = pkt_mode_select(pd, &cgc))) { 1760 if ((ret = pkt_mode_select(pd, &cgc))) {
1760 pkt_dump_sense(&cgc); 1761 pkt_dump_sense(pd, &cgc);
1761 return ret; 1762 return ret;
1762 } 1763 }
1763 1764
@@ -1969,7 +1970,7 @@ static noinline_for_stack int pkt_write_caching(struct pktcdvd_device *pd,
1969 ret = pkt_mode_select(pd, &cgc); 1970 ret = pkt_mode_select(pd, &cgc);
1970 if (ret) { 1971 if (ret) {
1971 pkt_err(pd, "write caching control failed\n"); 1972 pkt_err(pd, "write caching control failed\n");
1972 pkt_dump_sense(&cgc); 1973 pkt_dump_sense(pd, &cgc);
1973 } else if (!ret && set) 1974 } else if (!ret && set)
1974 pkt_notice(pd, "enabled write caching\n"); 1975 pkt_notice(pd, "enabled write caching\n");
1975 return ret; 1976 return ret;
@@ -2007,7 +2008,7 @@ static noinline_for_stack int pkt_get_max_speed(struct pktcdvd_device *pd,
2007 sizeof(struct mode_page_header); 2008 sizeof(struct mode_page_header);
2008 ret = pkt_mode_sense(pd, &cgc, GPMODE_CAPABILITIES_PAGE, 0); 2009 ret = pkt_mode_sense(pd, &cgc, GPMODE_CAPABILITIES_PAGE, 0);
2009 if (ret) { 2010 if (ret) {
2010 pkt_dump_sense(&cgc); 2011 pkt_dump_sense(pd, &cgc);
2011 return ret; 2012 return ret;
2012 } 2013 }
2013 } 2014 }
@@ -2066,7 +2067,7 @@ static noinline_for_stack int pkt_media_speed(struct pktcdvd_device *pd,
2066 cgc.cmd[8] = 2; 2067 cgc.cmd[8] = 2;
2067 ret = pkt_generic_packet(pd, &cgc); 2068 ret = pkt_generic_packet(pd, &cgc);
2068 if (ret) { 2069 if (ret) {
2069 pkt_dump_sense(&cgc); 2070 pkt_dump_sense(pd, &cgc);
2070 return ret; 2071 return ret;
2071 } 2072 }
2072 size = ((unsigned int) buf[0]<<8) + buf[1] + 2; 2073 size = ((unsigned int) buf[0]<<8) + buf[1] + 2;
@@ -2081,7 +2082,7 @@ static noinline_for_stack int pkt_media_speed(struct pktcdvd_device *pd,
2081 cgc.cmd[8] = size; 2082 cgc.cmd[8] = size;
2082 ret = pkt_generic_packet(pd, &cgc); 2083 ret = pkt_generic_packet(pd, &cgc);
2083 if (ret) { 2084 if (ret) {
2084 pkt_dump_sense(&cgc); 2085 pkt_dump_sense(pd, &cgc);
2085 return ret; 2086 return ret;
2086 } 2087 }
2087 2088
@@ -2136,7 +2137,7 @@ static noinline_for_stack int pkt_perform_opc(struct pktcdvd_device *pd)
2136 cgc.cmd[0] = GPCMD_SEND_OPC; 2137 cgc.cmd[0] = GPCMD_SEND_OPC;
2137 cgc.cmd[1] = 1; 2138 cgc.cmd[1] = 1;
2138 if ((ret = pkt_generic_packet(pd, &cgc))) 2139 if ((ret = pkt_generic_packet(pd, &cgc)))
2139 pkt_dump_sense(&cgc); 2140 pkt_dump_sense(pd, &cgc);
2140 return ret; 2141 return ret;
2141} 2142}
2142 2143