diff options
author | Colin Ian King <colin.king@canonical.com> | 2018-08-21 05:12:48 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-08-21 13:00:17 -0400 |
commit | 1e7da865b8c0428b9bcb18ba05ba0f6f47bcfdb4 (patch) | |
tree | a293b834432fb0a40fe0f064dce3d68408d80fd2 | |
parent | f5bbbbe4d63577026f908a809f22f5fd5a90ea1f (diff) |
block/DAC960.c: make some arrays static const, shrinks object size
Don't populate the arrays ReadCacheStatus, WriteCacheStatus and
SenseErrors on the stack but instead make them static const. Makes
the object code smaller by 47 bytes:
Before:
text data bss dec hex filename
160974 34628 832 196434 2ff52 drivers/block/DAC960.o
After:
text data bss dec hex filename
160671 34884 832 196387 2ff23 drivers/block/DAC960.o
(gcc version 8.2.0 x86_64)
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | drivers/block/DAC960.c | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index f99e5c883368..581312ac375f 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c | |||
@@ -2428,16 +2428,20 @@ static bool DAC960_V2_ReportDeviceConfiguration(DAC960_Controller_T | |||
2428 | { | 2428 | { |
2429 | DAC960_V2_LogicalDeviceInfo_T *LogicalDeviceInfo = | 2429 | DAC960_V2_LogicalDeviceInfo_T *LogicalDeviceInfo = |
2430 | Controller->V2.LogicalDeviceInformation[LogicalDriveNumber]; | 2430 | Controller->V2.LogicalDeviceInformation[LogicalDriveNumber]; |
2431 | unsigned char *ReadCacheStatus[] = { "Read Cache Disabled", | 2431 | static const unsigned char *ReadCacheStatus[] = { |
2432 | "Read Cache Enabled", | 2432 | "Read Cache Disabled", |
2433 | "Read Ahead Enabled", | 2433 | "Read Cache Enabled", |
2434 | "Intelligent Read Ahead Enabled", | 2434 | "Read Ahead Enabled", |
2435 | "-", "-", "-", "-" }; | 2435 | "Intelligent Read Ahead Enabled", |
2436 | unsigned char *WriteCacheStatus[] = { "Write Cache Disabled", | 2436 | "-", "-", "-", "-" |
2437 | "Logical Device Read Only", | 2437 | }; |
2438 | "Write Cache Enabled", | 2438 | static const unsigned char *WriteCacheStatus[] = { |
2439 | "Intelligent Write Cache Enabled", | 2439 | "Write Cache Disabled", |
2440 | "-", "-", "-", "-" }; | 2440 | "Logical Device Read Only", |
2441 | "Write Cache Enabled", | ||
2442 | "Intelligent Write Cache Enabled", | ||
2443 | "-", "-", "-", "-" | ||
2444 | }; | ||
2441 | unsigned char *GeometryTranslation; | 2445 | unsigned char *GeometryTranslation; |
2442 | if (LogicalDeviceInfo == NULL) continue; | 2446 | if (LogicalDeviceInfo == NULL) continue; |
2443 | switch (LogicalDeviceInfo->DriveGeometry) | 2447 | switch (LogicalDeviceInfo->DriveGeometry) |
@@ -4339,14 +4343,16 @@ static void DAC960_V1_ProcessCompletedCommand(DAC960_Command_T *Command) | |||
4339 | static void DAC960_V2_ReadWriteError(DAC960_Command_T *Command) | 4343 | static void DAC960_V2_ReadWriteError(DAC960_Command_T *Command) |
4340 | { | 4344 | { |
4341 | DAC960_Controller_T *Controller = Command->Controller; | 4345 | DAC960_Controller_T *Controller = Command->Controller; |
4342 | unsigned char *SenseErrors[] = { "NO SENSE", "RECOVERED ERROR", | 4346 | static const unsigned char *SenseErrors[] = { |
4343 | "NOT READY", "MEDIUM ERROR", | 4347 | "NO SENSE", "RECOVERED ERROR", |
4344 | "HARDWARE ERROR", "ILLEGAL REQUEST", | 4348 | "NOT READY", "MEDIUM ERROR", |
4345 | "UNIT ATTENTION", "DATA PROTECT", | 4349 | "HARDWARE ERROR", "ILLEGAL REQUEST", |
4346 | "BLANK CHECK", "VENDOR-SPECIFIC", | 4350 | "UNIT ATTENTION", "DATA PROTECT", |
4347 | "COPY ABORTED", "ABORTED COMMAND", | 4351 | "BLANK CHECK", "VENDOR-SPECIFIC", |
4348 | "EQUAL", "VOLUME OVERFLOW", | 4352 | "COPY ABORTED", "ABORTED COMMAND", |
4349 | "MISCOMPARE", "RESERVED" }; | 4353 | "EQUAL", "VOLUME OVERFLOW", |
4354 | "MISCOMPARE", "RESERVED" | ||
4355 | }; | ||
4350 | unsigned char *CommandName = "UNKNOWN"; | 4356 | unsigned char *CommandName = "UNKNOWN"; |
4351 | switch (Command->CommandType) | 4357 | switch (Command->CommandType) |
4352 | { | 4358 | { |