From patchwork Wed Feb 9 09:56:58 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: 12739966 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.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 052DE29CA for ; Wed, 9 Feb 2022 09:57:15 +0000 (UTC) Received: by mail-yb1-f202.google.com with SMTP id q11-20020a252a0b000000b0061e240c8fb3so79605ybq.22 for ; Wed, 09 Feb 2022 01:57:15 -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=JvULB6LG4OVJvYKRyYDkOucqyqSMXIuDjjLj+Rq8spQ=; b=Bw4eJyd7KJoXVt+EiaG0Xa52r1vTzXbZ/GRr8BO0GfPO5h6T/BjFCXXj27QF+/hsI0 IZYeqSdVCGUHTvzBn4k9lb07vjWM5kG4xSRxsSyrNvs3IRrpl9iMNX6nXWqOE0f2JovM OSM2vnHHlotLF/hJO4VDf3svVWskXCsjEyMa02YRWuZ0NdS+WOfuK7l2suRkMaw3dkZd MOkPv23occyLoexGt4412FjvU2q6Udp0EWUejPpR7RJpheWAU7esT4hI4P1kqwX6CYk2 3p13PaspOhyMDYScsLA8FWEMGjq/DlupPZ/3WddQxKHx7LCywAjpjL2eM7r9x7La+Ms6 5r9A== 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=JvULB6LG4OVJvYKRyYDkOucqyqSMXIuDjjLj+Rq8spQ=; b=U5bCMu6yY3nBm4qf1yvNlQRyodyF7AwYJGhGvLnzp2fK1+9BM+So7RUMJdBYA4ymEt WJoZClBG87S7NA3yPQGEHJX18UCHKQd8sOb6O1bvbl0X+V4jI9P222M/c47xVFgKpX68 vo83/dTvmG43cV4l8+ssTE/OVIelhP/aypheC9qOYuQBD0rLJ3MWW0zxL/WAqVJsfRfR kY5nVj1NLo1sGhEzAGQOYVUAgfDb0ouFRMc3hsMsLfLqty7GccqKsJAzWVHrrnv7s+8I nGD61rFpaBLMGkOSXvRC1NAFUmTx4hymsbVco7/iY6YwXfzbQMlRyNf35W8hY+CIRpQb xqfw== X-Gm-Message-State: AOAM532skVc5E2M4Uepc9KetewLff8AaYuwlu7Jcil+FmpQOaDCut4E6 HjcrG8LmP8xIkIdu2hHQluOnAcqH0iiU X-Google-Smtp-Source: ABdhPJxrw25aqvwm55A0ykiMxJjW6ZuYkjFM3h+srhyA0NfV32vG3PZAK6hUYXqQNv4uaBh/mOTVVvcs6MbQ X-Received: from tzungbi-z840.tpe.corp.google.com ([2401:fa00:1:10:ee29:8b32:75bc:44ec]) (user=tzungbi job=sendgmr) by 2002:a81:e405:: with SMTP id r5mr1367498ywl.428.1644400635110; Wed, 09 Feb 2022 01:57:15 -0800 (PST) Date: Wed, 9 Feb 2022 17:56:58 +0800 In-Reply-To: <20220209095703.517608-1-tzungbi@google.com> Message-Id: <20220209095703.517608-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: <20220209095703.517608-1-tzungbi@google.com> X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog Subject: [PATCH v3 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, pmalani@chromium.org Fix cros_ec_register() to unregister platform devices if blocking_notifier_chain_register() fails. Also use the single exit path to handle the platform device unregistration. Fixes: 42cd0ab476e2 ("platform/chrome: cros_ec: Query EC protocol version if EC transitions between RO/RW") Signed-off-by: Tzung-Bi Shih --- Changes from v2: (https://patchwork.kernel.org/project/chrome-platform/patch/20220209045035.380615-2-tzungbi@google.com/) - Fix grammar error in commit message. - Change the code that don't rely on zeroed memory. - Remove unnecessary `if` checks before calling platform_device_unregister(). Changes from v1: (https://lore.kernel.org/lkml/20220125101527.1812887-1-tzungbi@google.com/T/#u) - Use imperative mood in commit message. - Use IS_ERR_OR_NULL() in 1st patch. drivers/platform/chrome/cros_ec.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c index fc5aa1525d13..15f599d721a1 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,11 @@ int cros_ec_register(struct cros_ec_device *ec_dev) cros_ec_irq_thread(0, ec_dev); return 0; +exit: + if (ec_dev->max_passthru) + platform_device_unregister(ec_dev->pd); + platform_device_unregister(ec_dev->ec); + return err; } EXPORT_SYMBOL(cros_ec_register); From patchwork Wed Feb 9 09:56:59 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: 12739967 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 1EB1E2C80 for ; Wed, 9 Feb 2022 09:57:21 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id z15-20020a25bb0f000000b00613388c7d99so3787917ybg.8 for ; Wed, 09 Feb 2022 01:57:20 -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=rRfDQtc3ibfieKIjj3DCAb31SXeCDyRQBAeZpRGeCck=; b=WTPDUbHhg0wilFuxCd/IelD7nNvO3Csj7uiID2ORu9emKEAZV6bu77ustH3kF0nwq2 5c9g4+0px0ANQxwXiZvJQ2b/s7vsDh/1qnJVVRIAVqNMZlzSsTm0ePfKEz5/APD+UC9f 2DIQPU4/DsQx0OoZL7HeLKCF82bHp/vcBTPs6AgMTQO97AFoXKotUoABjrmFAbIhQsu3 SIA8i5exsQ9nqSO4qNV0iC35moXQarJZEn4N8WofQhnO0z7OIxMQe7O5ilUKtWtBivye fewPgjjvQPmJ4rdGmY9oNIQI6vnKtSwQqhTNTKNPLGcn5IQDM2C+IpHN03hL87aR92Gg g+kw== 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=rRfDQtc3ibfieKIjj3DCAb31SXeCDyRQBAeZpRGeCck=; b=CTqrCNG151P3Y+ZXQ1AGYLEbMbC1SHa1S8Vkqg90rkGlz6FBxb1GqaVYeS7EAzX/+k 6jZB5hgAqmn8F0dLHUcTdyfZRvO0Y6L3xwD1SpbrXR4iUcVCcKtQAUy6zW+dPgCixetE 1Fian00N5+ybY7InOeIRzo279mxEb0QgONjo0sDl3CaY979fkpKjFjjKl80DaQzRiNDZ Lg5PIf9G58wz+4fozbqfrZ5uydFEnvp0ZIPb6roKGF7+v/bnn7tskjV5NOWXE5AWQeRT gkeNDfgKUwztw/enqQ9w2ZVMGEEjRqrYPiPQLAbrexrZyV2TkCdgc0DWZ+kaa+v60bUA CrNQ== X-Gm-Message-State: AOAM5311QiCwGUa+cKbC8Hf7TKJ/fLlAxJ47h7azm+As6Qco17j45Qgm yxgzO2K5Vr75uN9Cbqu0Cufq1I0PfG6h X-Google-Smtp-Source: ABdhPJys72ND3y5pJ8+gacD13ARKSrqIUPQoxstrxP07EwsR8hBG8a8LqvGPOf/A8EpFAiBtB8kpWKVfT/lz X-Received: from tzungbi-z840.tpe.corp.google.com ([2401:fa00:1:10:ee29:8b32:75bc:44ec]) (user=tzungbi job=sendgmr) by 2002:a25:251:: with SMTP id 78mr1266412ybc.730.1644400639117; Wed, 09 Feb 2022 01:57:19 -0800 (PST) Date: Wed, 9 Feb 2022 17:56:59 +0800 In-Reply-To: <20220209095703.517608-1-tzungbi@google.com> Message-Id: <20220209095703.517608-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: <20220209095703.517608-1-tzungbi@google.com> X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog Subject: [PATCH v3 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, pmalani@chromium.org Reviewed-by: Prashant Malani Signed-off-by: Tzung-Bi Shih --- Changes from v2: (https://patchwork.kernel.org/project/chrome-platform/patch/20220209045035.380615-3-tzungbi@google.com/) - Add pmalani's R-b tag. - Remove redundant commit message. Changes from v1: (https://lore.kernel.org/lkml/20220125101527.1812887-1-tzungbi@google.com/T/#u) - Use imperative mood in commit message. 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 15f599d721a1..c9c90f98baf4 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -343,7 +343,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 09:57:00 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: 12739968 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.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 136172C80 for ; Wed, 9 Feb 2022 09:57:24 +0000 (UTC) Received: by mail-yb1-f202.google.com with SMTP id 127-20020a250f85000000b00611ab6484abso3635216ybp.23 for ; Wed, 09 Feb 2022 01:57:24 -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=HiqGi6T/H+jNXGMi9MYVABP3BOad9wxsk0Vnb/KPmnM=; b=klnw3w0Ujq5BD++WXJ29PmRLm20UzxVowqpLz+eu2EMFjTrwSaeW9UywFt8bg9AbwO Oi7Acuy0v7rf1bO31ctAIjo+4IZPN/0cH16pFgVBw74h2YiTRbn9flZ6L2k3a+0Dt6hb uTAEjzjTdMsCkUduERjTk9qNycl7pRLph5Gyi56xNBSSK3rj5lf5xzmrmAhW88h9rVnY y85q8OEUMabFAcqoYduQ69MEcaIHTX6AQug3iY67grhND49FBuF7AiK6SYEtv1AKhB4s p77vOj27F2lXaSKqW8+JMg5dPNPUafCOW4rqziVs2LUpgrgAqibjVN2pzFBLi10sdi6K qjsw== 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=HiqGi6T/H+jNXGMi9MYVABP3BOad9wxsk0Vnb/KPmnM=; b=I2yJhXFrDgRKXpKerGdsLT8ScVoG3Toq7G0IMF0nKiyaNNvXXXUjoxnYl4qhWmhLlq pJXoc7afOM0XPsZtF3CcWLKHD3Jr7LH9FcgSy4i7iN6IqwHiwx4TrjUDk90eaKRiCqg3 bn8+pLROsz2kb382VOx4pbx54gwkAQyzlW5vH/11cpn8dRBrBrUUEwC0mpGbccN6PEAH /ZrzG+YkuRGVLI4mhFC5TXTW7DRI9m2+y9o/PF+ObUYp1AeC5l7GmHIa53eSCvn/rSJs fL97LpKBpiX1lgli6rbyPErMdHP3GrqjOn+3Yba5t+DmW/8VwU7LpNFBIvBs+T0Athnw Z9FA== X-Gm-Message-State: AOAM530fYrpZHXienjQsse7taJp4BdYxDVKqD0rcgo03pXLCZYU4MrrU fj+dcgRJPUNAoYM1wSUSvXs6QP0OaZS8 X-Google-Smtp-Source: ABdhPJyw9k6hMcAOYHhZe6hjqAdQ4dbDGZ18OMjDJ7a/6IDYTGxRSSXy0ez8OlFKi4/1sqGYx/upYrnVp3n3 X-Received: from tzungbi-z840.tpe.corp.google.com ([2401:fa00:1:10:ee29:8b32:75bc:44ec]) (user=tzungbi job=sendgmr) by 2002:a81:af61:: with SMTP id x33mr1314943ywj.259.1644400643102; Wed, 09 Feb 2022 01:57:23 -0800 (PST) Date: Wed, 9 Feb 2022 17:57:00 +0800 In-Reply-To: <20220209095703.517608-1-tzungbi@google.com> Message-Id: <20220209095703.517608-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: <20220209095703.517608-1-tzungbi@google.com> X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog Subject: [PATCH v3 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, pmalani@chromium.org `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 --- No changes from v2. Changes from v1: (https://lore.kernel.org/lkml/20220125101527.1812887-1-tzungbi@google.com/T/#u) - Use imperative mood in commit message. 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 c9c90f98baf4..07dd5cc35d7c 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -341,6 +341,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; @@ -382,10 +384,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 09:57:01 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: 12739969 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 0F7EC2C80 for ; Wed, 9 Feb 2022 09:57:28 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id m10-20020a25800a000000b0061daa5b7151so3746804ybk.10 for ; Wed, 09 Feb 2022 01:57:28 -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=UG8PyS/piTDySpDY4q3V93iNg/uO6gwtySeAVQxms8k=; b=IrAGrVtvCsMtqSg/rifKwcIZ2qU1d9/AHiDqeuqNmWswM71DEi93XIvx6xMWubzp4w 4U+ngljDHe+XbLAudzX0z4hGwc40IEWYvQn1V0yRNp8OdLAxE0TzKRA2giVWr5X5ZL0E RdLAYNHTkfvHHyPfnDJqb5UmduK52LlK9Hk3IGkVJwcwrI/oCJrJm6JGDFBhQ03ENg+0 3B+IyYQ8yZGD7fCjYFAZenKCrRJN5jQjUtfAT3iQZfaUP6LvmVR6zR8vd9nXGqZbw0+F Pqr4rHDYEiQi6TcUDWLO5MYQWPFqZ4LXm0kGCD7PdVIn42wrBBCiGs5WZy8io7aoQ7Iy erFQ== 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=UG8PyS/piTDySpDY4q3V93iNg/uO6gwtySeAVQxms8k=; b=ta5xbB4bErNM5DbOdw4c+tTfZH7MDxjyBhPbF1TCtFghzn6iNW3OUEPd23ZNC0tKJs 5/nVhMiY1MjQXIVr9A5aHb59zMq68rjf0NRLA+oIYf1lsRY1Y2jKMGSXSGFkjX3YkSQe cOfXga2XHnZVwSNXxXGk8Tt2VujBXBebYTEnoRp41qyWJrgU9lzfuHfqld7jk0Bm3x9V wL+SEzJ+FjfzNOMnULKMswSnJNHjJIJfmMCCsnAPfY6j2YTiMCiQRmvEQjWfJkKjZddy diFayzPniS70Kk8VRpxmAUCEByI1+oWDnXPEgGrX4D1EQZbgFNGVz3uMcRa+7DQBOHi0 tlFg== X-Gm-Message-State: AOAM532RI5MYqGaRUT8fORPDRA5Y9YQvTqU5K9dxKkE16ZjPVUc+UtiK JGVrRQ8wGpUcCKfbF3dvfdqSHJvCWv/z X-Google-Smtp-Source: ABdhPJxKIPk0HOfbFn+yj4lQxP+A+O64P/7oH7REOAF8c7v2FZkEXoE6WqpyXgSs17Jz9nCibYjhzQKvduQp X-Received: from tzungbi-z840.tpe.corp.google.com ([2401:fa00:1:10:ee29:8b32:75bc:44ec]) (user=tzungbi job=sendgmr) by 2002:a25:c753:: with SMTP id w80mr1331685ybe.381.1644400647153; Wed, 09 Feb 2022 01:57:27 -0800 (PST) Date: Wed, 9 Feb 2022 17:57:01 +0800 In-Reply-To: <20220209095703.517608-1-tzungbi@google.com> Message-Id: <20220209095703.517608-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: <20220209095703.517608-1-tzungbi@google.com> X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog Subject: [PATCH v3 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, pmalani@chromium.org `err` in cros_ec_register() doesn't need to be initialized because it is going to be overridden in the following code soon. Signed-off-by: Tzung-Bi Shih --- No changes from v2. Changes from v1: (https://lore.kernel.org/lkml/20220125101527.1812887-1-tzungbi@google.com/T/#u) - Use imperative mood in commit message. 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 07dd5cc35d7c..618b8b4c42ef 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 09:57:02 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: 12739970 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 E13002C80 for ; Wed, 9 Feb 2022 09:57:31 +0000 (UTC) Received: by mail-pj1-f73.google.com with SMTP id gj12-20020a17090b108c00b001b89b5f3dd4so3495860pjb.6 for ; Wed, 09 Feb 2022 01:57:31 -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=Dlw6zYxPk62QBxL93j+QBRqUzy/6DWY+PNzSwlT4tDU=; b=eJLEwFslJwUR1juU6MndzWRZLcz5rVv/AVv5CwdE3t1LBnVphGjmOZt1qnt7WM3//g JLYBCA7bOIxKhb+oKCP9ZkuJqEIG28KfogCmmxNKvr2xPF6LxMuM10Si8W+kqiZPmL6x SqQFd2kDs86lguLP+Yyelk8g+EOTbpQTWX+voPxkVaAgpK/ODPIXYlIDAiUgkLVf1c3/ 295o682L2ZwVW8gltOqCf4Aeq+81298BKqRju2gPFan3M7bGKHeQgCUX8ECOvgclqTOb JN/Tx3CtDNx6n4N5RAYbpFblO4DhGvlrlTVRGM4XO1pvEf67haedjxmhwVPBc4IOhcpy BQ1A== 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=Dlw6zYxPk62QBxL93j+QBRqUzy/6DWY+PNzSwlT4tDU=; b=ppXObUN7w+O1IiXVdOpk7Zg23pLnc4oFfLAEV06a5pRXn0DIw6YIZNYLISwRGBmcD8 d5m3pQjHynMFL76i1ByF0F4LL3s5jk9An8eQlLtsQH0CCYCzTQvx8RnCsvOtzc8Ridqr xmN1G6zizT+HGtLR/MkHfv2tIGeaNco902Q56nEJqzxqjI3gU9eeIhsL+jYE62lKddMi 3NPEXvYy0sRgOqGl+/BAjwzw2AvuVX99yFZCQ31VfAiRIZOB4O26x5mUCZJQHQvh4b0b Qc0Pnak2mD0XqqfTLibUwQVLHe+E0v6+IKx+c0w/v/rmiX2T4ZgUe0Whom8rA44M7NOI gg/w== X-Gm-Message-State: AOAM533PzueMzc0ROfRGi5jgqXbcfjv5EgaTXRE7baN9BybMmKwxtq27 T+wl9uD+ibGD4E8M4Xd9wBmFKSk0A8/s X-Google-Smtp-Source: ABdhPJyBMZkH7GJpzRQh9H502XZ48l6fApcBU86LktWp4sCO/l37uSK7ZUmo+BWyifBzCrljc5tN285XDlp5 X-Received: from tzungbi-z840.tpe.corp.google.com ([2401:fa00:1:10:ee29:8b32:75bc:44ec]) (user=tzungbi job=sendgmr) by 2002:a17:90b:4c8e:: with SMTP id my14mr340888pjb.0.1644400651220; Wed, 09 Feb 2022 01:57:31 -0800 (PST) Date: Wed, 9 Feb 2022 17:57:02 +0800 In-Reply-To: <20220209095703.517608-1-tzungbi@google.com> Message-Id: <20220209095703.517608-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: <20220209095703.517608-1-tzungbi@google.com> X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog Subject: [PATCH v3 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, pmalani@chromium.org Sort header inclusion alphabetically. Signed-off-by: Tzung-Bi Shih Reviewed-by: Prashant Malani --- No changes from v2. Changes from v1: (https://lore.kernel.org/lkml/20220125101527.1812887-1-tzungbi@google.com/T/#u) - Use imperative mood in commit message. 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 618b8b4c42ef..2c4e81f3fef9 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 09:57:03 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: 12739971 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.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 CC2E32C80 for ; Wed, 9 Feb 2022 09:57:35 +0000 (UTC) Received: by mail-pl1-f201.google.com with SMTP id q4-20020a170902f78400b0014d57696618so1396708pln.20 for ; Wed, 09 Feb 2022 01:57:35 -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=dLsQ8j/eaK2sPDSE7zPtNw82onF6HQ/CZ66kA9Om+Gk=; b=XPBl8B9ZzeEwkJPR8kKU4tQaaToHgQ2GLkPMz4C43807C3EmjsPB0iiJGDM2atMX+X +lq6mDMSPwlGQuNDX6qZZmmNmqQ5igB3ilRjQa45w4tBTCb4Hi3RV9NM63M0b9rgQnzp 5nw9WKLkZKdBVAw0zYI+2SeuVVS1X+dmIVv4xYuAc6Z+8PEJM+xms8yNsx5cuv5L7WKQ vS1+6u3y8Cvg9PZzc5Zx1bbwRSpSkgESIGy2GWdaplRRkACBM0zyAwTZxqLDwH8uHnK1 seLssxyQ4i8xaAUpsY8+MAaDYjlIWPB0UH4pv1b6ao4H/lRRCrQ8xYoWFt2h91UKLRLI JjHg== 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=dLsQ8j/eaK2sPDSE7zPtNw82onF6HQ/CZ66kA9Om+Gk=; b=mdlSlv5/cXRM2jwwZMwSyVYKCX4gHCrgn5i9cnDDo3WITSSovSyjFYwavxENk9O+t4 rojFcwx20sHIsC7Qhcvm5+Wdx7K+/un6Uy1Wo/ZrGWO8Zc+QIWgqTUEhsEhBIqIwLxef p7vqoqVzjzE3rgNm7Js18QRX6M9YMXaKh+j8gz9fElDOl61vod7zVtkyYv1om1CQnIq+ 2JMVnc1DMK1o1oHWBFVy57cOzZjf2Kld/UFX3Rx6l08kfBtnJcE44teptFwhmNECe4cF Ocd5eDodp3WdkeSkQolJ1VdaWObYDPjn4qGK0kbzpyxleVKdEmB1cF8svhYaaJ2q4395 zksQ== X-Gm-Message-State: AOAM530GvCoZ0Dkd2RKdIViTw+aUzsDv7dtS0y/PQohwHOF4kBbG3GgF 0shoTlq7aWNgC/6qymeJhLzjG4CDXqOc X-Google-Smtp-Source: ABdhPJxMl2ZtqPjPLKT16DCq0O5wQvpOIQmB+UhYl8tFNm/+vg89f7FmCK5xv1dTmKzRvFd52SE8qH731ZCk X-Received: from tzungbi-z840.tpe.corp.google.com ([2401:fa00:1:10:ee29:8b32:75bc:44ec]) (user=tzungbi job=sendgmr) by 2002:a17:902:f68a:: with SMTP id l10mr1330890plg.146.1644400655253; Wed, 09 Feb 2022 01:57:35 -0800 (PST) Date: Wed, 9 Feb 2022 17:57:03 +0800 In-Reply-To: <20220209095703.517608-1-tzungbi@google.com> Message-Id: <20220209095703.517608-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: <20220209095703.517608-1-tzungbi@google.com> X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog Subject: [PATCH v3 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, pmalani@chromium.org To be consistent, append newline ("\n") to all logs. Signed-off-by: Tzung-Bi Shih Reviewed-by: Prashant Malani --- No changes from v2. Changes from v1: (https://lore.kernel.org/lkml/20220125101527.1812887-1-tzungbi@google.com/T/#u) - Use imperative mood in commit message. 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 2c4e81f3fef9..639d5a651b76 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) { @@ -336,7 +336,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)) @@ -381,7 +381,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)