Re: [PATCH] media: platform: davinci: drop VPFE_CMD_S_CCDC_RAW_PARAMS

2017-06-30 Thread Lad, Prabhakar
Hi Arnd,

On Fri, Jun 30, 2017 at 11:03 AM, Arnd Bergmann  wrote:
> On Fri, Jun 30, 2017 at 11:32 AM, Prabhakar  
> wrote:
>> From: "Lad, Prabhakar" 
>>
>> For dm355 and dm644x the vpfe driver provided a ioctl to
>> configure the raw bayer config using a IOCTL, but since
>> the code was not properly implemented and aswell the
>> IOCTL was marked as 'experimental ioctl that will change
>> in future kernels', dropping this IOCTL.
>>
>> Signed-off-by: Lad, Prabhakar 
>> ---
>> As discussed at [1], there wouldn’t be any possible users of
>> the VPFE_CMD_S_CCDC_RAW_PARAMS IOCTL, but if someone complains
>> we might end up reverting the removal and fix it differently.
>>
>> Note: This patch is on top of [1].
>>
>> [1] https://patchwork.kernel.org/patch/9779385/
>
> Acked-by: Arnd Bergmann 
>
Thanks for the Ack.

> I think it would be good to backport one or both of the patches to
> stable kernels, to close the potential risk of someone abusing the
> ioctl.

I think just your patch should be suffice to the stable kernel,
blocking this IOCTL.

Cheers,
--Prabhakar Lad


Re: [PATCH] media: platform: davinci: drop VPFE_CMD_S_CCDC_RAW_PARAMS

2017-06-30 Thread Arnd Bergmann
On Fri, Jun 30, 2017 at 11:32 AM, Prabhakar  wrote:
> From: "Lad, Prabhakar" 
>
> For dm355 and dm644x the vpfe driver provided a ioctl to
> configure the raw bayer config using a IOCTL, but since
> the code was not properly implemented and aswell the
> IOCTL was marked as 'experimental ioctl that will change
> in future kernels', dropping this IOCTL.
>
> Signed-off-by: Lad, Prabhakar 
> ---
> As discussed at [1], there wouldn’t be any possible users of
> the VPFE_CMD_S_CCDC_RAW_PARAMS IOCTL, but if someone complains
> we might end up reverting the removal and fix it differently.
>
> Note: This patch is on top of [1].
>
> [1] https://patchwork.kernel.org/patch/9779385/

Acked-by: Arnd Bergmann 

I think it would be good to backport one or both of the patches to
stable kernels, to close the potential risk of someone abusing the
ioctl.


[PATCH] media: platform: davinci: drop VPFE_CMD_S_CCDC_RAW_PARAMS

2017-06-30 Thread Prabhakar
From: "Lad, Prabhakar" 

For dm355 and dm644x the vpfe driver provided a ioctl to
configure the raw bayer config using a IOCTL, but since
the code was not properly implemented and aswell the
IOCTL was marked as 'experimental ioctl that will change
in future kernels', dropping this IOCTL.

Signed-off-by: Lad, Prabhakar 
---
As discussed at [1], there wouldn’t be any possible users of
the VPFE_CMD_S_CCDC_RAW_PARAMS IOCTL, but if someone complains
we might end up reverting the removal and fix it differently.

Note: This patch is on top of [1].

[1] https://patchwork.kernel.org/patch/9779385/

 drivers/media/platform/davinci/ccdc_hw_device.h |  10 --
 drivers/media/platform/davinci/dm355_ccdc.c |   1 -
 drivers/media/platform/davinci/dm644x_ccdc.c| 151 
 drivers/media/platform/davinci/vpfe_capture.c   |  93 ---
 include/media/davinci/dm644x_ccdc.h |  12 --
 include/media/davinci/vpfe_capture.h|  10 --
 6 files changed, 277 deletions(-)

