Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Benjamin Tissoires and committed by
Dmitry Torokhov
0a135b88 e9dade41

+10 -11
+2 -2
drivers/input/rmi4/rmi_f11.c
··· 1080 1080 rc = rmi_2d_sensor_of_probe(&fn->dev, &f11->sensor_pdata); 1081 1081 if (rc) 1082 1082 return rc; 1083 - } else if (pdata->sensor_pdata) { 1084 - f11->sensor_pdata = *pdata->sensor_pdata; 1083 + } else { 1084 + f11->sensor_pdata = pdata->sensor_pdata; 1085 1085 } 1086 1086 1087 1087 f11->rezero_wait_ms = f11->sensor_pdata.rezero_wait;
+2 -2
drivers/input/rmi4/rmi_f12.c
··· 352 352 ret = rmi_2d_sensor_of_probe(&fn->dev, &f12->sensor_pdata); 353 353 if (ret) 354 354 return ret; 355 - } else if (pdata->sensor_pdata) { 356 - f12->sensor_pdata = *pdata->sensor_pdata; 355 + } else { 356 + f12->sensor_pdata = pdata->sensor_pdata; 357 357 } 358 358 359 359 ret = rmi_read_register_desc(rmi_dev, query_addr,
+4 -5
drivers/input/rmi4/rmi_f30.c
··· 196 196 rmi_get_platform_data(fn->rmi_dev); 197 197 int error; 198 198 199 - if (pdata->f30_data && pdata->f30_data->disable) { 199 + if (pdata->f30_data.disable) { 200 200 drv->clear_irq_bits(fn->rmi_dev, fn->irq_mask); 201 201 } else { 202 202 /* Write Control Register values back to device */ ··· 355 355 f30->gpioled_key_map = (u16 *)map_memory; 356 356 357 357 pdata = rmi_get_platform_data(rmi_dev); 358 - if (pdata && f30->has_gpio) { 358 + if (f30->has_gpio) { 359 359 button = BTN_LEFT; 360 360 for (i = 0; i < f30->gpioled_count; i++) { 361 361 if (rmi_f30_is_valid_button(i, f30->ctrl)) { ··· 366 366 * f30->has_mech_mouse_btns, but I am 367 367 * not sure, so use only the pdata info 368 368 */ 369 - if (pdata->f30_data && 370 - pdata->f30_data->buttonpad) 369 + if (pdata->f30_data.buttonpad) 371 370 break; 372 371 } 373 372 } ··· 381 382 const struct rmi_device_platform_data *pdata = 382 383 rmi_get_platform_data(fn->rmi_dev); 383 384 384 - if (pdata->f30_data && pdata->f30_data->disable) 385 + if (pdata->f30_data.disable) 385 386 return 0; 386 387 387 388 rc = rmi_f30_initialize(fn);
+2 -2
include/linux/rmi.h
··· 218 218 struct rmi_device_platform_data_spi spi_data; 219 219 220 220 /* function handler pdata */ 221 - struct rmi_2d_sensor_platform_data *sensor_pdata; 221 + struct rmi_2d_sensor_platform_data sensor_pdata; 222 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 /**