On Fri Jul 18 13:08:01 2025 +0000, Darshan Rathod wrote:
> 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 <[email protected]>
> Signed-off-by: Hans Verkuil <[email protected]>
> [hverkuil: split rbuf->pread = rbuf->pwrite = 0 in two lines]

Patch committed.

Thanks,
Hans Verkuil

 drivers/media/dvb-core/dvb_ringbuffer.c | 36 +++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 15 deletions(-)

---

diff --git a/drivers/media/dvb-core/dvb_ringbuffer.c 
b/drivers/media/dvb-core/dvb_ringbuffer.c
index 7d4558de8e83..de6226556826 100644
--- a/drivers/media/dvb-core/dvb_ringbuffer.c
+++ b/drivers/media/dvb-core/dvb_ringbuffer.c
@@ -37,10 +37,11 @@
 
 void dvb_ringbuffer_init(struct dvb_ringbuffer *rbuf, void *data, size_t len)
 {
-       rbuf->pread=rbuf->pwrite=0;
-       rbuf->data=data;
-       rbuf->size=len;
-       rbuf->error=0;
+       rbuf->pread = 0;
+       rbuf->pwrite = 0;
+       rbuf->data = data;
+       rbuf->size = len;
+       rbuf->error = 0;
 
        init_waitqueue_head(&rbuf->queue);
 
@@ -235,7 +236,7 @@ ssize_t dvb_ringbuffer_write_user(struct dvb_ringbuffer 
*rbuf,
        return len;
 }
 
-ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf, size_t 
len)
+ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8 *buf, size_t 
len)
 {
        int status;
        ssize_t oldpwrite = rbuf->pwrite;
@@ -245,7 +246,8 @@ ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer 
*rbuf, u8* buf, size_t le
        DVB_RINGBUFFER_WRITE_BYTE(rbuf, PKT_READY);
        status = dvb_ringbuffer_write(rbuf, buf, len);
 
-       if (status < 0) rbuf->pwrite = oldpwrite;
+       if (status < 0)
+               rbuf->pwrite = oldpwrite;
        return status;
 }
 
@@ -258,8 +260,10 @@ ssize_t dvb_ringbuffer_pkt_read_user(struct dvb_ringbuffer 
*rbuf, size_t idx,
 
        pktlen = rbuf->data[idx] << 8;
        pktlen |= rbuf->data[(idx + 1) % rbuf->size];
-       if (offset > pktlen) return -EINVAL;
-       if ((offset + len) > pktlen) len = pktlen - offset;
+       if (offset > pktlen)
+               return -EINVAL;
+       if ((offset + len) > pktlen)
+               len = pktlen - offset;
 
        idx = (idx + DVB_RINGBUFFER_PKTHDRSIZE + offset) % rbuf->size;
        todo = len;
@@ -278,7 +282,7 @@ ssize_t dvb_ringbuffer_pkt_read_user(struct dvb_ringbuffer 
*rbuf, size_t idx,
 }
 
 ssize_t dvb_ringbuffer_pkt_read(struct dvb_ringbuffer *rbuf, size_t idx,
-                               int offset, u8* buf, size_t len)
+                               int offset, u8 *buf, size_t len)
 {
        size_t todo;
        size_t split;
@@ -286,8 +290,10 @@ ssize_t dvb_ringbuffer_pkt_read(struct dvb_ringbuffer 
*rbuf, size_t idx,
 
        pktlen = rbuf->data[idx] << 8;
        pktlen |= rbuf->data[(idx + 1) % rbuf->size];
-       if (offset > pktlen) return -EINVAL;
-       if ((offset + len) > pktlen) len = pktlen - offset;
+       if (offset > pktlen)
+               return -EINVAL;
+       if ((offset + len) > pktlen)
+               len = pktlen - offset;
 
        idx = (idx + DVB_RINGBUFFER_PKTHDRSIZE + offset) % rbuf->size;
        todo = len;
@@ -309,7 +315,7 @@ void dvb_ringbuffer_pkt_dispose(struct dvb_ringbuffer 
*rbuf, size_t idx)
        rbuf->data[(idx + 2) % rbuf->size] = PKT_DISPOSED;
 
        // clean up disposed packets
-       while(dvb_ringbuffer_avail(rbuf) > DVB_RINGBUFFER_PKTHDRSIZE) {
+       while (dvb_ringbuffer_avail(rbuf) > DVB_RINGBUFFER_PKTHDRSIZE) {
                if (DVB_RINGBUFFER_PEEK(rbuf, 2) == PKT_DISPOSED) {
                        pktlen = DVB_RINGBUFFER_PEEK(rbuf, 0) << 8;
                        pktlen |= DVB_RINGBUFFER_PEEK(rbuf, 1);
@@ -321,14 +327,14 @@ void dvb_ringbuffer_pkt_dispose(struct dvb_ringbuffer 
*rbuf, size_t idx)
        }
 }
 
-ssize_t dvb_ringbuffer_pkt_next(struct dvb_ringbuffer *rbuf, size_t idx, 
size_t* pktlen)
+ssize_t dvb_ringbuffer_pkt_next(struct dvb_ringbuffer *rbuf, size_t idx, 
size_t *pktlen)
 {
        int consumed;
        int curpktlen;
        int curpktstatus;
 
        if (idx == -1) {
-              idx = rbuf->pread;
+               idx = rbuf->pread;
        } else {
                curpktlen = rbuf->data[idx] << 8;
                curpktlen |= rbuf->data[(idx + 1) % rbuf->size];
@@ -339,7 +345,7 @@ ssize_t dvb_ringbuffer_pkt_next(struct dvb_ringbuffer 
*rbuf, size_t idx, size_t*
        if (consumed < 0)
                consumed += rbuf->size;
 
-       while((dvb_ringbuffer_avail(rbuf) - consumed) > 
DVB_RINGBUFFER_PKTHDRSIZE) {
+       while ((dvb_ringbuffer_avail(rbuf) - consumed) > 
DVB_RINGBUFFER_PKTHDRSIZE) {
 
                curpktlen = rbuf->data[idx] << 8;
                curpktlen |= rbuf->data[(idx + 1) % rbuf->size];
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to