From patchwork Wed Feb 9 04:50:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 12739603 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0BEA2F21 for ; Wed, 9 Feb 2022 04:50:46 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id b64-20020a256743000000b0061e169a5f19so2005640ybc.11 for ; Tue, 08 Feb 2022 20:50:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=TGpw6JCsUI7vu1URJQ/M4DQvG2LRyayAZSrFB0JmYO4=; b=SzvTI08/YVzNPp2ar5Amf2aF9ZgwdEpnZQrfgczpI0RRlxmM4KXPbouwxO02NZ5t2u klTA0+ffQHl9PcyfFhS53pMKxbJBioyuJTs8Ujhy2HNSbNZJk2xaMucX+24hzHSDHJpJ NPLjb7ogM/Pn6P4K8u/fgl8szlAm1zBpBVmLBYYd60RqhjtGASk+FL04vWx+15s9AFE7 StB5vWSWlbp6of1f41Gqe8sP11CPEaVY87Yh+d8fsuO7lzbyHuQpxrzECcgQPutWLXi0 ygU2z37KwSQaDQGOAwgrbX2Ikt1l546kXqkE/nVg9lJWytIRRDtZiu3D1oi8cd+EoenI eB0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=TGpw6JCsUI7vu1URJQ/M4DQvG2LRyayAZSrFB0JmYO4=; b=rmB5DHHiVnT3JOzJ2CFCjndYB03POc/fmunAv5nQN+rnfaejDaRZJ+CNRkE4JasriF sCDV53wjWo7QuHT4f15256wAL1WI54UWrWOIKUCkXGJvR9HnGGJI1bn9ADYPyafjTmjj sgAICojqF6MUFyFkhtm38nSVmY7axE6CAGHeFLUmjFVjWHeJoMz4NMu72CEiWaikMTYL AGO7B55q0sbnZ676DInaV8cTbvKmFiWgd29El62BsZEv5/o6Q916vHn9+7eLbNetPiNG OJ+Smttmu/VgOVZm7+x8wn2z6ayFPMUYkgeKtC/VWyLS7nuUDlOlPO1K53w5RMwBJba7 CV0Q== X-Gm-Message-State: AOAM532eEjo4cuOxjupwKxdkOo+9lID5P4+UFgLyNA3DCuykX7LaPyO2 QKd4mWu1AP6wMR+RGRvVlm65iGeqtwrz X-Google-Smtp-Source: ABdhPJzTAoODqzH9hCVzIOtQGHhxyKQqYRNWifDqN3g4kj1kVm25ERwdjC//JrOXy7m9NDxncasizPkdQM+A X-Received: from tzungbi-z840.tpe.corp.google.com ([2401:fa00:1:10:4b6f:f14d:be50:86a]) (user=tzungbi job=sendgmr) by 2002:a81:364f:: with SMTP id d76mr474530ywa.406.1644382245868; Tue, 08 Feb 2022 20:50:45 -0800 (PST) Date: Wed, 9 Feb 2022 12:50:30 +0800 In-Reply-To: <20220209045035.380615-1-tzungbi@google.com> Message-Id: <20220209045035.380615-2-tzungbi@google.com> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20220209045035.380615-1-tzungbi@google.com> X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog Subject: [PATCH v2 1/6] platform/chrome: cros_ec: fix error handling in cros_ec_register() From: Tzung-Bi Shih To: bleung@chromium.org, groeck@chromium.org Cc: chrome-platform@lists.linux.dev, tzungbi@google.com Fix cros_ec_register() doesn't unregister platform devices if blocking_notifier_chain_register() fails. Also use the single exit path to handle the platform device unregistration. This fix depends on the fact that all the callers of cros_ec_register() allocate zeroed memory. Fixes: 42cd0ab476e2 ("platform/chrome: cros_ec: Query EC protocol version if EC transitions between RO/RW") Signed-off-by: Tzung-Bi Shih --- drivers/platform/chrome/cros_ec.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c index fc5aa1525d13..7ce667ff08e0 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -245,18 +245,16 @@ int cros_ec_register(struct cros_ec_device *ec_dev) if (IS_ERR(ec_dev->pd)) { dev_err(ec_dev->dev, "Failed to create CrOS PD platform device\n"); - platform_device_unregister(ec_dev->ec); - return PTR_ERR(ec_dev->pd); + err = PTR_ERR(ec_dev->pd); + goto exit; } } if (IS_ENABLED(CONFIG_OF) && dev->of_node) { err = devm_of_platform_populate(dev); if (err) { - platform_device_unregister(ec_dev->pd); - platform_device_unregister(ec_dev->ec); dev_err(dev, "Failed to register sub-devices\n"); - return err; + goto exit; } } @@ -278,7 +276,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev) err = blocking_notifier_chain_register(&ec_dev->event_notifier, &ec_dev->notifier_ready); if (err) - return err; + goto exit; } dev_info(dev, "Chrome EC device registered\n"); @@ -291,6 +289,12 @@ int cros_ec_register(struct cros_ec_device *ec_dev) cros_ec_irq_thread(0, ec_dev); return 0; +exit: + if (!IS_ERR_OR_NULL(ec_dev->pd)) + platform_device_unregister(ec_dev->pd); + if (!IS_ERR_OR_NULL(ec_dev->ec)) + platform_device_unregister(ec_dev->ec); + return err; } EXPORT_SYMBOL(cros_ec_register); From patchwork Wed Feb 9 04:50:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 12739604 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9883229CA for ; Wed, 9 Feb 2022 04:50:50 +0000 (UTC) Received: by mail-pj1-f73.google.com with SMTP id n9-20020a17090a73c900b001b5cafefa27so955241pjk.2 for ; Tue, 08 Feb 2022 20:50:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=hiaEEl8bksaecRkgyTL7gJID3dXR4jWaEsiI7nesU2A=; b=SLwJlCNfDVrERxV3KVLYCRVs9OuOaJ/+pXloZdDk7PyosNGrY0tAbuJWQr3RIV4uE1 ICjv377W2f5z8NaZjeYjP2nooHtcU/n9TZxnVzh1WkOanAF2wAEk/p2MIKI0U9r/boKF go2jQL9x1Obahde5DMscxtJ73DiFBMGW/b/rsPovouZ6URrCPZM1x5dn7tn2i6tD3BN0 lUl2OCdb3xMw6GVeB4MlvUjE4OZbE2b+dTy7iF3x9DLogIDRvabkyont9Gk/8QgEGVnz FZYQAh3fTCKq1w+0wD9QYHPCKwyU+yT2qngAtQNQ4O3YRD6hMRWzvuC8Fb4Vnchg1NYJ 8wFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=hiaEEl8bksaecRkgyTL7gJID3dXR4jWaEsiI7nesU2A=; b=q8aqbHYDP6Zrtv+48VLKjnFAdtoTDTzQNGnZ3q35+lila9uaxLUbxC9SEf8dqYM8mc 2PjnX5G8M9hcXa4n1PS7vW+tnhoTGy1rU8yvkjf6WWTYQkoxDePxVs+rCFnkc9/K/Sc3 BMxeHe+GT8YH6WNA7CxvOTg3lqGZ/ilTHMqeoM/B7aLibINhS5H1N0jeSUUyEI1r839b MjUh9BuOfryfQNXsufWPoypktWNOxlaRM8bJ7JdTiy3G+TwG6NfW5OxEiS7BuIxuamNj jGiIliblLAIeyNa9gf+wt+KKLXRh8zJyUUGw8xSq08L+xIi7mVnsIHSnot5EtNfSovXL 5kvw== X-Gm-Message-State: AOAM530y5Kpdwq47o4W02ghdCdLRgRixpZW5VH387cQ5qaQez8fTkkIs NecBU7A9Sc/RElpA7pGKJNb6UQzxftAB X-Google-Smtp-Source: ABdhPJy1dbFk4ggAppsMVvoyDeOhoQGS5Tm1MsSApeVo/23yMvIkcCjFQdWCr+UmyGmbx3Kxm33qtFwrVh7R X-Received: from tzungbi-z840.tpe.corp.google.com ([2401:fa00:1:10:4b6f:f14d:be50:86a]) (user=tzungbi job=sendgmr) by 2002:a17:903:41d0:: with SMTP id u16mr523179ple.144.1644382249855; Tue, 08 Feb 2022 20:50:49 -0800 (PST) Date: Wed, 9 Feb 2022 12:50:31 +0800 In-Reply-To: <20220209045035.380615-1-tzungbi@google.com> Message-Id: <20220209045035.380615-3-tzungbi@google.com> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20220209045035.380615-1-tzungbi@google.com> X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog Subject: [PATCH v2 2/6] platform/chrome: cros_ec: remove unused variable `was_wake_device` From: Tzung-Bi Shih To: bleung@chromium.org, groeck@chromium.org Cc: chrome-platform@lists.linux.dev, tzungbi@google.com `was_wake_device` is unused. Remove it. Signed-off-by: Tzung-Bi Shih Reviewed-by: Prashant Malani --- drivers/platform/chrome/cros_ec.c | 1 - include/linux/platform_data/cros_ec_proto.h | 3 --- 2 files changed, 4 deletions(-) diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c index 7ce667ff08e0..303af630c03e 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -344,7 +344,6 @@ int cros_ec_suspend(struct cros_ec_device *ec_dev) ec_dev->wake_enabled = !enable_irq_wake(ec_dev->irq); disable_irq(ec_dev->irq); - ec_dev->was_wake_device = ec_dev->wake_enabled; ec_dev->suspended = true; return 0; diff --git a/include/linux/platform_data/cros_ec_proto.h b/include/linux/platform_data/cros_ec_proto.h index df3c78c92ca2..c65971ec90ea 100644 --- a/include/linux/platform_data/cros_ec_proto.h +++ b/include/linux/platform_data/cros_ec_proto.h @@ -76,8 +76,6 @@ struct cros_ec_command { * struct cros_ec_device - Information about a ChromeOS EC device. * @phys_name: Name of physical comms layer (e.g. 'i2c-4'). * @dev: Device pointer for physical comms device - * @was_wake_device: True if this device was set to wake the system from - * sleep at the last suspend. * @cros_class: The class structure for this device. * @cmd_readmem: Direct read of the EC memory-mapped region, if supported. * @offset: Is within EC_LPC_ADDR_MEMMAP region. @@ -137,7 +135,6 @@ struct cros_ec_device { /* These are used by other drivers that want to talk to the EC */ const char *phys_name; struct device *dev; - bool was_wake_device; struct class *cros_class; int (*cmd_readmem)(struct cros_ec_device *ec, unsigned int offset, unsigned int bytes, void *dest); From patchwork Wed Feb 9 04:50:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 12739605 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A7E82C80 for ; Wed, 9 Feb 2022 04:50:54 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id z15-20020a25bb0f000000b00613388c7d99so2479470ybg.8 for ; Tue, 08 Feb 2022 20:50:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=nCp6s4nr1Xud5CTQ+VIlWSD+FKpfYJQlQboKMSin5u4=; b=PmG67QHwG12X6WVc59SCtrxEsxp0NHt+0/sf7IYEqhyTTLMpbAlGml2df2jy4f+wXy FgRtsss/i4V5TXdqoU6ZZK6MBTHSxXTEj3Y2kGpbXdRFFvCLKXA0+4lKwQrjFgYUedU2 COLR/hXysFpfR0DHU1hAH5Uikip0iOb/shrOUC5FWbiGgQ39/2rm4M++N59C2sC2qOBr kzLx4O8JGLbV6xy5GMAJHxUo7ER+ncMHdno4AstS9qmwUpPmDbamqlBAqs7X0MhozUFm vQoJHqJsXKyxn/MqXwSDnrjYPpUCY+ejzTMrPcswJ7gSs3hnWCX84gLyEcSDPniUq+vy ZvyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=nCp6s4nr1Xud5CTQ+VIlWSD+FKpfYJQlQboKMSin5u4=; b=B4yT7oHjlq8BpkXNWo6792uwY/XWE8WJxmDNmTxm2Wwy+NRBEpk3Q5IN0CeeAFlKIp N1fYZiXDP5Z5t8RlcyacVs6DnALzmuzyuhOMtRfrMkHJvjZ8QmNmjSlp6kuvRsy3VZGi tGQ+LS+G+CJ44rQiWWZHlGO/+yRTaL/VqjYQuuO5qGD5Zhcs+rVAHFYBG33bx0x1fA5M LBoYNXjZCdRNf3n/3IDj5jm2NiPukzZeF58U774S91J7iQ/tZVNf50zUn74fLSsvpHd1 CEl4xpwsu9oxiKTD3bpac80u7WDgXTmT0TALOrba2fBXxq/cfdOMEdVb5S/8gKigIAfK qe6w== X-Gm-Message-State: AOAM532k/+ALXf5UdUz8c6BDuh7n1O2ug1fTO2nRN9xowcJ41tCSOnm/ 1V857pOecm9bY5sxUJHkdkhNEVdk/Pgp X-Google-Smtp-Source: ABdhPJyTV7Gw0YbC6bHqcu3AaOBFSpFFAPqYAOk8AQ9thEsV42gywCIoACXGz8SU3caIzyPvKsfbhYqRQtn4 X-Received: from tzungbi-z840.tpe.corp.google.com ([2401:fa00:1:10:4b6f:f14d:be50:86a]) (user=tzungbi job=sendgmr) by 2002:a05:6902:8f:: with SMTP id h15mr603267ybs.537.1644382253743; Tue, 08 Feb 2022 20:50:53 -0800 (PST) Date: Wed, 9 Feb 2022 12:50:32 +0800 In-Reply-To: <20220209045035.380615-1-tzungbi@google.com> Message-Id: <20220209045035.380615-4-tzungbi@google.com> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20220209045035.380615-1-tzungbi@google.com> X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog Subject: [PATCH v2 3/6] platform/chrome: cros_ec: determine `wake_enabled` in cros_ec_suspend() From: Tzung-Bi Shih To: bleung@chromium.org, groeck@chromium.org Cc: chrome-platform@lists.linux.dev, tzungbi@google.com `wake_enabled` indicates cros_ec_resume() needs to call disable_irq_wake() to undo enable_irq_wake() in cros_ec_suspend(). Determine `wake_enabled` in cros_ec_suspend() instead of reset-after-used in cros_ec_resume(). Signed-off-by: Tzung-Bi Shih --- drivers/platform/chrome/cros_ec.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c index 303af630c03e..a97a47ae0472 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -342,6 +342,8 @@ int cros_ec_suspend(struct cros_ec_device *ec_dev) if (device_may_wakeup(dev)) ec_dev->wake_enabled = !enable_irq_wake(ec_dev->irq); + else + ec_dev->wake_enabled = false; disable_irq(ec_dev->irq); ec_dev->suspended = true; @@ -383,10 +385,9 @@ int cros_ec_resume(struct cros_ec_device *ec_dev) dev_dbg(ec_dev->dev, "Error %d sending resume event to ec", ret); - if (ec_dev->wake_enabled) { + if (ec_dev->wake_enabled) disable_irq_wake(ec_dev->irq); - ec_dev->wake_enabled = 0; - } + /* * Let the mfd devices know about events that occur during * suspend. This way the clients know what to do with them. From patchwork Wed Feb 9 04:50:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 12739606 Received: from mail-oo1-f74.google.com (mail-oo1-f74.google.com [209.85.161.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AEB472C80 for ; Wed, 9 Feb 2022 04:50:58 +0000 (UTC) Received: by mail-oo1-f74.google.com with SMTP id c124-20020a4a4f82000000b002fb4087a29fso679448oob.20 for ; Tue, 08 Feb 2022 20:50:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=RHk25DN0/ZfupdswNUXEUVlZfAqqSfGu21RsrAB7jvs=; b=oFs43K4uwJcIV6HaNiwRQyuGq4ivTrIXJGtPq5D3iZpyvEFtXDFtB/d2jFPTnRsQfy vG6jkgUL/FVKJlIZMyuBDUJQWTl150msIKzHRUUmc0TlE4r3PQstc/0NrsJNFW8GCRrg f/jt1JhEBmGAwvARXf2+yu1X9ffEcefv89AdRepFa1zkd1GigPhL0u9uTyCpm0hlfAYu JfPCad1vUGp6vxUAbddjrxyu4QGo0SMW4hzSOVxu0tk48VlEp7erHHAPTP5waC/RJuD0 lZ6mB3/OBOlwDdfmJMOWrgRg9/mPo40UPzdnftcsGQ+VFAnLGMOsz1mI7vmERxw0MBes GeDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=RHk25DN0/ZfupdswNUXEUVlZfAqqSfGu21RsrAB7jvs=; b=rUsKbJe/+3l/4GCu3z0/gsAMiyqUNVZWhz1fROO8RFeAadLxQKAboMDGLC9f4EtsBk Xizakev6AWsKMQ7wO7BY5MNjeKbbrXNd87PkEDlcE3UrIioBNZJ5yFl5Yd9wdOO6SA1W Nwv+6Jb5MDWGO0xjfObI8D5zHDW4OHU98g9BMZhoZYsGyol5OFU6daxGLHLBsVn23jxs Db9PPsV/Pe2PH/m2udLAPgYq3AeSMM1CzTG2QW9qcJOBx/sX+DMOAxH7CYtfXJ4CVCdO oYaHd+X7pSbH7JNSqNUqD94IccSMM0eBnB9EwiwOx5IJGN5M10N5rK1EPnnkNkKS5rjP xU6w== X-Gm-Message-State: AOAM531MqyQMThmxc9WrZu1GTvQfmdOEUIcwrkLcnxrbQwNsvbRWJZ10 oQJLYbW3jCLmdy6TMhFreDfED/p/nr5K X-Google-Smtp-Source: ABdhPJz4nczjbNCzYcIv7E3rjuJKjoz6FJjY/rCeWNnx7Ub1qcIS1XluXx7bODLU129gTbfuY1RvgOJmqIeJ X-Received: from tzungbi-z840.tpe.corp.google.com ([2401:fa00:1:10:4b6f:f14d:be50:86a]) (user=tzungbi job=sendgmr) by 2002:aca:c008:: with SMTP id q8mr215786oif.236.1644382257694; Tue, 08 Feb 2022 20:50:57 -0800 (PST) Date: Wed, 9 Feb 2022 12:50:33 +0800 In-Reply-To: <20220209045035.380615-1-tzungbi@google.com> Message-Id: <20220209045035.380615-5-tzungbi@google.com> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20220209045035.380615-1-tzungbi@google.com> X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog Subject: [PATCH v2 4/6] platform/chrome: cros_ec: don't initialize `err` in cros_ec_register() From: Tzung-Bi Shih To: bleung@chromium.org, groeck@chromium.org Cc: chrome-platform@lists.linux.dev, tzungbi@google.com `err` in cros_ec_register() doesn't need to be initialized. Signed-off-by: Tzung-Bi Shih --- drivers/platform/chrome/cros_ec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c index a97a47ae0472..c2105621b368 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -182,7 +182,7 @@ static int cros_ec_ready_event(struct notifier_block *nb, int cros_ec_register(struct cros_ec_device *ec_dev) { struct device *dev = ec_dev->dev; - int err = 0; + int err; BLOCKING_INIT_NOTIFIER_HEAD(&ec_dev->event_notifier); From patchwork Wed Feb 9 04:50:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 12739607 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6785A2C80 for ; Wed, 9 Feb 2022 04:51:02 +0000 (UTC) Received: by mail-pl1-f202.google.com with SMTP id p16-20020a170902a41000b0014992c5d56bso932107plq.19 for ; Tue, 08 Feb 2022 20:51:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=koQ2tHBjNS8/f2hzlZMkuTgOUCTplJaQ9J/1YczOYVg=; b=i8vNqQgcJj3UfDn3QYEYqFXf0Qh46q9yiKYDz/8T3NDL+SGuPipiju1MDYGk+GOT8g nrP7lk/MsJX5zDOiepdgryOIpHvqMap6P+t7gLaaLD4QzFh4Dih4oNS4kKb4M1EMzLLe Nq1i88yEoVPxrYQEIRD9yxeAkySqHAZOGBAxQSlnNtq87GLjdyfn/B+K5DISuD7kLAkH viZPhxDiGzD7sFrKxc2DCtauHHvEXBfXOtd++YiB59QJ10V5aGNGTwEAeKEF9/Ca0S3N c2TtALRCrr9dKmbmbeigQ2IV9Nqht4dBMjuEUH4NeIYGy3p/ydukrULLezz7N1n6BdSN LVkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=koQ2tHBjNS8/f2hzlZMkuTgOUCTplJaQ9J/1YczOYVg=; b=Vu3deL6WXPa7mkGwzqDo3QXeXo0ljODK5lmzgE+IrL2tLbTTJQTk8ouZDQlz46Ib0Z yeagtIRxLIL3/YYeGLuv+iNwZHSzVh30CZ6jNBs418Gy/UpIQ61TcgsjfaoDpXYL2FEh 4J5xFfqUSpezfIT5f1l4q1MW+QbpIwMg6jxlZHKEyD9o2j78TqK2kEsMu3WZ6Kfa28M6 FKGPWKu3lIaoi4j/xBb+bb5wbCopert5qfaWvtSfEa/f2f2L7j6ooiRSLpvcOJ3iOimg 8x7h+rF8VYUZ3VX6G287p0094rwVhRPTBcFfXt8WYn4I011A5zyy+/RdhB+x3fkkZRcq 0fIQ== X-Gm-Message-State: AOAM530nFGLjCvoShaJBx4Y3gOXFjtpsGRFO8ZEuh6Cg/v8iflL+YfK7 Z7Kps2kWTOra+/mYlTm3msMcJIzstncl X-Google-Smtp-Source: ABdhPJy6HT4kXGiOtOfWQWXFAaVyETsyOVTwJ7QyVelnSzuwjpMmRKsY7ETQn//vN2RvHeQ10Ffaan/HILA5 X-Received: from tzungbi-z840.tpe.corp.google.com ([2401:fa00:1:10:4b6f:f14d:be50:86a]) (user=tzungbi job=sendgmr) by 2002:a17:90b:4c8e:: with SMTP id my14mr240462pjb.0.1644382261659; Tue, 08 Feb 2022 20:51:01 -0800 (PST) Date: Wed, 9 Feb 2022 12:50:34 +0800 In-Reply-To: <20220209045035.380615-1-tzungbi@google.com> Message-Id: <20220209045035.380615-6-tzungbi@google.com> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20220209045035.380615-1-tzungbi@google.com> X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog Subject: [PATCH v2 5/6] platform/chrome: cros_ec: sort header inclusion alphabetically From: Tzung-Bi Shih To: bleung@chromium.org, groeck@chromium.org Cc: chrome-platform@lists.linux.dev, tzungbi@google.com Sort header inclusion alphabetically. Signed-off-by: Tzung-Bi Shih --- drivers/platform/chrome/cros_ec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c index c2105621b368..008dc2fc5066 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -9,12 +9,12 @@ * battery charging and regulator control, firmware update. */ -#include #include -#include #include +#include #include #include +#include #include #include "cros_ec.h" From patchwork Wed Feb 9 04:50:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 12739608 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A4932C80 for ; Wed, 9 Feb 2022 04:51:06 +0000 (UTC) Received: by mail-pj1-f73.google.com with SMTP id bj11-20020a17090b088b00b001b8ba3e7ce7so2994826pjb.2 for ; Tue, 08 Feb 2022 20:51:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=w/FmSJt4q0EBOhTIs5yfalWe7onSq3OGyk5zwTrCxMM=; b=E5VSI6zb/Cx1lAfNoS+227jAzLKcmnPWMxyUTsNtqpX1UIXpb8Y+qijNHTfnWqwMCH JZmC+EhkQlisU2VimqaLKeXbGjFFC4k6X2q6M6lHSX/uhniZO9DM8Ced9Ax7Rh9GiXCL c7ZP57sbr+q5UuMn+BLQIgfMnxFVl7PJvH/RyrQPJ5o6SsLMy5ljclGU36UopQASAtVF fx3OlJO/GairO4s3ZSpAmYoq8UhStC2+EpDC285FodunvKz9j5wEeIEuidnYoKr+1KGE znMvu6holwajHZva3RsfaBK/0KKNjyvfeVMsjh/2m3YqLik7OHHYf2QCkdPkZtv9Oipy tfjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=w/FmSJt4q0EBOhTIs5yfalWe7onSq3OGyk5zwTrCxMM=; b=EGPpofeDxUb9dlzvxtQp+vRWM7u4SyU2VBDXmqo/X08p4TMBaj1WfOcCH2iL7V6qJ8 SyUfcksF0CJyORo1euKZXBmc/EJIYY0WQ6BDTIja+bnLWjGiSSWC1aQ/rL0iSNpd1sD9 ZXGcR4tnSwbomFFJD3q5zv/8N+XmYyM4BjDSuO1ThDLO7JpkmN1EV2/fAtXQGYdYF0lb x0cuLWLB5JwCovSi5VO9uMEascl8xGoX/4AOdLx43+LsBJjWdlKUKTuZFUj4RRDc2jzW qPCsfZtH2qV+pI4NTOdwsJSnD17ArVLofRRx2YS3EP7oC1SOz+pGO3mulhmCqF0S9g4j gCgA== X-Gm-Message-State: AOAM533xGb+v+8UEy5eEX5o01pRDRJ5G056W+lQGk+TWAE1vGRLf31ZW ij8oD8ZLbg0UlNkr9p20Luzy1VIMhqAv X-Google-Smtp-Source: ABdhPJx7RMkh8rtj5s/zxdPCY68SRTxtjuZoMZkiVHH5NL0si/DyWbWI6acc1OJ9J/edxMvxfzM50uKxMdqO X-Received: from tzungbi-z840.tpe.corp.google.com ([2401:fa00:1:10:4b6f:f14d:be50:86a]) (user=tzungbi job=sendgmr) by 2002:a17:902:f711:: with SMTP id h17mr776132plo.26.1644382265741; Tue, 08 Feb 2022 20:51:05 -0800 (PST) Date: Wed, 9 Feb 2022 12:50:35 +0800 In-Reply-To: <20220209045035.380615-1-tzungbi@google.com> Message-Id: <20220209045035.380615-7-tzungbi@google.com> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20220209045035.380615-1-tzungbi@google.com> X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog Subject: [PATCH v2 6/6] platform/chrome: cros_ec: append newline to all logs From: Tzung-Bi Shih To: bleung@chromium.org, groeck@chromium.org Cc: chrome-platform@lists.linux.dev, tzungbi@google.com To be consistent, append newline ("\n") to all logs. Signed-off-by: Tzung-Bi Shih --- drivers/platform/chrome/cros_ec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c index 008dc2fc5066..426314e4b7f6 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -213,7 +213,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev) IRQF_TRIGGER_LOW | IRQF_ONESHOT, "chromeos-ec", ec_dev); if (err) { - dev_err(dev, "Failed to request IRQ %d: %d", + dev_err(dev, "Failed to request IRQ %d: %d\n", ec_dev->irq, err); return err; } @@ -264,7 +264,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev) */ err = cros_ec_sleep_event(ec_dev, 0); if (err < 0) - dev_dbg(ec_dev->dev, "Error %d clearing sleep event to ec", + dev_dbg(ec_dev->dev, "Error %d clearing sleep event to ec\n", err); if (ec_dev->mkbp_event_supported) { @@ -337,7 +337,7 @@ int cros_ec_suspend(struct cros_ec_device *ec_dev) ret = cros_ec_sleep_event(ec_dev, sleep_event); if (ret < 0) - dev_dbg(ec_dev->dev, "Error %d sending suspend event to ec", + dev_dbg(ec_dev->dev, "Error %d sending suspend event to ec\n", ret); if (device_may_wakeup(dev)) @@ -382,7 +382,7 @@ int cros_ec_resume(struct cros_ec_device *ec_dev) ret = cros_ec_sleep_event(ec_dev, sleep_event); if (ret < 0) - dev_dbg(ec_dev->dev, "Error %d sending resume event to ec", + dev_dbg(ec_dev->dev, "Error %d sending resume event to ec\n", ret); if (ec_dev->wake_enabled)