* [PATCH v2 00/17] media: s2255: Coding style cleanup
@ 2026-07-20 2:54 Lei Huang
2026-07-20 2:54 ` [PATCH v2 01/17] media: s2255: Rename CamelCase goto labels to snake_case Lei Huang
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: Lei Huang @ 2026-07-20 2:54 UTC (permalink / raw)
To: mchehab; +Cc: johan, hverkuil+cisco, linux-media, linux-kernel, Lei Huang
From: Lei Huang <huanglei@kylinos.cn>
The previous coding style cleanup series failed during
integration by the Media CI robot because it depended on the
"media: s2255: Rename CamelCase goto labels to snake_case" patch,
which had not been merged independently in the linux-media community.
To resolve this, the goto labels rename patch is now included as
patch 1/17 in this v2 series, followed by the remaining coding
style cleanups. This ensures the entire series can be applied and
integrated cleanly as a single unit.
This series applies a series of coding style cleanups to the
s2255 USB video driver (drivers/media/usb/s2255/s2255drv.c) to bring
it closer to the Linux kernel coding style. The changes address issues
flagged by checkpatch.pl and general style review:
- Rename CamelCase goto labels and remaining identifiers to snake_case
- Remove unnecessary spaces after casts and parentheses around
conditions
- Use consistent braces on all arms of if/else statements, and remove
unnecessary braces from single-statement blocks
- Replace NULL comparisons with ! notation and bare 'unsigned' with
'unsigned int'
- Fix alignment to match open parenthesis and add spaces around
multiplication operators
- Parenthesize macro arguments to avoid precedence issues
- Fix block comment style to kernel format
- Add blank lines after function/struct/enum declarations and after
variable declarations, and remove extra blank lines
- Remove unnecessary return statements from void functions
- Remove unnecessary debug logging and out-of-memory messages
No functional changes; the driver behavior is unchanged.
Lei Huang (17):
media: s2255: Rename CamelCase goto labels to snake_case
media: s2255: Rename remaining CamelCase identifiers to snake_case
media: s2255: Remove unnecessary spaces after casts
media: s2255: Use consistent braces on all arms of if/else statements
media: s2255: Replace NULL comparisons with ! notation
media: s2255: Fix alignment to match open parenthesis
media: s2255: Remove multiple blank lines and before close braces
media: s2255: Add blank lines after function/struct/enum declarations
media: s2255: Add spaces around multiplication operators
media: s2255: Remove unnecessary parentheses around conditions
media: s2255: Parenthesize macro argument to avoid precedence issues
media: s2255: Add blank lines after variable declarations
media: s2255: Fix block comment style to kernel format
media: s2255: Remove unnecessary return statements from void functions
media: s2255: Remove unnecessary debug logging and out-of-memory
messages
media: s2255: Remove unnecessary braces from single-statement blocks
media: s2255: Replace bare 'unsigned' with 'unsigned int'
drivers/media/usb/s2255/s2255drv.c | 413 ++++++++++++++---------------
1 file changed, 205 insertions(+), 208 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 01/17] media: s2255: Rename CamelCase goto labels to snake_case
2026-07-20 2:54 [PATCH v2 00/17] media: s2255: Coding style cleanup Lei Huang
@ 2026-07-20 2:54 ` Lei Huang
2026-07-20 2:54 ` [PATCH v2 02/17] media: s2255: Rename remaining CamelCase identifiers " Lei Huang
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Lei Huang @ 2026-07-20 2:54 UTC (permalink / raw)
To: mchehab; +Cc: johan, hverkuil+cisco, linux-media, linux-kernel, Lei Huang
From: Lei Huang <huanglei@kylinos.cn>
Rename the error-path goto labels in s2255_probe() from CamelCase to
snake_case to comply with the Linux kernel coding style:
errorBOARDINIT -> err_boardinit
errorFWMARKER -> err_fwmarker
errorREQFW -> err_reqfw
errorFWDATA2 -> err_fwdata2
errorFWURB -> err_fwurb
errorEP -> err_ep
errorUDEV -> err_udev
errorFWDATA1 -> err_fwdata1
No functional changes; all label definitions and goto references are
updated consistently.
Signed-off-by: Lei Huang <huanglei@kylinos.cn>
---
drivers/media/usb/s2255/s2255drv.c | 38 +++++++++++++++---------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c
index 3917913c3b47..64140b780e63 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -2216,14 +2216,14 @@ static int s2255_probe(struct usb_interface *interface,
dev->cmdbuf = kzalloc(S2255_CMDBUF_SIZE, GFP_KERNEL);
if (dev->cmdbuf == NULL) {
s2255_dev_err(&interface->dev, "out of memory\n");
- goto errorFWDATA1;
+ goto err_fwdata1;
}
refcount_set(&dev->num_channels, 0);
dev->pid = id->idProduct;
dev->fw_data = kzalloc_obj(struct s2255_fw);
if (!dev->fw_data)
- goto errorFWDATA1;
+ goto err_fwdata1;
mutex_init(&dev->lock);
mutex_init(&dev->cmdlock);
/* grab usb_device and save it */
@@ -2231,7 +2231,7 @@ static int s2255_probe(struct usb_interface *interface,
if (dev->udev == NULL) {
dev_err(&interface->dev, "null usb device\n");
retval = -ENODEV;
- goto errorUDEV;
+ goto err_udev;
}
dev_dbg(&interface->dev, "dev: %p, udev %p interface %p\n",
dev, dev->udev, interface);
@@ -2243,7 +2243,7 @@ static int s2255_probe(struct usb_interface *interface,
if (usb_find_bulk_in_endpoint(iface_desc, &endpoint)) {
dev_err(&interface->dev, "Could not find bulk-in endpoint\n");
- goto errorEP;
+ goto err_ep;
}
dev->read_endpoint = endpoint->bEndpointAddress;
@@ -2262,32 +2262,32 @@ static int s2255_probe(struct usb_interface *interface,
dev->fw_data->fw_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->fw_data->fw_urb)
- goto errorFWURB;
+ goto err_fwurb;
dev->fw_data->pfw_data = kzalloc(CHUNK_SIZE, GFP_KERNEL);
if (!dev->fw_data->pfw_data) {
dev_err(&interface->dev, "out of memory!\n");
- goto errorFWDATA2;
+ goto err_fwdata2;
}
/* load the first chunk */
if (request_firmware(&dev->fw_data->fw,
FIRMWARE_FILE_NAME, &dev->udev->dev)) {
dev_err(&interface->dev, "sensoray 2255 failed to get firmware\n");
- goto errorREQFW;
+ goto err_reqfw;
}
/* check the firmware is valid */
fw_size = dev->fw_data->fw->size;
if (fw_size < 8) {
dev_err(&interface->dev, "Firmware invalid: too small.\n");
retval = -ENODEV;
- goto errorFWMARKER;
+ goto err_fwmarker;
}
pdata = (__le32 *) &dev->fw_data->fw->data[fw_size - 8];
if (*pdata != S2255_FW_MARKER) {
dev_err(&interface->dev, "Firmware invalid.\n");
retval = -ENODEV;
- goto errorFWMARKER;
+ goto err_fwmarker;
} else {
/* make sure firmware is the latest */
__le32 *pRel;
@@ -2305,30 +2305,30 @@ static int s2255_probe(struct usb_interface *interface,
/* load 2255 board specific */
retval = s2255_board_init(dev);
if (retval)
- goto errorBOARDINIT;
+ goto err_boardinit;
s2255_fwload_start(dev);
/* loads v4l specific */
retval = s2255_probe_v4l(dev);
if (retval)
- goto errorBOARDINIT;
+ goto err_boardinit;
dev_info(&interface->dev, "Sensoray 2255 detected\n");
return 0;
-errorBOARDINIT:
+err_boardinit:
s2255_board_shutdown(dev);
-errorFWMARKER:
+err_fwmarker:
release_firmware(dev->fw_data->fw);
-errorREQFW:
+err_reqfw:
kfree(dev->fw_data->pfw_data);
-errorFWDATA2:
+err_fwdata2:
usb_free_urb(dev->fw_data->fw_urb);
-errorFWURB:
+err_fwurb:
timer_shutdown_sync(&dev->timer);
-errorEP:
+err_ep:
usb_put_dev(dev->udev);
-errorUDEV:
+err_udev:
kfree(dev->fw_data);
mutex_destroy(&dev->lock);
-errorFWDATA1:
+err_fwdata1:
kfree(dev->cmdbuf);
kfree(dev);
pr_warn("Sensoray 2255 driver load failed: 0x%x\n", retval);
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 02/17] media: s2255: Rename remaining CamelCase identifiers to snake_case
2026-07-20 2:54 [PATCH v2 00/17] media: s2255: Coding style cleanup Lei Huang
2026-07-20 2:54 ` [PATCH v2 01/17] media: s2255: Rename CamelCase goto labels to snake_case Lei Huang
@ 2026-07-20 2:54 ` Lei Huang
2026-07-20 2:54 ` [PATCH v2 03/17] media: s2255: Remove unnecessary spaces after casts Lei Huang
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Lei Huang @ 2026-07-20 2:54 UTC (permalink / raw)
To: mchehab; +Cc: johan, hverkuil+cisco, linux-media, linux-kernel, Lei Huang
From: Lei Huang <huanglei@kylinos.cn>
Rename CamelCase identifiers throughout s2255drv.c to comply with the
Linux kernel coding style. All identifiers are local to this file
(no header file or cross-file references).
Struct members:
ulState -> state
dwFrames -> num_frames
Function parameters (s2255_vendor_req, also updating the forward
declaration to match):
Request -> req
Index -> index
Value -> value
TransferBuffer -> xfer_buf
TransferBufferLength -> xfer_buf_len
bOut -> is_out
Local variables:
pY/pCb/pCr -> p_y/p_cb/p_cr
linesPerFrame -> lines_per_frame
pixelsPerLine -> pixels_per_line
outImageSize -> out_image_size
usbInSize -> usb_in_size
transBuffer -> trans_buf
pRel -> p_rel
No functional changes.
Signed-off-by: Lei Huang <huanglei@kylinos.cn>
---
drivers/media/usb/s2255/s2255drv.c | 139 +++++++++++++++--------------
1 file changed, 70 insertions(+), 69 deletions(-)
diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c
index 64140b780e63..0f98a4cc18a4 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -151,14 +151,14 @@ struct s2255_mode {
/* frame structure */
struct s2255_framei {
unsigned long size;
- unsigned long ulState; /* ulState:S2255_READ_IDLE, S2255_READ_FRAME*/
+ unsigned long state; /* state:S2255_READ_IDLE, S2255_READ_FRAME*/
void *lpvbits; /* image data */
unsigned long cur_size; /* current data copied to it */
};
/* image buffer structure */
struct s2255_bufferi {
- unsigned long dwFrames; /* number of frames in buffer */
+ unsigned long num_frames; /* number of frames in buffer */
struct s2255_framei frame[SYS_FRAMES]; /* array of FRAME structures */
};
@@ -343,8 +343,8 @@ static int s2255_board_shutdown(struct s2255_dev *dev);
static void s2255_fwload_start(struct s2255_dev *dev);
static void s2255_destroy(struct s2255_dev *dev);
static long s2255_vendor_req(struct s2255_dev *dev, unsigned char req,
- u16 index, u16 value, void *buf,
- s32 buf_len, int bOut);
+ u16 index, u16 value, void *xfer_buf,
+ s32 xfer_buf_len, int is_out);
/* dev_err macro with driver name */
#define S2255_DRIVER_NAME "s2255"
@@ -440,19 +440,19 @@ static void planar422p_to_yuv_packed(const unsigned char *in,
int width, int height,
int fmt)
{
- unsigned char *pY;
- unsigned char *pCb;
- unsigned char *pCr;
+ unsigned char *p_y;
+ unsigned char *p_cb;
+ unsigned char *p_cr;
unsigned long size = height * width;
unsigned int i;
- pY = (unsigned char *)in;
- pCr = (unsigned char *)in + height * width;
- pCb = (unsigned char *)in + height * width + (height * width / 2);
+ p_y = (unsigned char *)in;
+ p_cr = (unsigned char *)in + height * width;
+ p_cb = (unsigned char *)in + height * width + (height * width / 2);
for (i = 0; i < size * 2; i += 4) {
- out[i] = (fmt == V4L2_PIX_FMT_YUYV) ? *pY++ : *pCr++;
- out[i + 1] = (fmt == V4L2_PIX_FMT_YUYV) ? *pCr++ : *pY++;
- out[i + 2] = (fmt == V4L2_PIX_FMT_YUYV) ? *pY++ : *pCb++;
- out[i + 3] = (fmt == V4L2_PIX_FMT_YUYV) ? *pCb++ : *pY++;
+ out[i] = (fmt == V4L2_PIX_FMT_YUYV) ? *p_y++ : *p_cr++;
+ out[i + 1] = (fmt == V4L2_PIX_FMT_YUYV) ? *p_cr++ : *p_y++;
+ out[i + 2] = (fmt == V4L2_PIX_FMT_YUYV) ? *p_y++ : *p_cb++;
+ out[i + 3] = (fmt == V4L2_PIX_FMT_YUYV) ? *p_cb++ : *p_y++;
}
return;
}
@@ -896,10 +896,10 @@ static int s2255_write_config(struct usb_device *udev, unsigned char *pbuf,
static u32 get_transfer_size(struct s2255_mode *mode)
{
- int linesPerFrame = LINE_SZ_DEF;
- int pixelsPerLine = NUM_LINES_DEF;
- u32 outImageSize;
- u32 usbInSize;
+ int lines_per_frame = LINE_SZ_DEF;
+ int pixels_per_line = NUM_LINES_DEF;
+ u32 out_image_size;
+ u32 usb_in_size;
unsigned int mask_mult;
if (mode == NULL)
@@ -909,16 +909,16 @@ static u32 get_transfer_size(struct s2255_mode *mode)
switch (mode->scale) {
case SCALE_4CIFS:
case SCALE_4CIFSI:
- linesPerFrame = NUM_LINES_4CIFS_NTSC * 2;
- pixelsPerLine = LINE_SZ_4CIFS_NTSC;
+ lines_per_frame = NUM_LINES_4CIFS_NTSC * 2;
+ pixels_per_line = LINE_SZ_4CIFS_NTSC;
break;
case SCALE_2CIFS:
- linesPerFrame = NUM_LINES_2CIFS_NTSC;
- pixelsPerLine = LINE_SZ_2CIFS_NTSC;
+ lines_per_frame = NUM_LINES_2CIFS_NTSC;
+ pixels_per_line = LINE_SZ_2CIFS_NTSC;
break;
case SCALE_1CIFS:
- linesPerFrame = NUM_LINES_1CIFS_NTSC;
- pixelsPerLine = LINE_SZ_1CIFS_NTSC;
+ lines_per_frame = NUM_LINES_1CIFS_NTSC;
+ pixels_per_line = LINE_SZ_1CIFS_NTSC;
break;
default:
break;
@@ -927,35 +927,35 @@ static u32 get_transfer_size(struct s2255_mode *mode)
switch (mode->scale) {
case SCALE_4CIFS:
case SCALE_4CIFSI:
- linesPerFrame = NUM_LINES_4CIFS_PAL * 2;
- pixelsPerLine = LINE_SZ_4CIFS_PAL;
+ lines_per_frame = NUM_LINES_4CIFS_PAL * 2;
+ pixels_per_line = LINE_SZ_4CIFS_PAL;
break;
case SCALE_2CIFS:
- linesPerFrame = NUM_LINES_2CIFS_PAL;
- pixelsPerLine = LINE_SZ_2CIFS_PAL;
+ lines_per_frame = NUM_LINES_2CIFS_PAL;
+ pixels_per_line = LINE_SZ_2CIFS_PAL;
break;
case SCALE_1CIFS:
- linesPerFrame = NUM_LINES_1CIFS_PAL;
- pixelsPerLine = LINE_SZ_1CIFS_PAL;
+ lines_per_frame = NUM_LINES_1CIFS_PAL;
+ pixels_per_line = LINE_SZ_1CIFS_PAL;
break;
default:
break;
}
}
- outImageSize = linesPerFrame * pixelsPerLine;
+ out_image_size = lines_per_frame * pixels_per_line;
if ((mode->color & MASK_COLOR) != COLOR_Y8) {
/* 2 bytes/pixel if not monochrome */
- outImageSize *= 2;
+ out_image_size *= 2;
}
/* total bytes to send including prefix and 4K padding;
must be a multiple of USB_READ_SIZE */
- usbInSize = outImageSize + PREFIX_SIZE; /* always send prefix */
+ usb_in_size = out_image_size + PREFIX_SIZE; /* always send prefix */
mask_mult = 0xffffffffUL - DEF_USB_BLOCK + 1;
/* if size not a multiple of USB_READ_SIZE */
- if (usbInSize & ~mask_mult)
- usbInSize = (usbInSize & mask_mult) + (DEF_USB_BLOCK);
- return usbInSize;
+ if (usb_in_size & ~mask_mult)
+ usb_in_size = (usb_in_size & mask_mult) + (DEF_USB_BLOCK);
+ return usb_in_size;
}
static void s2255_print_cfg(struct s2255_dev *sdev, struct s2255_mode *mode)
@@ -1066,7 +1066,7 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count)
vc->cur_frame = 0;
vc->frame_count = 0;
for (j = 0; j < SYS_FRAMES; j++) {
- vc->buffer.frame[j].ulState = S2255_READ_IDLE;
+ vc->buffer.frame[j].state = S2255_READ_IDLE;
vc->buffer.frame[j].cur_size = 0;
}
return s2255_start_acquire(vc);
@@ -1701,7 +1701,7 @@ static int save_frame(struct s2255_dev *dev, struct s2255_pipeinfo *pipe_info)
vc = &dev->vc[dev->cc];
idx = vc->cur_frame;
frm = &vc->buffer.frame[idx];
- if (frm->ulState == S2255_READ_IDLE) {
+ if (frm->state == S2255_READ_IDLE) {
int jj;
unsigned int cc;
__le32 *pdword; /*data from dsp is little endian */
@@ -1790,12 +1790,12 @@ static int save_frame(struct s2255_dev *dev, struct s2255_pipeinfo *pipe_info)
/* search done. now find out if should be acquiring on this channel */
if (!vb2_is_streaming(&vc->vb_vidq)) {
/* we found a frame, but this channel is turned off */
- frm->ulState = S2255_READ_IDLE;
+ frm->state = S2255_READ_IDLE;
return -EINVAL;
}
- if (frm->ulState == S2255_READ_IDLE) {
- frm->ulState = S2255_READ_FRAME;
+ if (frm->state == S2255_READ_IDLE) {
+ frm->state = S2255_READ_FRAME;
frm->cur_size = 0;
}
@@ -1829,13 +1829,13 @@ static int save_frame(struct s2255_dev *dev, struct s2255_pipeinfo *pipe_info)
vc->cur_frame++;
/* end of system frame ring buffer, start at zero */
if ((vc->cur_frame == SYS_FRAMES) ||
- (vc->cur_frame == vc->buffer.dwFrames))
+ (vc->cur_frame == vc->buffer.num_frames))
vc->cur_frame = 0;
/* frame ready */
if (vb2_is_streaming(&vc->vb_vidq))
s2255_got_frame(vc, vc->jpg_size);
vc->frame_count++;
- frm->ulState = S2255_READ_IDLE;
+ frm->state = S2255_READ_IDLE;
frm->cur_size = 0;
}
@@ -1863,33 +1863,33 @@ static void s2255_read_video_callback(struct s2255_dev *dev,
return;
}
-static long s2255_vendor_req(struct s2255_dev *dev, unsigned char Request,
- u16 Index, u16 Value, void *TransferBuffer,
- s32 TransferBufferLength, int bOut)
+static long s2255_vendor_req(struct s2255_dev *dev, unsigned char req,
+ u16 index, u16 value, void *xfer_buf,
+ s32 xfer_buf_len, int is_out)
{
int r;
unsigned char *buf;
- buf = kmalloc(TransferBufferLength, GFP_KERNEL);
+ buf = kmalloc(xfer_buf_len, GFP_KERNEL);
if (!buf)
return -ENOMEM;
- if (!bOut) {
+ if (!is_out) {
r = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
- Request,
+ req,
USB_TYPE_VENDOR | USB_RECIP_DEVICE |
USB_DIR_IN,
- Value, Index, buf,
- TransferBufferLength, USB_CTRL_SET_TIMEOUT);
+ value, index, buf,
+ xfer_buf_len, USB_CTRL_SET_TIMEOUT);
if (r >= 0)
- memcpy(TransferBuffer, buf, TransferBufferLength);
+ memcpy(xfer_buf, buf, xfer_buf_len);
} else {
- memcpy(buf, TransferBuffer, TransferBufferLength);
+ memcpy(buf, xfer_buf, xfer_buf_len);
r = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
- Request, USB_TYPE_VENDOR | USB_RECIP_DEVICE,
- Value, Index, buf,
- TransferBufferLength, USB_CTRL_SET_TIMEOUT);
+ req, USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+ value, index, buf,
+ xfer_buf_len, USB_CTRL_SET_TIMEOUT);
}
kfree(buf);
return r;
@@ -1904,14 +1904,14 @@ static int s2255_get_fx2fw(struct s2255_dev *dev)
{
int fw;
int ret;
- u8 transBuffer[2] = {};
+ u8 trans_buf[2] = {};
- ret = s2255_vendor_req(dev, S2255_VR_FW, 0, 0, transBuffer,
- sizeof(transBuffer), S2255_VR_IN);
+ ret = s2255_vendor_req(dev, S2255_VR_FW, 0, 0, trans_buf,
+ sizeof(trans_buf), S2255_VR_IN);
if (ret < 0)
dprintk(dev, 2, "get fw error: %x\n", ret);
- fw = transBuffer[0] + (transBuffer[1] << 8);
- dprintk(dev, 2, "Get FW %x %x\n", transBuffer[0], transBuffer[1]);
+ fw = trans_buf[0] + (trans_buf[1] << 8);
+ dprintk(dev, 2, "Get FW %x %x\n", trans_buf[0], trans_buf[1]);
return fw;
}
@@ -1923,7 +1923,7 @@ static int s2255_create_sys_buffers(struct s2255_vc *vc)
{
unsigned long i;
unsigned long reqsize;
- vc->buffer.dwFrames = SYS_FRAMES;
+ vc->buffer.num_frames = SYS_FRAMES;
/* always allocate maximum size(PAL) for system buffers */
reqsize = SYS_FRAMES_MAXSIZE;
@@ -1936,14 +1936,14 @@ static int s2255_create_sys_buffers(struct s2255_vc *vc)
vc->buffer.frame[i].size = reqsize;
if (vc->buffer.frame[i].lpvbits == NULL) {
pr_info("out of memory. using less frames\n");
- vc->buffer.dwFrames = i;
+ vc->buffer.num_frames = i;
break;
}
}
/* make sure internal states are set */
for (i = 0; i < SYS_FRAMES; i++) {
- vc->buffer.frame[i].ulState = 0;
+ vc->buffer.frame[i].state = 0;
vc->buffer.frame[i].cur_size = 0;
}
@@ -2123,7 +2123,7 @@ static int s2255_start_acquire(struct s2255_vc *vc)
vc->bad_payload = 0;
vc->cur_frame = 0;
for (j = 0; j < SYS_FRAMES; j++) {
- vc->buffer.frame[j].ulState = 0;
+ vc->buffer.frame[j].state = 0;
vc->buffer.frame[j].cur_size = 0;
}
@@ -2290,10 +2290,11 @@ static int s2255_probe(struct usb_interface *interface,
goto err_fwmarker;
} else {
/* make sure firmware is the latest */
- __le32 *pRel;
- pRel = (__le32 *) &dev->fw_data->fw->data[fw_size - 4];
- pr_info("s2255 dsp fw version %x\n", le32_to_cpu(*pRel));
- dev->dsp_fw_ver = le32_to_cpu(*pRel);
+ __le32 *p_rel;
+
+ p_rel = (__le32 *)&dev->fw_data->fw->data[fw_size - 4];
+ pr_info("s2255 dsp fw version %x\n", le32_to_cpu(*p_rel));
+ dev->dsp_fw_ver = le32_to_cpu(*p_rel);
if (dev->dsp_fw_ver < S2255_CUR_DSP_FWVER)
pr_info("s2255: f2255usb.bin out of date.\n");
if (dev->pid == 0x2257 &&
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 03/17] media: s2255: Remove unnecessary spaces after casts
2026-07-20 2:54 [PATCH v2 00/17] media: s2255: Coding style cleanup Lei Huang
2026-07-20 2:54 ` [PATCH v2 01/17] media: s2255: Rename CamelCase goto labels to snake_case Lei Huang
2026-07-20 2:54 ` [PATCH v2 02/17] media: s2255: Rename remaining CamelCase identifiers " Lei Huang
@ 2026-07-20 2:54 ` Lei Huang
2026-07-20 2:54 ` [PATCH v2 04/17] media: s2255: Use consistent braces on all arms of if/else statements Lei Huang
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Lei Huang @ 2026-07-20 2:54 UTC (permalink / raw)
To: mchehab; +Cc: johan, hverkuil+cisco, linux-media, linux-kernel, Lei Huang
From: Lei Huang <huanglei@kylinos.cn>
Fix all 8 'CHECK: No space is necessary after a cast' issues reported by
checkpatch.pl in s2255drv.c. Remove the space between the cast type and
the value being cast.
Signed-off-by: Lei Huang <huanglei@kylinos.cn>
---
drivers/media/usb/s2255/s2255drv.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c
index 0f98a4cc18a4..78011f5fe99c 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -521,7 +521,7 @@ static void s2255_fwchunk_complete(struct urb *urb)
memset(data->pfw_data, 0, CHUNK_SIZE);
memcpy(data->pfw_data,
- (char *) data->fw->data + data->fw_loaded, len);
+ (char *)data->fw->data + data->fw_loaded, len);
usb_fill_bulk_urb(data->fw_urb, udev, usb_sndbulkpipe(udev, 2),
data->pfw_data, CHUNK_SIZE,
@@ -875,7 +875,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
else if (mode.format != vc->mode.format)
mode.restart = 1;
vc->mode = mode;
- (void) s2255_set_mode(vc, &mode);
+ (void)s2255_set_mode(vc, &mode);
return 0;
}
@@ -1001,7 +1001,7 @@ static int s2255_set_mode(struct s2255_vc *vc,
dprintk(dev, 1, "%s: reqsize %ld\n", __func__, vc->req_image_size);
/* set the mode */
buffer[0] = IN_DATA_TOKEN;
- buffer[1] = (__le32) cpu_to_le32(chn_rev);
+ buffer[1] = (__le32)cpu_to_le32(chn_rev);
buffer[2] = CMD_SET_MODE;
for (i = 0; i < sizeof(struct s2255_mode) / sizeof(u32); i++)
buffer[3 + i] = cpu_to_le32(((u32 *)&vc->mode)[i]);
@@ -1038,7 +1038,7 @@ static int s2255_cmd_status(struct s2255_vc *vc, u32 *pstatus)
dprintk(dev, 4, "%s chan %d\n", __func__, vc->idx);
/* form the get vid status command */
buffer[0] = IN_DATA_TOKEN;
- buffer[1] = (__le32) cpu_to_le32(chn_rev);
+ buffer[1] = (__le32)cpu_to_le32(chn_rev);
buffer[2] = CMD_STATUS;
*pstatus = 0;
vc->vidstatus_ready = 0;
@@ -1078,7 +1078,7 @@ static void stop_streaming(struct vb2_queue *vq)
struct s2255_vc *vc = vb2_get_drv_priv(vq);
struct s2255_buffer *buf, *node;
unsigned long flags;
- (void) s2255_stop_acquire(vc);
+ (void)s2255_stop_acquire(vc);
spin_lock_irqsave(&vc->qlock, flags);
list_for_each_entry_safe(buf, node, &vc->buf_list, list) {
list_del(&buf->list);
@@ -2129,7 +2129,7 @@ static int s2255_start_acquire(struct s2255_vc *vc)
/* send the start command */
buffer[0] = IN_DATA_TOKEN;
- buffer[1] = (__le32) cpu_to_le32(chn_rev);
+ buffer[1] = (__le32)cpu_to_le32(chn_rev);
buffer[2] = CMD_START;
res = s2255_write_config(dev->udev, (unsigned char *)buffer, 512);
if (res != 0)
@@ -2151,7 +2151,7 @@ static int s2255_stop_acquire(struct s2255_vc *vc)
chn_rev = G_chnmap[vc->idx];
/* send the stop command */
buffer[0] = IN_DATA_TOKEN;
- buffer[1] = (__le32) cpu_to_le32(chn_rev);
+ buffer[1] = (__le32)cpu_to_le32(chn_rev);
buffer[2] = CMD_STOP;
res = s2255_write_config(dev->udev, (unsigned char *)buffer, 512);
@@ -2282,7 +2282,7 @@ static int s2255_probe(struct usb_interface *interface,
retval = -ENODEV;
goto err_fwmarker;
}
- pdata = (__le32 *) &dev->fw_data->fw->data[fw_size - 8];
+ pdata = (__le32 *)&dev->fw_data->fw->data[fw_size - 8];
if (*pdata != S2255_FW_MARKER) {
dev_err(&interface->dev, "Firmware invalid.\n");
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 04/17] media: s2255: Use consistent braces on all arms of if/else statements
2026-07-20 2:54 [PATCH v2 00/17] media: s2255: Coding style cleanup Lei Huang
` (2 preceding siblings ...)
2026-07-20 2:54 ` [PATCH v2 03/17] media: s2255: Remove unnecessary spaces after casts Lei Huang
@ 2026-07-20 2:54 ` Lei Huang
2026-07-20 2:54 ` [PATCH v2 05/17] media: s2255: Replace NULL comparisons with ! notation Lei Huang
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Lei Huang @ 2026-07-20 2:54 UTC (permalink / raw)
To: mchehab; +Cc: johan, hverkuil+cisco, linux-media, linux-kernel, Lei Huang
From: Lei Huang <huanglei@kylinos.cn>
Fix all 5 'CHECK: braces {} should be used on all arms of this statement'
issues reported by checkpatch.pl in s2255drv.c. Add braces to else and
else-if branches that were missing them for consistency with other
branches.
Signed-off-by: Lei Huang <huanglei@kylinos.cn>
---
drivers/media/usb/s2255/s2255drv.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c
index 78011f5fe99c..a759ba9a6d51 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -534,8 +534,9 @@ static void s2255_fwchunk_complete(struct urb *urb)
return;
}
data->fw_loaded += len;
- } else
+ } else {
atomic_set(&data->fw_state, S2255_FW_LOADED_DSPWAIT);
+ }
return;
}
@@ -839,8 +840,9 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
mode.scale = SCALE_4CIFSI;
else
mode.scale = SCALE_4CIFS;
- } else
+ } else {
mode.scale = SCALE_2CIFS;
+ }
} else {
mode.scale = SCALE_1CIFS;
@@ -1122,8 +1124,9 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id i)
vc->width = LINE_SZ_4CIFS_PAL;
vc->height = NUM_LINES_4CIFS_PAL * 2;
}
- } else
+ } else {
return -EINVAL;
+ }
vc->std = i;
if (mode.restart)
s2255_set_mode(vc, &mode);
@@ -1306,11 +1309,11 @@ static int vidioc_s_parm(struct file *file, void *priv,
return -EBUSY;
def_num = (mode.format == FORMAT_NTSC) ? 1001 : 1000;
def_dem = (mode.format == FORMAT_NTSC) ? 30000 : 25000;
- if (def_dem != sp->parm.capture.timeperframe.denominator)
+ if (def_dem != sp->parm.capture.timeperframe.denominator) {
sp->parm.capture.timeperframe.numerator = def_num;
- else if (sp->parm.capture.timeperframe.numerator <= def_num)
+ } else if (sp->parm.capture.timeperframe.numerator <= def_num) {
sp->parm.capture.timeperframe.numerator = def_num;
- else if (sp->parm.capture.timeperframe.numerator <= (def_num * 2)) {
+ } else if (sp->parm.capture.timeperframe.numerator <= (def_num * 2)) {
sp->parm.capture.timeperframe.numerator = def_num * 2;
fdec = FDEC_2;
} else if (sp->parm.capture.timeperframe.numerator <= (def_num * 3)) {
@@ -2058,9 +2061,9 @@ static void read_pipe_completion(struct urb *purb)
return;
}
- if (status == 0)
+ if (status == 0) {
s2255_read_video_callback(dev, pipe_info);
- else {
+ } else {
pipe_info->err_count++;
dprintk(dev, 1, "%s: failed URB %d\n", __func__, status);
}
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 05/17] media: s2255: Replace NULL comparisons with ! notation
2026-07-20 2:54 [PATCH v2 00/17] media: s2255: Coding style cleanup Lei Huang
` (3 preceding siblings ...)
2026-07-20 2:54 ` [PATCH v2 04/17] media: s2255: Use consistent braces on all arms of if/else statements Lei Huang
@ 2026-07-20 2:54 ` Lei Huang
2026-07-20 2:54 ` [PATCH v2 06/17] media: s2255: Fix alignment to match open parenthesis Lei Huang
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Lei Huang @ 2026-07-20 2:54 UTC (permalink / raw)
To: mchehab; +Cc: johan, hverkuil+cisco, linux-media, linux-kernel, Lei Huang
From: Lei Huang <huanglei@kylinos.cn>
Fix all 15 'CHECK: Comparison to NULL could be written' issues reported by
checkpatch.pl in s2255drv.c. Replace 'x == NULL' with '!x' for pointer
NULL checks.
Signed-off-by: Lei Huang <huanglei@kylinos.cn>
---
drivers/media/usb/s2255/s2255drv.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c
index a759ba9a6d51..4df558a7b8b3 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -501,7 +501,7 @@ static void s2255_fwchunk_complete(struct urb *urb)
wake_up(&data->wait_fw);
return;
}
- if (data->fw_urb == NULL) {
+ if (!data->fw_urb) {
s2255_dev_err(&udev->dev, "disconnected\n");
atomic_set(&data->fw_state, S2255_FW_FAILED);
/* wake up anything waiting for the firmware */
@@ -664,7 +664,7 @@ static int buffer_prepare(struct vb2_buffer *vb)
unsigned long size;
dprintk(vc->dev, 4, "%s\n", __func__);
- if (vc->fmt == NULL)
+ if (!vc->fmt)
return -EINVAL;
if ((w < norm_minw(vc)) ||
@@ -763,7 +763,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
fmt = format_by_fourcc(f->fmt.pix.pixelformat);
- if (fmt == NULL)
+ if (!fmt)
return -EINVAL;
dprintk(vc->dev, 50, "%s NTSC: %d suggested width: %d, height: %d\n",
@@ -820,7 +820,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
fmt = format_by_fourcc(f->fmt.pix.pixelformat);
- if (fmt == NULL)
+ if (!fmt)
return -EINVAL;
if (vb2_is_busy(q)) {
@@ -904,7 +904,7 @@ static u32 get_transfer_size(struct s2255_mode *mode)
u32 usb_in_size;
unsigned int mask_mult;
- if (mode == NULL)
+ if (!mode)
return 0;
if (mode->format == FORMAT_NTSC) {
@@ -1358,7 +1358,7 @@ static int vidioc_enum_framesizes(struct file *file, void *priv,
return -EINVAL;
fmt = format_by_fourcc(fe->pixel_format);
- if (fmt == NULL)
+ if (!fmt)
return -EINVAL;
fe->type = V4L2_FRMSIZE_TYPE_DISCRETE;
fe->discrete = is_ntsc ? ntsc_sizes[fe->index] : pal_sizes[fe->index];
@@ -1380,7 +1380,7 @@ static int vidioc_enum_frameintervals(struct file *file, void *priv,
return -EINVAL;
fmt = format_by_fourcc(fe->pixel_format);
- if (fmt == NULL)
+ if (!fmt)
return -EINVAL;
sizes = is_ntsc ? ntsc_sizes : pal_sizes;
@@ -1806,7 +1806,7 @@ static int save_frame(struct s2255_dev *dev, struct s2255_pipeinfo *pipe_info)
psrc = (u8 *)pipe_info->transfer_buffer + offset;
- if (frm->lpvbits == NULL) {
+ if (!frm->lpvbits) {
dprintk(dev, 1, "s2255 frame buffer == NULL.%p %p %d %d",
frm, dev, dev->cc, idx);
return -ENOMEM;
@@ -1937,7 +1937,7 @@ static int s2255_create_sys_buffers(struct s2255_vc *vc)
/* allocate the frames */
vc->buffer.frame[i].lpvbits = vmalloc(reqsize);
vc->buffer.frame[i].size = reqsize;
- if (vc->buffer.frame[i].lpvbits == NULL) {
+ if (!vc->buffer.frame[i].lpvbits) {
pr_info("out of memory. using less frames\n");
vc->buffer.num_frames = i;
break;
@@ -1979,7 +1979,7 @@ static int s2255_board_init(struct s2255_dev *dev)
pipe->transfer_buffer = kzalloc(pipe->max_transfer_size,
GFP_KERNEL);
- if (pipe->transfer_buffer == NULL) {
+ if (!pipe->transfer_buffer) {
dprintk(dev, 1, "out of memory!\n");
return -ENOMEM;
}
@@ -2039,12 +2039,12 @@ static void read_pipe_completion(struct urb *purb)
int status;
int pipe;
pipe_info = purb->context;
- if (pipe_info == NULL) {
+ if (!pipe_info) {
dev_err(&purb->dev->dev, "no context!\n");
return;
}
dev = pipe_info->dev;
- if (dev == NULL) {
+ if (!dev) {
dev_err(&purb->dev->dev, "no context!\n");
return;
}
@@ -2211,13 +2211,13 @@ static int s2255_probe(struct usb_interface *interface,
/* allocate memory for our device state and initialize it to zero */
dev = kzalloc_obj(struct s2255_dev);
- if (dev == NULL) {
+ if (!dev) {
s2255_dev_err(&interface->dev, "out of memory\n");
return -ENOMEM;
}
dev->cmdbuf = kzalloc(S2255_CMDBUF_SIZE, GFP_KERNEL);
- if (dev->cmdbuf == NULL) {
+ if (!dev->cmdbuf) {
s2255_dev_err(&interface->dev, "out of memory\n");
goto err_fwdata1;
}
@@ -2231,7 +2231,7 @@ static int s2255_probe(struct usb_interface *interface,
mutex_init(&dev->cmdlock);
/* grab usb_device and save it */
dev->udev = usb_get_dev(interface_to_usbdev(interface));
- if (dev->udev == NULL) {
+ if (!dev->udev) {
dev_err(&interface->dev, "null usb device\n");
retval = -ENODEV;
goto err_udev;
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 06/17] media: s2255: Fix alignment to match open parenthesis
2026-07-20 2:54 [PATCH v2 00/17] media: s2255: Coding style cleanup Lei Huang
` (4 preceding siblings ...)
2026-07-20 2:54 ` [PATCH v2 05/17] media: s2255: Replace NULL comparisons with ! notation Lei Huang
@ 2026-07-20 2:54 ` Lei Huang
2026-07-20 2:54 ` [PATCH v2 07/17] media: s2255: Remove multiple blank lines and before close braces Lei Huang
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Lei Huang @ 2026-07-20 2:54 UTC (permalink / raw)
To: mchehab; +Cc: johan, hverkuil+cisco, linux-media, linux-kernel, Lei Huang
From: Lei Huang <huanglei@kylinos.cn>
Fix all 16 'CHECK: Alignment should match open parenthesis' issues
reported by checkpatch.pl in s2255drv.c. Adjust continuation line
indentation in function declarations, if-conditions, function calls,
and block comments to properly align with the opening parenthesis.
Signed-off-by: Lei Huang <huanglei@kylinos.cn>
---
drivers/media/usb/s2255/s2255drv.c | 36 +++++++++++++++---------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c
index 4df558a7b8b3..f3e4bd069f1c 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -720,21 +720,21 @@ static int vidioc_querycap(struct file *file, void *priv,
}
static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
- struct v4l2_fmtdesc *f)
+ struct v4l2_fmtdesc *f)
{
int index = f->index;
if (index >= ARRAY_SIZE(formats))
return -EINVAL;
if (!jpeg_enable && ((formats[index].fourcc == V4L2_PIX_FMT_JPEG) ||
- (formats[index].fourcc == V4L2_PIX_FMT_MJPEG)))
+ (formats[index].fourcc == V4L2_PIX_FMT_MJPEG)))
return -EINVAL;
f->pixelformat = formats[index].fourcc;
return 0;
}
static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
- struct v4l2_format *f)
+ struct v4l2_format *f)
{
struct s2255_vc *vc = video_drvdata(file);
int is_ntsc = vc->std & V4L2_STD_525_60;
@@ -754,7 +754,7 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
}
static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
- struct v4l2_format *f)
+ struct v4l2_format *f)
{
const struct s2255_fmt *fmt;
enum v4l2_field field;
@@ -805,7 +805,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
}
static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
- struct v4l2_format *f)
+ struct v4l2_format *f)
{
struct s2255_vc *vc = video_drvdata(file);
const struct s2255_fmt *fmt;
@@ -1234,7 +1234,7 @@ static int s2255_s_ctrl(struct v4l2_ctrl *ctrl)
}
static int vidioc_g_jpegcomp(struct file *file, void *priv,
- struct v4l2_jpegcompression *jc)
+ struct v4l2_jpegcompression *jc)
{
struct s2255_vc *vc = video_drvdata(file);
@@ -1245,7 +1245,7 @@ static int vidioc_g_jpegcomp(struct file *file, void *priv,
}
static int vidioc_s_jpegcomp(struct file *file, void *priv,
- const struct v4l2_jpegcompression *jc)
+ const struct v4l2_jpegcompression *jc)
{
struct s2255_vc *vc = video_drvdata(file);
@@ -1348,7 +1348,7 @@ static const struct v4l2_frmsize_discrete pal_sizes[] = {
};
static int vidioc_enum_framesizes(struct file *file, void *priv,
- struct v4l2_frmsizeenum *fe)
+ struct v4l2_frmsizeenum *fe)
{
struct s2255_vc *vc = video_drvdata(file);
int is_ntsc = vc->std & V4L2_STD_525_60;
@@ -1366,7 +1366,7 @@ static int vidioc_enum_framesizes(struct file *file, void *priv,
}
static int vidioc_enum_frameintervals(struct file *file, void *priv,
- struct v4l2_frmivalenum *fe)
+ struct v4l2_frmivalenum *fe)
{
struct s2255_vc *vc = video_drvdata(file);
const struct s2255_fmt *fmt;
@@ -1418,7 +1418,7 @@ static int s2255_open(struct file *file)
return -ENODEV;
case S2255_FW_FAILED:
s2255_dev_err(&dev->udev->dev,
- "firmware load failed. retrying.\n");
+ "firmware load failed. retrying.\n");
s2255_fwload_start(dev);
wait_event_timeout(dev->fw_data->wait_fw,
((atomic_read(&dev->fw_data->fw_state)
@@ -1601,17 +1601,17 @@ static int s2255_probe_v4l(struct s2255_dev *dev)
v4l2_ctrl_handler_init(&vc->hdl, 6);
v4l2_ctrl_new_std(&vc->hdl, &s2255_ctrl_ops,
- V4L2_CID_BRIGHTNESS, -127, 127, 1, DEF_BRIGHT);
+ V4L2_CID_BRIGHTNESS, -127, 127, 1, DEF_BRIGHT);
v4l2_ctrl_new_std(&vc->hdl, &s2255_ctrl_ops,
- V4L2_CID_CONTRAST, 0, 255, 1, DEF_CONTRAST);
+ V4L2_CID_CONTRAST, 0, 255, 1, DEF_CONTRAST);
v4l2_ctrl_new_std(&vc->hdl, &s2255_ctrl_ops,
- V4L2_CID_SATURATION, 0, 255, 1, DEF_SATURATION);
+ V4L2_CID_SATURATION, 0, 255, 1, DEF_SATURATION);
v4l2_ctrl_new_std(&vc->hdl, &s2255_ctrl_ops,
- V4L2_CID_HUE, 0, 255, 1, DEF_HUE);
+ V4L2_CID_HUE, 0, 255, 1, DEF_HUE);
vc->jpegqual_ctrl = v4l2_ctrl_new_std(&vc->hdl,
- &s2255_ctrl_ops,
- V4L2_CID_JPEG_COMPRESSION_QUALITY,
- 0, 100, 1, S2255_DEF_JPEG_QUAL);
+ &s2255_ctrl_ops,
+ V4L2_CID_JPEG_COMPRESSION_QUALITY,
+ 0, 100, 1, S2255_DEF_JPEG_QUAL);
if (dev->dsp_fw_ver >= S2255_MIN_DSP_COLORFILTER &&
(dev->pid != 0x2257 || vc->idx <= 1))
v4l2_ctrl_new_custom(&vc->hdl, &color_filter_ctrl,
@@ -2301,7 +2301,7 @@ static int s2255_probe(struct usb_interface *interface,
if (dev->dsp_fw_ver < S2255_CUR_DSP_FWVER)
pr_info("s2255: f2255usb.bin out of date.\n");
if (dev->pid == 0x2257 &&
- dev->dsp_fw_ver < S2255_MIN_DSP_COLORFILTER)
+ dev->dsp_fw_ver < S2255_MIN_DSP_COLORFILTER)
pr_warn("2257 needs firmware %d or above.\n",
S2255_MIN_DSP_COLORFILTER);
}
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 07/17] media: s2255: Remove multiple blank lines and before close braces
2026-07-20 2:54 [PATCH v2 00/17] media: s2255: Coding style cleanup Lei Huang
` (5 preceding siblings ...)
2026-07-20 2:54 ` [PATCH v2 06/17] media: s2255: Fix alignment to match open parenthesis Lei Huang
@ 2026-07-20 2:54 ` Lei Huang
2026-07-20 2:54 ` [PATCH v2 08/17] media: s2255: Add blank lines after function/struct/enum declarations Lei Huang
2026-07-20 2:54 ` [PATCH v2 09/17] media: s2255: Add spaces around multiplication operators Lei Huang
8 siblings, 0 replies; 10+ messages in thread
From: Lei Huang @ 2026-07-20 2:54 UTC (permalink / raw)
To: mchehab; +Cc: johan, hverkuil+cisco, linux-media, linux-kernel, Lei Huang
From: Lei Huang <huanglei@kylinos.cn>
Remove all 9 instances of double blank lines: 'CHECK: Please don't use
multiple blank lines' reported by checkpatch.pl in s2255drv.c.
Fix all 3 'CHECK: Blank lines aren't necessary before a close brace'
issues reported by checkpatch.pl in s2255drv.c.
Signed-off-by: Lei Huang <huanglei@kylinos.cn>
---
drivers/media/usb/s2255/s2255drv.c | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c
index f3e4bd069f1c..dc3a9d69789c 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -86,7 +86,6 @@
#define LINE_SZ_DEF 640
#define NUM_LINES_DEF 240
-
/* predefined settings */
#define FORMAT_NTSC 1
#define FORMAT_PAL 2
@@ -144,7 +143,6 @@ struct s2255_mode {
u32 restart; /* if DSP requires restart */
};
-
#define S2255_READ_IDLE 0
#define S2255_READ_FRAME 1
@@ -243,7 +241,6 @@ struct s2255_vc {
spinlock_t qlock;
};
-
struct s2255_dev {
struct s2255_vc vc[MAX_CHANNELS];
struct v4l2_device v4l2_dev;
@@ -284,7 +281,6 @@ struct s2255_buffer {
struct list_head list;
};
-
/* current cypress EEPROM firmware version */
#define S2255_CUR_USB_FWVER ((3 << 8) | 12)
/* current DSP FW version */
@@ -430,7 +426,6 @@ static int norm_minh(struct s2255_vc *vc)
(NUM_LINES_1CIFS_NTSC) : (NUM_LINES_1CIFS_PAL);
}
-
/*
* TODO: fixme: move YUV reordering to hardware
* converts 2255 planar format to yuyv or uyvy
@@ -482,7 +477,6 @@ static void s2255_timer(struct timer_list *t)
}
}
-
/* this loads the firmware asynchronously.
Originally this was done synchronously in probe.
But it is better to load it asynchronously here than block
@@ -538,7 +532,6 @@ static void s2255_fwchunk_complete(struct urb *urb)
atomic_set(&data->fw_state, S2255_FW_LOADED_DSPWAIT);
}
return;
-
}
static void s2255_got_frame(struct s2255_vc *vc, int jpgsize)
@@ -637,7 +630,6 @@ static void s2255_fillbuff(struct s2255_vc *vc,
vbuf, pos);
}
-
/* ------------------------------------------------------------------
Videobuf operations
------------------------------------------------------------------*/
@@ -881,7 +873,6 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
return 0;
}
-
/* write to the configuration pipe, synchronously */
static int s2255_write_config(struct usb_device *udev, unsigned char *pbuf,
int size)
@@ -1663,7 +1654,6 @@ static int s2255_probe_v4l(struct s2255_dev *dev)
refcount_inc(&dev->num_channels);
v4l2_info(&dev->v4l2_dev, "V4L2 device registered as %s\n",
video_device_node_name(&vc->vdev));
-
}
pr_info("Sensoray 2255 V4L driver Revision: %s\n",
S2255_VERSION);
@@ -1805,7 +1795,6 @@ static int save_frame(struct s2255_dev *dev, struct s2255_pipeinfo *pipe_info)
/* skip the marker 512 bytes (and offset if out of sync) */
psrc = (u8 *)pipe_info->transfer_buffer + offset;
-
if (!frm->lpvbits) {
dprintk(dev, 1, "s2255 frame buffer == NULL.%p %p %d %d",
frm, dev, dev->cc, idx);
@@ -1840,7 +1829,6 @@ static int save_frame(struct s2255_dev *dev, struct s2255_pipeinfo *pipe_info)
vc->frame_count++;
frm->state = S2255_READ_IDLE;
frm->cur_size = 0;
-
}
/* done successfully */
return 0;
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 08/17] media: s2255: Add blank lines after function/struct/enum declarations
2026-07-20 2:54 [PATCH v2 00/17] media: s2255: Coding style cleanup Lei Huang
` (6 preceding siblings ...)
2026-07-20 2:54 ` [PATCH v2 07/17] media: s2255: Remove multiple blank lines and before close braces Lei Huang
@ 2026-07-20 2:54 ` Lei Huang
2026-07-20 2:54 ` [PATCH v2 09/17] media: s2255: Add spaces around multiplication operators Lei Huang
8 siblings, 0 replies; 10+ messages in thread
From: Lei Huang @ 2026-07-20 2:54 UTC (permalink / raw)
To: mchehab; +Cc: johan, hverkuil+cisco, linux-media, linux-kernel, Lei Huang
From: Lei Huang <huanglei@kylinos.cn>
Fix all 2 'CHECK: Please use a blank line after function/struct/union/enum
declarations' issues reported by checkpatch.pl in s2255drv.c.
Signed-off-by: Lei Huang <huanglei@kylinos.cn>
---
drivers/media/usb/s2255/s2255drv.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c
index dc3a9d69789c..3aa6270358fc 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -1178,6 +1178,7 @@ static int vidioc_g_input(struct file *file, void *priv, unsigned int *i)
*i = 0;
return 0;
}
+
static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
{
if (i > 0)
@@ -1332,6 +1333,7 @@ static const struct v4l2_frmsize_discrete ntsc_sizes[] = {
{ 640, 240 },
{ 320, 240 },
};
+
static const struct v4l2_frmsize_discrete pal_sizes[] = {
{ 704, 576 },
{ 704, 288 },
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 09/17] media: s2255: Add spaces around multiplication operators
2026-07-20 2:54 [PATCH v2 00/17] media: s2255: Coding style cleanup Lei Huang
` (7 preceding siblings ...)
2026-07-20 2:54 ` [PATCH v2 08/17] media: s2255: Add blank lines after function/struct/enum declarations Lei Huang
@ 2026-07-20 2:54 ` Lei Huang
8 siblings, 0 replies; 10+ messages in thread
From: Lei Huang @ 2026-07-20 2:54 UTC (permalink / raw)
To: mchehab; +Cc: johan, hverkuil+cisco, linux-media, linux-kernel, Lei Huang
From: Lei Huang <huanglei@kylinos.cn>
Fix all 3 'CHECK: spaces preferred around that '*' (ctx:VxV)' issues
reported by checkpatch.pl in s2255drv.c. Add spaces around the
multiplication operators in the SYS_FRAMES_MAXSIZE macro.
Signed-off-by: Lei Huang <huanglei@kylinos.cn>
---
drivers/media/usb/s2255/s2255drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c
index 3aa6270358fc..ee69492ba8b9 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -69,7 +69,7 @@
#define MAX_CHANNELS 4
#define SYS_FRAMES 4
/* maximum size is PAL full size plus room for the marker header(s) */
-#define SYS_FRAMES_MAXSIZE (720*288*2*2 + 4096)
+#define SYS_FRAMES_MAXSIZE (720 * 288 * 2 * 2 + 4096)
#define DEF_USB_BLOCK S2255_USB_XFER_SIZE
#define LINE_SZ_4CIFS_NTSC 640
#define LINE_SZ_2CIFS_NTSC 640
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-07-20 2:55 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-20 2:54 [PATCH v2 00/17] media: s2255: Coding style cleanup Lei Huang
2026-07-20 2:54 ` [PATCH v2 01/17] media: s2255: Rename CamelCase goto labels to snake_case Lei Huang
2026-07-20 2:54 ` [PATCH v2 02/17] media: s2255: Rename remaining CamelCase identifiers " Lei Huang
2026-07-20 2:54 ` [PATCH v2 03/17] media: s2255: Remove unnecessary spaces after casts Lei Huang
2026-07-20 2:54 ` [PATCH v2 04/17] media: s2255: Use consistent braces on all arms of if/else statements Lei Huang
2026-07-20 2:54 ` [PATCH v2 05/17] media: s2255: Replace NULL comparisons with ! notation Lei Huang
2026-07-20 2:54 ` [PATCH v2 06/17] media: s2255: Fix alignment to match open parenthesis Lei Huang
2026-07-20 2:54 ` [PATCH v2 07/17] media: s2255: Remove multiple blank lines and before close braces Lei Huang
2026-07-20 2:54 ` [PATCH v2 08/17] media: s2255: Add blank lines after function/struct/enum declarations Lei Huang
2026-07-20 2:54 ` [PATCH v2 09/17] media: s2255: Add spaces around multiplication operators Lei Huang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®