diff --git a/drivers/media/platform/davinci/ccdc_hw_device.h 
b/drivers/media/platform/davinci/ccdc_hw_device.h
index 8f6688a..f1b5210 100644
--- a/drivers/media/platform/davinci/ccdc_hw_device.h
+++ b/drivers/media/platform/davinci/ccdc_hw_device.h
@@ -42,16 +42,6 @@ struct ccdc_hw_ops {
int (*set_hw_if_params) (struct vpfe_hw_if_param *param);
/* get interface parameters */
int (*get_hw_if_params) (struct vpfe_hw_if_param *param);
-   /*
-* Pointer to function to set parameters. Used
-* for implementing VPFE_S_CCDC_PARAMS
-*/
-   int (*set_params) (void *params);
-   /*
-* Pointer to function to get parameter. Used
-* for implementing VPFE_G_CCDC_PARAMS
-*/
-   int (*get_params) (void *params);
/* Pointer to function to configure ccdc */
int (*configure) (void);
 
diff --git a/drivers/media/platform/davinci/dm355_ccdc.c 
b/drivers/media/platform/davinci/dm355_ccdc.c
index 73db166..4682f22 100644
--- a/drivers/media/platform/davinci/dm355_ccdc.c
+++ b/drivers/media/platform/davinci/dm355_ccdc.c
@@ -939,7 +939,6 @@ static struct ccdc_hw_device ccdc_hw_dev = {
.enable = ccdc_enable,
.enable_out_to_sdram = ccdc_enable_output_to_sdram,
.set_hw_if_params = ccdc_set_hw_if_params,
-   .set_params = ccdc_set_params,
.configure = ccdc_configure,
.set_buftype = ccdc_set_buftype,
.get_buftype = ccdc_get_buftype,
diff --git a/drivers/media/platform/davinci/dm644x_ccdc.c 
b/drivers/media/platform/davinci/dm644x_ccdc.c
index 1b42f50..1ec1886 100644
--- a/drivers/media/platform/davinci/dm644x_ccdc.c
+++ b/drivers/media/platform/davinci/dm644x_ccdc.c
@@ -216,106 +216,8 @@ static void ccdc_readregs(void)
dev_notice(ccdc_cfg.dev, "\nReading 0x%x to VERT_LINES...\n", val);
 }
 
-static int validate_ccdc_param(struct ccdc_config_params_raw *ccdcparam)
-{
-   if (ccdcparam->alaw.enable) {
-   u8 max_gamma = 
ccdc_gamma_width_max_bit(ccdcparam->alaw.gamma_wd);
-   u8 max_data = ccdc_data_size_max_bit(ccdcparam->data_sz);
-
-   if ((ccdcparam->alaw.gamma_wd > CCDC_GAMMA_BITS_09_0) ||
-   (ccdcparam->alaw.gamma_wd < CCDC_GAMMA_BITS_15_6) ||
-   (max_gamma > max_data)) {
-   dev_dbg(ccdc_cfg.dev, "\nInvalid data line select");
-   return -1;
-   }
-   }
-   return 0;
-}
-
-static int ccdc_update_raw_params(struct ccdc_config_params_raw *raw_params)
-{
-   struct ccdc_config_params_raw *config_params =
-   &ccdc_cfg.bayer.config_params;
-   unsigned int *fpc_virtaddr;
-   phys_addr_t fpc_physaddr;
-
-   memcpy(config_params, raw_params, sizeof(*raw_params));
-
-   /*
-* FIXME: the code to copy the fault_pxl settings was present
-*in the original version but clearly could never
-*work and will interpret user-provided data in
-*dangerous ways. Let's disable it completely to be
-*on the safe side.
-*/
-   config_params->fault_pxl.enable = 0;
-   config_params->fault_pxl.fp_num = 0;
-   config_params->fault_pxl.fpc_table_addr = 0;
-
-   /*
-* allocate memory for fault pixel table and copy the user
-* values to the table
-*/
-   if (!config_params->fault_pxl.enable)
-   return 0;
-
-   fpc_physaddr = config_params->fault_pxl.fpc_table_addr;
-   fpc_virtaddr = (unsigned int *)phys_to_virt(fpc_physaddr);
-   /*
-* Allocate memory for FPC table if current
-* FPC table buffer is not big enough to
-* accommodate FPC Number requested
-*/
-   if (raw_params->fault_pxl.fp_num != config_params->fault_pxl.fp_num) {
-   if (fpc_physaddr) {
-   fre