Input: regulator-haptic - drop platform data support and style fixes
Subsystems (2)
Dmitry Torokhov
maintainercover Input: regulator-haptic - drop platform data support and style fixes
This short series removes unused legacy platform data support and its header file from the regulator-haptic driver (as all users configure the device via Device Tree) and fixes minor coding style issues.
Thanks.
Dmitry Torokhov (2):
Input: regulator-haptic - drop platform data support
Input: regulator-haptic - fix coding style issues
drivers/input/misc/regulator-haptic.c | 29 ++++++------------- .../linux/platform_data/regulator-haptic.h | 26 ----------------- 2 files changed, 9 insertions(+), 46 deletions(-) delete mode 100644 include/linux/platform_data/regulator-haptic.h
Signature · 1 line
2.56.0.567.gdb80ae8cd5-goog
Dmitry Torokhov
maintainerPATCH 1/2 Input: regulator-haptic - drop platform data support
All users configure regulator-haptic devices via Device Tree, and there are no in-tree board files providing platform data. Remove platform data support, call regulator_haptic_parse_dt() directly from the probe routine, and remove the unused header file.
--- drivers/input/misc/regulator-haptic.c | 20 ++++---------- .../linux/platform_data/regulator-haptic.h | 26 ------------------- 2 files changed, 5 insertions(+), 41 deletions(-) delete mode 100644 include/linux/platform_data/regulator-haptic.h
drivers/input/misc/regulator-haptic.c +5 -15
@@ -10,7 +10,6 @@#include <linux/input.h> #include <linux/module.h> #include <linux/of.h> -#include <linux/platform_data/regulator-haptic.h> #include <linux/platform_device.h> #include <linux/regulator/consumer.h> #include <linux/slab.h>
@@ -112,8 +111,8 @@ static void regulator_haptic_close(struct input_dev *input)regulator_haptic_set_voltage (haptic,0 ); } -static int __maybe_unused -regulator_haptic_parse_dt (struct device *dev,struct regulator_haptic *haptic) +static int regulator_haptic_parse_dt (struct device *dev, +struct regulator_haptic *haptic) {struct device_node *node;int error;
@@ -141,7 +140,6 @@ regulator_haptic_parse_dt(struct device *dev, struct regulator_haptic *haptic)static int regulator_haptic_probe (struct platform_device *pdev) { -const struct regulator_haptic_data *pdata =dev_get_platdata (&pdev->dev);struct regulator_haptic *haptic;struct input_dev *input_dev;int error;
@@ -155,17 +153,9 @@ static int regulator_haptic_probe(struct platform_device *pdev)mutex_init (&haptic->mutex);INIT_WORK (&haptic->work, regulator_haptic_work); -if (pdata) { - haptic->max_volt = pdata->max_volt; - haptic->min_volt = pdata->min_volt; - }else if (IS_ENABLED (CONFIG_OF )) { - error =regulator_haptic_parse_dt (&pdev->dev, haptic); -if (error) -return error; - }else { -dev_err (&pdev->dev,"Missing platform data\n" ); -return -EINVAL ; - } + error =regulator_haptic_parse_dt (&pdev->dev, haptic); +if (error) +return error; haptic->regulator =devm_regulator_get_exclusive (&pdev->dev,"haptic" );if (IS_ERR (haptic->regulator)) {
include/linux/platform_data/regulator-haptic.h deleted +0 -26
@@ -1,26 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -* Regulator Haptic Platform Data -* -* Copyright (c) 2014 Samsung Electronics Co., Ltd. -* Author: Jaewon Kim <[email protected]> -* Author: Hyunhee Kim <[email protected]> -*/ - -#ifndef _REGULATOR_HAPTIC_H -#define _REGULATOR_HAPTIC_H - -/* -* struct regulator_haptic_data - Platform device data -* -* @max_volt: maximum voltage value supplied to the haptic motor. -* <The unit of the voltage is a micro> -* @min_volt: minimum voltage value supplied to the haptic motor. -* <The unit of the voltage is a micro> -*/ -struct regulator_haptic_data { -unsigned int max_volt; -unsigned int min_volt; -}; - -#endif /* _REGULATOR_HAPTIC_H */
Signature · 1 line
2.56.0.567.gdb80ae8cd5-goog
Dmitry Torokhov
maintainerPATCH 2/2 Input: regulator-haptic - fix coding style issues
In reply to Dmitry TorokhovFix minor coding style issues across the driver: add a comment explaining mutex purpose, drop an unnecessary blank line after an open brace, align function arguments with the open parenthesis, fix whitespace in conditional checks, and use a space instead of a tab in a return statement.
--- drivers/input/misc/regulator-haptic.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/input/misc/regulator-haptic.c +4 -5
@@ -23,7 +23,7 @@ struct regulator_haptic {struct regulator *regulator;struct work_struct work; -struct mutex mutex; +struct mutex mutex;/* serializes voltage updates and suspend/resume */ bool active;bool suspended;
@@ -38,7 +38,6 @@ static int regulator_haptic_toggle(struct regulator_haptic *haptic, bool on)int error;if (haptic->active != on) { - error = on ?regulator_enable (haptic->regulator) :regulator_disable (haptic->regulator);if (error) {
@@ -55,7 +54,7 @@ static int regulator_haptic_toggle(struct regulator_haptic *haptic, bool on) }static int regulator_haptic_set_voltage (struct regulator_haptic *haptic, -unsigned int magnitude) +unsigned int magnitude) {u64 volt_mag_multi;unsigned int intensity;
@@ -118,7 +117,7 @@ static int regulator_haptic_parse_dt(struct device *dev,int error; node = dev->of_node; -if (!node) { +if (!node) {dev_err (dev,"Missing device tree data\n" );return -EINVAL ; }
@@ -165,7 +164,7 @@ static int regulator_haptic_probe(struct platform_device *pdev) input_dev =devm_input_allocate_device (&pdev->dev);if (!input_dev) -return -ENOMEM ; +return -ENOMEM ; haptic->input_dev = input_dev; haptic->input_dev->name ="regulator-haptic" ;
Signature · 1 line
2.56.0.567.gdb80ae8cd5-goog
Dmitry Torokhov
maintainerQuoted 9 lines · Dmitry Torokhov
This short series removes unused legacy platform data support and its header file from the regulator-haptic driver (as all users configure the device via Device Tree) and fixes minor coding style issues.
Thanks.
Dmitry Torokhov (2):
Input: regulator-haptic - drop platform data support
Input: regulator-haptic - fix coding style issues
Applied the lot.
Signature · 1 line
Dmitry