Re: [PATCH 1/3] tps6507x-ts: update to devm_* API
From: Yegor Yefremov <hidden>
Date: 2017-03-01 08:15:47
On Tue, Feb 28, 2017 at 7:57 PM, Dmitry Torokhov [off-list ref] wrote:
On Fri, Feb 24, 2017 at 04:42:24PM +0100, yegorslists@googlemail.com wrote:quoted
From: Yegor Yefremov <redacted> Update the code to use devm_* API so that driver core will manage resources. Signed-off-by: Yegor Yefremov <redacted> --- drivers/input/touchscreen/tps6507x-ts.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)diff --git a/drivers/input/touchscreen/tps6507x-ts.c b/drivers/input/touchscreen/tps6507x-ts.c index a340bfc..5bf1ec6 100644 --- a/drivers/input/touchscreen/tps6507x-ts.c +++ b/drivers/input/touchscreen/tps6507x-ts.c@@ -226,7 +226,7 @@ static int tps6507x_ts_probe(struct platform_device *pdev) */ init_data = tps_board->tps6507x_ts_init_data; - tsc = kzalloc(sizeof(struct tps6507x_ts), GFP_KERNEL); + tsc = devm_kzalloc(&pdev->dev, sizeof(struct tps6507x_ts), GFP_KERNEL);If you do this, why not use devm_input_allocate_polled_device() as well? Then you can get rid of tps6507x_ts_remove().
Will do. The less code the better. Yegor