public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: aaro.koskinen@nokia•com (Aaro Koskinen)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH 6/6] ARM: oprofile: convert from sysdev to platform device
Date: Thu, 06 May 2010 19:20:41 +0300	[thread overview]
Message-ID: <4BE2EC59.4060101@nokia.com> (raw)
In-Reply-To: <1271695361-7121-7-git-send-email-will.deacon@arm.com>

Hi,

Will Deacon wrote:
> This is a reworking of an original patch posted by Aaro Koskinen:
> 
> oprofile does not work with PM, because sysdev_suspend() is done with
> interrupts disabled and oprofile needs a mutex. Implementing oprofile
> as a platform device solves this problem.
> 
> Cc: Russell King - ARM Linux <linux@arm•linux.org.uk>
> Cc: Aaro Koskinen <aaro.koskinen@nokia•com>

You can change this to Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia•com>

Thanks,

A.

> Signed-off-by: Will Deacon <will.deacon@arm•com>
> ---
>  arch/arm/oprofile/common.c |   44 +++++++++++++++++++++++++++++---------------
>  1 files changed, 29 insertions(+), 15 deletions(-)
> 
> diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c
> index aad83df..0691176 100644
> --- a/arch/arm/oprofile/common.c
> +++ b/arch/arm/oprofile/common.c
> @@ -10,13 +10,14 @@
>   */
>  
>  #include <linux/cpumask.h>
> +#include <linux/err.h>
>  #include <linux/errno.h>
>  #include <linux/init.h>
>  #include <linux/mutex.h>
>  #include <linux/oprofile.h>
>  #include <linux/perf_event.h>
> +#include <linux/platform_device.h>
>  #include <linux/slab.h>
> -#include <linux/sysdev.h>
>  #include <asm/stacktrace.h>
>  #include <linux/uaccess.h>
>  
> @@ -227,7 +228,7 @@ static void op_arm_stop(void)
>  }
>  
>  #ifdef CONFIG_PM
> -static int op_arm_suspend(struct sys_device *dev, pm_message_t state)
> +static int op_arm_suspend(struct platform_device *dev, pm_message_t state)
>  {
>  	mutex_lock(&op_arm_mutex);
>  	if (op_arm_enabled)
> @@ -236,7 +237,7 @@ static int op_arm_suspend(struct sys_device *dev, pm_message_t state)
>  	return 0;
>  }
>  
> -static int op_arm_resume(struct sys_device *dev)
> +static int op_arm_resume(struct platform_device *dev)
>  {
>  	mutex_lock(&op_arm_mutex);
>  	if (op_arm_enabled && op_perf_start())
> @@ -245,34 +246,42 @@ static int op_arm_resume(struct sys_device *dev)
>  	return 0;
>  }
>  
> -static struct sysdev_class oprofile_sysclass = {
> -	.name		= "oprofile",
> +static struct platform_driver oprofile_driver = {
> +	.driver		= {
> +		.name		= "arm-oprofile",
> +	},
>  	.resume		= op_arm_resume,
>  	.suspend	= op_arm_suspend,
>  };
>  
> -static struct sys_device device_oprofile = {
> -	.id		= 0,
> -	.cls		= &oprofile_sysclass,
> -};
> +static struct platform_device *oprofile_pdev;
>  
>  static int __init init_driverfs(void)
>  {
>  	int ret;
>  
> -	if (!(ret = sysdev_class_register(&oprofile_sysclass)))
> -		ret = sysdev_register(&device_oprofile);
> +	ret = platform_driver_register(&oprofile_driver);
> +	if (ret)
> +		goto out;
> +
> +	oprofile_pdev =	platform_device_register_simple(
> +				oprofile_driver.driver.name, 0, NULL, 0);
> +	if (IS_ERR(oprofile_pdev)) {
> +		ret = PTR_ERR(oprofile_pdev);
> +		platform_driver_unregister(&oprofile_driver);
> +	}
>  
> +out:
>  	return ret;
>  }
>  
>  static void  exit_driverfs(void)
>  {
> -	sysdev_unregister(&device_oprofile);
> -	sysdev_class_unregister(&oprofile_sysclass);
> +	platform_device_unregister(oprofile_pdev);
> +	platform_driver_unregister(&oprofile_driver);
>  }
>  #else
> -#define init_driverfs()	do { } while (0)
> +static int __init init_driverfs(void) { return 0; }
>  #define exit_driverfs() do { } while (0)
>  #endif /* CONFIG_PM */
>  
> @@ -353,6 +362,12 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
>  		return -ENOMEM;
>  	}
>  
> +	ret = init_driverfs();
> +	if (ret) {
> +		kfree(counter_config);
> +		return ret;
> +	}
> +
>  	for_each_possible_cpu(cpu) {
>  		perf_events[cpu] = kcalloc(perf_num_counters,
>  				sizeof(struct perf_event *), GFP_KERNEL);
> @@ -365,7 +380,6 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
>  		}
>  	}
>  
> -	init_driverfs();
>  	ops->backtrace		= arm_backtrace;
>  	ops->create_files	= op_arm_create_files;
>  	ops->setup		= op_arm_setup;

  reply	other threads:[~2010-05-06 16:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-19 16:42 [PATCH 0/6] ARM: oprofile: use perf-events framework as backend [v4] Will Deacon
2010-04-19 16:42 ` [PATCH 1/6] ARM: perf-events: use numeric ID to identify PMU Will Deacon
2010-04-19 16:42   ` [PATCH 2/6] ARM: perf-events: add support for xscale PMUs Will Deacon
2010-04-19 16:42     ` [PATCH 3/6] ARM: perf-events: allow modules to query the number of hardware counters Will Deacon
2010-04-19 16:42       ` [PATCH 4/6] ARM: oprofile: use perf-events framework as backend Will Deacon
2010-04-19 16:42         ` [PATCH 5/6] ARM: oprofile: remove old files and update KConfig Will Deacon
2010-04-19 16:42           ` [PATCH 6/6] ARM: oprofile: convert from sysdev to platform device Will Deacon
2010-05-06 16:20             ` Aaro Koskinen [this message]
2010-05-07 16:44               ` Will Deacon
  -- strict thread matches above, loose matches on Subject: below --
2010-04-12 15:04 [PATCH 0/6] ARM: oprofile: use perf-events framework as backend [v3] Will Deacon
2010-04-12 15:04 ` [PATCH 1/6] ARM: perf-events: use numeric ID to identify PMU Will Deacon
2010-04-12 15:04   ` [PATCH 2/6] ARM: perf-events: add support for xscale PMUs Will Deacon
2010-04-12 15:04     ` [PATCH 3/6] perf-events: allow modules to query the maximum number of perf events Will Deacon
2010-04-12 15:04       ` [PATCH 4/6] ARM: oprofile: use perf-events framework as backend Will Deacon
2010-04-12 15:04         ` [PATCH 5/6] ARM: oprofile: remove old files and update KConfig Will Deacon
2010-04-12 15:04           ` [PATCH 6/6] ARM: oprofile: convert from sysdev to platform device Will Deacon

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=4BE2EC59.4060101@nokia.com \
    --to=aaro.koskinen@nokia$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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