From: Len Brown <lenb@kernel.org>
To: "Zhang, Rui" <rui.zhang@intel.com>
Cc: linux-acpi <linux-acpi@vger.kernel.org>,
lm-sensors <lm-sensors@lm-sensors.org>,
Hans de Goede <j.w.r.degoede@hhs.nl>
Subject: Re: [PATCH 1/2] thermal: add hwmon sys I/F for thermal device
Date: Tue, 18 Mar 2008 00:59:39 -0400 [thread overview]
Message-ID: <200803180059.40007.lenb@kernel.org> (raw)
In-Reply-To: <1205398009.2240.75.camel@acpi-hp-zz.sh.intel.com>
On Thursday 13 March 2008, Zhang, Rui wrote:
>
> On Thu, 2008-03-13 at 13:09 +0800, Len Brown wrote:
> >
> > > On Tuesday 26 February 2008, Zhang, Rui wrote:
> > > >
> > > > Add hwmon sys I/F for the generic thermal device.
> > > >
> > > > Signed-off-by: Zhang Rui <rui.zhang@intel.com>
> > > > Cc: Hans de Geode <j.w.r.degoede@hhs.nl>
> > > > ---
> > > > Documentation/thermal/sysfs-api.txt | 22 ++--
> > > > drivers/thermal/Kconfig | 1
> > > > drivers/thermal/thermal.c | 169
> > ++++++++++++++++++++++++++++++------
> > > > 3 files changed, 155 insertions(+), 37 deletions(-)
> > > >
> > ...
> > > > {
> > > > int result = 0;
> > > > @@ -716,16 +829,20 @@ static int __init thermal_init(void)
> > > > mutex_destroy(&thermal_idr_lock);
> > > > mutex_destroy(&thermal_list_lock);
> > > > }
> > > > - return result;
> > > > -}
> > > >
> > > > -static void __exit thermal_exit(void)
> > > > -{
> > > > - class_unregister(&thermal_class);
> > > > - idr_destroy(&thermal_tz_idr);
> > > > - idr_destroy(&thermal_cdev_idr);
> > > > - mutex_destroy(&thermal_idr_lock);
> > > > - mutex_destroy(&thermal_list_lock);
> > > > + thermal_hwmon = hwmon_device_register(NULL);
> > > > + if (IS_ERR(thermal_hwmon)) {
> > > > + result = PTR_ERR(thermal_hwmon);
> > > > + thermal_hwmon = NULL;
> > > > + printk(KERN_ERR PREFIX
> > > > + "unable to register hwmon device\n");
> > > > + thermal_exit();
> >
> > An __exit routine can not be called from an __init routine.
> > this doesn't build on ia64, which discards .exit sections:
> >
> > .exit.text' referenced in section `.init.text' of drivers/built-in.o:
> > defined in discarded section `.exit.text' of drivers/built-in.o
> >
> > -Len
> As I don't have an ia64 machine,
> len, could you please help me test this incremental patch? :)
>
> From: Zhang Rui <rui.zhang@intel.com>
>
> An __exit routine can not be called from an __init routine.
> this doesn't build on ia64, which discards .exit sections:
> ".exit.text' referenced in section `.init.text' of drivers/built-in.o:
> defined in discarded section `.exit.text' of drivers/built-in.o"
>
> http://marc.info/?l=linux-acpi&m=120538509025142&w=2
>
> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
> ---
> drivers/thermal/thermal.c | 19 +++++++++++--------
> 1 file changed, 11 insertions(+), 8 deletions(-)
>
> Index: linux-2.6/drivers/thermal/thermal.c
> ===================================================================
> --- linux-2.6.orig/drivers/thermal/thermal.c
> +++ linux-2.6/drivers/thermal/thermal.c
> @@ -823,12 +823,8 @@ static int __init thermal_init(void)
> int result = 0;
>
> result = class_register(&thermal_class);
> - if (result) {
> - idr_destroy(&thermal_tz_idr);
> - idr_destroy(&thermal_cdev_idr);
> - mutex_destroy(&thermal_idr_lock);
> - mutex_destroy(&thermal_list_lock);
> - }
> + if (result)
> + goto err;
>
> thermal_hwmon = hwmon_device_register(NULL);
> if (IS_ERR(thermal_hwmon)) {
> @@ -836,13 +832,20 @@ static int __init thermal_init(void)
> thermal_hwmon = NULL;
> printk(KERN_ERR PREFIX
> "unable to register hwmon device\n");
> - thermal_exit();
> - return result;
> + class_unregister(&thermal_class);
> + goto err;
> }
>
> result = device_create_file(thermal_hwmon, &dev_attr_name);
>
> return result;
> + err:
> + idr_destroy(&thermal_tz_idr);
> + idr_destroy(&thermal_cdev_idr);
> + mutex_destroy(&thermal_idr_lock);
> + mutex_destroy(&thermal_list_lock);
> +
> + return result;
> }
>
> subsys_initcall(thermal_init);
>
>
I already addressed this by modifying your patch that called thermal_exit() from __init
to simply remove the __exit from thermal_exit().
ie. as Henrique does in thinkpad_acpi.c -- we simply don't reward =y builds
by labeling anything with __exit for the tools to strip.
thanks,
-Len
next prev parent reply other threads:[~2008-03-18 5:01 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-27 0:37 [PATCH 1/2] thermal: add hwmon sys I/F for thermal device Zhang, Rui
2008-03-12 4:29 ` Len Brown
2008-03-13 5:09 ` Len Brown
2008-03-13 8:46 ` Zhang, Rui
2008-03-18 4:59 ` Len Brown [this message]
2008-03-13 10:59 ` Thomas Renninger
2008-03-13 23:09 ` Henrique de Moraes Holschuh
2008-03-14 9:03 ` Thomas Renninger
2008-03-15 4:25 ` [lm-sensors] " Henrique de Moraes Holschuh
-- strict thread matches above, loose matches on Subject: below --
2008-02-25 21:31 Zhang, Rui
2008-02-26 8:39 ` Hans de Goede
2008-02-26 21:40 ` Zhang, Rui
2008-02-27 8:32 ` Hans de Goede
2008-03-17 12:37 ` Jean Delvare
2008-03-17 12:55 ` Hans de Goede
2008-03-17 13:48 ` Jean Delvare
2008-03-18 3:45 ` Zhang, Rui
2008-03-18 10:06 ` Jean Delvare
2008-03-20 14:58 ` Henrique de Moraes Holschuh
2008-03-18 5:12 ` Len Brown
2008-03-18 9:44 ` Jean Delvare
2008-03-18 3:11 ` Zhang, Rui
2008-03-18 1:59 ` Zhang, Rui
2008-03-18 9:25 ` Hans de Goede
2008-03-18 9:40 ` Jean Delvare
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=200803180059.40007.lenb@kernel.org \
--to=lenb@kernel.org \
--cc=j.w.r.degoede@hhs.nl \
--cc=linux-acpi@vger.kernel.org \
--cc=lm-sensors@lm-sensors.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox