mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 00:04:15 +08:00
Input: bu21029_ts - use local 'client->dev' variable in probe()
'dev' is shorter and simpler than '&client->dev' and in few cases it allows to skip line wrapping. Probe function uses '&client->dev' a lot, so this improves readability slightly. Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20230625162817.100397-25-krzysztof.kozlowski@linaro.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
parent
2bdb1a9a8a
commit
59a51ba6e9
@ -333,6 +333,7 @@ static void bu21029_stop_chip(struct input_dev *dev)
|
||||
|
||||
static int bu21029_probe(struct i2c_client *client)
|
||||
{
|
||||
struct device *dev = &client->dev;
|
||||
struct bu21029_ts_data *bu21029;
|
||||
struct input_dev *in_dev;
|
||||
int error;
|
||||
@ -341,37 +342,33 @@ static int bu21029_probe(struct i2c_client *client)
|
||||
I2C_FUNC_SMBUS_WRITE_BYTE |
|
||||
I2C_FUNC_SMBUS_WRITE_BYTE_DATA |
|
||||
I2C_FUNC_SMBUS_READ_I2C_BLOCK)) {
|
||||
dev_err(&client->dev,
|
||||
"i2c functionality support is not sufficient\n");
|
||||
dev_err(dev, "i2c functionality support is not sufficient\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
bu21029 = devm_kzalloc(&client->dev, sizeof(*bu21029), GFP_KERNEL);
|
||||
bu21029 = devm_kzalloc(dev, sizeof(*bu21029), GFP_KERNEL);
|
||||
if (!bu21029)
|
||||
return -ENOMEM;
|
||||
|
||||
error = device_property_read_u32(&client->dev, "rohm,x-plate-ohms",
|
||||
&bu21029->x_plate_ohms);
|
||||
error = device_property_read_u32(dev, "rohm,x-plate-ohms", &bu21029->x_plate_ohms);
|
||||
if (error) {
|
||||
dev_err(&client->dev,
|
||||
"invalid 'x-plate-ohms' supplied: %d\n", error);
|
||||
dev_err(dev, "invalid 'x-plate-ohms' supplied: %d\n", error);
|
||||
return error;
|
||||
}
|
||||
|
||||
bu21029->vdd = devm_regulator_get(&client->dev, "vdd");
|
||||
bu21029->vdd = devm_regulator_get(dev, "vdd");
|
||||
if (IS_ERR(bu21029->vdd))
|
||||
return dev_err_probe(&client->dev, PTR_ERR(bu21029->vdd),
|
||||
return dev_err_probe(dev, PTR_ERR(bu21029->vdd),
|
||||
"failed to acquire 'vdd' supply\n");
|
||||
|
||||
bu21029->reset_gpios = devm_gpiod_get_optional(&client->dev,
|
||||
"reset", GPIOD_OUT_HIGH);
|
||||
bu21029->reset_gpios = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
|
||||
if (IS_ERR(bu21029->reset_gpios))
|
||||
return dev_err_probe(&client->dev, PTR_ERR(bu21029->reset_gpios),
|
||||
return dev_err_probe(dev, PTR_ERR(bu21029->reset_gpios),
|
||||
"failed to acquire 'reset' gpio\n");
|
||||
|
||||
in_dev = devm_input_allocate_device(&client->dev);
|
||||
in_dev = devm_input_allocate_device(dev);
|
||||
if (!in_dev) {
|
||||
dev_err(&client->dev, "unable to allocate input device\n");
|
||||
dev_err(dev, "unable to allocate input device\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -392,20 +389,18 @@ static int bu21029_probe(struct i2c_client *client)
|
||||
|
||||
input_set_drvdata(in_dev, bu21029);
|
||||
|
||||
error = devm_request_threaded_irq(&client->dev, client->irq,
|
||||
NULL, bu21029_touch_soft_irq,
|
||||
error = devm_request_threaded_irq(dev, client->irq, NULL,
|
||||
bu21029_touch_soft_irq,
|
||||
IRQF_ONESHOT | IRQF_NO_AUTOEN,
|
||||
DRIVER_NAME, bu21029);
|
||||
if (error) {
|
||||
dev_err(&client->dev,
|
||||
"unable to request touch irq: %d\n", error);
|
||||
dev_err(dev, "unable to request touch irq: %d\n", error);
|
||||
return error;
|
||||
}
|
||||
|
||||
error = input_register_device(in_dev);
|
||||
if (error) {
|
||||
dev_err(&client->dev,
|
||||
"unable to register input device: %d\n", error);
|
||||
dev_err(dev, "unable to register input device: %d\n", error);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user