aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>2016-11-30 20:01:50 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2016-11-30 20:42:19 -0500
commit0a135b88bceac40d0036e401c19cdbda65b38a8f (patch)
treeb5bbd78e35099836c45f2e5210793e421abb51b3
parente9dade4106e1c1ff4ae91386b9812ee8f51c3775 (diff)
Input: synaptics-rmi4 - have only one struct platform data
If struct rmi_device_platform_data contains pointers to other struct, it gets difficult to allocate a fixed size struct and copy it over between drivers. Change the pointers into a struct and change the code in rmi4 accordingly. Reviewed-by: Andrew Duggan <aduggan@synaptics.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--drivers/input/rmi4/rmi_f11.c4
-rw-r--r--drivers/input/rmi4/rmi_f12.c4
-rw-r--r--drivers/input/rmi4/rmi_f30.c9
-rw-r--r--include/linux/rmi.h4
4 files changed, 10 insertions, 11 deletions
diff --git a/drivers/input/rmi4/rmi_f11.c b/drivers/input/rmi4/rmi_f11.c
index c252d405df4c..ffcbbc1745de 100644
--- a/drivers/input/rmi4/rmi_f11.c
+++ b/drivers/input/rmi4/rmi_f11.c
@@ -1080,8 +1080,8 @@ static int rmi_f11_initialize(struct rmi_function *fn)
1080 rc = rmi_2d_sensor_of_probe(&fn->dev, &f11->sensor_pdata); 1080 rc = rmi_2d_sensor_of_probe(&fn->dev, &f11->sensor_pdata);
1081 if (rc) 1081 if (rc)
1082 return rc; 1082 return rc;
1083 } else if (pdata->sensor_pdata) { 1083 } else {
1084 f11->sensor_pdata = *pdata->sensor_pdata; 1084 f11->sensor_pdata = pdata->sensor_pdata;
1085 } 1085 }
1086 1086
1087 f11->rezero_wait_ms = f11->sensor_pdata.rezero_wait; 1087 f11->rezero_wait_ms = f11->sensor_pdata.rezero_wait;
diff --git a/drivers/input/rmi4/rmi_f12.c b/drivers/input/rmi4/rmi_f12.c
index d7255f18306d..82a4964e5eb9 100644
--- a/drivers/input/rmi4/rmi_f12.c
+++ b/drivers/input/rmi4/rmi_f12.c
@@ -352,8 +352,8 @@ static int rmi_f12_probe(struct rmi_function *fn)
352 ret = rmi_2d_sensor_of_probe(&fn->dev, &f12->sensor_pdata); 352 ret = rmi_2d_sensor_of_probe(&fn->dev, &f12->sensor_pdata);
353 if (ret) 353 if (ret)
354 return ret; 354 return ret;
355 } else if (pdata->sensor_pdata) { 355 } else {
356 f12->sensor_pdata = *pdata->sensor_pdata; 356 f12->sensor_pdata = pdata->sensor_pdata;
357 } 357 }
358 358
359 ret = rmi_read_register_desc(rmi_dev, query_addr, 359 ret = rmi_read_register_desc(rmi_dev, query_addr,
diff --git a/drivers/input/rmi4/rmi_f30.c b/drivers/input/rmi4/rmi_f30.c
index 485907ff10f4..f696137a56f5 100644
--- a/drivers/input/rmi4/rmi_f30.c
+++ b/drivers/input/rmi4/rmi_f30.c
@@ -196,7 +196,7 @@ static int rmi_f30_config(struct rmi_function *fn)
196 rmi_get_platform_data(fn->rmi_dev); 196 rmi_get_platform_data(fn->rmi_dev);
197 int error; 197 int error;
198 198
199 if (pdata->f30_data && pdata->f30_data->disable) { 199 if (pdata->f30_data.disable) {
200 drv->clear_irq_bits(fn->rmi_dev, fn->irq_mask); 200 drv->clear_irq_bits(fn->rmi_dev, fn->irq_mask);
201 } else { 201 } else {
202 /* Write Control Register values back to device */ 202 /* Write Control Register values back to device */
@@ -355,7 +355,7 @@ static inline int rmi_f30_initialize(struct rmi_function *fn)
355 f30->gpioled_key_map = (u16 *)map_memory; 355 f30->gpioled_key_map = (u16 *)map_memory;
356 356
357 pdata = rmi_get_platform_data(rmi_dev); 357 pdata = rmi_get_platform_data(rmi_dev);
358 if (pdata && f30->has_gpio) { 358 if (f30->has_gpio) {
359 button = BTN_LEFT; 359 button = BTN_LEFT;
360 for (i = 0; i < f30->gpioled_count; i++) { 360 for (i = 0; i < f30->gpioled_count; i++) {
361 if (rmi_f30_is_valid_button(i, f30->ctrl)) { 361 if (rmi_f30_is_valid_button(i, f30->ctrl)) {
@@ -366,8 +366,7 @@ static inline int rmi_f30_initialize(struct rmi_function *fn)
366 * f30->has_mech_mouse_btns, but I am 366 * f30->has_mech_mouse_btns, but I am
367 * not sure, so use only the pdata info 367 * not sure, so use only the pdata info
368 */ 368 */
369 if (pdata->f30_data && 369 if (pdata->f30_data.buttonpad)
370 pdata->f30_data->buttonpad)
371 break; 370 break;
372 } 371 }
373 } 372 }
@@ -382,7 +381,7 @@ static int rmi_f30_probe(struct rmi_function *fn)
382 const struct rmi_device_platform_data *pdata = 381 const struct rmi_device_platform_data *pdata =
383 rmi_get_platform_data(fn->rmi_dev); 382 rmi_get_platform_data(fn->rmi_dev);
384 383
385 if (pdata->f30_data && pdata->f30_data->disable) 384 if (pdata->f30_data.disable)
386 return 0; 385 return 0;
387 386
388 rc = rmi_f30_initialize(fn); 387 rc = rmi_f30_initialize(fn);
diff --git a/include/linux/rmi.h b/include/linux/rmi.h
index 621f098f1243..7780e40a2573 100644
--- a/include/linux/rmi.h
+++ b/include/linux/rmi.h
@@ -218,9 +218,9 @@ struct rmi_device_platform_data {
218 struct rmi_device_platform_data_spi spi_data; 218 struct rmi_device_platform_data_spi spi_data;
219 219
220 /* function handler pdata */ 220 /* function handler pdata */
221 struct rmi_2d_sensor_platform_data *sensor_pdata; 221 struct rmi_2d_sensor_platform_data sensor_pdata;
222 struct rmi_f01_power_management power_management; 222 struct rmi_f01_power_management power_management;
223 struct rmi_f30_data *f30_data; 223 struct rmi_f30_data f30_data;
224}; 224};
225 225
226/** 226/**