提交 a963d7c5 编写于 作者: H Heiner Kallweit 提交者: Sudeep Holla

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: NKevin Hilman <khilman@baylibre.com>
Signed-off-by: NHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: NSudeep Holla <sudeep.holla@arm.com>
上级 5abc7935
...@@ -72,8 +72,6 @@ ...@@ -72,8 +72,6 @@
#define MAX_DVFS_DOMAINS 8 #define MAX_DVFS_DOMAINS 8
#define MAX_DVFS_OPPS 16 #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_BITS 16
#define PROTOCOL_REV_MINOR_MASK ((1U << PROTOCOL_REV_MINOR_BITS) - 1) #define PROTOCOL_REV_MINOR_MASK ((1U << PROTOCOL_REV_MINOR_BITS) - 1)
...@@ -328,7 +326,9 @@ struct legacy_clk_set_value { ...@@ -328,7 +326,9 @@ struct legacy_clk_set_value {
} __packed; } __packed;
struct dvfs_info { struct dvfs_info {
__le32 header; u8 domain;
u8 opp_count;
__le16 latency;
struct { struct {
__le32 freq; __le32 freq;
__le32 m_volt; __le32 m_volt;
...@@ -665,8 +665,8 @@ static struct scpi_dvfs_info *scpi_dvfs_get_info(u8 domain) ...@@ -665,8 +665,8 @@ static struct scpi_dvfs_info *scpi_dvfs_get_info(u8 domain)
if (!info) if (!info)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
info->count = DVFS_OPP_COUNT(buf.header); info->count = buf.opp_count;
info->latency = DVFS_LATENCY(buf.header) * 1000; /* uS to nS */ info->latency = le16_to_cpu(buf.latency) * 1000; /* uS to nS */
info->opps = kcalloc(info->count, sizeof(*opp), GFP_KERNEL); info->opps = kcalloc(info->count, sizeof(*opp), GFP_KERNEL);
if (!info->opps) { if (!info->opps) {
...@@ -713,9 +713,6 @@ static int scpi_dvfs_get_transition_latency(struct device *dev) ...@@ -713,9 +713,6 @@ static int scpi_dvfs_get_transition_latency(struct device *dev)
if (IS_ERR(info)) if (IS_ERR(info))
return PTR_ERR(info); return PTR_ERR(info);
if (!info->latency)
return 0;
return info->latency; return info->latency;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册