* [PATCH] gspca: print small buffers via %*ph
@ 2013-09-03 12:31 Andy Shevchenko
2013-09-09 11:43 ` Hans de Goede
0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2013-09-03 12:31 UTC (permalink / raw)
To: Hans de Goede, Mauro Carvalho Chehab, linux-media; +Cc: Andy Shevchenko
Instead of passing each byte through stack let's use %*ph specifier to do this
job better.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/media/usb/gspca/sonixb.c | 5 +----
drivers/media/usb/gspca/xirlink_cit.c | 12 ++++--------
2 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/drivers/media/usb/gspca/sonixb.c b/drivers/media/usb/gspca/sonixb.c
index d7ff3b9..5e5613e 100644
--- a/drivers/media/usb/gspca/sonixb.c
+++ b/drivers/media/usb/gspca/sonixb.c
@@ -513,10 +513,7 @@ static void i2c_w(struct gspca_dev *gspca_dev, const u8 *buf)
if (gspca_dev->usb_buf[0] & 0x04) {
if (gspca_dev->usb_buf[0] & 0x08) {
dev_err(gspca_dev->v4l2_dev.dev,
- "i2c error writing %02x %02x %02x %02x"
- " %02x %02x %02x %02x\n",
- buf[0], buf[1], buf[2], buf[3],
- buf[4], buf[5], buf[6], buf[7]);
+ "i2c error writing %8ph\n", buf);
gspca_dev->usb_err = -EIO;
}
return;
diff --git a/drivers/media/usb/gspca/xirlink_cit.c b/drivers/media/usb/gspca/xirlink_cit.c
index 7eaf64e..3beb351 100644
--- a/drivers/media/usb/gspca/xirlink_cit.c
+++ b/drivers/media/usb/gspca/xirlink_cit.c
@@ -2864,20 +2864,16 @@ static u8 *cit_find_sof(struct gspca_dev *gspca_dev, u8 *data, int len)
if (data[i] == 0xff) {
if (i >= 4)
PDEBUG(D_FRAM,
- "header found at offset: %d: %02x %02x 00 %02x %02x %02x\n",
+ "header found at offset: %d: %02x %02x 00 %3ph\n",
i - 1,
data[i - 4],
data[i - 3],
- data[i],
- data[i + 1],
- data[i + 2]);
+ &data[i]);
else
PDEBUG(D_FRAM,
- "header found at offset: %d: 00 %02x %02x %02x\n",
+ "header found at offset: %d: 00 %3ph\n",
i - 1,
- data[i],
- data[i + 1],
- data[i + 2]);
+ &data[i]);
return data + i + (sd->sof_len - 1);
}
break;
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] gspca: print small buffers via %*ph
2013-09-03 12:31 [PATCH] gspca: print small buffers via %*ph Andy Shevchenko
@ 2013-09-09 11:43 ` Hans de Goede
0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2013-09-09 11:43 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Mauro Carvalho Chehab, linux-media
Hi,
Thanks! I've added these to my gspca tree for 3.13, and send a pull-request
with these for 3.13 to Mauro.
Regards,
Hans
On 09/03/2013 02:31 PM, Andy Shevchenko wrote:
> Instead of passing each byte through stack let's use %*ph specifier to do this
> job better.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/media/usb/gspca/sonixb.c | 5 +----
> drivers/media/usb/gspca/xirlink_cit.c | 12 ++++--------
> 2 files changed, 5 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/media/usb/gspca/sonixb.c b/drivers/media/usb/gspca/sonixb.c
> index d7ff3b9..5e5613e 100644
> --- a/drivers/media/usb/gspca/sonixb.c
> +++ b/drivers/media/usb/gspca/sonixb.c
> @@ -513,10 +513,7 @@ static void i2c_w(struct gspca_dev *gspca_dev, const u8 *buf)
> if (gspca_dev->usb_buf[0] & 0x04) {
> if (gspca_dev->usb_buf[0] & 0x08) {
> dev_err(gspca_dev->v4l2_dev.dev,
> - "i2c error writing %02x %02x %02x %02x"
> - " %02x %02x %02x %02x\n",
> - buf[0], buf[1], buf[2], buf[3],
> - buf[4], buf[5], buf[6], buf[7]);
> + "i2c error writing %8ph\n", buf);
> gspca_dev->usb_err = -EIO;
> }
> return;
> diff --git a/drivers/media/usb/gspca/xirlink_cit.c b/drivers/media/usb/gspca/xirlink_cit.c
> index 7eaf64e..3beb351 100644
> --- a/drivers/media/usb/gspca/xirlink_cit.c
> +++ b/drivers/media/usb/gspca/xirlink_cit.c
> @@ -2864,20 +2864,16 @@ static u8 *cit_find_sof(struct gspca_dev *gspca_dev, u8 *data, int len)
> if (data[i] == 0xff) {
> if (i >= 4)
> PDEBUG(D_FRAM,
> - "header found at offset: %d: %02x %02x 00 %02x %02x %02x\n",
> + "header found at offset: %d: %02x %02x 00 %3ph\n",
> i - 1,
> data[i - 4],
> data[i - 3],
> - data[i],
> - data[i + 1],
> - data[i + 2]);
> + &data[i]);
> else
> PDEBUG(D_FRAM,
> - "header found at offset: %d: 00 %02x %02x %02x\n",
> + "header found at offset: %d: 00 %3ph\n",
> i - 1,
> - data[i],
> - data[i + 1],
> - data[i + 2]);
> + &data[i]);
> return data + i + (sd->sof_len - 1);
> }
> break;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-09-09 11:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-03 12:31 [PATCH] gspca: print small buffers via %*ph Andy Shevchenko
2013-09-09 11:43 ` Hans de Goede
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).