2008-01-16 13:00:49

by Johannes Weiner

[permalink] [raw]
Subject: thinkpad_acpi: define _sta only when needed


Define _sta() helper conditionally; also remove its prototype from
the internal header and also some other unneeded ones.

This function is only needed when the bay or the dock subdriver is
enabled. Otherwise, gcc complains about an unused static function.


2008-01-16 13:01:01

by Johannes Weiner

[permalink] [raw]
Subject: [PATCH] thinkpad_acpi: Remove superfluous prototypes from internal header

The helper functions are defined at the top of the C file so they are
known within the definition of the callsites below anyway.

Signed-off-by: Johannes Weiner <[email protected]>
---
drivers/misc/thinkpad_acpi.h | 10 ----------
1 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h
index 8fba2bb..afaeb82 100644
--- a/drivers/misc/thinkpad_acpi.h
+++ b/drivers/misc/thinkpad_acpi.h
@@ -115,13 +115,6 @@ static const char *str_supported(int is_supported);
/* ACPI HIDs */
#define IBM_HKEY_HID "IBM0068"

-/* ACPI helpers */
-static int __must_check acpi_evalf(acpi_handle handle,
- void *res, char *method, char *fmt, ...);
-static int __must_check acpi_ec_read(int i, u8 * p);
-static int __must_check acpi_ec_write(int i, u8 v);
-static int __must_check _sta(acpi_handle handle);
-
/* ACPI handles */
static acpi_handle root_handle; /* root namespace */
static acpi_handle ec_handle; /* EC */
@@ -135,9 +128,6 @@ static void drv_acpi_handle_init(char *name,
drv_acpi_handle_init(#object, &object##_handle, *object##_parent, \
object##_paths, ARRAY_SIZE(object##_paths), &object##_path)

-/* ThinkPad ACPI helpers */
-static int issue_thinkpad_cmos_command(int cmos_cmd);
-
/* procfs support */
static struct proc_dir_entry *proc_dir;

--
1.5.3.8

2008-01-16 13:01:22

by Johannes Weiner

[permalink] [raw]
Subject: [PATCH] thinkpad_acpi: Define _sta() only when there are callsites

With configs where neither the dock nor the bay subdriver is enabled,
_sta() is defined but never used. Define it conditionally.

Signed-off-by: Johannes Weiner <[email protected]>
---
drivers/misc/thinkpad_acpi.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index cf56647..d5ac8b7 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -293,6 +293,7 @@ static int acpi_ec_write(int i, u8 v)
return 1;
}

+#if defined(CONFIG_THINKPAD_ACPI_DOCK) || defined(CONFIG_THINKPAD_ACPI_DOCK)
static int _sta(acpi_handle handle)
{
int status;
@@ -302,6 +303,7 @@ static int _sta(acpi_handle handle)

return status;
}
+#endif

static int issue_thinkpad_cmos_command(int cmos_cmd)
{
--
1.5.3.8

Subject: Re: thinkpad_acpi: define _sta only when needed

On Wed, 16 Jan 2008, Johannes Weiner wrote:
> Define _sta() helper conditionally; also remove its prototype from
> the internal header and also some other unneeded ones.
>
> This function is only needed when the bay or the dock subdriver is
> enabled. Otherwise, gcc complains about an unused static function.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

Johannes, thanks for the patches, but NAK. A similar group of patches that
clean up the _sta and heander file (kills it, actually) has already been
sent to Len Brown to be merged for 2.6.25.

--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh

Subject: Re: [PATCH] thinkpad_acpi: Remove superfluous prototypes from internal header


Equivalent patch already sent to Len Brown for 2.6.25, removing the header
file altogether...

--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh

Subject: Re: [PATCH] thinkpad_acpi: Define _sta() only when there are callsites

Another version of this patch has been sent to Len Brown for 2.6.25 already.

--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh

2008-01-16 21:09:37

by Johannes Weiner

[permalink] [raw]
Subject: Re: thinkpad_acpi: define _sta only when needed

Hi Henrique,

Henrique de Moraes Holschuh <[email protected]> writes:

> On Wed, 16 Jan 2008, Johannes Weiner wrote:
>> Define _sta() helper conditionally; also remove its prototype from
>> the internal header and also some other unneeded ones.
>>
>> This function is only needed when the bay or the dock subdriver is
>> enabled. Otherwise, gcc complains about an unused static function.
>
> Johannes, thanks for the patches, but NAK. A similar group of patches that
> clean up the _sta and heander file (kills it, actually) has already been
> sent to Len Brown to be merged for 2.6.25.

Sorry, I missed to check his tree in advance. And if the work is
already done - even better! :)

Hannes

Subject: Re: thinkpad_acpi: define _sta only when needed

On Wed, 16 Jan 2008, Johannes Weiner wrote:
> > Johannes, thanks for the patches, but NAK. A similar group of patches that
> > clean up the _sta and heander file (kills it, actually) has already been
> > sent to Len Brown to be merged for 2.6.25.
>
> Sorry, I missed to check his tree in advance. And if the work is
> already done - even better! :)

I don't think Len merged the latest version of the patchset yet, but a
previous version is available in the acpi-test tree. The latest version was
posted to linux-acpi recently.

--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh