linux-mips
[Top] [All Lists]

[PATCH 1/1] APM-EMULATION: apm_get_power_status() should be NULL on init

To: Paul Mundt <lethal@linux-sh.org>, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.arm.linux.org.uk, linux-mips@linux-mips.org
Subject: [PATCH 1/1] APM-EMULATION: apm_get_power_status() should be NULL on init [was: Advice on battery support]
From: Rodolfo Giometti <giometti@enneenne.com>
Date: Fri, 2 Feb 2007 22:27:41 +0100
In-reply-to: <20070201095904.GE8882@enneenne.com>
Organization: GNU/Linux Device Drivers, Embedded Systems and Courses
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20070129230755.GA8705@enneenne.com> <20070130010055.GA15907@linux-sh.org> <20070201095904.GE8882@enneenne.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.13 (2006-08-11)
APM-EMULATION: apm_get_power_status() should be NULL on init.

Signed-off-by: Rodolfo Giometti <giometti@enneenne.com>

---

If the function apm_get_info() do like this:

   static int apm_get_info(char *buf, char **start, off_t fpos, int length)
   {
           struct apm_power_info info;
           char *units;
           int ret;

           info.ac_line_status = 0xff;
           info.battery_status = 0xff;
           info.battery_flag   = 0xff;
           info.battery_life   = -1;
           info.time           = -1;
           info.units          = -1;

           if (apm_get_power_status)
                   apm_get_power_status(&info);
   ...

we shouldn't set:

   static void __apm_get_power_status(struct apm_power_info *info)
   {
   }

   void (*apm_get_power_status)(struct apm_power_info *) = 
__apm_get_power_status;

otherwise the check is not needed. Furthermore setting the function to
NULL signals that the apm-emulation layer is not already assigned (I
found this very useful for my apm-emulation battery_class support).

<Prev in Thread] Current Thread [Next in Thread>