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

From: Joe Perches
Date: Tue Sep 20 2011 - 18:18:02 EST


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...

> +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 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/