There are no in-tree users of platform data and any new ones should either use device tree or static device properties, so let's remove platform data support.
Unified · Split
| @@ -9,21 +9,19 @@ · 8 unmodified lines | ||
| 9 | 9 | * Author: Pieter Truter<ptruter@intrinsyc.com> |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | −#include <linux/module.h> | |
| 13 | −#include <linux/hrtimer.h> | |
| 14 | −#include <linux/slab.h> | |
| 15 | −#include <linux/input.h> | |
| 16 | −#include <linux/interrupt.h> | |
| 17 | −#include <linux/i2c.h> | |
| 18 | 12 | #include <linux/delay.h> |
| 19 | −#include <linux/gpio/consumer.h> | |
| 20 | 13 | #include <linux/device.h> |
| 21 | −#include <linux/sysfs.h> | |
| 14 | +#include <linux/gpio/consumer.h> | |
| 15 | +#include <linux/i2c.h> | |
| 16 | +#include <linux/input.h> | |
| 22 | 17 | #include <linux/input/mt.h> |
| 23 | 18 | #include <linux/input/touchscreen.h> |
| 24 | −#include <linux/platform_data/zforce_ts.h> | |
| 25 | −#include <linux/regulator/consumer.h> | |
| 19 | +#include <linux/interrupt.h> | |
| 20 | +#include <linux/module.h> | |
| 26 | 21 | #include <linux/of.h> |
| 22 | +#include <linux/property.h> | |
| 23 | +#include <linux/regulator/consumer.h> | |
| 24 | +#include <linux/slab.h> | |
| 27 | 25 | |
| 28 | 26 | #define WAIT_TIMEOUT msecs_to_jiffies(1000) |
| 29 | 27 | |
| @@ -108,7 +106,6 @@ struct zforce_ts { · 78 unmodified lines | ||
| 108 | 106 | struct i2c_client *client; |
| 109 | 107 | struct input_dev *input; |
| 110 | 108 | struct touchscreen_properties prop; |
| 111 | − const struct zforce_ts_platdata *pdata; | |
| 112 | 109 | char phys[32]; |
| 113 | 110 | |
| 114 | 111 | struct regulator *reg_vdd; |
| @@ -702,39 +699,24 @@ static void zforce_reset(void *data) · 587 unmodified lines | ||
| 702 | 699 | regulator_disable(ts->reg_vdd); |
| 703 | 700 | } |
| 704 | 701 | |
| 705 | −static struct zforce_ts_platdata *zforce_parse_dt(struct device *dev) | |
| 702 | +static void zforce_ts_parse_legacy_properties(struct zforce_ts *ts) | |
| 706 | 703 | { |
| 707 | − struct zforce_ts_platdata *pdata; | |
| 708 | − struct device_node *np = dev->of_node; | |
| 709 | − | |
| 710 | − if (!np) | |
| 711 | − return ERR_PTR(-ENOENT); | |
| 704 | + u32 x_max = 0; | |
| 705 | + u32 y_max = 0; | |
| 712 | 706 | |
| 713 | − pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); | |
| 714 | − if (!pdata) { | |
| 715 | − dev_err(dev, "failed to allocate platform data\n"); | |
| 716 | − return ERR_PTR(-ENOMEM); | |
| 717 | − } | |
| 718 | − | |
| 719 | − of_property_read_u32(np, "x-size", &pdata->x_max); | |
| 720 | − of_property_read_u32(np, "y-size", &pdata->y_max); | |
| 707 | + device_property_read_u32(&ts->client->dev, "x-size", &x_max); | |
| 708 | + input_set_abs_params(ts->input, ABS_MT_POSITION_X, 0, x_max, 0, 0); | |
| 721 | 709 | |
| 722 | − return pdata; | |
| 710 | + device_property_read_u32(&ts->client->dev, "y-size", &y_max); | |
| 711 | + input_set_abs_params(ts->input, ABS_MT_POSITION_Y, 0, y_max, 0, 0); | |
| 723 | 712 | } |
| 724 | 713 | |
| 725 | 714 | static int zforce_probe(struct i2c_client *client) |
| 726 | 715 | { |
| 727 | − const struct zforce_ts_platdata *pdata = dev_get_platdata(&client->dev); | |
| 728 | 716 | struct zforce_ts *ts; |
| 729 | 717 | struct input_dev *input_dev; |
| 730 | 718 | int ret; |
| 731 | 719 | |
| 732 | − if (!pdata) { | |
| 733 | − pdata = zforce_parse_dt(&client->dev); | |
| 734 | − if (IS_ERR(pdata)) | |
| 735 | − return PTR_ERR(pdata); | |
| 736 | − } | |
| 737 | − | |
| 738 | 720 | ts = devm_kzalloc(&client->dev, sizeof(struct zforce_ts), GFP_KERNEL); |
| 739 | 721 | if (!ts) |
| 740 | 722 | return -ENOMEM; |
| @@ -822,7 +804,6 @@ static int zforce_probe(struct i2c_client *client) · 81 unmodified lines | ||
| 822 | 804 | mutex_init(&ts->access_mutex); |
| 823 | 805 | mutex_init(&ts->command_mutex); |
| 824 | 806 | |
| 825 | − ts->pdata = pdata; | |
| 826 | 807 | ts->client = client; |
| 827 | 808 | ts->input = input_dev; |
| 828 | 809 | |
| @@ -837,12 +818,7 @@ static int zforce_probe(struct i2c_client *client) · 8 unmodified lines | ||
| 837 | 818 | __set_bit(EV_SYN, input_dev->evbit); |
| 838 | 819 | __set_bit(EV_ABS, input_dev->evbit); |
| 839 | 820 | |
| 840 | − /* For multi touch */ | |
| 841 | − input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, | |
| 842 | − pdata->x_max, 0, 0); | |
| 843 | − input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, | |
| 844 | − pdata->y_max, 0, 0); | |
| 845 | − | |
| 821 | + zforce_ts_parse_legacy_properties(ts); | |
| 846 | 822 | touchscreen_parse_properties(input_dev, true, &ts->prop); |
| 847 | 823 | if (ts->prop.max_x == 0 || ts->prop.max_y == 0) { |
| 848 | 824 | dev_err(&client->dev, "no size specified\n"); |
| @@ -1,15 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0-only */ | |
| 2 | −/* drivers/input/touchscreen/zforce.c | |
| 3 | − * | |
| 4 | − * Copyright (C) 2012-2013 MundoReader S.L. | |
| 5 | − */ | |
| 6 | − | |
| 7 | −#ifndef _LINUX_INPUT_ZFORCE_TS_H | |
| 8 | −#define _LINUX_INPUT_ZFORCE_TS_H | |
| 9 | − | |
| 10 | −struct zforce_ts_platdata { | |
| 11 | − unsigned int x_max; | |
| 12 | − unsigned int y_max; | |
| 13 | −}; | |
| 14 | − | |
| 15 | −#endif /* _LINUX_INPUT_ZFORCE_TS_H */ | |