Skip to content

Commit d445571

Browse files
spandruvadarafaeljw
authored andcommitted
ACPI: fan: Optimize struct acpi_fan_fif
We don't need u64 to store the information about _FIF. There are two booleans (fine_grain_ctrl and low_speed_notification) and one field step_size which can take value from 1-9. There are no internal users of revision field. So convert all fields to u8, by not directly extracting the _FIF info the struct. Use an intermediate buffer to extract and assign. This will help to do u32 math using these fields. No functional changes are expected. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 00ae053 commit d445571

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

drivers/acpi/fan.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ struct acpi_fan_fps {
3030
};
3131

3232
struct acpi_fan_fif {
33-
u64 revision;
34-
u64 fine_grain_ctrl;
35-
u64 step_size;
36-
u64 low_speed_notification;
33+
u8 revision;
34+
u8 fine_grain_ctrl;
35+
u8 step_size;
36+
u8 low_speed_notification;
3737
};
3838

3939
struct acpi_fan {

drivers/acpi/fan_core.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ static int acpi_fan_get_fif(struct acpi_device *device)
211211
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
212212
struct acpi_fan *fan = acpi_driver_data(device);
213213
struct acpi_buffer format = { sizeof("NNNN"), "NNNN" };
214-
struct acpi_buffer fif = { sizeof(fan->fif), &fan->fif };
214+
u64 fields[4];
215+
struct acpi_buffer fif = { sizeof(fields), fields };
215216
union acpi_object *obj;
216217
acpi_status status;
217218

@@ -232,6 +233,11 @@ static int acpi_fan_get_fif(struct acpi_device *device)
232233
status = -EINVAL;
233234
}
234235

236+
fan->fif.revision = fields[0];
237+
fan->fif.fine_grain_ctrl = fields[1];
238+
fan->fif.step_size = fields[2];
239+
fan->fif.low_speed_notification = fields[3];
240+
235241
err:
236242
kfree(obj);
237243
return status;

0 commit comments

Comments
 (0)