From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
To: Sudeep Holla <sudeep.holla-5wv7dgnIgG8@public.gmane.org>
Cc: Linux Kernel Mailing List
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Roy Franz <roy.franz-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>,
Harb Abdulhamid <harba-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
Nishanth Menon <nm-l0cyMroinI0@public.gmane.org>
Subject: Re: [RFC PATCH 6/8] firmware: arm_scmi: add initial support for power protocol
Date: Wed, 7 Jun 2017 22:38:42 +0200 [thread overview]
Message-ID: <CAK8P3a3Vw2AvAr4hNd0A6Tih1YNorjiG2jkhcuo=CK1RF+aLFA@mail.gmail.com> (raw)
In-Reply-To: <1496851812-19623-7-git-send-email-sudeep.holla-5wv7dgnIgG8@public.gmane.org>
On Wed, Jun 7, 2017 at 6:10 PM, Sudeep Holla <sudeep.holla-5wv7dgnIgG8@public.gmane.org> wrote:
> +struct scmi_msg_resp_power_attributes {
> + __le16 num_domains;
> + __le16 reserved;
> + __le32 stats_addr_low;
> + __le32 stats_addr_high;
> + __le32 stats_size;
> +} __packed;
> +
> +struct scmi_msg_resp_power_domain_attributes {
> + __le32 flags;
> +#define SUPPORTS_STATE_SET_NOTIFY(x) ((x) & BIT(31))
> +#define SUPPORTS_STATE_SET_ASYNC(x) ((x) & BIT(30))
> +#define SUPPORTS_STATE_SET_SYNC(x) ((x) & BIT(29))
> + u8 name[SCMI_MAX_STR_SIZE];
> +} __packed;
I think it would be better to leave out the __packed here, which
can lead to rather inefficient code. It's only really a problem when
building with -mstrict-align, but it's better to write code in a way that
doesn't rely on that.
> +static int
> +scmi_power_domain_attributes_get(struct scmi_handle *handle, u32 domain,
> + struct power_dom_info *dom_info)
> +{
> + int ret;
> + struct scmi_xfer *t;
> + struct scmi_msg_resp_power_domain_attributes *attr;
> +
> + ret = scmi_one_xfer_init(handle, POWER_DOMAIN_ATTRIBUTES,
> + SCMI_PROTOCOL_POWER, sizeof(domain),
> + sizeof(*attr), &t);
> + if (ret)
> + return ret;
> +
> + *(__le32 *)t->tx.buf = cpu_to_le32(domain);
> + attr = (struct scmi_msg_resp_power_domain_attributes *)t->rx.buf;
It seems you require a similar pattern in each caller of scmi_one_xfer_init(),
but it seems a little clumsy to always require those casts, so maybe there
is a nicer way to do this. How about making scmi_one_xfer_init() act
as an allocation function and having it return the buffer or a PTR_ERR?
It also seems odd to have it named 'init' but actually allocate the scmi_xfer
structure rather than filling a local variable that gets passed by reference.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-06-07 20:38 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-07 16:10 [RFC PATCH 0/8] firmware: ARM System Control and Management Interface(SCMI) support Sudeep Holla
2017-06-07 16:10 ` [RFC PATCH 1/8] Documentation: add DT binding for ARM System Control and Management Interface(SCMI) protocol Sudeep Holla
[not found] ` <1496851812-19623-2-git-send-email-sudeep.holla-5wv7dgnIgG8@public.gmane.org>
2017-06-09 14:16 ` Rob Herring
2017-06-09 14:47 ` Sudeep Holla
[not found] ` <8d17f317-510c-b98e-4c42-c4ad2a8f0c63-5wv7dgnIgG8@public.gmane.org>
2017-06-09 15:39 ` Rob Herring
[not found] ` <CAL_JsqJK9Wkr-x2RbgGfqSDfK7b21MQAaWwONfVwQV8eHAm+qg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-09 15:50 ` Sudeep Holla
2017-06-09 18:12 ` Matt Sealey
[not found] ` <CAHCPf3s3MsiQyWFOgNJdD9F2JAwi_BVxVZG69zj+bJLzEw9AiA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-12 17:39 ` Sudeep Holla
2017-06-12 21:13 ` Rob Herring
2017-06-07 16:10 ` [RFC PATCH 2/8] firmware: arm_scmi: add basic driver infrastructure for SCMI Sudeep Holla
2017-06-07 19:18 ` Roy Franz
[not found] ` <CAKWsp+xR_1u2zrG=-dSzSktRvrr2Nfp50Hxur_YEFgr6oQ7KZQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-08 9:28 ` Sudeep Holla
2017-06-07 16:10 ` [RFC PATCH 3/8] firmware: arm_scmi: add common infrastructure and support for base protocol Sudeep Holla
[not found] ` <1496851812-19623-4-git-send-email-sudeep.holla-5wv7dgnIgG8@public.gmane.org>
2017-06-07 19:19 ` Roy Franz
2017-06-07 16:10 ` [RFC PATCH 4/8] firmware: arm_scmi: add initial support for performance protocol Sudeep Holla
[not found] ` <1496851812-19623-1-git-send-email-sudeep.holla-5wv7dgnIgG8@public.gmane.org>
2017-06-07 16:10 ` [RFC PATCH 5/8] firmware: arm_scmi: add initial support for clock protocol Sudeep Holla
[not found] ` <1496851812-19623-6-git-send-email-sudeep.holla-5wv7dgnIgG8@public.gmane.org>
2017-06-07 19:19 ` Roy Franz
2017-06-07 16:10 ` [RFC PATCH 8/8] firmware: arm_scmi: probe and initialise all the supported protocols Sudeep Holla
2017-06-07 16:10 ` [RFC PATCH 6/8] firmware: arm_scmi: add initial support for power protocol Sudeep Holla
[not found] ` <1496851812-19623-7-git-send-email-sudeep.holla-5wv7dgnIgG8@public.gmane.org>
2017-06-07 20:38 ` Arnd Bergmann [this message]
[not found] ` <CAK8P3a3Vw2AvAr4hNd0A6Tih1YNorjiG2jkhcuo=CK1RF+aLFA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-08 9:39 ` Sudeep Holla
[not found] ` <d610d205-aa19-cf2f-072a-8b64c8c8be66-5wv7dgnIgG8@public.gmane.org>
2017-06-08 11:06 ` Arnd Bergmann
[not found] ` <CAK8P3a2wJ+hWro7+KYUBLRSTdbwKFjuzutajo436F-X=nMD5cQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-08 11:14 ` Sudeep Holla
2017-06-07 16:10 ` [RFC PATCH 7/8] firmware: arm_scmi: add initial support for sensor protocol Sudeep Holla
2017-06-07 19:19 ` Roy Franz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAK8P3a3Vw2AvAr4hNd0A6Tih1YNorjiG2jkhcuo=CK1RF+aLFA@mail.gmail.com' \
--to=arnd-r2ngtmty4d4@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=harba-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=nm-l0cyMroinI0@public.gmane.org \
--cc=roy.franz-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org \
--cc=sudeep.holla-5wv7dgnIgG8@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).