diff options
Diffstat (limited to 'drivers/media/video/gspca/kinect.c')
-rw-r--r-- | drivers/media/video/gspca/kinect.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/drivers/media/video/gspca/kinect.c b/drivers/media/video/gspca/kinect.c index 26fc206f095e..9ed15a103477 100644 --- a/drivers/media/video/gspca/kinect.c +++ b/drivers/media/video/gspca/kinect.c | |||
@@ -24,6 +24,8 @@ | |||
24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
28 | |||
27 | #define MODULE_NAME "kinect" | 29 | #define MODULE_NAME "kinect" |
28 | 30 | ||
29 | #include "gspca.h" | 31 | #include "gspca.h" |
@@ -141,7 +143,7 @@ static int send_cmd(struct gspca_dev *gspca_dev, uint16_t cmd, void *cmdbuf, | |||
141 | struct cam_hdr *rhdr = (void *)ibuf; | 143 | struct cam_hdr *rhdr = (void *)ibuf; |
142 | 144 | ||
143 | if (cmd_len & 1 || cmd_len > (0x400 - sizeof(*chdr))) { | 145 | if (cmd_len & 1 || cmd_len > (0x400 - sizeof(*chdr))) { |
144 | err("send_cmd: Invalid command length (0x%x)", cmd_len); | 146 | pr_err("send_cmd: Invalid command length (0x%x)\n", cmd_len); |
145 | return -1; | 147 | return -1; |
146 | } | 148 | } |
147 | 149 | ||
@@ -157,7 +159,7 @@ static int send_cmd(struct gspca_dev *gspca_dev, uint16_t cmd, void *cmdbuf, | |||
157 | PDEBUG(D_USBO, "Control cmd=%04x tag=%04x len=%04x: %d", cmd, | 159 | PDEBUG(D_USBO, "Control cmd=%04x tag=%04x len=%04x: %d", cmd, |
158 | sd->cam_tag, cmd_len, res); | 160 | sd->cam_tag, cmd_len, res); |
159 | if (res < 0) { | 161 | if (res < 0) { |
160 | err("send_cmd: Output control transfer failed (%d)", res); | 162 | pr_err("send_cmd: Output control transfer failed (%d)\n", res); |
161 | return res; | 163 | return res; |
162 | } | 164 | } |
163 | 165 | ||
@@ -166,33 +168,35 @@ static int send_cmd(struct gspca_dev *gspca_dev, uint16_t cmd, void *cmdbuf, | |||
166 | } while (actual_len == 0); | 168 | } while (actual_len == 0); |
167 | PDEBUG(D_USBO, "Control reply: %d", res); | 169 | PDEBUG(D_USBO, "Control reply: %d", res); |
168 | if (actual_len < sizeof(*rhdr)) { | 170 | if (actual_len < sizeof(*rhdr)) { |
169 | err("send_cmd: Input control transfer failed (%d)", res); | 171 | pr_err("send_cmd: Input control transfer failed (%d)\n", res); |
170 | return res; | 172 | return res; |
171 | } | 173 | } |
172 | actual_len -= sizeof(*rhdr); | 174 | actual_len -= sizeof(*rhdr); |
173 | 175 | ||
174 | if (rhdr->magic[0] != 0x52 || rhdr->magic[1] != 0x42) { | 176 | if (rhdr->magic[0] != 0x52 || rhdr->magic[1] != 0x42) { |
175 | err("send_cmd: Bad magic %02x %02x", rhdr->magic[0], | 177 | pr_err("send_cmd: Bad magic %02x %02x\n", |
176 | rhdr->magic[1]); | 178 | rhdr->magic[0], rhdr->magic[1]); |
177 | return -1; | 179 | return -1; |
178 | } | 180 | } |
179 | if (rhdr->cmd != chdr->cmd) { | 181 | if (rhdr->cmd != chdr->cmd) { |
180 | err("send_cmd: Bad cmd %02x != %02x", rhdr->cmd, chdr->cmd); | 182 | pr_err("send_cmd: Bad cmd %02x != %02x\n", |
183 | rhdr->cmd, chdr->cmd); | ||
181 | return -1; | 184 | return -1; |
182 | } | 185 | } |
183 | if (rhdr->tag != chdr->tag) { | 186 | if (rhdr->tag != chdr->tag) { |
184 | err("send_cmd: Bad tag %04x != %04x", rhdr->tag, chdr->tag); | 187 | pr_err("send_cmd: Bad tag %04x != %04x\n", |
188 | rhdr->tag, chdr->tag); | ||
185 | return -1; | 189 | return -1; |
186 | } | 190 | } |
187 | if (cpu_to_le16(rhdr->len) != (actual_len/2)) { | 191 | if (cpu_to_le16(rhdr->len) != (actual_len/2)) { |
188 | err("send_cmd: Bad len %04x != %04x", | 192 | pr_err("send_cmd: Bad len %04x != %04x\n", |
189 | cpu_to_le16(rhdr->len), (int)(actual_len/2)); | 193 | cpu_to_le16(rhdr->len), (int)(actual_len/2)); |
190 | return -1; | 194 | return -1; |
191 | } | 195 | } |
192 | 196 | ||
193 | if (actual_len > reply_len) { | 197 | if (actual_len > reply_len) { |
194 | warn("send_cmd: Data buffer is %d bytes long, but got %d bytes", | 198 | pr_warn("send_cmd: Data buffer is %d bytes long, but got %d bytes\n", |
195 | reply_len, actual_len); | 199 | reply_len, actual_len); |
196 | memcpy(replybuf, ibuf+sizeof(*rhdr), reply_len); | 200 | memcpy(replybuf, ibuf+sizeof(*rhdr), reply_len); |
197 | } else { | 201 | } else { |
198 | memcpy(replybuf, ibuf+sizeof(*rhdr), actual_len); | 202 | memcpy(replybuf, ibuf+sizeof(*rhdr), actual_len); |
@@ -218,8 +222,8 @@ static int write_register(struct gspca_dev *gspca_dev, uint16_t reg, | |||
218 | if (res < 0) | 222 | if (res < 0) |
219 | return res; | 223 | return res; |
220 | if (res != 2) { | 224 | if (res != 2) { |
221 | warn("send_cmd returned %d [%04x %04x], 0000 expected", | 225 | pr_warn("send_cmd returned %d [%04x %04x], 0000 expected\n", |
222 | res, reply[0], reply[1]); | 226 | res, reply[0], reply[1]); |
223 | } | 227 | } |
224 | return 0; | 228 | return 0; |
225 | } | 229 | } |
@@ -353,8 +357,8 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, u8 *__data, int len) | |||
353 | return; | 357 | return; |
354 | 358 | ||
355 | if (hdr->magic[0] != 'R' || hdr->magic[1] != 'B') { | 359 | if (hdr->magic[0] != 'R' || hdr->magic[1] != 'B') { |
356 | warn("[Stream %02x] Invalid magic %02x%02x", sd->stream_flag, | 360 | pr_warn("[Stream %02x] Invalid magic %02x%02x\n", |
357 | hdr->magic[0], hdr->magic[1]); | 361 | sd->stream_flag, hdr->magic[0], hdr->magic[1]); |
358 | return; | 362 | return; |
359 | } | 363 | } |
360 | 364 | ||
@@ -368,7 +372,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, u8 *__data, int len) | |||
368 | gspca_frame_add(gspca_dev, LAST_PACKET, data, datalen); | 372 | gspca_frame_add(gspca_dev, LAST_PACKET, data, datalen); |
369 | 373 | ||
370 | else | 374 | else |
371 | warn("Packet type not recognized..."); | 375 | pr_warn("Packet type not recognized...\n"); |
372 | } | 376 | } |
373 | 377 | ||
374 | /* sub-driver description */ | 378 | /* sub-driver description */ |