Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18135C433DB for ; Wed, 13 Jan 2021 18:21:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C5D8F23436 for ; Wed, 13 Jan 2021 18:21:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727963AbhAMSVr (ORCPT ); Wed, 13 Jan 2021 13:21:47 -0500 Received: from mail-40134.protonmail.ch ([185.70.40.134]:22598 "EHLO mail-40134.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727851AbhAMSVr (ORCPT ); Wed, 13 Jan 2021 13:21:47 -0500 Date: Wed, 13 Jan 2021 18:20:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1610562065; bh=MEcMsH5SPU91xLKxQanVZutXXkK5HhSF/dd5d5D2Ce0=; h=Date:To:From:Reply-To:Subject:In-Reply-To:References:From; b=UPf8fcxr/X+Otb5//dw9SthhPcWYT0PNhnrbaZmD21L2qspuelt115sExP+pWuczI 4CTL8bEHRxOO8MoB2/9kMTQGOrf4sauGwDFsZ2nEjEUMMcgYFk0Hl2shFC+SSmWdyI DSnn75TtGM4b/ZAovAexuCfKuz1HcdOXFFWigD10= To: platform-driver-x86@vger.kernel.org, Hans de Goede , Mark Gross , Ike Panhc From: =?utf-8?Q?Barnab=C3=A1s_P=C5=91cze?= Reply-To: =?utf-8?Q?Barnab=C3=A1s_P=C5=91cze?= Subject: [PATCH v2 06/24] platform/x86: ideapad-laptop: use msecs_to_jiffies() helper instead of hand-crafted formula Message-ID: <20210113182016.166049-7-pobrn@protonmail.com> In-Reply-To: <20210113182016.166049-1-pobrn@protonmail.com> References: <20210113182016.166049-1-pobrn@protonmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org The current code used a hand-crafted formulate to convert milliseconds to jiffies, replace it with the msecs_to_jiffies() function. Signed-off-by: Barnab=C3=A1s P=C5=91cze Reviewed-by: Hans de Goede diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/i= deapad-laptop.c index 29e91942c756..174edbfc52dc 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -190,7 +191,7 @@ static int read_ec_data(acpi_handle handle, int cmd, un= signed long *data) =09if (method_vpcw(handle, 1, cmd)) =09=09return -1; =20 -=09for (end_jiffies =3D jiffies+(HZ)*IDEAPAD_EC_TIMEOUT/1000+1; +=09for (end_jiffies =3D jiffies + msecs_to_jiffies(IDEAPAD_EC_TIMEOUT) + 1= ; =09 time_before(jiffies, end_jiffies);) { =09=09schedule(); =09=09if (method_vpcr(handle, 1, &val)) @@ -216,7 +217,7 @@ static int write_ec_cmd(acpi_handle handle, int cmd, un= signed long data) =09if (method_vpcw(handle, 1, cmd)) =09=09return -1; =20 -=09for (end_jiffies =3D jiffies+(HZ)*IDEAPAD_EC_TIMEOUT/1000+1; +=09for (end_jiffies =3D jiffies + msecs_to_jiffies(IDEAPAD_EC_TIMEOUT) + 1= ; =09 time_before(jiffies, end_jiffies);) { =09=09schedule(); =09=09if (method_vpcr(handle, 1, &val)) --=20 2.30.0