added 1 changeset to branch 'refs/remotes/yongcong-github/master' old head: 27789944d7a5823c63d10a16e1bf8f50db36766f new head: 5450b1468e73b57afe7893003522fe243c08dcd2 ---------------------------------------------------------------------------- 5450b14: 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 [ Yongcong Du <ycdu.vmcore@xxxxxxxxx> ] ---------------------------------------------------------------------------- Commit: 5450b1468e73b57afe7893003522fe243c08dcd2 Author: Yongcong Du <ycdu.vmcore@xxxxxxxxx> Date: Wed Aug 22 10:55:23 2012 UTC ---------------------------------------------------------------------------- 3 files changed, 158 deletions(-) src/add-ons/kernel/drivers/Jamfile | 1 - src/add-ons/kernel/drivers/cpuidle/Jamfile | 7 - src/add-ons/kernel/drivers/cpuidle/cpuidle.cpp | 150 -------------------- ---------------------------------------------------------------------------- diff --git a/src/add-ons/kernel/drivers/Jamfile b/src/add-ons/kernel/drivers/Jamfile index f23cf48..ef7c7ee 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 ce5f450..0000000 --- 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 <driver>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 82110c9..0000000 --- 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 <ycdu.vmcore@xxxxxxxxx> - */ - -#include <stdio.h> -#include <string.h> -#include <smp.h> - -#include <Drivers.h> -#include <KernelExport.h> - -#include <cpuidle.h> - -#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); -}