Commit 8f97f8e5 authored by Douglas Anderson's avatar Douglas Anderson Committed by Dmitry Torokhov

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: default avatarDouglas Anderson <dianders@chromium.org>
Signed-off-by: default avatarBrian Norris <briannorris@chromium.org>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 0097ff3d
...@@ -186,7 +186,7 @@ static irqreturn_t cros_ec_keyb_irq(int irq, void *data) ...@@ -186,7 +186,7 @@ static irqreturn_t cros_ec_keyb_irq(int irq, void *data)
if (ret >= 0) if (ret >= 0)
cros_ec_keyb_process(ckdev, kb_state, ret); cros_ec_keyb_process(ckdev, kb_state, ret);
else else
dev_err(ec->dev, "failed to get keyboard state: %d\n", ret); dev_err(ckdev->dev, "failed to get keyboard state: %d\n", ret);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -236,7 +236,7 @@ static void cros_ec_keyb_compute_valid_keys(struct cros_ec_keyb *ckdev) ...@@ -236,7 +236,7 @@ static void cros_ec_keyb_compute_valid_keys(struct cros_ec_keyb *ckdev)
static int cros_ec_keyb_probe(struct platform_device *pdev) static int cros_ec_keyb_probe(struct platform_device *pdev)
{ {
struct cros_ec_device *ec = dev_get_drvdata(pdev->dev.parent); struct cros_ec_device *ec = dev_get_drvdata(pdev->dev.parent);
struct device *dev = ec->dev; struct device *dev = &pdev->dev;
struct cros_ec_keyb *ckdev; struct cros_ec_keyb *ckdev;
struct input_dev *idev; struct input_dev *idev;
struct device_node *np; struct device_node *np;
...@@ -246,23 +246,22 @@ static int cros_ec_keyb_probe(struct platform_device *pdev) ...@@ -246,23 +246,22 @@ static int cros_ec_keyb_probe(struct platform_device *pdev)
if (!np) if (!np)
return -ENODEV; return -ENODEV;
ckdev = devm_kzalloc(&pdev->dev, sizeof(*ckdev), GFP_KERNEL); ckdev = devm_kzalloc(dev, sizeof(*ckdev), GFP_KERNEL);
if (!ckdev) if (!ckdev)
return -ENOMEM; return -ENOMEM;
err = matrix_keypad_parse_of_params(&pdev->dev, &ckdev->rows, err = matrix_keypad_parse_of_params(dev, &ckdev->rows, &ckdev->cols);
&ckdev->cols);
if (err) if (err)
return err; return err;
ckdev->valid_keys = devm_kzalloc(&pdev->dev, ckdev->cols, GFP_KERNEL); ckdev->valid_keys = devm_kzalloc(dev, ckdev->cols, GFP_KERNEL);
if (!ckdev->valid_keys) if (!ckdev->valid_keys)
return -ENOMEM; return -ENOMEM;
ckdev->old_kb_state = devm_kzalloc(&pdev->dev, ckdev->cols, GFP_KERNEL); ckdev->old_kb_state = devm_kzalloc(dev, ckdev->cols, GFP_KERNEL);
if (!ckdev->old_kb_state) if (!ckdev->old_kb_state)
return -ENOMEM; return -ENOMEM;
idev = devm_input_allocate_device(&pdev->dev); idev = devm_input_allocate_device(dev);
if (!idev) if (!idev)
return -ENOMEM; return -ENOMEM;
...@@ -273,7 +272,7 @@ static int cros_ec_keyb_probe(struct platform_device *pdev) ...@@ -273,7 +272,7 @@ static int cros_ec_keyb_probe(struct platform_device *pdev)
ckdev->ec = ec; ckdev->ec = ec;
ckdev->dev = dev; ckdev->dev = dev;
dev_set_drvdata(&pdev->dev, ckdev); dev_set_drvdata(dev, ckdev);
idev->name = CROS_EC_DEV_NAME; idev->name = CROS_EC_DEV_NAME;
idev->phys = ec->phys_name; idev->phys = ec->phys_name;
...@@ -282,7 +281,7 @@ static int cros_ec_keyb_probe(struct platform_device *pdev) ...@@ -282,7 +281,7 @@ static int cros_ec_keyb_probe(struct platform_device *pdev)
idev->id.bustype = BUS_VIRTUAL; idev->id.bustype = BUS_VIRTUAL;
idev->id.version = 1; idev->id.version = 1;
idev->id.product = 0; idev->id.product = 0;
idev->dev.parent = &pdev->dev; idev->dev.parent = dev;
idev->open = cros_ec_keyb_open; idev->open = cros_ec_keyb_open;
idev->close = cros_ec_keyb_close; idev->close = cros_ec_keyb_close;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment