From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: markgross@thegnar.org
Cc: Jean Pihet <jean.pihet@newoldbits.com>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
Kevin Hilman <khilman@ti.com>,
Linux PM mailing list <linux-pm@lists.linux-foundation.org>,
linux-omap@vger.kernel.org, Paul Walmsley <paul@pwsan.com>,
Magnus Damm <magnus.damm@gmail.com>,
Todd Poynor <toddpoynor@google.com>, Jean Pihet <j-pihet@ti.com>
Subject: Re: [PATCH 05/15] PM QoS: generalize and export the constraints management code
Date: Tue, 16 Aug 2011 20:01:38 +0200 [thread overview]
Message-ID: <201108162001.38894.rjw@sisk.pl> (raw)
In-Reply-To: <20110816174557.GA17027@gvim.org>
On Tuesday, August 16, 2011, mark gross wrote:
> On Tue, Aug 16, 2011 at 08:44:19AM +0200, Jean Pihet wrote:
> > On Tue, Aug 16, 2011 at 6:08 AM, mark gross <markgross@thegnar.org> wrote:
> > > On Sun, Aug 14, 2011 at 03:37:43PM +0200, Rafael J. Wysocki wrote:
> > >> On Sunday, August 14, 2011, Jean Pihet wrote:
> > >> > Hi Rafael, Mark,
> > >> >
> > >> > On Sat, Aug 13, 2011 at 10:34 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> > >> > > On Saturday, August 13, 2011, mark gross wrote:
> > >> > >> On Thu, Aug 11, 2011 at 05:06:42PM +0200, jean.pihet@newoldbits.com wrote:
> > >> > >> > From: Jean Pihet <j-pihet@ti.com>
> > >> > >> >
> > >> > >> > In preparation for the per-device constratins support:
> > >> > >> > - rename update_target to pm_qos_update_target
> > >> > >> > - generalize and export pm_qos_update_target for usage by the upcoming
> > >> > >> > per-device latency constraints framework:
> > >> > >> > . operate on struct pm_qos_constraints for constraints management,
> > >> > >> > . introduce an 'action' parameter for constraints add/update/remove,
> > >> > >> > . the return value indicates if the aggregated constraint value has
> > >> > >> > changed,
> > >> > >> > - update the internal code to operate on struct pm_qos_constraints
> > >> > >> > - add a NULL pointer check in the API functions
> > >> > >> >
> > >> > >> > Signed-off-by: Jean Pihet <j-pihet@ti.com>
> > >> > ...
> > >> > >> > +/* Action requested to pm_qos_update_target */
> > >> > >> > +enum pm_qos_req_action {
> > >> > >> > + PM_QOS_ADD_REQ, /* Add a new request */
> > >> > >> > + PM_QOS_UPDATE_REQ, /* Update an existing request */
> > >> > >> > + PM_QOS_REMOVE_REQ /* Remove an existing request */
> > >> > >> > +};
> > >> > >> > +
> > >> > >>
> > >> > >> What do you need this enum for? The function names *_update_*, *_add_*,
> > >> > >> and *_remove_* seem to be pretty redundant if you have to pass an enum
> > >> > >> that could possibly conflict with the function name.
> > >> > >>
> > >> > >> > #ifdef CONFIG_PM
> > >> > >> > +int pm_qos_update_target(struct pm_qos_constraints *c, struct plist_node *node,
> > >> > >> > + enum pm_qos_req_action action, int value);
> > >> > >> The action for update_target better damn well be "PM_QOS_UPDATE_REQ" or
> > >> > >> there is something strange going on.... BTW what shold this function do
> > >> > >> if the pm_qos_req_action was *not* the UPDATE one?
> > >> >
> > >> > The meaning of pm_qos_update_target is 'update the PM QoS target
> > >> > constraints lists'. As described in the changelog the intention of
> > >> > this patch is to implement the constraints lists management logic in
> > >> > update_target and simplify the API functions (add/update/remove). It
> > >> > is also exported for the upcoming (patch 06/15]) to use it as well.
> > >>
> > >> The enums are fine by me and they allow us to simplify the code
> > >> quite a bit.
> > >>
> > > Ok, but they look a bit sloppy to me as we now have an API that says
> > > "add" we can actually pass in an enum that says "remove".
> > We have an API that says 'update target' that we pass in a parameter
> > that says 'add request', 'update request' or 'remove request'.
> > If it is required I could just rename the internal function
> > update_target, in a later patch.
>
> You are right. I thought I saw the enum added to the other API's for
> some reason. Still, with this update we have an API overloaded through
> that enum parameter providing 2 add, 2 delete and 2 update API's Each
> pair doing about the same thing.
>
> To me it feels like a baby step toward an ioctl type of API that I don't
> like. I'm not going to fight about it any more but I don't like such
> API's as they tend to get hard to read and get out of control.
>
> please rethink this a little.
For real _users_, the API is still "add", "update" and "remove",
but _internally_ those functions use the same "worker" routine with an
argument specifying the operation to carry out. This reduces code
duplication quite a bit and it quite common in the kernel.
Thanks,
Rafael
next prev parent reply other threads:[~2011-08-16 17:59 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-11 15:06 [PATCH v4 00/15] PM QoS: add a per-device latency constraints class jean.pihet
2011-08-11 15:06 ` [PATCH 01/15] PM QoS: move and rename the implementation files jean.pihet
2011-08-13 2:47 ` mark gross
2011-08-11 15:06 ` [PATCH 02/15] PM QoS: minor clean-ups jean.pihet
2011-08-13 2:48 ` mark gross
2011-08-11 15:06 ` [PATCH 03/15] PM QoS: code re-organization jean.pihet
2011-08-13 2:50 ` mark gross
2011-08-11 15:06 ` [PATCH 04/15] PM QoS: re-organize data structs jean.pihet
2011-08-13 2:56 ` mark gross
2011-08-13 20:58 ` Rafael J. Wysocki
2011-08-14 8:29 ` Jean Pihet
2011-08-14 13:34 ` Rafael J. Wysocki
2011-08-11 15:06 ` [PATCH 05/15] PM QoS: generalize and export the constraints management code jean.pihet
2011-08-13 3:09 ` mark gross
2011-08-13 20:34 ` Rafael J. Wysocki
2011-08-14 8:25 ` Jean Pihet
2011-08-14 13:37 ` Rafael J. Wysocki
2011-08-16 4:08 ` mark gross
2011-08-16 6:44 ` Jean Pihet
2011-08-16 17:45 ` mark gross
2011-08-16 18:01 ` Rafael J. Wysocki [this message]
2011-08-11 15:06 ` [PATCH 06/15] PM QoS: implement the per-device PM QoS constraints jean.pihet
2011-08-13 3:16 ` mark gross
2011-08-13 21:08 ` Rafael J. Wysocki
2011-08-14 8:50 ` Jean Pihet
2011-08-14 13:51 ` Rafael J. Wysocki
2011-08-11 15:06 ` [PATCH 07/15] PM QoS: add a global notification mechanism for the device constraints jean.pihet
2011-08-14 21:50 ` Rafael J. Wysocki
2011-08-16 9:58 ` Jean Pihet
2011-08-11 15:06 ` [PATCH 08/15] OMAP: convert I2C driver to PM QoS for latency constraints jean.pihet
2011-08-11 15:06 ` [PATCH 09/15] OMAP: PM: create a PM layer plugin for per-device constraints jean.pihet
2011-08-11 15:06 ` [PATCH 10/15] OMAP2+: powerdomain: control power domains next state jean.pihet
2011-08-11 15:06 ` [PATCH 11/15] OMAP3: powerdomain data: add wake-up latency figures jean.pihet
2011-08-11 15:06 ` [PATCH 12/15] OMAP4: " jean.pihet
2011-08-11 15:06 ` [PATCH 13/15] OMAP2+: omap_hwmod: manage the wake-up latency constraints jean.pihet
2011-08-11 15:06 ` [PATCH 14/15] OMAP: PM CONSTRAINTS: implement the devices " jean.pihet
2011-08-11 15:06 ` [PATCH 15/15] OMAP2+: cpuidle only influences the MPU state jean.pihet
2011-08-12 8:02 ` [PATCH v4 00/15] PM QoS: add a per-device latency constraints class Rafael J. Wysocki
2011-08-12 11:56 ` Jean Pihet
2011-08-12 21:56 ` Rafael J. Wysocki
2011-08-14 8:51 ` Jean Pihet
2011-08-14 13:53 ` Rafael J. Wysocki
-- strict thread matches above, loose matches on Subject: below --
2011-08-16 13:43 [PATCH v5 00/15] PM QoS: add a per-device latency constraints framework jean.pihet
2011-08-16 13:43 ` [PATCH 05/15] PM QoS: generalize and export the constraints management code jean.pihet
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=201108162001.38894.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=j-pihet@ti.com \
--cc=jean.pihet@newoldbits.com \
--cc=khilman@ti.com \
--cc=linux-omap@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=magnus.damm@gmail.com \
--cc=markgross@thegnar.org \
--cc=paul@pwsan.com \
--cc=toddpoynor@google.com \
/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