From patchwork Mon Jul 25 18:43:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 9246329 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 69D066077C for ; Mon, 25 Jul 2016 18:44:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CB4920009 for ; Mon, 25 Jul 2016 18:44:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5006C20453; Mon, 25 Jul 2016 18:44:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C420920009 for ; Mon, 25 Jul 2016 18:44:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752818AbcGYSoP (ORCPT ); Mon, 25 Jul 2016 14:44:15 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:36696 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752610AbcGYSoO (ORCPT ); Mon, 25 Jul 2016 14:44:14 -0400 Received: by mail-pa0-f53.google.com with SMTP id pp5so63672639pac.3 for ; Mon, 25 Jul 2016 11:44:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=XJUA7Kaoc25DhB9gnx05kmXDoy6gUkm5myS+DS1bTQQ=; b=mibhWXB02qb0xZBFHZxBFiv+3UNE+UsxqNugNRlOCZdeQbaq0z6sZS/sG9FeZlWVSe FoKvHst92KK5b0eDnRBIyCKbfO76xXOU/3APtgaET41ip7Qpd9JDV6gT3fP7jd4c6/ui 60wRNNO1IzTw8YDRGWyvx/VndMT3DORAjwkEU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=XJUA7Kaoc25DhB9gnx05kmXDoy6gUkm5myS+DS1bTQQ=; b=VgMpjMaXppNawJKS8R4+4BGwERc6SecldhB7vBrcQIkLjv3eokkv5GeyxKKWEckw2+ aPbM43VbRtG0CFgJLXn0kWOcF7ikYXskFaqa6MgkUI2X9+yJQT/1PMpodXlcqeE7CntZ 12tGGpmIBendzsnV+hkTs8zxX4Z+iX6EwofjduxQgssJ76AYcY0+QrTeAWrTeeB8vOML 0ZNLvTuudS55A0kqNa1t2gc1lfEvpYIjx0MKoS/AVqknberpwhkrxFV4jv7kZIfbFDct 7YtOwYcXag5mdRPKr0ZZQduyuRECrenlIWT7VDDiUH5ECBIABQlP1yn35Kxodn+XtHLx sPzw== X-Gm-Message-State: AEkoouucFe5RL8J4BQGt4uEeApaQTy+/Y3qyDklgA4L1fOpXlIw0rtk8OOiA5/0Vewyk9oqv X-Received: by 10.66.54.35 with SMTP id g3mr31984073pap.30.1469472253899; Mon, 25 Jul 2016 11:44:13 -0700 (PDT) Received: from ban.mtv.corp.google.com ([172.22.64.120]) by smtp.gmail.com with ESMTPSA id dz13sm41975366pac.44.2016.07.25.11.44.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Jul 2016 11:44:13 -0700 (PDT) From: Brian Norris To: Dmitry Torokhov Cc: Brian Norris , linux-input@vger.kernel.org, , Douglas Anderson , Brian Norris Subject: [PATCH] Input: cros_ec_keyb - cleanup use of dev Date: Mon, 25 Jul 2016 11:43:48 -0700 Message-Id: <1469472228-58912-1-git-send-email-briannorris@chromium.org> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Douglas Anderson 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, which seems more technically correct. Signed-off-by: Douglas Anderson Signed-off-by: Brian Norris --- drivers/input/keyboard/cros_ec_keyb.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c index 6e48616a3a88..ab1b50152b86 100644 --- a/drivers/input/keyboard/cros_ec_keyb.c +++ b/drivers/input/keyboard/cros_ec_keyb.c @@ -186,7 +186,7 @@ static irqreturn_t cros_ec_keyb_irq(int irq, void *data) if (ret >= 0) cros_ec_keyb_process(ckdev, kb_state, ret); 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; } @@ -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) { 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 input_dev *idev; struct device_node *np; @@ -246,23 +246,22 @@ static int cros_ec_keyb_probe(struct platform_device *pdev) if (!np) return -ENODEV; - ckdev = devm_kzalloc(&pdev->dev, sizeof(*ckdev), GFP_KERNEL); + ckdev = devm_kzalloc(dev, sizeof(*ckdev), GFP_KERNEL); if (!ckdev) return -ENOMEM; - err = matrix_keypad_parse_of_params(&pdev->dev, &ckdev->rows, - &ckdev->cols); + err = matrix_keypad_parse_of_params(dev, &ckdev->rows, &ckdev->cols); if (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) 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) return -ENOMEM; - idev = devm_input_allocate_device(&pdev->dev); + idev = devm_input_allocate_device(dev); if (!idev) return -ENOMEM; @@ -273,7 +272,7 @@ static int cros_ec_keyb_probe(struct platform_device *pdev) ckdev->ec = ec; ckdev->dev = dev; - dev_set_drvdata(&pdev->dev, ckdev); + dev_set_drvdata(dev, ckdev); idev->name = CROS_EC_DEV_NAME; idev->phys = ec->phys_name; @@ -282,7 +281,7 @@ static int cros_ec_keyb_probe(struct platform_device *pdev) idev->id.bustype = BUS_VIRTUAL; idev->id.version = 1; idev->id.product = 0; - idev->dev.parent = &pdev->dev; + idev->dev.parent = dev; idev->open = cros_ec_keyb_open; idev->close = cros_ec_keyb_close;