Input: synaptics-rmi4 - have only one struct platform data
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>
Thu, 1 Dec 2016 01:01:50 +0000 (17:01 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 1 Dec 2016 01:42:19 +0000 (17:42 -0800)
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>
drivers/input/rmi4/rmi_f11.c
drivers/input/rmi4/rmi_f12.c
drivers/input/rmi4/rmi_f30.c
include/linux/rmi.h

index c252d405df4c1a1ae243606e0c6e61b578fe6a1e..ffcbbc1745de8756cc0e151c2c9bb3e11c9ff2d4 100644 (file)
@@ -1080,8 +1080,8 @@ static int rmi_f11_initialize(struct rmi_function *fn)
                rc = rmi_2d_sensor_of_probe(&fn->dev, &f11->sensor_pdata);
                if (rc)
                        return rc;
-       } else if (pdata->sensor_pdata) {
-               f11->sensor_pdata = *pdata->sensor_pdata;
+       } else {
+               f11->sensor_pdata = pdata->sensor_pdata;
        }
 
        f11->rezero_wait_ms = f11->sensor_pdata.rezero_wait;
index d7255f18306d648fc579398931f6de079ce1a7e4..82a4964e5eb9103837883a5b9594d32a01555cef 100644 (file)
@@ -352,8 +352,8 @@ static int rmi_f12_probe(struct rmi_function *fn)
                ret = rmi_2d_sensor_of_probe(&fn->dev, &f12->sensor_pdata);
                if (ret)
                        return ret;
-       } else if (pdata->sensor_pdata) {
-               f12->sensor_pdata = *pdata->sensor_pdata;
+       } else {
+               f12->sensor_pdata = pdata->sensor_pdata;
        }
 
        ret = rmi_read_register_desc(rmi_dev, query_addr,
index 485907ff10f4281c2a533f89aa486aa2fbc024bf..f696137a56f52a709ba73180486b51b54e0b80bb 100644 (file)
@@ -196,7 +196,7 @@ static int rmi_f30_config(struct rmi_function *fn)
                                rmi_get_platform_data(fn->rmi_dev);
        int error;
 
-       if (pdata->f30_data && pdata->f30_data->disable) {
+       if (pdata->f30_data.disable) {
                drv->clear_irq_bits(fn->rmi_dev, fn->irq_mask);
        } else {
                /* Write Control Register values back to device */
@@ -355,7 +355,7 @@ static inline int rmi_f30_initialize(struct rmi_function *fn)
        f30->gpioled_key_map = (u16 *)map_memory;
 
        pdata = rmi_get_platform_data(rmi_dev);
-       if (pdata && f30->has_gpio) {
+       if (f30->has_gpio) {
                button = BTN_LEFT;
                for (i = 0; i < f30->gpioled_count; i++) {
                        if (rmi_f30_is_valid_button(i, f30->ctrl)) {
@@ -366,8 +366,7 @@ static inline int rmi_f30_initialize(struct rmi_function *fn)
                                 * f30->has_mech_mouse_btns, but I am
                                 * not sure, so use only the pdata info
                                 */
-                               if (pdata->f30_data &&
-                                   pdata->f30_data->buttonpad)
+                               if (pdata->f30_data.buttonpad)
                                        break;
                        }
                }
@@ -382,7 +381,7 @@ static int rmi_f30_probe(struct rmi_function *fn)
        const struct rmi_device_platform_data *pdata =
                                rmi_get_platform_data(fn->rmi_dev);
 
-       if (pdata->f30_data && pdata->f30_data->disable)
+       if (pdata->f30_data.disable)
                return 0;
 
        rc = rmi_f30_initialize(fn);
index 621f098f12438233d743a3c2c5ced25b58f0d1df..7780e40a25736ca4926c4b7b24c712d3e28c78b3 100644 (file)
@@ -218,9 +218,9 @@ struct rmi_device_platform_data {
        struct rmi_device_platform_data_spi spi_data;
 
        /* function handler pdata */
-       struct rmi_2d_sensor_platform_data *sensor_pdata;
+       struct rmi_2d_sensor_platform_data sensor_pdata;
        struct rmi_f01_power_management power_management;
-       struct rmi_f30_data *f30_data;
+       struct rmi_f30_data f30_data;
 };
 
 /**