Re: [PATCH 1/6] toshiba_acpi: Convert to use acpi_driver

From: Corentin Chary
Date: Wed Sep 21 2011 - 03:31:38 EST


On Wed, Sep 21, 2011 at 12:17 AM, Joe Perches <joe@xxxxxxxxxxx> wrote:
> On Tue, 2011-09-20 at 16:55 -0500, Seth Forshee wrote:
>> Changes toshiba_acpi to register an acpi driver and eliminates the
>> platform device it was using.
>
> Just trivial comments...
>
>> diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
>> +static acpi_status hci_raw(struct toshiba_acpi_dev *dev,
>> + Â Â Â Â Â Â Â Â Â Â Â Âconst u32 in[HCI_WORDS], u32 out[HCI_WORDS])
> []
>> @@ -237,85 +234,79 @@ static acpi_status hci_raw(const u32 in[HCI_WORDS], u32 out[HCI_WORDS])
>> Â * may be useful (such as "not supported").
>> Â */
>>
>> -static acpi_status hci_write1(u32 reg, u32 in1, u32 * result)
>> +static acpi_status hci_write1(struct toshiba_acpi_dev *dev, u32 reg,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â u32 in1, u32 *result)
>> Â{
>> Â Â Â u32 in[HCI_WORDS] = { HCI_SET, reg, in1, 0, 0, 0 };
>
> A lot of the in[HCI_WORDS] could be static const or const
>
> Â Â Â Âstatic const u32 in[HCI_WORDS] etc...

Not static const ! see how reg and in1 are used. const is ok.

>
>> +static acpi_status hci_read1(struct toshiba_acpi_dev *dev, u32 reg,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Âu32 *out1, u32 *result)
>> Â{
>> Â Â Â u32 in[HCI_WORDS] = { HCI_GET, reg, 0, 0, 0, 0 };
>
> here too.
>
>> Â Â Â u32 out[HCI_WORDS];
>> - Â Â acpi_status status = hci_raw(in, out);
>> + Â Â acpi_status status = hci_raw(dev, in, out);
>> Â Â Â *out1 = out[2];
>> Â Â Â *result = (status == AE_OK) ? out[0] : HCI_FAILURE;
>> Â Â Â return status;
>> Â}
>>
>> -static acpi_status hci_write2(u32 reg, u32 in1, u32 in2, u32 *result)
>> +static acpi_status hci_write2(struct toshiba_acpi_dev *dev, u32 reg,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â u32 in1, u32 in2, u32 *result)
>> Â{
>> Â Â Â u32 in[HCI_WORDS] = { HCI_SET, reg, in1, in2, 0, 0 };
>
> const etc.
>
>> @@ -507,8 +486,13 @@ static int get_lcd(struct backlight_device *bd)
>>
>> Âstatic int lcd_proc_show(struct seq_file *m, void *v)
>> Â{
>> - Â Â int value = get_lcd(NULL);
>> + Â Â struct toshiba_acpi_dev *dev = m->private;
>> + Â Â int value;
>> +
>> + Â Â if (!dev->backlight_dev)
>> + Â Â Â Â Â Â return -ENODEV;
>>
>> + Â Â value = get_lcd(dev->backlight_dev);
>> Â Â Â if (value >= 0) {
>> Â Â Â Â Â Â Â seq_printf(m, "brightness: Â Â Â Â Â Â Â%d\n", value);
>> Â Â Â Â Â Â Â seq_printf(m, "brightness_levels: Â Â Â %d\n",
>
> Some small amount space could be saved by using:
>
> Â Â Â Â Â Â Â Âseq_printf(m, "%-24s %d\n", "brightness:", value);
> Â Â Â Â Â Â Â Âseq_printf(m, "%-24s %d\n", "brightness_levels:", etc...
> []
>> @@ -675,13 +663,14 @@ static const struct file_operations video_proc_fops = {
>>
>> Âstatic int fan_proc_show(struct seq_file *m, void *v)
>> Â{
>> + Â Â struct toshiba_acpi_dev *dev = m->private;
>> Â Â Â u32 hci_result;
>> Â Â Â u32 value;
>>
>> - Â Â hci_read1(HCI_FAN, &value, &hci_result);
>> + Â Â hci_read1(dev, HCI_FAN, &value, &hci_result);
>> Â Â Â if (hci_result == HCI_SUCCESS) {
>> Â Â Â Â Â Â Â seq_printf(m, "running: Â Â Â Â Â Â Â Â %d\n", (value > 0));
>
> Here too:
>
> Â Â Â Â Â Â Â Âseq_printf(m, "%-24s %d\n", "running:", (value > 0);
>
>> - Â Â Â Â Â Â seq_printf(m, "force_on: Â Â Â Â Â Â Â Â%d\n", force_fan);
>> + Â Â Â Â Â Â seq_printf(m, "force_on: Â Â Â Â Â Â Â Â%d\n", dev->force_fan);
>
> etc.
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at Âhttp://vger.kernel.org/majordomo-info.html
>



--
Corentin Chary
http://xf.iksaif.net
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/