From: Eduardo Valentin <edubezval@gmail.com>
To: Amit Kachhap <amit.kachhap@gmail.com>
Cc: Javi Merino <javi.merino@arm.com>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
"rjw@rjwysocki.net" <rjw@rjwysocki.net>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Zhang Rui <rui.zhang@intel.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"lenb@kernel.org" <lenb@kernel.org>
Subject: Re: [PATCH v1 2/6] thermal: cpu_cooling: Support passing driver private data.
Date: Mon, 2 Jun 2014 14:57:39 -0400 [thread overview]
Message-ID: <20140602185739.GC5902@developer> (raw)
In-Reply-To: <CADGdYn6_cxfxR9+CA+pez00ViOVpTbv=r3eaGsk94CJ8PhF1tA@mail.gmail.com>
On Mon, Jun 02, 2014 at 02:54:04PM +0530, Amit Kachhap wrote:
> On 5/29/14, Javi Merino <javi.merino@arm.com> wrote:
> > Hi Amit,
> >
> > One minor comment.
> >
> > On Thu, May 29, 2014 at 09:15:30AM +0100, Amit Daniel Kachhap wrote:
> >> This patch allows the caller of cpufreq cooling APIs to register along
> >> with their driver data which will be useful while receiving any cooling
> >> states
> >> notifications.
> >> This patch is in preparation to add notfication support for cpufrequency
> >> cooling changes. This change also removes the unnecessary exposing of
> >> internal housekeeping structure via thermal_cooling_device->devdata to
> >> the
> >> users of cpufreq cooling APIs. As part of this implmentation, this private
> >> local
> >> structure (cpufreq_dev) is now stored in a list and scanned for each call
> >> to
> >> cpu cooling interfaces.
> >>
> >> Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
> >> ---
> >> Documentation/thermal/cpu-cooling-api.txt | 3 +-
> >> drivers/thermal/cpu_cooling.c | 89
> >> ++++++++++++++++----
> >> drivers/thermal/db8500_cpufreq_cooling.c | 2 +-
> >> drivers/thermal/samsung/exynos_thermal_common.c | 2 +-
> >> drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 2 +-
> >> include/linux/cpu_cooling.h | 5 +-
> >> 6 files changed, 80 insertions(+), 23 deletions(-)
> >>
> >> diff --git a/Documentation/thermal/cpu-cooling-api.txt
> >> b/Documentation/thermal/cpu-cooling-api.txt
> >> index fca24c9..aaa07c6 100644
> >> --- a/Documentation/thermal/cpu-cooling-api.txt
> >> +++ b/Documentation/thermal/cpu-cooling-api.txt
> >> @@ -17,13 +17,14 @@ the user. The registration APIs returns the cooling
> >> device pointer.
> >>
> >> 1.1 cpufreq registration/unregistration APIs
> >> 1.1.1 struct thermal_cooling_device *cpufreq_cooling_register(
> >> - struct cpumask *clip_cpus)
> >> + struct cpumask *clip_cpus, void *devdata)
> >>
> >> This interface function registers the cpufreq cooling device with the
> >> name
> >> "thermal-cpufreq-%x". This api can support multiple instances of
> >> cpufreq
> >> cooling devices.
> >>
> >> clip_cpus: cpumask of cpus where the frequency constraints will
> >> happen.
> >> + devdata: driver private data pointer.
> >>
> >> 1.1.2 void cpufreq_cooling_unregister(struct thermal_cooling_device
> >> *cdev)
> >>
> >> diff --git a/drivers/thermal/cpu_cooling.c
> >> b/drivers/thermal/cpu_cooling.c
> >> index 16388b0..6d145d5 100644
> >> --- a/drivers/thermal/cpu_cooling.c
> >> +++ b/drivers/thermal/cpu_cooling.c
> >> @@ -50,16 +50,18 @@ struct cpufreq_cooling_device {
> >> unsigned int cpufreq_state;
> >> unsigned int cpufreq_val;
> >> struct cpumask allowed_cpus;
> >> + struct list_head node;
> >> };
> >> static DEFINE_IDR(cpufreq_idr);
> >> static DEFINE_MUTEX(cooling_cpufreq_lock);
> >>
> >> -static unsigned int cpufreq_dev_count;
> >> -
> >> /* notify_table passes value to the CPUFREQ_ADJUST callback function. */
> >> #define NOTIFY_INVALID NULL
> >> static DEFINE_PER_CPU(struct cpufreq_cooling_device *, notify_device);
> >>
> >> +/* A list to hold all the cpufreq cooling devices registered */
> >> +static LIST_HEAD(cpufreq_cooling_list);
> >> +
> >> /**
> >> * get_idr - function to get a unique id.
> >> * @idr: struct idr * handle used to create a id.
> >> @@ -98,6 +100,26 @@ static void release_idr(struct idr *idr, int id)
> >>
> >> /* Below code defines functions to be used for cpufreq as cooling device
> >> */
> >>
> >> +/**
> >> + * cpufreq_cooling_get_info - function to cpufreq_dev for the
> >> corresponding cdev
> >> + * @cdev: pointer of the cooling device
> >> + *
> >> + * This function will loop through the cpufreq_cooling_device list and
> >> + * return the matching device
> >> + *
> >
> > You should add a "Locking:" section here which documents that this
> > function must be called with cooling_cpufreq_lock held.
> Yes agreed. Will update in the next version.
One good practice is to check the output of scripts/kerneldoc on your
changed file.
Cheers
>
> Thanks,
> Amit
> >
> > Cheers,
> > Javi
> >
> >> + * Return: cpufreq_cooling_device if matched with the cdev or NULL if
> >> not
> >> + * matched.
> >> + */
> >> +static inline struct cpufreq_cooling_device *
> >> +cpufreq_cooling_get_info(struct thermal_cooling_device *cdev)
> >> +{
> >> + struct cpufreq_cooling_device *cpufreq_dev = NULL;
> >> + list_for_each_entry(cpufreq_dev, &cpufreq_cooling_list, node)
> >> + if (cpufreq_dev->cool_dev == cdev)
> >> + break;
> >> + return cpufreq_dev;
> >> +}
> >> +
> >
> >
> >
WARNING: multiple messages have this Message-ID (diff)
From: edubezval@gmail.com (Eduardo Valentin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v1 2/6] thermal: cpu_cooling: Support passing driver private data.
Date: Mon, 2 Jun 2014 14:57:39 -0400 [thread overview]
Message-ID: <20140602185739.GC5902@developer> (raw)
In-Reply-To: <CADGdYn6_cxfxR9+CA+pez00ViOVpTbv=r3eaGsk94CJ8PhF1tA@mail.gmail.com>
On Mon, Jun 02, 2014 at 02:54:04PM +0530, Amit Kachhap wrote:
> On 5/29/14, Javi Merino <javi.merino@arm.com> wrote:
> > Hi Amit,
> >
> > One minor comment.
> >
> > On Thu, May 29, 2014 at 09:15:30AM +0100, Amit Daniel Kachhap wrote:
> >> This patch allows the caller of cpufreq cooling APIs to register along
> >> with their driver data which will be useful while receiving any cooling
> >> states
> >> notifications.
> >> This patch is in preparation to add notfication support for cpufrequency
> >> cooling changes. This change also removes the unnecessary exposing of
> >> internal housekeeping structure via thermal_cooling_device->devdata to
> >> the
> >> users of cpufreq cooling APIs. As part of this implmentation, this private
> >> local
> >> structure (cpufreq_dev) is now stored in a list and scanned for each call
> >> to
> >> cpu cooling interfaces.
> >>
> >> Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
> >> ---
> >> Documentation/thermal/cpu-cooling-api.txt | 3 +-
> >> drivers/thermal/cpu_cooling.c | 89
> >> ++++++++++++++++----
> >> drivers/thermal/db8500_cpufreq_cooling.c | 2 +-
> >> drivers/thermal/samsung/exynos_thermal_common.c | 2 +-
> >> drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 2 +-
> >> include/linux/cpu_cooling.h | 5 +-
> >> 6 files changed, 80 insertions(+), 23 deletions(-)
> >>
> >> diff --git a/Documentation/thermal/cpu-cooling-api.txt
> >> b/Documentation/thermal/cpu-cooling-api.txt
> >> index fca24c9..aaa07c6 100644
> >> --- a/Documentation/thermal/cpu-cooling-api.txt
> >> +++ b/Documentation/thermal/cpu-cooling-api.txt
> >> @@ -17,13 +17,14 @@ the user. The registration APIs returns the cooling
> >> device pointer.
> >>
> >> 1.1 cpufreq registration/unregistration APIs
> >> 1.1.1 struct thermal_cooling_device *cpufreq_cooling_register(
> >> - struct cpumask *clip_cpus)
> >> + struct cpumask *clip_cpus, void *devdata)
> >>
> >> This interface function registers the cpufreq cooling device with the
> >> name
> >> "thermal-cpufreq-%x". This api can support multiple instances of
> >> cpufreq
> >> cooling devices.
> >>
> >> clip_cpus: cpumask of cpus where the frequency constraints will
> >> happen.
> >> + devdata: driver private data pointer.
> >>
> >> 1.1.2 void cpufreq_cooling_unregister(struct thermal_cooling_device
> >> *cdev)
> >>
> >> diff --git a/drivers/thermal/cpu_cooling.c
> >> b/drivers/thermal/cpu_cooling.c
> >> index 16388b0..6d145d5 100644
> >> --- a/drivers/thermal/cpu_cooling.c
> >> +++ b/drivers/thermal/cpu_cooling.c
> >> @@ -50,16 +50,18 @@ struct cpufreq_cooling_device {
> >> unsigned int cpufreq_state;
> >> unsigned int cpufreq_val;
> >> struct cpumask allowed_cpus;
> >> + struct list_head node;
> >> };
> >> static DEFINE_IDR(cpufreq_idr);
> >> static DEFINE_MUTEX(cooling_cpufreq_lock);
> >>
> >> -static unsigned int cpufreq_dev_count;
> >> -
> >> /* notify_table passes value to the CPUFREQ_ADJUST callback function. */
> >> #define NOTIFY_INVALID NULL
> >> static DEFINE_PER_CPU(struct cpufreq_cooling_device *, notify_device);
> >>
> >> +/* A list to hold all the cpufreq cooling devices registered */
> >> +static LIST_HEAD(cpufreq_cooling_list);
> >> +
> >> /**
> >> * get_idr - function to get a unique id.
> >> * @idr: struct idr * handle used to create a id.
> >> @@ -98,6 +100,26 @@ static void release_idr(struct idr *idr, int id)
> >>
> >> /* Below code defines functions to be used for cpufreq as cooling device
> >> */
> >>
> >> +/**
> >> + * cpufreq_cooling_get_info - function to cpufreq_dev for the
> >> corresponding cdev
> >> + * @cdev: pointer of the cooling device
> >> + *
> >> + * This function will loop through the cpufreq_cooling_device list and
> >> + * return the matching device
> >> + *
> >
> > You should add a "Locking:" section here which documents that this
> > function must be called with cooling_cpufreq_lock held.
> Yes agreed. Will update in the next version.
One good practice is to check the output of scripts/kerneldoc on your
changed file.
Cheers
>
> Thanks,
> Amit
> >
> > Cheers,
> > Javi
> >
> >> + * Return: cpufreq_cooling_device if matched with the cdev or NULL if
> >> not
> >> + * matched.
> >> + */
> >> +static inline struct cpufreq_cooling_device *
> >> +cpufreq_cooling_get_info(struct thermal_cooling_device *cdev)
> >> +{
> >> + struct cpufreq_cooling_device *cpufreq_dev = NULL;
> >> + list_for_each_entry(cpufreq_dev, &cpufreq_cooling_list, node)
> >> + if (cpufreq_dev->cool_dev == cdev)
> >> + break;
> >> + return cpufreq_dev;
> >> +}
> >> +
> >
> >
> >
next prev parent reply other threads:[~2014-06-02 18:57 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-29 8:15 [PATCH v1 0/6] ACPI: thermal: Migrate cpufreq cooling to generic cpu_cooling layer Amit Daniel Kachhap
2014-05-29 8:15 ` Amit Daniel Kachhap
2014-05-29 8:15 ` [PATCH v1 1/6] thermal: cpu_cooling: Fix the notification mechanism by using per cpu structure Amit Daniel Kachhap
2014-05-29 8:15 ` Amit Daniel Kachhap
2014-05-29 8:15 ` [PATCH v1 2/6] thermal: cpu_cooling: Support passing driver private data Amit Daniel Kachhap
2014-05-29 8:15 ` Amit Daniel Kachhap
2014-05-29 8:15 ` Amit Daniel Kachhap
2014-05-29 12:06 ` Javi Merino
2014-05-29 12:06 ` Javi Merino
2014-06-02 9:24 ` Amit Kachhap
2014-06-02 9:24 ` Amit Kachhap
2014-06-02 18:57 ` Eduardo Valentin [this message]
2014-06-02 18:57 ` Eduardo Valentin
2014-05-29 8:15 ` [PATCH v1 3/6] thermal: thermal-core: Add notifications support for the cooling states Amit Daniel Kachhap
2014-05-29 8:15 ` Amit Daniel Kachhap
2014-05-29 12:24 ` Javi Merino
2014-05-29 12:24 ` Javi Merino
2014-06-02 9:31 ` Amit Kachhap
2014-06-02 9:31 ` Amit Kachhap
2014-06-02 10:14 ` Javi Merino
2014-06-02 10:14 ` Javi Merino
2014-05-29 8:15 ` [PATCH v1 4/6] thermal: cpu_cooling: Add support to find up/low frequency levels Amit Daniel Kachhap
2014-05-29 8:15 ` Amit Daniel Kachhap
2014-05-29 8:15 ` [PATCH v1 5/6] thermal: thermal_core: Remove the max cooling limit check in registration Amit Daniel Kachhap
2014-05-29 8:15 ` Amit Daniel Kachhap
2014-05-29 8:15 ` [PATCH v1 6/6] ACPI: thermal: processor: Use the generic cpufreq infrastructure Amit Daniel Kachhap
2014-05-29 8:15 ` Amit Daniel Kachhap
2014-05-29 12:42 ` Javi Merino
2014-05-29 12:42 ` Javi Merino
2014-06-02 9:21 ` Amit Kachhap
2014-06-02 9:21 ` Amit Kachhap
2014-06-02 10:20 ` Javi Merino
2014-06-02 10:20 ` Javi Merino
2014-06-02 17:36 ` Eduardo Valentin
2014-06-02 17:36 ` Eduardo Valentin
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=20140602185739.GC5902@developer \
--to=edubezval@gmail.com \
--cc=amit.kachhap@gmail.com \
--cc=javi.merino@arm.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=rui.zhang@intel.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 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.