[MeeGo-dev] [PATCH] cy8ctmg110_ts: Fix broken build introduced by multi-input patch

James jketreno at linux.intel.com
Fri Aug 27 11:07:14 PDT 2010


linux-2.6-mid-35 commit 1b0857fcd88 (cy8ctmg110:
Add multi-touch capabilities) breaks the kernel build.

There was an error while formatting the patches in email
that resulted in a clean applying patch, which is missing
a chunk of code.

Without that chunk of code, the kernel will not build with
that patch applied.

This patch fixes the kernel build problem.

Compile and run-time tested in kernel-mrst-2.6.35.2 with
   CONFIG_CY8CTMG110_MULTIPLE_INPUT=y
and
   CONFIG_CY8CTMG110_MULTIPLE_INPUT=n

Compile tested against linux-2.6-mid-35 with:
   CONFIG_CY8CTMG110_MULTIPLE_INPUT=y
and
   CONFIG_CY8CTMG110_MULTIPLE_INPUT=n

Tracked on bugs.meego.com as #5951

Signed-off-by: James Ketrenos<jketreno at linux.intel.com>
---
  drivers/input/touchscreen/cy8ctmg110_ts.c |   56 +++++++++++++++++++---------
  1 files changed, 38 insertions(+), 18 deletions(-)

diff --git a/drivers/input/touchscreen/cy8ctmg110_ts.c b/drivers/input/touchscreen/cy8ctmg110_ts.c
index 9221d80..0a18f72 100644
--- a/drivers/input/touchscreen/cy8ctmg110_ts.c
+++ b/drivers/input/touchscreen/cy8ctmg110_ts.c
@@ -311,37 +311,57 @@ static int cy8ctmg110_probe(struct i2c_client *client,
  		return -EIO;

  	ts = kzalloc(sizeof(struct cy8ctmg110), GFP_KERNEL);
-	input_dev = input_allocate_device();

-	if (!ts || !input_dev) {
+	if (!ts) {
  		err = -ENOMEM;
  		goto err_free_mem;
  	}

  	ts->client = client;
  	i2c_set_clientdata(client, ts);
-
-	ts->input = input_dev;
  	ts->polling = polling;

-	snprintf(ts->phys, sizeof(ts->phys), "%s/input0",
-						dev_name(&client->dev));
+	spin_lock_init(&ts->lock);
+
+#ifdef CONFIG_TOUCHSCREEN_CY8CTMG110_MULTIPLE_INPUT
+	/* Allocate one input device per supported contact point */
+	for (contact = 0; contact<  MAX_FINGERS; contact++) {
+#endif

-	input_dev->name = CY8CTMG110_DRIVER_NAME " Touchscreen";
-	input_dev->phys = ts->phys;
-	input_dev->id.bustype = BUS_I2C;
+		input_dev = input_allocate_device();
+		if (!input_dev) {
+			err = -ENOMEM;
+			goto err_free_mem;
+		}

-	spin_lock_init(&ts->lock);
+#ifdef CONFIG_TOUCHSCREEN_CY8CTMG110_MULTIPLE_INPUT
+		ts->input[contact] = input_dev;
+		snprintf(ts->phys[contact], sizeof(ts->phys[contact]),
+			"%s/input%d", dev_name(&client->dev), contact);
+		input_dev->phys = ts->phys[contact];
+#else
+		ts->input = input_dev;
+		snprintf(ts->phys, sizeof(ts->phys),
+			"%s/input0", dev_name(&client->dev));
+		input_dev->phys = ts->phys;
+#endif
+
+		input_dev->name = CY8CTMG110_DRIVER_NAME " Touchscreen";
+		input_dev->id.bustype = BUS_I2C;

-	input_set_capability(input_dev, EV_KEY, BTN_TOUCH);
-	input_set_capability(input_dev, EV_ABS, ABS_X);
-	input_set_capability(input_dev, EV_ABS, ABS_Y);
+		input_set_capability(input_dev, EV_KEY, BTN_TOUCH);
+		input_set_capability(input_dev, EV_ABS, ABS_X);
+		input_set_capability(input_dev, EV_ABS, ABS_Y);

-	/* Initialize these with 4 fuzz for jitter... */
-	input_set_abs_params(input_dev, ABS_X, CY8CTMG110_X_MIN,
-			     CY8CTMG110_X_MAX, 4, 0);
-	input_set_abs_params(input_dev, ABS_Y, CY8CTMG110_Y_MIN,
-			     CY8CTMG110_Y_MAX, 4, 0);
+		/* Initialize these with 4 fuzz for jitter... */
+		input_set_abs_params(input_dev, ABS_X, CY8CTMG110_X_MIN,
+				     CY8CTMG110_X_MAX, 4, 0);
+		input_set_abs_params(input_dev, ABS_Y, CY8CTMG110_Y_MIN,
+				     CY8CTMG110_Y_MAX, 4, 0);
+
+#ifdef CONFIG_TOUCHSCREEN_CY8CTMG110_MULTIPLE_INPUT
+	}
+#endif

  	err = gpio_request(CY8CTMG110_RESET_PIN_GPIO, NULL);

-- 
1.7.1




More information about the MeeGo-dev mailing list