All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Jeff Garzik <jeff@garzik.org>
Cc: Andrew Morton <akpm@osdl.org>,
	LKML <linux-kernel@vger.kernel.org>,
	dmitriyz@google.com
Subject: Re: [PATCH] x86 therm_throttle: handle sysfs errors
Date: Wed, 4 Oct 2006 13:54:44 +0200	[thread overview]
Message-ID: <200610041354.44967.ak@suse.de> (raw)
In-Reply-To: <20061004112859.GA20672@havoc.gtf.org>

On Wednesday 04 October 2006 13:28, Jeff Garzik wrote:
> 
> Signed-off-by: Jeff Garzik <jeff@garzik.org>
> 
> ---
> 
> Not sure if NOTIFY_BAD is the correct way to handle the error.
> Please review.

Best you cc the patch author.
(full quote)

-Andi

> 
>  arch/i386/kernel/cpu/mcheck/therm_throt.c |   31 +++++++++++++++++++++---------
>  1 files changed, 22 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/i386/kernel/cpu/mcheck/therm_throt.c b/arch/i386/kernel/cpu/mcheck/therm_throt.c
> index 4f43047..86a47f7 100644
> --- a/arch/i386/kernel/cpu/mcheck/therm_throt.c
> +++ b/arch/i386/kernel/cpu/mcheck/therm_throt.c
> @@ -112,15 +112,13 @@ #ifdef CONFIG_SYSFS
>  /* Add/Remove thermal_throttle interface for CPU device */
>  staticdmitriyz@google.com __cpuinit int thermal_throttle_add_dev(struct sys_device * sys_dev)
>  {
> -	sysfs_create_group(&sys_dev->kobj, &thermal_throttle_attr_group);
> -	return 0;
> +	return sysfs_create_group(&sys_dev->kobj, &thermal_throttle_attr_group);
>  }
>  
>  #ifdef CONFIG_HOTPLUG_CPU
> -static __cpuinit int thermal_throttle_remove_dev(struct sys_device * sys_dev)
> +static __cpuinit void thermal_throttle_remove_dev(struct sys_device * sys_dev)
>  {
>  	sysfs_remove_group(&sys_dev->kobj, &thermal_throttle_attr_group);
> -	return 0;
>  }
>  
>  /* Mutex protecting device creation against CPU hotplug */
> @@ -133,19 +131,21 @@ static __cpuinit int thermal_throttle_cp
>  {
>  	unsigned int cpu = (unsigned long)hcpu;
>  	struct sys_device *sys_dev;
> +	int rc = 0;
>  
>  	sys_dev = get_cpu_sysdev(cpu);
>  	mutex_lock(&therm_cpu_lock);
>  	switch (action) {
>  	case CPU_ONLINE:
> -		thermal_throttle_add_dev(sys_dev);
> +		rc = thermal_throttle_add_dev(sys_dev);
>  		break;
>  	case CPU_DEAD:
>  		thermal_throttle_remove_dev(sys_dev);
>  		break;
>  	}
>  	mutex_unlock(&therm_cpu_lock);
> -	return NOTIFY_OK;
> +
> +	return rc ? NOTIFY_BAD : NOTIFY_OK;
>  }
>  
>  static struct notifier_block thermal_throttle_cpu_notifier =
> @@ -156,7 +156,8 @@ #endif /* CONFIG_HOTPLUG_CPU */
>  
>  static __init int thermal_throttle_init_device(void)
>  {
> -	unsigned int cpu = 0;
> +	unsigned int cpu = 0, cpu_err;
> +	int err = 0;
>  
>  	if (!atomic_read(&therm_throt_en))
>  		return 0;
> @@ -167,13 +168,25 @@ #ifdef CONFIG_HOTPLUG_CPU
>  	mutex_lock(&therm_cpu_lock);
>  #endif
>  	/* connect live CPUs to sysfs */
> -	for_each_online_cpu(cpu)
> -		thermal_throttle_add_dev(get_cpu_sysdev(cpu));
> +	for_each_online_cpu(cpu) {
> +		if (!err)
> +			err = thermal_throttle_add_dev(get_cpu_sysdev(cpu));
> +	}
> +	if (err)
> +		goto err_out;
> +
>  #ifdef CONFIG_HOTPLUG_CPU
>  	mutex_unlock(&therm_cpu_lock);
>  #endif
>  
>  	return 0;
> +
> +err_out:
> +	for_each_online_cpu(cpu_err) {
> +		if (cpu_err < cpu)
> +			thermal_throttle_remove_dev(get_cpu_sysdev(cpu_err));
> +	}
> +	return err;
>  }
>  
>  device_initcall(thermal_throttle_init_device);
> 

      reply	other threads:[~2006-10-04 11:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-04 11:28 [PATCH] x86 therm_throttle: handle sysfs errors Jeff Garzik
2006-10-04 11:54 ` Andi Kleen [this message]

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=200610041354.44967.ak@suse.de \
    --to=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=dmitriyz@google.com \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.