public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Dominik Brodowski <linux@dominikbrodowski.net>
To: "Eugeny S. Mints" <eugeny.mints@gmail.com>
Cc: pm list <linux-pm@lists.osdl.org>,
	kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] CPUFreq PowerOP integration, Centrino PM Core and OPs registration 2/3
Date: Fri, 6 Oct 2006 23:19:10 -0400	[thread overview]
Message-ID: <20061007031910.GA1494@dominikbrodowski.de> (raw)
In-Reply-To: <45096C1A.7010008@gmail.com>

Hi,

On Thu, Sep 14, 2006 at 06:50:02PM +0400, Eugeny S. Mints wrote:

> +static int 
> +process_pwr_param(struct pm_core_point *opt, int op, char *param_name,
> +		  int va_arg)
> +{
> +	int cpu = 0;
> +	char buf[8];
> +
> +	for (cpu = 0; cpu < NR_CPUS; cpu++)
> +	{
> +		sprintf(buf, "v%d", cpu);
> +
> +		if (strcmp(param_name, buf) == 0) {
> +			if (op == PWR_PARAM_SET)
> +				opt->opt[cpu].pwpr[_I386_PM_CORE_POINT_V] = 
> +									va_arg;
> +			else if (opt != NULL)
> +				*(int *)va_arg = 
> +				     opt->opt[cpu].pwpr[_I386_PM_CORE_POINT_V];
> +			else if ((*(int *)va_arg = get_vtg(cpu)) <= 0)
> +				return -EINVAL;
> +			return 0;
> +		}
> +
> +		sprintf(buf, "freq%d", cpu);
> +
> +		if (strcmp(param_name, buf) == 0) {
> +			if (op == PWR_PARAM_SET)
> +				opt->opt[cpu].pwpr[_I386_PM_CORE_POINT_FREQ] = 
> +									va_arg;
> +			else if (opt != NULL)
> +				*(int *)va_arg = 
> +				  opt->opt[cpu].pwpr[_I386_PM_CORE_POINT_FREQ];
> +			else if ((*(int *)va_arg = get_freq(cpu)) <= 0)
> +				return -EINVAL;
> +
> +			return 0;
> +		}
> +	}
> +
> +	return -EINVAL;
> +}

Ouch. IIRC Pavel had some fine comments about such string parsing deep in
arch code... Other than that I see lots of indirection, lots of code being
added (~400 lines) for no gain in functionality for the x86 case.

Thanks,
	Dominik

  parent reply	other threads:[~2006-10-07  3:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-14 14:50 [RFC] CPUFreq PowerOP integration, Centrino PM Core and OPs registration 2/3 Eugeny S. Mints
2006-09-18 10:46 ` Pavel Machek
2006-09-18 11:16   ` [linux-pm] " Eugeny S. Mints
2006-10-07  3:19 ` Dominik Brodowski [this message]
2006-10-09 13:42   ` Eugeny S. Mints
  -- strict thread matches above, loose matches on Subject: below --
2006-08-24  1:29 Eugeny S. Mints
2006-08-26  0:03 ` Eugeny S. Mints

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=20061007031910.GA1494@dominikbrodowski.de \
    --to=linux@dominikbrodowski.net \
    --cc=eugeny.mints@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.osdl.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