Re: [PATCH][RFC] kernel.h: provide array iterator

2018-03-16 Thread Rasmus Villemoes
On 2018-03-15 11:00, Kieran Bingham wrote: > Simplify array iteration with a helper to iterate each entry in an array. > Utilise the existing ARRAY_SIZE macro to identify the length of the array > and pointer arithmetic to process each item as a for loop. > > Signed-off-by: Kieran Bingham

[PATCH 2/4] [media] lmedm04: change some static variables to automatic

2016-11-30 Thread Rasmus Villemoes
ibuf and rbuf in lme2510_int_response are always assigned to before they are read, and their addresses do not escape the function, so they have no reason to be static. Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes.dk> --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 2 +- 1 file chan

[PATCH 3/4] [media] lmedm04: make some string arrays static

2016-11-30 Thread Rasmus Villemoes
It takes more .text to initialize these on the stack than they occupy in .rodata, so just make them static const. Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes.dk> --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff

[PATCH 1/4] [media] lmedm04: use %phN for hex dump

2016-11-30 Thread Rasmus Villemoes
Using the %ph printf extension for hex dumps like this makes the generated code quite a bit smaller. Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes.dk> --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/u

[PATCH 4/4] [media] lmedm04: make lme2510_powerup a little smaller

2016-11-30 Thread Rasmus Villemoes
gcc isn't smart enough to realize it can share most of the argument buildup and the actual function call between the two branches, so help it a little. Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes.dk> --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 5 + 1 file changed, 1 ins

[RFC 4/7] drivers/media/pci/zoran: avoid fragile snprintf use

2016-03-08 Thread Rasmus Villemoes
Appending to a string by doing snprintf(buf, bufsize, "%s...", buf, ...) is not guaranteed to work. Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes.dk> --- drivers/media/pci/zoran/videocodec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers

[RFC 6/7] [media] ati_remote: avoid fragile snprintf use

2016-03-08 Thread Rasmus Villemoes
Passing overlapping source and destination to snprintf is fragile. Replace with a single (mostly) equivalent call. If one wants to preserve the space preceding udev->product whether or not there was a manufacturer, just remove udev->manufacturer from the && expression. Signed-

[PATCH] [media] exynos4-is: fix a format string bug

2015-12-08 Thread Rasmus Villemoes
[media] exynos4-is: fix some warnings when compiling on arm64") Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes.dk> --- drivers/media/platform/exynos4-is/fimc-isp-video.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/exynos4-is/f

[PATCH] [media] drxd: use kzalloc in drxd_attach()

2015-10-01 Thread Rasmus Villemoes
This saves a little .text and removes the sizeof(...) style inconsistency. Use sizeof(*state) in accordance with CodingStyle. Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes.dk> --- drivers/media/dvb-frontends/drxd_hard.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff

[PATCH] [media] s5p_mfc: Remove redundant casts

2014-10-21 Thread Rasmus Villemoes
Both sides of these assignments actually have type const struct vb2_mem_ops *, so the casts are unnecessary and slightly confusing. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions

[PATCH] drivers: media: b2c2: flexcop.h: Fix typo in include guard

2014-08-22 Thread Rasmus Villemoes
Three trailing underscores is one too many. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/media/common/b2c2/flexcop.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/common/b2c2/flexcop.h b/drivers/media/common/b2c2/flexcop.h index

[PATCH] drivers: media: i2c: adv7343_regs.h: Fix typo in #ifndef

2014-08-22 Thread Rasmus Villemoes
Test for definedness of the macro which is actually defined, and which matches the name of the file. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/media/i2c/adv7343_regs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/adv7343_regs.h

[PATCH] staging: omap4iss: Fix type of struct iss_device::crashed

2014-07-02 Thread Rasmus Villemoes
, which is unlikely to be what was intended. Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk --- drivers/staging/media/omap4iss/iss.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/omap4iss/iss.h b/drivers/staging/media/omap4iss/iss.h index