From be9a02c0db1f0b7b0a75d2d5099371992195bb01 Mon Sep 17 00:00:00 2001 From: Yongcong Du Date: Wed, 22 Aug 2012 18:55:23 +0800 Subject: [PATCH] cpuidle: remove drivers/cpuidle Since generic cpuidle module is loaded by lowlevel cpuidle drivers which are loaded dynamically during boot, we don't need drivers/cpuidle any more Signed-off-by: Fredrik Holmqvist --- src/add-ons/kernel/drivers/Jamfile | 1 - src/add-ons/kernel/drivers/cpuidle/Jamfile | 7 - .../kernel/drivers/cpuidle/cpuidle.cpp | 150 ------------------ 3 files changed, 158 deletions(-) delete mode 100644 src/add-ons/kernel/drivers/cpuidle/Jamfile delete mode 100644 src/add-ons/kernel/drivers/cpuidle/cpuidle.cpp diff --git a/src/add-ons/kernel/drivers/Jamfile b/src/add-ons/kernel/drivers/Jamfile index f23cf48e96..ef7c7eee24 100644 --- a/src/add-ons/kernel/drivers/Jamfile +++ b/src/add-ons/kernel/drivers/Jamfile @@ -4,7 +4,6 @@ SubInclude HAIKU_TOP src add-ons kernel drivers bluetooth ; SubInclude HAIKU_TOP src add-ons kernel drivers bus ; SubInclude HAIKU_TOP src add-ons kernel drivers audio ; SubInclude HAIKU_TOP src add-ons kernel drivers common ; -SubInclude HAIKU_TOP src add-ons kernel drivers cpuidle ; SubInclude HAIKU_TOP src add-ons kernel drivers disk ; SubInclude HAIKU_TOP src add-ons kernel drivers dvb ; SubInclude HAIKU_TOP src add-ons kernel drivers input ; diff --git a/src/add-ons/kernel/drivers/cpuidle/Jamfile b/src/add-ons/kernel/drivers/cpuidle/Jamfile deleted file mode 100644 index ce5f450017..0000000000 --- a/src/add-ons/kernel/drivers/cpuidle/Jamfile +++ /dev/null @@ -1,7 +0,0 @@ -SubDir HAIKU_TOP src add-ons kernel drivers cpuidle ; - -UsePrivateKernelHeaders ; - -KernelAddon cpuidle : - cpuidle.cpp - ; diff --git a/src/add-ons/kernel/drivers/cpuidle/cpuidle.cpp b/src/add-ons/kernel/drivers/cpuidle/cpuidle.cpp deleted file mode 100644 index 82110c9253..0000000000 --- a/src/add-ons/kernel/drivers/cpuidle/cpuidle.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright 2012, Haiku, Inc. All Rights Reserved. - * Distributed under the terms of the MIT License. - * - * Authors: - * Yongcong Du - */ - -#include -#include -#include - -#include -#include - -#include - -#define DEVICE_NAME "cpuidle" - -int32 api_version = B_CUR_DRIVER_API_VERSION; - -static GenCpuidle *sGenCpuidle; - -static status_t -cpuidle_open(const char *name, uint32 flags, void **cookie) -{ - *cookie = NULL; - return B_OK; -} - - -static status_t -cpuidle_close(void *cookie) -{ - return B_OK; -} - - -static status_t -cpuidle_free(void *cookie) -{ - return B_OK; -} - - -static status_t -cpuidle_ioctl(void *cookie, uint32 op, void *buffer, size_t length) -{ - return B_OK; -} - - -static status_t -cpuidle_read(void *cookie, off_t pos, void *buffer, size_t *length) -{ - if (pos != 0) { - *length = 0; - return B_OK; - } - char *str = (char *)buffer; - size_t max_len = *length; - int32 stateCount = sGenCpuidle->GetIdleStateCount(); - int32 bytes = snprintf(str, max_len, "C-STATE COUNT: %"B_PRId32"\n", stateCount); - max_len-= bytes; - str += bytes; - int32 cpu = smp_get_num_cpus(); - - for (int32 i = 0; i < cpu; i++) { - bytes = snprintf(str, max_len, "CPU%"B_PRId32"\n", i); - max_len-= bytes; - str += bytes; - for (int32 j = 1; j < stateCount; j++) { - CpuidleStat stat; - bytes = snprintf(str, max_len, "%s\n", sGenCpuidle->GetIdleStateName(j)); - max_len-= bytes; - str += bytes; - sGenCpuidle->GetIdleStateInfo(i, j, &stat); - bytes = snprintf(str, max_len, "%lld %lldus\n", - stat.usageCount, stat.usageTime); - max_len-= bytes; - str += bytes; - } - } - *length = strlen((char *)buffer); - - return B_OK; -} - - -static status_t -cpuidle_write(void *cookie, off_t pos, const void *buffer, size_t *_length) -{ - return B_OK; -} - - -status_t -init_hardware(void) -{ - return B_OK; -} - - -const char ** -publish_devices(void) -{ - static const char *devices[] = { - DEVICE_NAME, - NULL - }; - - return devices; -} - - -device_hooks * -find_device(const char *name) -{ - static device_hooks hooks = { - &cpuidle_open, - &cpuidle_close, - &cpuidle_free, - &cpuidle_ioctl, - &cpuidle_read, - &cpuidle_write, - }; - - - return &hooks; -} - - -status_t -init_driver(void) -{ - status_t err; - - err = get_module(B_CPUIDLE_MODULE_NAME, (module_info **)&sGenCpuidle); - if (err != B_OK) { - dprintf("can't load "B_CPUIDLE_MODULE_NAME"\n"); - } - return B_OK; -} - - -void -uninit_driver(void) -{ - put_module(B_CPUIDLE_MODULE_NAME); -}