* [PATCH] acpi: remove dead code
@ 2010-10-18 15:42 Stephen Hemminger
2010-10-18 16:49 ` Len Brown
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2010-10-18 15:42 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi
Found by running make namespacecheck on linux-next
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/acpi/osl.c 2010-10-06 13:42:58.722974685 +0900
+++ b/drivers/acpi/osl.c 2010-10-06 13:45:23.322689618 +0900
@@ -780,16 +780,6 @@ void acpi_os_wait_events_complete(void *
EXPORT_SYMBOL(acpi_os_wait_events_complete);
/*
- * Allocate the memory for a spinlock and initialize it.
- */
-acpi_status acpi_os_create_lock(acpi_spinlock * handle)
-{
- spin_lock_init(*handle);
-
- return AE_OK;
-}
-
-/*
* Deallocate the memory for a spinlock.
*/
void acpi_os_delete_lock(acpi_spinlock handle)
@@ -1152,21 +1142,6 @@ int acpi_check_region(resource_size_t st
}
EXPORT_SYMBOL(acpi_check_region);
-int acpi_check_mem_region(resource_size_t start, resource_size_t n,
- const char *name)
-{
- struct resource res = {
- .start = start,
- .end = start + n - 1,
- .name = name,
- .flags = IORESOURCE_MEM,
- };
-
- return acpi_check_resource_conflict(&res);
-
-}
-EXPORT_SYMBOL(acpi_check_mem_region);
-
/*
* Let drivers know whether the resource checks are effective
*/
--- a/drivers/acpi/processor_driver.c 2010-10-06 13:46:52.594978592 +0900
+++ b/drivers/acpi/processor_driver.c 2010-10-06 13:46:55.817980993 +0900
@@ -899,6 +899,4 @@ static void __exit acpi_processor_exit(v
module_init(acpi_processor_init);
module_exit(acpi_processor_exit);
-EXPORT_SYMBOL(acpi_processor_set_thermal_limit);
-
MODULE_ALIAS("processor");
--- a/drivers/acpi/processor_thermal.c 2010-10-06 13:47:23.469979232 +0900
+++ b/drivers/acpi/processor_thermal.c 2010-10-06 13:47:29.141997316 +0900
@@ -238,113 +238,6 @@ static int acpi_thermal_cpufreq_decrease
#endif
-int acpi_processor_set_thermal_limit(acpi_handle handle, int type)
-{
- int result = 0;
- struct acpi_processor *pr = NULL;
- struct acpi_device *device = NULL;
- int tx = 0, max_tx_px = 0;
-
-
- if ((type < ACPI_PROCESSOR_LIMIT_NONE)
- || (type > ACPI_PROCESSOR_LIMIT_DECREMENT))
- return -EINVAL;
-
- result = acpi_bus_get_device(handle, &device);
- if (result)
- return result;
-
- pr = acpi_driver_data(device);
- if (!pr)
- return -ENODEV;
-
- /* Thermal limits are always relative to the current Px/Tx state. */
- if (pr->flags.throttling)
- pr->limit.thermal.tx = pr->throttling.state;
-
- /*
- * Our default policy is to only use throttling at the lowest
- * performance state.
- */
-
- tx = pr->limit.thermal.tx;
-
- switch (type) {
-
- case ACPI_PROCESSOR_LIMIT_NONE:
- do {
- result = acpi_thermal_cpufreq_decrease(pr->id);
- } while (!result);
- tx = 0;
- break;
-
- case ACPI_PROCESSOR_LIMIT_INCREMENT:
- /* if going up: P-states first, T-states later */
-
- result = acpi_thermal_cpufreq_increase(pr->id);
- if (!result)
- goto end;
- else if (result == -ERANGE)
- ACPI_DEBUG_PRINT((ACPI_DB_INFO,
- "At maximum performance state\n"));
-
- if (pr->flags.throttling) {
- if (tx == (pr->throttling.state_count - 1))
- ACPI_DEBUG_PRINT((ACPI_DB_INFO,
- "At maximum throttling state\n"));
- else
- tx++;
- }
- break;
-
- case ACPI_PROCESSOR_LIMIT_DECREMENT:
- /* if going down: T-states first, P-states later */
-
- if (pr->flags.throttling) {
- if (tx == 0) {
- max_tx_px = 1;
- ACPI_DEBUG_PRINT((ACPI_DB_INFO,
- "At minimum throttling state\n"));
- } else {
- tx--;
- goto end;
- }
- }
-
- result = acpi_thermal_cpufreq_decrease(pr->id);
- if (result) {
- /*
- * We only could get -ERANGE, 1 or 0.
- * In the first two cases we reached max freq again.
- */
- ACPI_DEBUG_PRINT((ACPI_DB_INFO,
- "At minimum performance state\n"));
- max_tx_px = 1;
- } else
- max_tx_px = 0;
-
- break;
- }
-
- end:
- if (pr->flags.throttling) {
- pr->limit.thermal.px = 0;
- pr->limit.thermal.tx = tx;
-
- result = acpi_processor_apply_limit(pr);
- if (result)
- printk(KERN_ERR PREFIX "Unable to set thermal limit\n");
-
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Thermal limit now (P%d:T%d)\n",
- pr->limit.thermal.px, pr->limit.thermal.tx));
- } else
- result = 0;
- if (max_tx_px)
- return 1;
- else
- return result;
-}
-
int acpi_processor_get_limit_info(struct acpi_processor *pr)
{
--- a/include/acpi/acpi_drivers.h 2010-10-06 13:47:54.590004475 +0900
+++ b/include/acpi/acpi_drivers.h 2010-10-06 13:47:59.250377356 +0900
@@ -115,8 +115,6 @@ void pci_acpi_crs_quirks(void);
#define ACPI_PROCESSOR_LIMIT_INCREMENT 0x01
#define ACPI_PROCESSOR_LIMIT_DECREMENT 0x02
-int acpi_processor_set_thermal_limit(acpi_handle handle, int type);
-
/*--------------------------------------------------------------------------
Dock Station
-------------------------------------------------------------------------- */
--- a/include/acpi/acpiosxf.h 2010-10-06 13:44:29.943008303 +0900
+++ b/include/acpi/acpiosxf.h 2010-10-06 13:44:36.262095467 +0900
@@ -98,8 +98,6 @@ acpi_os_table_override(struct acpi_table
/*
* Spinlock primitives
*/
-acpi_status acpi_os_create_lock(acpi_spinlock * out_handle);
-
void acpi_os_delete_lock(acpi_spinlock handle);
acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock handle);
--- a/include/linux/acpi.h 2010-10-06 13:42:58.734970973 +0900
+++ b/include/linux/acpi.h 2010-10-06 13:45:25.793973981 +0900
@@ -245,8 +245,6 @@ int acpi_check_resource_conflict(const s
int acpi_check_region(resource_size_t start, resource_size_t n,
const char *name);
-int acpi_check_mem_region(resource_size_t start, resource_size_t n,
- const char *name);
int acpi_resources_are_enforced(void);
@@ -344,12 +342,6 @@ static inline int acpi_check_region(reso
return 0;
}
-static inline int acpi_check_mem_region(resource_size_t start,
- resource_size_t n, const char *name)
-{
- return 0;
-}
-
struct acpi_table_header;
static inline int acpi_table_parse(char *id,
int (*handler)(struct acpi_table_header *))
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] acpi: remove dead code
2010-10-18 15:42 [PATCH] acpi: remove dead code Stephen Hemminger
@ 2010-10-18 16:49 ` Len Brown
2010-10-19 0:42 ` Lin Ming
0 siblings, 1 reply; 4+ messages in thread
From: Len Brown @ 2010-10-18 16:49 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: linux-acpi
On Mon, 18 Oct 2010, Stephen Hemminger wrote:
> Found by running make namespacecheck on linux-next
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>
> --- a/drivers/acpi/osl.c 2010-10-06 13:42:58.722974685 +0900
...
> /*
> - * Allocate the memory for a spinlock and initialize it.
> - */
> -acpi_status acpi_os_create_lock(acpi_spinlock * handle)
> -{
> - spin_lock_init(*handle);
> -
> - return AE_OK;
> -}
ACPICA declares acpi_os_create_lock in acpiosxf.h,
but never calls it. Bob, can we do away with it?
...
> -int acpi_check_mem_region(resource_size_t start, resource_size_t n,
> - const char *name)
> -{
> - struct resource res = {
> - .start = start,
> - .end = start + n - 1,
> - .name = name,
> - .flags = IORESOURCE_MEM,
> - };
> -
> - return acpi_check_resource_conflict(&res);
> -
> -}
> -EXPORT_SYMBOL(acpi_check_mem_region);
acpi_check_mem_region seems to be entirely
a Linux thing. It is exported to modules -- though
see any that use it.
> --- a/drivers/acpi/processor_driver.c 2010-10-06 13:46:52.594978592 +0900
...
> -EXPORT_SYMBOL(acpi_processor_set_thermal_limit);
...
> --- a/drivers/acpi/processor_thermal.c 2010-10-06 13:47:23.469979232 +0900
...
> -int acpi_processor_set_thermal_limit(acpi_handle handle, int type)
> -{
although acpi_processor_set_thermal_limit() is exported to modules
I don't see any users in recent history.
thanks,
-Len Brown, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] acpi: remove dead code
2010-10-18 16:49 ` Len Brown
@ 2010-10-19 0:42 ` Lin Ming
2010-10-19 4:07 ` Len Brown
0 siblings, 1 reply; 4+ messages in thread
From: Lin Ming @ 2010-10-19 0:42 UTC (permalink / raw)
To: Len Brown; +Cc: Stephen Hemminger, linux-acpi
On Tue, Oct 19, 2010 at 12:49 AM, Len Brown <lenb@kernel.org> wrote:
> On Mon, 18 Oct 2010, Stephen Hemminger wrote:
>
>> Found by running make namespacecheck on linux-next
>>
>> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>>
>> --- a/drivers/acpi/osl.c 2010-10-06 13:42:58.722974685 +0900
> ...
>> /*
>> - * Allocate the memory for a spinlock and initialize it.
>> - */
>> -acpi_status acpi_os_create_lock(acpi_spinlock * handle)
>> -{
>> - spin_lock_init(*handle);
>> -
>> - return AE_OK;
>> -}
>
> ACPICA declares acpi_os_create_lock in acpiosxf.h,
> but never calls it. Bob, can we do away with it?
In ACPICA code (AcpiUtMutexInitialize),
Status = AcpiOsCreateLock (&AcpiGbl_GpeLock);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
Status = AcpiOsCreateLock (&AcpiGbl_HardwareLock);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
In Linux code (acpi_ut_mutex_initialize)
spin_lock_init(acpi_gbl_gpe_lock);
spin_lock_init(acpi_gbl_hardware_lock);
This is another divergence between ACPICA and Linux code.
Lin Ming
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] acpi: remove dead code
2010-10-19 0:42 ` Lin Ming
@ 2010-10-19 4:07 ` Len Brown
0 siblings, 0 replies; 4+ messages in thread
From: Len Brown @ 2010-10-19 4:07 UTC (permalink / raw)
To: Lin Ming; +Cc: Stephen Hemminger, linux-acpi
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1526 bytes --]
On Tue, 19 Oct 2010, Lin Ming wrote:
> On Tue, Oct 19, 2010 at 12:49 AM, Len Brown <lenb@kernel.org> wrote:
> > On Mon, 18 Oct 2010, Stephen Hemminger wrote:
> >
> >> Found by running make namespacecheck on linux-next
> >>
> >> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> >>
> >> --- a/drivers/acpi/osl.c 2010-10-06 13:42:58.722974685 +0900
> > ...
> >> /*
> >> - * Allocate the memory for a spinlock and initialize it.
> >> - */
> >> -acpi_status acpi_os_create_lock(acpi_spinlock * handle)
> >> -{
> >> - spin_lock_init(*handle);
> >> -
> >> - return AE_OK;
> >> -}
> >
> > ACPICA declares acpi_os_create_lock in acpiosxf.h,
> > but never calls it. Bob, can we do away with it?
>
> In ACPICA code (AcpiUtMutexInitialize),
>
> Status = AcpiOsCreateLock (&AcpiGbl_GpeLock);
> if (ACPI_FAILURE (Status))
> {
> return_ACPI_STATUS (Status);
> }
>
> Status = AcpiOsCreateLock (&AcpiGbl_HardwareLock);
> if (ACPI_FAILURE (Status))
> {
> return_ACPI_STATUS (Status);
> }
>
> In Linux code (acpi_ut_mutex_initialize)
>
> spin_lock_init(acpi_gbl_gpe_lock);
> spin_lock_init(acpi_gbl_hardware_lock);
>
> This is another divergence between ACPICA and Linux code.
Lin-Ming,
Thanks for the explanation.
I've applied Stephen's patch, since it is correct.
If you later want to send me patches to reduce the divergence
between ACPICA and Linux/ACPICA, I'll be happy to accept them.
thanks,
Len Brown, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-10-19 4:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-18 15:42 [PATCH] acpi: remove dead code Stephen Hemminger
2010-10-18 16:49 ` Len Brown
2010-10-19 0:42 ` Lin Ming
2010-10-19 4:07 ` Len Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox