media: meson: include linux/kthread.h
Subsystems (4)
PATCH 1/3 media: meson: include linux/kthread.h
Without this header, we get a compilation error in some configurations:
drivers/staging/media/meson/vdec/vdec.c: In function 'vdec_recycle_thread':drivers/staging/media/meson/vdec/vdec.c:59:10: error: implicit declaration of function 'kthread_should_stop' [-Werror=implicit-function-declaration]
--- drivers/staging/media/meson/vdec/vdec.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/media/meson/vdec/vdec.c +1 -0
@@ -8,6 +8,7 @@#include <linux/clk.h> #include <linux/io.h> #include <linux/module.h> +#include <linux/kthread.h> #include <linux/platform_device.h> #include <linux/mfd/syscon.h> #include <linux/slab.h>
Signature · 1 line
2.20.0
PATCH 2/3 media: dvb_frontend: split dvb_frontend_handle_ioctl function
Over time, dvb_frontend_handle_ioctl() has grown to the point where we now get a warning from the compiler about excessive stack usage:
drivers/media/dvb-core/dvb_frontend.c: In function 'dvb_frontend_handle_ioctl':drivers/media/dvb-core/dvb_frontend.c:2692:1: error: the frame size of 1048 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
Almost all of this is used by the dtv_frontend_properties structure in the FE_GET_PROPERTY and FE_GET_FRONTEND commands. Splitting those into separate function reduces the stack usage of the main function to just 136 bytes, the others are under 500 each.
--- drivers/media/dvb-core/dvb_frontend.c | 140 ++++++++++++++------------ 1 file changed, 77 insertions(+), 63 deletions(-)
drivers/media/dvb-core/dvb_frontend.c +77 -63
@@ -2314,6 +2314,78 @@ static int dtv_set_frontend(struct dvb_frontend *fe)return 0 ; } +static int dvb_get_property (struct dvb_frontend *fe,struct file *file, +struct dtv_properties *tvps) +{ +struct dvb_frontend_private *fepriv = fe->frontend_priv; +struct dtv_property *tvp =NULL ; +struct dtv_frontend_properties getp; +int i, err; + +memcpy (&getp, &fe->dtv_property_cache,sizeof (getp)); + +dev_dbg (fe->dvb->device,"%s: properties.num = %d\n" , + __func__, tvps->num); +dev_dbg (fe->dvb->device,"%s: properties.props = %p\n" , + __func__, tvps->props); + +/* +* Put an arbitrary limit on the number of messages that can +* be sent at once +*/ +if (!tvps->num || (tvps->num >DTV_IOCTL_MAX_MSGS )) +return -EINVAL ; + + tvp =memdup_user ((void __user *)tvps->props, tvps->num *sizeof (*tvp)); +if (IS_ERR (tvp)) +return PTR_ERR (tvp); + +/* +* Let's use our own copy of property cache, in order to +* avoid mangling with DTV zigzag logic, as drivers might +* return crap, if they don't check if the data is available +* before updating the properties cache. +*/ +if (fepriv->state !=FESTATE_IDLE ) { + err =dtv_get_frontend (fe, &getp,NULL ); +if (err <0 ) + goto out; + } +for (i =0 ; i < tvps->num; i++) { + err =dtv_property_process_get (fe, &getp, + tvp + i, file); +if (err <0 ) + goto out; + } + +if (copy_to_user ((void __user *)tvps->props, tvp, + tvps->num *sizeof (struct dtv_property ))) { + err = -EFAULT ; + goto out; + } + + err =0 ; +out: +kfree (tvp); +return err; +} + +static int dvb_get_frontend (struct dvb_frontend *fe, +struct dvb_frontend_parameters *p_out) +{ +struct dtv_frontend_properties getp; + +/* +* Let's use our own copy of property cache, in order to +* avoid mangling with DTV zigzag logic, as drivers might +* return crap, if they don't check if the data is available +* before updating the properties cache. +*/ +memcpy (&getp, &fe->dtv_property_cache,sizeof (getp)); + +return dtv_get_frontend (fe, &getp, p_out); +} +static int dvb_frontend_handle_ioctl (struct file *file,unsigned int cmd,void *parg) {
@@ -2359,58 +2431,9 @@ static int dvb_frontend_handle_ioctl(struct file *file, err =0 ;break ; } -case FE_GET_PROPERTY : { -struct dtv_properties *tvps = parg; -struct dtv_property *tvp =NULL ; -struct dtv_frontend_properties getp = fe->dtv_property_cache; - -dev_dbg (fe->dvb->device,"%s: properties.num = %d\n" , - __func__, tvps->num); -dev_dbg (fe->dvb->device,"%s: properties.props = %p\n" , - __func__, tvps->props); - -/* -* Put an arbitrary limit on the number of messages that can -* be sent at once -*/ -if (!tvps->num || (tvps->num >DTV_IOCTL_MAX_MSGS )) -return -EINVAL ; - - tvp =memdup_user ((void __user *)tvps->props, tvps->num *sizeof (*tvp)); -if (IS_ERR (tvp)) -return PTR_ERR (tvp); - -/* -* Let's use our own copy of property cache, in order to -* avoid mangling with DTV zigzag logic, as drivers might -* return crap, if they don't check if the data is available -* before updating the properties cache. -*/ -if (fepriv->state !=FESTATE_IDLE ) { - err =dtv_get_frontend (fe, &getp,NULL ); -if (err <0 ) { -kfree (tvp); -return err; - } - } -for (i =0 ; i < tvps->num; i++) { - err =dtv_property_process_get (fe, &getp, - tvp + i, file); -if (err <0 ) { -kfree (tvp); -return err; - } - } - -if (copy_to_user ((void __user *)tvps->props, tvp, - tvps->num *sizeof (struct dtv_property ))) { -kfree (tvp); -return -EFAULT ; - } -kfree (tvp); - err =0 ; +case FE_GET_PROPERTY : + err =dvb_get_property (fe, file, parg);break ; - }case FE_GET_INFO : {struct dvb_frontend_info *info = parg;
@@ -2548,7 +2571,6 @@ static int dvb_frontend_handle_ioctl(struct file *file, fepriv->tune_mode_flags = (unsigned long )parg; err =0 ;break ; -/* DEPRECATED dish control ioctls */ case FE_DISHNETWORK_SEND_LEGACY_CMD :
@@ -2667,22 +2689,14 @@ static int dvb_frontend_handle_ioctl(struct file *file,break ; err =dtv_set_frontend (fe);break ; +case FE_GET_EVENT : err =dvb_frontend_get_event (fe, parg, file->f_flags);break ; -case FE_GET_FRONTEND : { -struct dtv_frontend_properties getp = fe->dtv_property_cache; - -/* -* Let's use our own copy of property cache, in order to -* avoid mangling with DTV zigzag logic, as drivers might -* return crap, if they don't check if the data is available -* before updating the properties cache. -*/ - err =dtv_get_frontend (fe, &getp, parg); +case FE_GET_FRONTEND : + err =dvb_get_frontend (fe, parg);break ; - }default :return -ENOTSUPP ;
Signature · 1 line
2.20.0
PATCH 3/3 media: ttpci: add RC_CORE dependency
In reply to Arnd BergmannThe ttpci driver now uses the rc-core, so we need to ensure it is enabled:
ERROR: "rc_unregister_device" [drivers/media/pci/ttpci/dvb-ttpci.ko] undefined!
ERROR: "rc_allocate_device" [drivers/media/pci/ttpci/dvb-ttpci.ko] undefined!
ERROR: "rc_free_device" [drivers/media/pci/ttpci/dvb-ttpci.ko] undefined!
ERROR: "rc_keydown" [drivers/media/pci/ttpci/dvb-ttpci.ko] undefined!
ERROR: "rc_register_device" [drivers/media/pci/ttpci/dvb-ttpci.ko] undefined!
--- drivers/media/pci/ttpci/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/media/pci/ttpci/Kconfig +1 -0
@@ -9,6 +9,7 @@ config DVB_AV7110 select VIDEO_SAA7146_VV select DVB_AV7110_IR if INPUT_EVDEV=y || INPUT_EVDEV=DVB_AV7110 depends on VIDEO_DEV # dependencies of VIDEO_SAA7146_VV + depends on RC_CORE select DVB_VES1820 if MEDIA_SUBDRV_AUTOSELECT select DVB_VES1X93 if MEDIA_SUBDRV_AUTOSELECT select DVB_STV0299 if MEDIA_SUBDRV_AUTOSELECT
Signature · 1 line
2.20.0
Re: [PATCH 3/3] media: ttpci: add RC_CORE dependency
Quoted 11 lines · Arnd Bergmann
The ttpci driver now uses the rc-core, so we need to ensure it is enabled:
ERROR: "
rc_unregister_device" [drivers/media/pci/ttpci/dvb-ttpci.ko] undefined!
ERROR: "rc_allocate_device" [drivers/media/pci/ttpci/dvb-ttpci.ko] undefined!
ERROR: "rc_free_device" [drivers/media/pci/ttpci/dvb-ttpci.ko] undefined!
ERROR: "rc_keydown" [drivers/media/pci/ttpci/dvb-ttpci.ko] undefined!
ERROR: "rc_register_device" [drivers/media/pci/ttpci/dvb-ttpci.ko] undefined!Fixes 71f49a8bf5c5 ("media: ttpci: use rc-core for the IR receiver")Signed-off-by Arnd Bergmann <[email protected]>
Thank you for the patch, unfortunately this was already fixed in commit 12e23ebb396e6ffea88b8c5e483059a297326afb (which was accepted after you sent your patch).
Thanks
Sean
Re: [PATCH 3/3] media: ttpci: add RC_CORE dependency
Quoted 11 lines · Sean Young
Quoted 9 lines · Arnd Bergmann
The ttpci driver now uses the rc-core, so we need to ensure it is enabled:
ERROR: "
rc_unregister_device" [drivers/media/pci/ttpci/dvb-ttpci.ko] undefined!
ERROR: "rc_allocate_device" [drivers/media/pci/ttpci/dvb-ttpci.ko] undefined!
ERROR: "rc_free_device" [drivers/media/pci/ttpci/dvb-ttpci.ko] undefined!
ERROR: "rc_keydown" [drivers/media/pci/ttpci/dvb-ttpci.ko] undefined!
ERROR: "rc_register_device" [drivers/media/pci/ttpci/dvb-ttpci.ko] undefined!
Quoted 6 lines
Quoted 2 lines
Fixes 71f49a8bf5c5 ("media: ttpci: use rc-core for the IR receiver")Signed-off-by Arnd Bergmann <[email protected]>Thank you for the patch, unfortunately this was already fixed in commit
12e23ebb396e6ffea88b8c5e483059a297326afb(which was accepted after you sent your patch).
That seems like a better fix, thanks for addressing the issue!
Arnd
Hello Arnd,
Quoted 25 lines · Arnd Bergmann
Without this header, we get a compilation error in some configurations:
drivers/staging/media/meson/vdec/vdec.c: In function 'vdec_recycle_thread':drivers/staging/media/meson/vdec/vdec.c:59:10: error: implicit declaration of function 'kthread_should_stop' [-Werror=implicit-function-declaration]Fixes 3e7f51bd9607 ("media: meson: add v4l2 m2m video decoder driver")Signed-off-by Arnd Bergmann <[email protected]>--- drivers/staging/media/meson/vdec/vdec.c | 1 + 1 file changed, 1 insertion(+)drivers/staging/media/meson/vdec/vdec.c +1
-1@@ -8,6 +8,7 @@#include <linux/clk.h> #include <linux/io.h> #include <linux/module.h> +#include <linux/kthread.h> #include <linux/platform_device.h> #include <linux/mfd/syscon.h> #include <linux/slab.h> --
Quoted 2 lines
2.20.0
Thanks for the patch, a similar one has already been sent by Yue Haibing and is sitting in media/master at the moment [0]. My apologies for this oversight.
Regards,
Maxime
[0] https://git.linuxtv.org/media_tree.git/commit/?id=3510c68d32bf3a188c077b5fb87339379f4e6b43