diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2017-12-05 17:16:52 -0500 |
---|---|---|
committer | Sudeep Holla <sudeep.holla@arm.com> | 2018-02-23 10:12:37 -0500 |
commit | a963d7c5264eaa544837ac8182a9eea55007a669 (patch) | |
tree | fa89dfecfa5e2b3f25a74080f40777e256f3a83d | |
parent | 5abc7935ed5bf70aa69a6001eee8495df43a17c7 (diff) |
firmware: arm_scpi: improve struct dvfs_info to make code better readable
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.
Tested-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
-rw-r--r-- | drivers/firmware/arm_scpi.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c index a6f6039ee3f9..9eeb53b766e0 100644 --- a/drivers/firmware/arm_scpi.c +++ b/drivers/firmware/arm_scpi.c | |||
@@ -72,8 +72,6 @@ | |||
72 | 72 | ||
73 | #define MAX_DVFS_DOMAINS 8 | 73 | #define MAX_DVFS_DOMAINS 8 |
74 | #define MAX_DVFS_OPPS 16 | 74 | #define MAX_DVFS_OPPS 16 |
75 | #define DVFS_LATENCY(hdr) (le32_to_cpu(hdr) >> 16) | ||
76 | #define DVFS_OPP_COUNT(hdr) ((le32_to_cpu(hdr) >> 8) & 0xff) | ||
77 | 75 | ||
78 | #define PROTOCOL_REV_MINOR_BITS 16 | 76 | #define PROTOCOL_REV_MINOR_BITS 16 |
79 | #define PROTOCOL_REV_MINOR_MASK ((1U << PROTOCOL_REV_MINOR_BITS) - 1) | 77 | #define PROTOCOL_REV_MINOR_MASK ((1U << PROTOCOL_REV_MINOR_BITS) - 1) |
@@ -328,7 +326,9 @@ struct legacy_clk_set_value { | |||
328 | } __packed; | 326 | } __packed; |
329 | 327 | ||
330 | struct dvfs_info { | 328 | struct dvfs_info { |
331 | __le32 header; | 329 | u8 domain; |
330 | u8 opp_count; | ||
331 | __le16 latency; | ||
332 | struct { | 332 | struct { |
333 | __le32 freq; | 333 | __le32 freq; |
334 | __le32 m_volt; | 334 | __le32 m_volt; |
@@ -665,8 +665,8 @@ static struct scpi_dvfs_info *scpi_dvfs_get_info(u8 domain) | |||
665 | if (!info) | 665 | if (!info) |
666 | return ERR_PTR(-ENOMEM); | 666 | return ERR_PTR(-ENOMEM); |
667 | 667 | ||
668 | info->count = DVFS_OPP_COUNT(buf.header); | 668 | info->count = buf.opp_count; |
669 | info->latency = DVFS_LATENCY(buf.header) * 1000; /* uS to nS */ | 669 | info->latency = le16_to_cpu(buf.latency) * 1000; /* uS to nS */ |
670 | 670 | ||
671 | info->opps = kcalloc(info->count, sizeof(*opp), GFP_KERNEL); | 671 | info->opps = kcalloc(info->count, sizeof(*opp), GFP_KERNEL); |
672 | if (!info->opps) { | 672 | if (!info->opps) { |
@@ -713,9 +713,6 @@ static int scpi_dvfs_get_transition_latency(struct device *dev) | |||
713 | if (IS_ERR(info)) | 713 | if (IS_ERR(info)) |
714 | return PTR_ERR(info); | 714 | return PTR_ERR(info); |
715 | 715 | ||
716 | if (!info->latency) | ||
717 | return 0; | ||
718 | |||
719 | return info->latency; | 716 | return info->latency; |
720 | } | 717 | } |
721 | 718 | ||