.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* Driver for Philips webcam |
---|
2 | 3 | Functions that send various control messages to the webcam, including |
---|
3 | 4 | video modes. |
---|
.. | .. |
---|
15 | 16 | The decompression routines have been implemented by reverse-engineering the |
---|
16 | 17 | Nemosoft binary pwcx module. Caveat emptor. |
---|
17 | 18 | |
---|
18 | | - This program is free software; you can redistribute it and/or modify |
---|
19 | | - it under the terms of the GNU General Public License as published by |
---|
20 | | - the Free Software Foundation; either version 2 of the License, or |
---|
21 | | - (at your option) any later version. |
---|
22 | | - |
---|
23 | | - This program is distributed in the hope that it will be useful, |
---|
24 | | - but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
25 | | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
26 | | - GNU General Public License for more details. |
---|
27 | | - |
---|
28 | | - You should have received a copy of the GNU General Public License |
---|
29 | | - along with this program; if not, write to the Free Software |
---|
30 | | - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
31 | 19 | */ |
---|
32 | 20 | |
---|
33 | 21 | /* |
---|
.. | .. |
---|
242 | 230 | fps = (frames / 5) - 1; |
---|
243 | 231 | |
---|
244 | 232 | /* Find a supported framerate with progressively higher compression */ |
---|
245 | | - pChoose = NULL; |
---|
246 | | - while (*compression <= 3) { |
---|
| 233 | + do { |
---|
247 | 234 | pChoose = &Timon_table[size][fps][*compression]; |
---|
248 | 235 | if (pChoose->alternate != 0) |
---|
249 | 236 | break; |
---|
250 | 237 | (*compression)++; |
---|
251 | | - } |
---|
252 | | - if (pChoose == NULL || pChoose->alternate == 0) |
---|
| 238 | + } while (*compression <= 3); |
---|
| 239 | + |
---|
| 240 | + if (pChoose->alternate == 0) |
---|
253 | 241 | return -ENOENT; /* Not supported. */ |
---|
254 | 242 | |
---|
255 | 243 | if (send_to_cam) |
---|
.. | .. |
---|
279 | 267 | static int set_video_mode_Kiara(struct pwc_device *pdev, int size, int pixfmt, |
---|
280 | 268 | int frames, int *compression, int send_to_cam) |
---|
281 | 269 | { |
---|
282 | | - const struct Kiara_table_entry *pChoose = NULL; |
---|
| 270 | + const struct Kiara_table_entry *pChoose; |
---|
283 | 271 | int fps, ret = 0; |
---|
284 | 272 | |
---|
285 | 273 | if (size >= PSZ_MAX || *compression < 0 || *compression > 3) |
---|
.. | .. |
---|
293 | 281 | fps = (frames / 5) - 1; |
---|
294 | 282 | |
---|
295 | 283 | /* Find a supported framerate with progressively higher compression */ |
---|
296 | | - while (*compression <= 3) { |
---|
| 284 | + do { |
---|
297 | 285 | pChoose = &Kiara_table[size][fps][*compression]; |
---|
298 | 286 | if (pChoose->alternate != 0) |
---|
299 | 287 | break; |
---|
300 | 288 | (*compression)++; |
---|
301 | | - } |
---|
302 | | - if (pChoose == NULL || pChoose->alternate == 0) |
---|
| 289 | + } while (*compression <= 3); |
---|
| 290 | + |
---|
| 291 | + if (pChoose->alternate == 0) |
---|
303 | 292 | return -ENOENT; /* Not supported. */ |
---|
304 | 293 | |
---|
305 | 294 | /* Firmware bug: video endpoint is 5, but commands are sent to endpoint 4 */ |
---|
.. | .. |
---|
534 | 523 | #ifdef CONFIG_USB_PWC_DEBUG |
---|
535 | 524 | int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor) |
---|
536 | 525 | { |
---|
537 | | - int ret = -1, request; |
---|
| 526 | + int ret, request; |
---|
538 | 527 | |
---|
539 | 528 | if (pdev->type < 675) |
---|
540 | 529 | request = SENSOR_TYPE_FORMATTER1; |
---|