# Re: \[PATCH 1/5\] Remove fixed config data from driver file; add config to platform data

- From: Dmitry Torokhov \<dmitry.torokhov@gmail.com\>
- Date: 2011-02-04 08:58:02 
- List: linux-input
- Page: https://ratatoskr.run/linux-input/2011/02/8916061
- Thread: https://ratatoskr.run/linux-input/2011/01/8915933/t.md

```text
On Thu, Feb 03, 2011 at 04:01:17PM +0200, Iiro Valkonen wrote:
> +	if (pdata->config) {
> +		init_vals = (u8 *)pdata->config;
> +	} else {
> +		dev_err(dev, "No cfg data defined, skipping reg init\n");
> +		return 0;
>  	}
>  
>  	for (i = 0; i < data->info.object_num; i++) {
> diff --git a/include/linux/i2c/qt602240_ts.h b/include/linux/i2c/qt602240_ts.h
> index 0b4c72f..130f8bc 100644
> --- a/include/linux/i2c/qt602240_ts.h
> +++ b/include/linux/i2c/qt602240_ts.h
> @@ -33,6 +33,7 @@ struct mxt_platform_data {
>  	unsigned int threshold;
>  	unsigned int voltage;
>  	unsigned char orient;
> +	unsigned char *config;

This should be "const u8 *config". Also it would be a good idea to also
pass length and validate it when dereferencing.

Thanks.

-- 
Dmitry
```
