From: Akio Idehara <zbe64533@gmail.com>
To: seth.forshee@canonical.com
Cc: mjg59@srcf.ucam.org, platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] toshiba_acpi: Add support for transflective LCD
Date: Tue, 03 Apr 2012 22:57:28 +0900 [thread overview]
Message-ID: <4F7B01C8.9050109@gmail.com> (raw)
In-Reply-To: <20120402193952.GD24020@thinkpad-t410>
Hi, Seth.
Thank you for reviewing my code again and again.
All your comments make sense.
I'll try to make the v3 patch.
Best Regards,
Akio
Seth Forshee wrote:
> On Sat, Mar 31, 2012 at 12:16:30AM +0900, Akio Idehara wrote:
>> +static int get_tr_backlight_status(struct toshiba_acpi_dev *dev, u32 *status)
>> +{
>> + u32 hci_result;
>> +
>> + hci_read1(dev, HCI_TR_BACKLIGHT, status, &hci_result);
>> + return hci_result == HCI_SUCCESS ? 0 : -EIO;
>> +}
>> +
>> +static int set_tr_backlight_status(struct toshiba_acpi_dev *dev, int value)
>> +{
>> + u32 hci_result;
>> +
>> + hci_write1(dev, HCI_TR_BACKLIGHT, value, &hci_result);
>> + return hci_result == HCI_SUCCESS ? 0 : -EIO;
>> +}
>
> I think the code will be easier to read if you change both of these to
> use boolean arguments, since that's essentially how they're being used
> anyway. I.e.
>
> static int get_tr_backlight_status(struct toshiba_acpi_dev *dev, boolean *enabled);
> static int set_tr_backlight_status(struct toshiba_acpi_dev *dev, boolean enable);
>
>> @@ -497,15 +527,18 @@ static int lcd_proc_show(struct seq_file *m, void *v)
>> {
>> struct toshiba_acpi_dev *dev = m->private;
>> int value;
>> + int levels = HCI_LCD_BRIGHTNESS_LEVELS;
>>
>> if (!dev->backlight_dev)
>> return -ENODEV;
>>
>> + if (dev->tr_backlight_supported)
>> + levels++;
>
> dev->backlight_dev->props.max_brightness + 1? That seems nicer than
> having to duplicate the "tr backlight gives me an additional brightness
> level" logic throughout the file.
>
>> @@ -1104,8 +1148,15 @@ static int __devinit toshiba_acpi_add(struct acpi_device *acpi_dev)
>>
>> mutex_init(&dev->mutex);
>>
>> + /* Determine whether or not BIOS supports transflective backlight */
>> + ret = get_tr_backlight_status(dev, &dummy) ? false : true;
>> + dev->tr_backlight_supported = ret;
>
> I'd personally prefer
>
> ret = get_tr_backlight_status(dev, &dummy);
> dev->tr_backlight_supported = !ret;
>
> to be consistent with how this is done other places in the file.
>
> Cheers,
> Seth
>
next prev parent reply other threads:[~2012-04-03 13:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-30 15:16 [PATCH v2] toshiba_acpi: Add support for transflective LCD Akio Idehara
2012-04-02 19:39 ` Seth Forshee
2012-04-03 13:57 ` Akio Idehara [this message]
2012-04-03 14:07 ` Seth Forshee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F7B01C8.9050109@gmail.com \
--to=zbe64533@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mjg59@srcf.ucam.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=seth.forshee@canonical.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).