From patchwork Tue Dec 5 22:16:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 10093873 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 92AFF6056E for ; Tue, 5 Dec 2017 22:18:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84DF2289BC for ; Tue, 5 Dec 2017 22:18:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79BED29460; Tue, 5 Dec 2017 22:18:15 +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=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0C510289BC for ; Tue, 5 Dec 2017 22:18:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:References:To:Subject:From:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oIWAQ/ZFD8MCmy3nwmGemyW1h6BkUBWeQJm/BAMWgug=; b=rwRn1DbUjczDPx IW3R/z9tSSvyyX9qpnNZsP8Ppn0BbyVsvba2ze6VsP1AZXEc5tg7qVGf+egmBiKPo/7z+ZPXyyFP7 XS7kOnvVjTqyhHjow7IzXjZGhWkUmEw0UCQegq5/8Y4vQu1mUayG3yt/PePinz+HylQEGlJFtJuwD CQkSWv6vXAmh7kt1RX+gZLDiOZmtS+Sm0Uf51i74wC0mu45JkP1+dcPUfNpxcB9lmouv96J7dhLbR eFcTap40VXKhtJnFa2mKRrLsjLBjqS+aAPnwRJFIw0KaFe7gMLOGU4/pjAhyG/T2zeEQkHY2/gidR dtoUL2A8jYx2oxaphuxA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eMLXa-0007NB-HP; Tue, 05 Dec 2017 22:18:14 +0000 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eMLXB-0006zg-65; Tue, 05 Dec 2017 22:17:50 +0000 Received: by mail-wr0-x244.google.com with SMTP id x49so1895710wrb.13; Tue, 05 Dec 2017 14:17:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=haNNs5kNrvRkGnl/aM1+2yJ43D1UoZOwtS1c3vWw7hQ=; b=mbIx3pApilUJxraeXfJe2QccHhlXbFMzV75jhbUmmCkurIJRj75ujayIBAgVLg/TPm qEWJiURHCFTJlhjnfyR+6QACKxF3yXuc1C11b9UfzRgOFWkQlsMVU7XgQ64jPcSO9ZQg LJVOhqKR7450ja3bYV8hWaj65KkcW/iakxIrrGuLpJ9WLmMUd3NIc0yy2XyYDmjijLdn fEMYjEyFoZioBPVwYQ7YSekTVkCMrXIFZT2K8NwJt2wttDvAX9POSk0zKwyb9Cz0Ue34 Vi/xJG9hs0l8Ok8KsNnuyt2bEknRQC2YfgqPQqYA+GcLj36vRY4GA2/+La5tAqOjNHtl I3Vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=haNNs5kNrvRkGnl/aM1+2yJ43D1UoZOwtS1c3vWw7hQ=; b=o8eF2/yumn6UoR9ICQBki3vgw2waarYZyyI2fLKXCxYSca4QSd3sWtmQuAyiQig4Yo M6NZMOxz40YWeIwqPHLmXh6wXmMBEVDcsDjmgRBqvujZNwJOIOnng3goPEZHrQMOdg8A 2rVhnSQHzL8bMyYVDtQJYteBNFjmsUDsZCiewk9fAa2PkC9DKkCv+mF10OLQhk9yx0AL WGRob4XObgwu5BnHBSUku5ISTYToUX4u8WhgbRbtbmhwg69FNDHiyXjGlYF/CZetDQcs mbaXUmTnwo6k8lUo1IOBkZK1NU03KcwHPOK9o7CuGQ3SS81A2vI4SuKyQq2ooMgsGh8c G6mA== X-Gm-Message-State: AKGB3mIPxP2CrHnOe6oJhYKLJSKXjOt7q6Zam5rpzvfmOx9JCDKLa/hh GO6hWFjzKcpzQHYy8+s7R4Y= X-Google-Smtp-Source: AGs4zMa008T1PoasNGh8M5JbW2edIik5mQO64qVhdN7HNoF3Uw4YE+9ColpgzqC3qfgQAd5ga7PaiQ== X-Received: by 10.223.196.189 with SMTP id m58mr817119wrf.7.1512512250468; Tue, 05 Dec 2017 14:17:30 -0800 (PST) Received: from ?IPv6:2003:ea:8bc0:e400:b595:9d9d:56de:88e3? (p200300EA8BC0E400B5959D9D56DE88E3.dip0.t-ipconnect.de. [2003:ea:8bc0:e400:b595:9d9d:56de:88e3]) by smtp.googlemail.com with ESMTPSA id e197sm1784416wmf.42.2017.12.05.14.17.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Dec 2017 14:17:30 -0800 (PST) From: Heiner Kallweit Subject: [PATCH 04/12] firmware: arm_scpi: improve struct dvfs_info to make code better readable To: Sudeep Holla References: <99220c79-8b35-2978-11d1-6d101ccb6772@gmail.com> Message-ID: Date: Tue, 5 Dec 2017 23:16:52 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <99220c79-8b35-2978-11d1-6d101ccb6772@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171205_141749_380596_B048C407 X-CRM114-Status: UNSURE ( 9.63 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:ARM/Amlogic Meson..." , "linux-arm-kernel@lists.infradead.org" , Kevin Hilman Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Making the header subfields members of struct dvfs_info allows to make the code better readable and avoids some macro magic. In addition remove a useless statement using info->latency. Signed-off-by: Heiner Kallweit --- drivers/firmware/arm_scpi.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c index a6f6039e..9eeb53b7 100644 --- a/drivers/firmware/arm_scpi.c +++ b/drivers/firmware/arm_scpi.c @@ -72,8 +72,6 @@ #define MAX_DVFS_DOMAINS 8 #define MAX_DVFS_OPPS 16 -#define DVFS_LATENCY(hdr) (le32_to_cpu(hdr) >> 16) -#define DVFS_OPP_COUNT(hdr) ((le32_to_cpu(hdr) >> 8) & 0xff) #define PROTOCOL_REV_MINOR_BITS 16 #define PROTOCOL_REV_MINOR_MASK ((1U << PROTOCOL_REV_MINOR_BITS) - 1) @@ -328,7 +326,9 @@ struct legacy_clk_set_value { } __packed; struct dvfs_info { - __le32 header; + u8 domain; + u8 opp_count; + __le16 latency; struct { __le32 freq; __le32 m_volt; @@ -665,8 +665,8 @@ static struct scpi_dvfs_info *scpi_dvfs_get_info(u8 domain) if (!info) return ERR_PTR(-ENOMEM); - info->count = DVFS_OPP_COUNT(buf.header); - info->latency = DVFS_LATENCY(buf.header) * 1000; /* uS to nS */ + info->count = buf.opp_count; + info->latency = le16_to_cpu(buf.latency) * 1000; /* uS to nS */ info->opps = kcalloc(info->count, sizeof(*opp), GFP_KERNEL); if (!info->opps) { @@ -713,9 +713,6 @@ static int scpi_dvfs_get_transition_latency(struct device *dev) if (IS_ERR(info)) return PTR_ERR(info); - if (!info->latency) - return 0; - return info->latency; }