int ac_brightness;
int dc_brightness;
int current_brightness;
- u32 *sinf;
struct acpi_device *device;
struct input_dev *input_dev;
struct backlight_device *backlight;
struct platform_device *platform;
+ u32 sinf[] __counted_by(num_sifr);
};
/*
*/
num_sifr++;
- pcc = kzalloc_obj(struct pcc_acpi);
+ pcc = kzalloc_flex(*pcc, sinf, num_sifr);
if (!pcc) {
pr_err("Couldn't allocate mem for pcc");
return -ENOMEM;
}
- pcc->sinf = kcalloc(num_sifr + 1, sizeof(u32), GFP_KERNEL);
- if (!pcc->sinf) {
- result = -ENOMEM;
- goto out_hotkey;
- }
-
+ pcc->num_sifr = num_sifr;
pcc->device = device;
pcc->handle = device->handle;
- pcc->num_sifr = num_sifr;
device->driver_data = pcc;
strscpy(acpi_device_name(device), ACPI_PCC_DEVICE_NAME);
strscpy(acpi_device_class(device), ACPI_PCC_CLASS);
result = acpi_pcc_init_input(pcc);
if (result) {
pr_err("Error installing keyinput handler\n");
- goto out_sinf;
+ goto out_hotkey;
}
if (!acpi_pcc_retrieve_biosdata(pcc)) {
backlight_device_unregister(pcc->backlight);
out_input:
input_unregister_device(pcc->input_dev);
-out_sinf:
- device->driver_data = NULL;
- kfree(pcc->sinf);
out_hotkey:
+ device->driver_data = NULL;
kfree(pcc);
return result;
device->driver_data = NULL;
- kfree(pcc->sinf);
kfree(pcc);
}