--- zzzz-none-000/linux-3.10.107/drivers/input/touchscreen/intel-mid-touch.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/input/touchscreen/intel-mid-touch.c 2021-02-04 17:41:59.000000000 +0000 @@ -27,7 +27,6 @@ */ #include -#include #include #include #include @@ -37,6 +36,7 @@ #include #include #include +#include /* PMIC Interrupt registers */ #define PMIC_REG_ID1 0x00 /* PMIC ID1 register */ @@ -581,12 +581,17 @@ return -EINVAL; } - tsdev = kzalloc(sizeof(struct mrstouch_dev), GFP_KERNEL); - input = input_allocate_device(); - if (!tsdev || !input) { + tsdev = devm_kzalloc(&pdev->dev, sizeof(struct mrstouch_dev), + GFP_KERNEL); + if (!tsdev) { dev_err(&pdev->dev, "unable to allocate memory\n"); - err = -ENOMEM; - goto err_free_mem; + return -ENOMEM; + } + + input = devm_input_allocate_device(&pdev->dev); + if (!input) { + dev_err(&pdev->dev, "unable to allocate input device\n"); + return -ENOMEM; } tsdev->dev = &pdev->dev; @@ -599,7 +604,7 @@ err = mrstouch_adc_init(tsdev); if (err) { dev_err(&pdev->dev, "ADC initialization failed\n"); - goto err_free_mem; + return err; } input->name = "mrst_touchscreen"; @@ -619,50 +624,28 @@ input_set_abs_params(tsdev->input, ABS_PRESSURE, MRST_PRESSURE_MIN, MRST_PRESSURE_MAX, 0, 0); - err = request_threaded_irq(tsdev->irq, NULL, mrstouch_pendet_irq, - IRQF_ONESHOT, "mrstouch", tsdev); + err = devm_request_threaded_irq(&pdev->dev, tsdev->irq, NULL, + mrstouch_pendet_irq, IRQF_ONESHOT, + "mrstouch", tsdev); if (err) { dev_err(tsdev->dev, "unable to allocate irq\n"); - goto err_free_mem; + return err; } err = input_register_device(tsdev->input); if (err) { dev_err(tsdev->dev, "unable to register input device\n"); - goto err_free_irq; + return err; } - platform_set_drvdata(pdev, tsdev); - return 0; - -err_free_irq: - free_irq(tsdev->irq, tsdev); -err_free_mem: - input_free_device(input); - kfree(tsdev); - return err; -} - -static int mrstouch_remove(struct platform_device *pdev) -{ - struct mrstouch_dev *tsdev = platform_get_drvdata(pdev); - - free_irq(tsdev->irq, tsdev); - input_unregister_device(tsdev->input); - kfree(tsdev); - - platform_set_drvdata(pdev, NULL); - return 0; } static struct platform_driver mrstouch_driver = { .driver = { .name = "pmic_touch", - .owner = THIS_MODULE, }, .probe = mrstouch_probe, - .remove = mrstouch_remove, }; module_platform_driver(mrstouch_driver);