Skip to content

Commit 8f97f8e

Browse files
diandersdtor
authored andcommitted
Input: cros_ec_keyb - cleanup use of dev
In cros_ec_keyb we stored "dev" in "struct cros_ec_keyb", but this was the EC's dev pointer and not the keyboard's. Let's clean this up to make it the keyboard's dev pointer. This could be useful in future patches but also has the nice effect of changing a few printouts to include the name of the keyboard device instead of the EC device, so we will see: [ 1.224648] cros-ec-keyb ff110000.spi:ec@0:keyboard-controller: valid_keys[00] = 0x14 instead of: [ 1.224505] cros-ec-spi spi0.0: valid_keys[00] = 0x14 Signed-off-by: Douglas Anderson <[email protected]> Signed-off-by: Brian Norris <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 0097ff3 commit 8f97f8e

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

drivers/input/keyboard/cros_ec_keyb.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static irqreturn_t cros_ec_keyb_irq(int irq, void *data)
186186
if (ret >= 0)
187187
cros_ec_keyb_process(ckdev, kb_state, ret);
188188
else
189-
dev_err(ec->dev, "failed to get keyboard state: %d\n", ret);
189+
dev_err(ckdev->dev, "failed to get keyboard state: %d\n", ret);
190190

191191
return IRQ_HANDLED;
192192
}
@@ -236,7 +236,7 @@ static void cros_ec_keyb_compute_valid_keys(struct cros_ec_keyb *ckdev)
236236
static int cros_ec_keyb_probe(struct platform_device *pdev)
237237
{
238238
struct cros_ec_device *ec = dev_get_drvdata(pdev->dev.parent);
239-
struct device *dev = ec->dev;
239+
struct device *dev = &pdev->dev;
240240
struct cros_ec_keyb *ckdev;
241241
struct input_dev *idev;
242242
struct device_node *np;
@@ -246,23 +246,22 @@ static int cros_ec_keyb_probe(struct platform_device *pdev)
246246
if (!np)
247247
return -ENODEV;
248248

249-
ckdev = devm_kzalloc(&pdev->dev, sizeof(*ckdev), GFP_KERNEL);
249+
ckdev = devm_kzalloc(dev, sizeof(*ckdev), GFP_KERNEL);
250250
if (!ckdev)
251251
return -ENOMEM;
252-
err = matrix_keypad_parse_of_params(&pdev->dev, &ckdev->rows,
253-
&ckdev->cols);
252+
err = matrix_keypad_parse_of_params(dev, &ckdev->rows, &ckdev->cols);
254253
if (err)
255254
return err;
256255

257-
ckdev->valid_keys = devm_kzalloc(&pdev->dev, ckdev->cols, GFP_KERNEL);
256+
ckdev->valid_keys = devm_kzalloc(dev, ckdev->cols, GFP_KERNEL);
258257
if (!ckdev->valid_keys)
259258
return -ENOMEM;
260259

261-
ckdev->old_kb_state = devm_kzalloc(&pdev->dev, ckdev->cols, GFP_KERNEL);
260+
ckdev->old_kb_state = devm_kzalloc(dev, ckdev->cols, GFP_KERNEL);
262261
if (!ckdev->old_kb_state)
263262
return -ENOMEM;
264263

265-
idev = devm_input_allocate_device(&pdev->dev);
264+
idev = devm_input_allocate_device(dev);
266265
if (!idev)
267266
return -ENOMEM;
268267

@@ -273,7 +272,7 @@ static int cros_ec_keyb_probe(struct platform_device *pdev)
273272

274273
ckdev->ec = ec;
275274
ckdev->dev = dev;
276-
dev_set_drvdata(&pdev->dev, ckdev);
275+
dev_set_drvdata(dev, ckdev);
277276

278277
idev->name = CROS_EC_DEV_NAME;
279278
idev->phys = ec->phys_name;
@@ -282,7 +281,7 @@ static int cros_ec_keyb_probe(struct platform_device *pdev)
282281
idev->id.bustype = BUS_VIRTUAL;
283282
idev->id.version = 1;
284283
idev->id.product = 0;
285-
idev->dev.parent = &pdev->dev;
284+
idev->dev.parent = dev;
286285
idev->open = cros_ec_keyb_open;
287286
idev->close = cros_ec_keyb_close;
288287

0 commit comments

Comments
 (0)