Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: dvb-core: dvb_ringbuffer: Fix various coding style issues

The file dvb_ringbuffer.c has several minor coding style violations.
This patch resolves these issues to improve code readability and align
the code with the Linux kernel coding style.

The cleanups include:
- Adding spaces around assignment and comparison operators.
- Adding spaces after commas in function arguments.
- Placing statements on a new line for single-line 'if' blocks.
- Correcting minor indentation.

This is a purely stylistic change with no functional impact.

Signed-off-by: Darshan Rathod <darshanrathod475@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
[hverkuil: split rbuf->pread = rbuf->pwrite = 0 in two lines]

authored by

Darshan Rathod and committed by
Hans Verkuil
ef08d2ea b91e6aaf

+21 -15
+21 -15
drivers/media/dvb-core/dvb_ringbuffer.c
··· 37 37 38 38 void dvb_ringbuffer_init(struct dvb_ringbuffer *rbuf, void *data, size_t len) 39 39 { 40 - rbuf->pread=rbuf->pwrite=0; 41 - rbuf->data=data; 42 - rbuf->size=len; 43 - rbuf->error=0; 40 + rbuf->pread = 0; 41 + rbuf->pwrite = 0; 42 + rbuf->data = data; 43 + rbuf->size = len; 44 + rbuf->error = 0; 44 45 45 46 init_waitqueue_head(&rbuf->queue); 46 47 ··· 236 235 return len; 237 236 } 238 237 239 - ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf, size_t len) 238 + ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8 *buf, size_t len) 240 239 { 241 240 int status; 242 241 ssize_t oldpwrite = rbuf->pwrite; ··· 246 245 DVB_RINGBUFFER_WRITE_BYTE(rbuf, PKT_READY); 247 246 status = dvb_ringbuffer_write(rbuf, buf, len); 248 247 249 - if (status < 0) rbuf->pwrite = oldpwrite; 248 + if (status < 0) 249 + rbuf->pwrite = oldpwrite; 250 250 return status; 251 251 } 252 252 ··· 260 258 261 259 pktlen = rbuf->data[idx] << 8; 262 260 pktlen |= rbuf->data[(idx + 1) % rbuf->size]; 263 - if (offset > pktlen) return -EINVAL; 264 - if ((offset + len) > pktlen) len = pktlen - offset; 261 + if (offset > pktlen) 262 + return -EINVAL; 263 + if ((offset + len) > pktlen) 264 + len = pktlen - offset; 265 265 266 266 idx = (idx + DVB_RINGBUFFER_PKTHDRSIZE + offset) % rbuf->size; 267 267 todo = len; ··· 282 278 } 283 279 284 280 ssize_t dvb_ringbuffer_pkt_read(struct dvb_ringbuffer *rbuf, size_t idx, 285 - int offset, u8* buf, size_t len) 281 + int offset, u8 *buf, size_t len) 286 282 { 287 283 size_t todo; 288 284 size_t split; ··· 290 286 291 287 pktlen = rbuf->data[idx] << 8; 292 288 pktlen |= rbuf->data[(idx + 1) % rbuf->size]; 293 - if (offset > pktlen) return -EINVAL; 294 - if ((offset + len) > pktlen) len = pktlen - offset; 289 + if (offset > pktlen) 290 + return -EINVAL; 291 + if ((offset + len) > pktlen) 292 + len = pktlen - offset; 295 293 296 294 idx = (idx + DVB_RINGBUFFER_PKTHDRSIZE + offset) % rbuf->size; 297 295 todo = len; ··· 315 309 rbuf->data[(idx + 2) % rbuf->size] = PKT_DISPOSED; 316 310 317 311 // clean up disposed packets 318 - while(dvb_ringbuffer_avail(rbuf) > DVB_RINGBUFFER_PKTHDRSIZE) { 312 + while (dvb_ringbuffer_avail(rbuf) > DVB_RINGBUFFER_PKTHDRSIZE) { 319 313 if (DVB_RINGBUFFER_PEEK(rbuf, 2) == PKT_DISPOSED) { 320 314 pktlen = DVB_RINGBUFFER_PEEK(rbuf, 0) << 8; 321 315 pktlen |= DVB_RINGBUFFER_PEEK(rbuf, 1); ··· 327 321 } 328 322 } 329 323 330 - ssize_t dvb_ringbuffer_pkt_next(struct dvb_ringbuffer *rbuf, size_t idx, size_t* pktlen) 324 + ssize_t dvb_ringbuffer_pkt_next(struct dvb_ringbuffer *rbuf, size_t idx, size_t *pktlen) 331 325 { 332 326 int consumed; 333 327 int curpktlen; 334 328 int curpktstatus; 335 329 336 330 if (idx == -1) { 337 - idx = rbuf->pread; 331 + idx = rbuf->pread; 338 332 } else { 339 333 curpktlen = rbuf->data[idx] << 8; 340 334 curpktlen |= rbuf->data[(idx + 1) % rbuf->size]; ··· 345 339 if (consumed < 0) 346 340 consumed += rbuf->size; 347 341 348 - while((dvb_ringbuffer_avail(rbuf) - consumed) > DVB_RINGBUFFER_PKTHDRSIZE) { 342 + while ((dvb_ringbuffer_avail(rbuf) - consumed) > DVB_RINGBUFFER_PKTHDRSIZE) { 349 343 350 344 curpktlen = rbuf->data[idx] << 8; 351 345 curpktlen |= rbuf->data[(idx + 1) % rbuf->size];