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

Input: pixcir_i2c_ts - remove platform data

Previous change moved platform data definition into the driver, making it
unusable for users. Given that we want to move away from custom platform
data structures, and always use device properties (DT, ACPI or static) to
configure devices, let's complete the removal.

Tested-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Michal Vokáč <michal.vokac@ysoft.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+25 -75
+25 -75
drivers/input/touchscreen/pixcir_i2c_ts.c
··· 62 62 #define PIXCIR_INT_POL_HIGH (1UL << 2) 63 63 64 64 /** 65 - * struct pixcir_irc_chip_data - chip related data 65 + * struct pixcir_i2c_chip_data - chip related data 66 66 * @max_fingers: Max number of fingers reported simultaneously by h/w 67 67 * @has_hw_ids: Hardware supports finger tracking IDs 68 68 * ··· 70 70 struct pixcir_i2c_chip_data { 71 71 u8 max_fingers; 72 72 bool has_hw_ids; 73 - }; 74 - 75 - struct pixcir_ts_platform_data { 76 - int x_max; 77 - int y_max; 78 - struct pixcir_i2c_chip_data chip; 79 73 }; 80 74 81 75 struct pixcir_i2c_ts_data { ··· 81 87 struct gpio_desc *gpio_wake; 82 88 const struct pixcir_i2c_chip_data *chip; 83 89 struct touchscreen_properties prop; 84 - int max_fingers; /* Max fingers supported in this instance */ 85 90 bool running; 86 91 }; 87 92 ··· 104 111 memset(report, 0, sizeof(struct pixcir_report_data)); 105 112 106 113 i = chip->has_hw_ids ? 1 : 0; 107 - readsize = 2 + tsdata->max_fingers * (4 + i); 114 + readsize = 2 + tsdata->chip->max_fingers * (4 + i); 108 115 if (readsize > sizeof(rdbuf)) 109 116 readsize = sizeof(rdbuf); 110 117 ··· 125 132 } 126 133 127 134 touch = rdbuf[0] & 0x7; 128 - if (touch > tsdata->max_fingers) 129 - touch = tsdata->max_fingers; 135 + if (touch > tsdata->chip->max_fingers) 136 + touch = tsdata->chip->max_fingers; 130 137 131 138 report->num_touches = touch; 132 139 bufptr = &rdbuf[2]; ··· 462 469 static SIMPLE_DEV_PM_OPS(pixcir_dev_pm_ops, 463 470 pixcir_i2c_ts_suspend, pixcir_i2c_ts_resume); 464 471 465 - #ifdef CONFIG_OF 466 - static const struct of_device_id pixcir_of_match[]; 467 - 468 - static int pixcir_parse_dt(struct device *dev, 469 - struct pixcir_i2c_ts_data *tsdata) 470 - { 471 - tsdata->chip = of_device_get_match_data(dev); 472 - if (!tsdata->chip) 473 - return -EINVAL; 474 - 475 - return 0; 476 - } 477 - #else 478 - static int pixcir_parse_dt(struct device *dev, 479 - struct pixcir_i2c_ts_data *tsdata) 480 - { 481 - return -EINVAL; 482 - } 483 - #endif 484 - 485 472 static int pixcir_i2c_ts_probe(struct i2c_client *client, 486 473 const struct i2c_device_id *id) 487 474 { 488 - const struct pixcir_ts_platform_data *pdata = 489 - dev_get_platdata(&client->dev); 490 475 struct device *dev = &client->dev; 491 476 struct pixcir_i2c_ts_data *tsdata; 492 477 struct input_dev *input; ··· 474 503 if (!tsdata) 475 504 return -ENOMEM; 476 505 477 - if (pdata) { 478 - tsdata->chip = &pdata->chip; 479 - } else if (dev->of_node) { 480 - error = pixcir_parse_dt(dev, tsdata); 481 - if (error) 482 - return error; 483 - } else { 484 - dev_err(dev, "platform data not defined\n"); 485 - return -EINVAL; 486 - } 487 - 488 - if (!tsdata->chip->max_fingers) { 489 - dev_err(dev, "Invalid max_fingers in chip data\n"); 506 + tsdata->chip = device_get_match_data(dev); 507 + if (!tsdata->chip && id) 508 + tsdata->chip = (const void *)id->driver_data; 509 + if (!tsdata->chip) { 510 + dev_err(dev, "can't locate chip data\n"); 490 511 return -EINVAL; 491 512 } 492 513 ··· 495 532 input->id.bustype = BUS_I2C; 496 533 input->open = pixcir_input_open; 497 534 input->close = pixcir_input_close; 498 - input->dev.parent = dev; 499 535 500 - if (pdata) { 501 - input_set_abs_params(input, ABS_MT_POSITION_X, 0, pdata->x_max, 0, 0); 502 - input_set_abs_params(input, ABS_MT_POSITION_Y, 0, pdata->y_max, 0, 0); 503 - } else { 504 - input_set_capability(input, EV_ABS, ABS_MT_POSITION_X); 505 - input_set_capability(input, EV_ABS, ABS_MT_POSITION_Y); 506 - touchscreen_parse_properties(input, true, &tsdata->prop); 507 - if (!input_abs_get_max(input, ABS_MT_POSITION_X) || 508 - !input_abs_get_max(input, ABS_MT_POSITION_Y)) { 509 - dev_err(dev, "Touchscreen size is not specified\n"); 510 - return -EINVAL; 511 - } 536 + input_set_capability(input, EV_ABS, ABS_MT_POSITION_X); 537 + input_set_capability(input, EV_ABS, ABS_MT_POSITION_Y); 538 + touchscreen_parse_properties(input, true, &tsdata->prop); 539 + if (!input_abs_get_max(input, ABS_MT_POSITION_X) || 540 + !input_abs_get_max(input, ABS_MT_POSITION_Y)) { 541 + dev_err(dev, "Touchscreen size is not specified\n"); 542 + return -EINVAL; 512 543 } 513 544 514 - tsdata->max_fingers = tsdata->chip->max_fingers; 515 - if (tsdata->max_fingers > PIXCIR_MAX_SLOTS) { 516 - tsdata->max_fingers = PIXCIR_MAX_SLOTS; 517 - dev_info(dev, "Limiting maximum fingers to %d\n", 518 - tsdata->max_fingers); 519 - } 520 - 521 - error = input_mt_init_slots(input, tsdata->max_fingers, 545 + error = input_mt_init_slots(input, tsdata->chip->max_fingers, 522 546 INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED); 523 547 if (error) { 524 548 dev_err(dev, "Error initializing Multi-Touch slots\n"); ··· 585 635 return 0; 586 636 } 587 637 588 - static const struct i2c_device_id pixcir_i2c_ts_id[] = { 589 - { "pixcir_ts", 0 }, 590 - { "pixcir_tangoc", 0 }, 591 - { } 592 - }; 593 - MODULE_DEVICE_TABLE(i2c, pixcir_i2c_ts_id); 594 - 595 - #ifdef CONFIG_OF 596 638 static const struct pixcir_i2c_chip_data pixcir_ts_data = { 597 639 .max_fingers = 2, 598 640 /* no hw id support */ ··· 595 653 .has_hw_ids = true, 596 654 }; 597 655 656 + static const struct i2c_device_id pixcir_i2c_ts_id[] = { 657 + { "pixcir_ts", (unsigned long) &pixcir_ts_data }, 658 + { "pixcir_tangoc", (unsigned long) &pixcir_tangoc_data }, 659 + { } 660 + }; 661 + MODULE_DEVICE_TABLE(i2c, pixcir_i2c_ts_id); 662 + 663 + #ifdef CONFIG_OF 598 664 static const struct of_device_id pixcir_of_match[] = { 599 665 { .compatible = "pixcir,pixcir_ts", .data = &pixcir_ts_data }, 600 666 { .compatible = "pixcir,pixcir_tangoc", .data = &pixcir_tangoc_data },